]> git.proxmox.com Git - rustc.git/blame - debian/check-orig-suspicious.sh
Add an unsuspicious list to track stuff we've already audited
[rustc.git] / debian / check-orig-suspicious.sh
CommitLineData
02aa35f3
XL
1#!/bin/sh
2
3set -x
4
5ver="$1"
6test -n "$ver" || exit 2
7
8FILTER="Files-Excluded: in debian/copyright and run a repack."
9SUS_WHITELIST=$(find "${PWD}" -name upstream-tarball-unsuspicious.txt -type f)
10
11rm -rf rustc-$ver-src/
12tar xf ../rustc_$ver+dfsg1.orig.tar.xz && cd rustc-$ver-src/
13
14# Remove non-suspicious files, warning on patterns that match nothing
15grep -v '^#' ${SUS_WHITELIST} | xargs -I% sh -c 'rm -r ./% || true'
16echo "Checking for suspicious files..."
17
18# TODO: merge the -m stuff into suspicious-source(1).
19suspicious-source -v -m text/x-objective-c
20# The following shell snippet is a bit more strict than suspicious-source(1)
21find . -type f -and -not -name '.cargo-checksum.json' -exec file '{}' \; | \
22 sed -e 's/\btext\b\(.*\), with very long lines/verylongtext\1/g' | \
23 grep -v '\b\(text\|empty\)\b' || true
24
25# Most C and JS code should be in their own package
26find src/vendor/ -name '*.c' -o -name '*.js'
27
28echo "The above files (if any) seem suspicious, please audit them."
29echo "If good, add them to ${SUS_WHITELIST}."
30echo "If bad, add them to ${FILTER}."
31
32echo "Artifacts left in rustc-$ver-src, please remove them yourself."