]> git.proxmox.com Git - rustc.git/blobdiff - debian/check-orig-suspicious.sh
Update files for importing 1.46.0~beta.2
[rustc.git] / debian / check-orig-suspicious.sh
index 6c1a015ed2580572f9b5d2c578877593728f3073..444c3fcc56621dcb6c2f6c0a64eb9d73ce3a6452 100755 (executable)
@@ -1,35 +1,21 @@
 #!/bin/bash
-
 set -e
 
 ver="$1"
 test -n "$ver" || exit 2
 
-FILTER="Files-Excluded: in debian/copyright and run a repack."
-SUS_WHITELIST=$(find "${PWD}" -name upstream-tarball-unsuspicious.txt -type f)
+SUS_WHITELIST=$(find "${PWD}/debian" -name upstream-tarball-unsuspicious.txt -type f)
 
 rm -rf rustc-${ver/*~*/beta}-src/
 tar xf ../rustc_$ver+dfsg1.orig.tar.xz && cd rustc-${ver/*~*/beta}-src/
 
-# Remove tiny files 4 bytes or less
-find . -size -4c -delete
-# Remove non-suspicious files, warning on patterns that match nothing
-echo "Excluding (i.e. removing) whitelisted files..."
-grep -v '^#' ${SUS_WHITELIST} | xargs  -I% sh -c 'rm -r ./% || true'
-echo "Checking for suspicious files..."
-
-# TODO: merge the -m stuff into suspicious-source(1).
-suspicious-source -v -m text/x-objective-c
-# The following shell snippet is a bit more strict than suspicious-source(1)
-find . -type f -and -not -name '.cargo-checksum.json' -exec file '{}' \; | \
-  sed -e 's/\btext\b\(.*\), with very long lines/verylongtext\1/g' | \
-  grep -v '\b\(text\|empty\)\b' || true
-
-# Most C and JS code should be in their own package
-find src/vendor/ -name '*.c' -o -name '*.js'
+# TODO: remove this code snippet after it gets into our cargo
+# Strip comments & blank lines before testing rust source code -
+# some authors like to write really long comments
+find . -name '*.rs' -execdir sed -i -e '\,^\s*//,d' -e '/^\s*$/d' '{}' \;
 
-echo "The above files (if any) seem suspicious, please audit them."
-echo "If good, add them to ${SUS_WHITELIST}."
-echo "If bad, add them to ${FILTER}."
+/usr/share/cargo/scripts/audit-vendor-source \
+  "$SUS_WHITELIST" \
+  "Files-Excluded: in debian/copyright and run a repack."
 
 echo "Artifacts left in rustc-$ver-src, please remove them yourself."