@cryptotaxi247 / netdata-1 / commits / 62bb02f27

Improve packaging checks (#4188)

* Simplify the packaging ignore list Applying sed commands to the result of a diff makes it non-obvious what is being ignored and what not. Shell globbing is much better understood. At the same time, the script is now verbose about what happened when a mismatch occurs, to help fix the detected issue. * Run release tar comparison on all builds The checks were only running when a release was imminent or in progress, now they run every time, so a travis build will now stop if files are not accounted for.

philwhineray committed Sep 13, 2018 at 08:19 UTC 62bb02f2754ba17de0c83c5be407e6750ca5bcff
3 files changed +43 -34
packaging/git-build
+2 -3
@@ -50,6 +50,5 @@ set -e
50 autoreconf -ivf
51 ./configure --enable-maintainer-mode
52 set +e
53 -make dist
54 -status=$?
55 -exit $status
53 +make dist || exit
54 +./packaging/tar-compare . netdata-*.tar.gz || exit
packaging/packaging.functions
-2
@@ -87,8 +87,6 @@ try_build() {
87 git diff --staged | patch -p1 -d "$MYTMP/build"
88 (cd $MYTMP/build; ./packaging/git-build || touch $MYTMP/fail)
89 if [ -f $MYTMP/fail ]; then return 1; fi
90 - (cd $MYTMP/build; ./packaging/tar-compare . *.tar.gz || touch $MYTMP/fail)
91 - if [ -f $MYTMP/fail ]; then return 1; fi
90 touch $MYTMP/success
91 return 0
92 }
packaging/tar-compare
+41 -29
@@ -6,6 +6,29 @@
6 # lists files which appear in one or the other only, to help check
7 # for missing EXTRA_DIST entries in Makefile.am files.
8
9 +# Note: this list uses shell globbing, i.e. an * matches any number of
10 +# subdirectories, so it is somewhat different to e.g. .gitignore
11 +ignore=$(tr '\n' '|' <<'END'
12 +autom4te.cache/*
13 +CMakeLists.txt
14 +config.h
15 +config.log
16 +config.status
17 +.git/*
18 +.githooks/*
19 +Makefile
20 +*/Makefile
21 +makeself/README.md
22 +netdata-*.tar.*
23 +packaging/*
24 +src/.deps/*
25 +stamp-h1
26 +tests/profile/*
27 +.travis.yml
28 +web/images/README.md
29 +END
30 +)
31 +
32 scriptname=tar-compare
33 if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
34 then
@@ -29,38 +52,27 @@ trap cleanup 0
52
53 if [ $# -ne 2 ]
54 then
32 - echo "tar-compare git-dir tar-gz-file"
55 + echo "Usage: tar-compare git-dir tar-gz-file"
56 exit 1
57 fi
58
59 mkdir $MYTMP/unpack
37 -tar xfzC "$2" $MYTMP/unpack
38 -diff -r "$1" $MYTMP/unpack/* | grep "^Only" | sed \
39 - -e '/: autom4te\.cache$/d' \
40 - -e '/: \.deps$/d' \
41 - -e '/: \.git$/d' \
42 - -e '/: \.gitattributes$/d' \
43 - -e '/: \.gitignore$/d' \
44 - -e '/: config\.log$/d' \
45 - -e '/: config\.status$/d' \
46 - -e '/: config\.h.*$/d' \
47 - -e '/: Makefile$/d' \
48 - -e '/: .githooks$/d' \
49 - -e '/: packaging$/d' \
50 - -e '/: stamp-h1$/d' \
51 - -e '/: README\.md$/d' \
52 - -e '/: tmp-anchor-links$/d' \
53 - -e '/: tmp-manproc$/d' \
54 - -e '/: .*\.tar\.gz$/d' \
55 - -e '/: .*\.tar\.bz2$/d' \
56 - -e '/: .*\.tar\.xz$/d' \
57 - -e '/: unittest$/d' \
58 - -e '/: iprange$/d' \
59 - -e '/: .*\.o$/d' \
60 - -e '/: CMakeLists.txt/d' \
61 - -e '/: tests$/d' \
62 - -e '/: .travis.yml/d' > $MYTMP/out
60 +tar xfzC "$2" $MYTMP/unpack || exit
61 +(cd "$1" && find . -type f | sort > $MYTMP/git-list)
62 +(cd "$MYTMP/unpack"/* && find . -type f | sort > $MYTMP/tar-list)
63 +
64 +comm -23 $MYTMP/git-list $MYTMP/tar-list | cut -f2- -d'/' > $MYTMP/only-in-git
65 +
66 +while read name
67 +do
68 + eval "case $name in $ignore,) : ;; *) echo 'In git but not tar: $name' >> '$MYTMP/out' ;; esac"
69 +done < $MYTMP/only-in-git
70
64 -cat $MYTMP/out
65 -test -s $MYTMP/out && exit 1
71 +if [ -s $MYTMP/out ]
72 +then
73 + cat $MYTMP/out
74 + echo "Release tarfile differs from git content unexpectedly."
75 + echo "Ensure all files are packaged, or ignored by packaging/tar-compare"
76 + exit 1
77 +fi
78 exit 0