3 # Copyright (c) 2013-2019. The SimGrid Team.
6 # This program is free software; you can redistribute it and/or modify it
7 # under the terms of the license (GNU LGPL) which comes with this package.
11 if [ "$1" = "-batch" ]; then
20 if [ $# -lt 1 -o $# -gt 3 ]; then
22 Usage: $0 [-batch] archive.tar.gz [git_url [git_reference]]
28 if [ ! -r "$archive" ]; then
29 printf 'File not found: %s\n' "$archive" >&2
37 giturl=$(git rev-parse --show-toplevel)
42 trap "rm -fr \"$tmpdir\"" EXIT
47 myname=$(type -p "$0")
50 exclude="$myname.exclude"
53 exclude="$PWD/$myname.exclude"
57 if [ ! -r "$exclude" ]; then
58 printf 'File not found: %s\n' "$exclude" >&2
62 echo "Exclude patterns extracted from file: $exclude"
64 echo "Extracting archive: $archive -> $arch_dir"
65 tar --directory "$tmpdir" \
66 --transform 's!^[^/]*!a!' \
67 --extract --gunzip --file "$archive"
69 echo "Copying git repository: $giturl/$gitref -> $git_dir"
70 git archive --format=tar --prefix="b/" --remote="$giturl" "$gitref" \
71 | tar --directory "$tmpdir" --extract --file -
77 sed -n '/^-/{s/^- //;p;}' "$exclude" > ea
78 sed -n '/^+/{s/^+ //;p;}' "$exclude" > eb
82 | grep -E -v -x -f ea \
86 | grep -E -v -x -f eb \
90 if cmp -s "$fa" "$fb"; then
92 echo "The archive looks good."
96 ERROR: Some files are missing and/or unexpected in the archive.
97 * lines beginning with '-' give files that are unexpected in the archive
98 * lines beginning with '+' give files that are missing from the archive
99 Please fix CMake files (e.g. "tools/cmake/DefinePackages.cmake"),
100 and/or "tools/internal/check_dist_archive.exclude".
106 colordiff=$(type -p colordiff || true)
108 if [ -x "$colordiff" ]; then
109 "$colordiff" | less -R -F -X
115 if [ "$interactive" = "1" ]; then