5 if [ "$1" = "-batch" ]; then
14 if [ $# -lt 1 -o $# -gt 3 ]; then
16 Usage: $0 [-batch] archive.tar.gz [git_url [git_reference]]
22 if [ ! -r "$archive" ]; then
23 printf 'File not found: %s\n' "$archive"
31 giturl=$(git rev-parse --show-toplevel)
36 trap "rm -fr \"$tmpdir\"" EXIT
41 myname=$(type -p "$0")
44 exclude="$myname.exclude"
47 exclude="$PWD/$myname.exclude"
51 if [ ! -r "$exclude" ]; then
52 printf 'File not found: %s\n' "$exclude"
56 echo "Exclude patterns extracted from file: $exclude"
58 echo "Extracting archive: $archive -> $arch_dir"
59 tar --directory "$tmpdir" \
60 --transform 's!^[^/]*!a!' \
61 --extract --gunzip --file "$archive"
63 echo "Copying git repository: $giturl/$gitref -> $git_dir"
64 git archive --format=tar --prefix="b/" --remote="$giturl" "$gitref" \
65 | tar --directory "$tmpdir" --extract --file -
71 sed -n '/^-/{s/^- //;p;}' "$exclude" > ea
72 sed -n '/^+/{s/^+ //;p;}' "$exclude" > eb
76 | grep -E -v -x -f ea \
80 | grep -E -v -x -f eb \
84 if cmp -s "$fa" "$fb"; then
86 echo "The archive looks good."
90 ERROR: Some files are missing and/or unexpected in the archive.
91 * lines beginning with '-' give files that are unexpected in the archive
92 * lines beginning with '+' give files that are missing from the archive
93 Please fix CMake files (e.g. "buildtools/Cmake/DefinePackages.cmake"),
94 and/or "tools/check_dist_archive.exclude".
100 colordiff=$(type -p colordiff || true)
102 if [ -x "$colordiff" ]; then
103 "$colordiff" | less -R -F -X
109 if [ "$interactive" = "1" ]; then