Cleanup docker packaging and contrib (#4627)
Paweł Krupa committed
Nov 29, 2018 at 00:47 UTC
03cd5be53af1a9255b5ed69d591bc8017267b9f0
24 files changed
+29
-986
.githooks/post-commit
deleted
-5
@@ -1,5 +0,0 @@
1
-#!/bin/sh
2
-if [ -x ./packaging/update-tags ]
3
-then
4
- exec git diff HEAD^ | ./packaging/update-tags -
5
-fi
.githooks/pre-commit
deleted
-5
@@ -1,5 +0,0 @@
1
-#!/bin/sh
2
-if [ -x ./packaging/check-files ]
3
-then
4
- exec git diff --cached | ./packaging/check-files -
5
-fi
.githooks/prepare-commit-msg
deleted
-2
@@ -1,2 +0,0 @@
1
-#!/bin/sh
2
-test -x ./packaging/release-msg && exec ./packaging/release-msg "$@"
.travis.yml
+1
-1
@@ -68,7 +68,7 @@ jobs:
68
file: "netdata*.tar.gz"
69
- name: docker images
70
install: sudo apt update -y && sudo apt install -y --only-upgrade docker-ce && docker info
71
- script: "docker/build.sh"
71
+ script: "packaging/docker/build.sh"
72
env: REPOSITORY="netdata/netdata"
73
- name: changelog generation
74
script: ".travis/generate_changelog.sh"
.travis/releaser.sh
+1
-1
@@ -53,7 +53,7 @@ git push "https://${GITHUB_TOKEN}:@$(git config --get remote.origin.url | sed -e
53
54
echo "---- CREATING TAGGED DOCKER CONTAINERS ----"
55
export REPOSITORY="netdata/netdata"
56
-./docker/build.sh
56
+./packaging/docker/build.sh
57
58
echo "---- CREATING RELEASE ARTIFACTS -----"
59
./.travis/create_artifacts.sh
Makefile.am
+1
-4
@@ -25,8 +25,6 @@ EXTRA_DIST = \
25
.lgtm.yml \
26
.travis \
27
.github/CODEOWNERS \
28
- build/build.sh \
29
- build/Dockerfile \
28
build/m4/jemalloc.m4 \
29
build/m4/ax_c___atomic.m4 \
30
build/m4/ax_check_enable_debug.m4 \
@@ -51,14 +49,13 @@ SUBDIRS = \
49
diagrams \
50
makeself \
51
system \
54
- contrib \
52
tests \
53
$(NULL)
54
55
dist_noinst_DATA= \
56
cppcheck.sh \
57
configs.signatures \
61
- docker \
58
+ contrib \
59
netdata.cppcheck \
60
netdata.spec \
61
package.json \
README.md
+2
-2
@@ -109,7 +109,7 @@ docker run -d --name=netdata \
109
netdata/netdata
110
```
111
112
-For more information about running netdata in docker, check the [docker installation page](docker/).
112
+For more information about running netdata in docker, check the [docker installation page](packaging/docker/).
113
114

115
@@ -463,7 +463,7 @@ Here is a quick list:
463
Directory|Description
464
:---|:---
465
[`installer`](installer/)|Instructions to install netdata on your systems.
466
-[`docker`](docker/)|Instructions to install netdata using docker.
466
+[`docker`](packaging/docker/)|Instructions to install netdata using docker.
467
[`daemon`](daemon/)|Information about the netdata daemon and its configuration.
468
[`collectors`](collectors/)|Information about data collection plugins.
469
[`health`](health/)|How netdata's health monitoring works, how to create your own alarms and how to configure alarm notification methods.
build/build.sh
+3
-2
@@ -1,7 +1,8 @@
1
#!/bin/bash
2
3
-if [ -f build.sh ]; then
4
- cd ../ || exit 1
3
+if [ ! -f .gitignore ]; then
4
+ echo "Run as ./travis/$(basename "$0") from top level directory of git repository"
5
+ exit 1
6
fi
7
8
if [ "$IS_CONTAINER" != "" ]; then
configure.ac
-1
@@ -566,7 +566,6 @@ AC_CONFIG_FILES([
566
collectors/python.d.plugin/Makefile
567
collectors/statsd.plugin/Makefile
568
collectors/tc.plugin/Makefile
569
- contrib/Makefile
569
daemon/Makefile
570
database/Makefile
571
diagrams/Makefile
contrib/Makefile.am
deleted
-33
@@ -1,33 +0,0 @@
1
-# SPDX-License-Identifier: GPL-3.0-or-later
2
-
3
-MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
4
-
5
-dist_noinst_DATA = \
6
- README.md \
7
- debian/copyright \
8
- debian/netdata.conf \
9
- debian/source/format \
10
- debian/control.wheezy \
11
- debian/compat \
12
- debian/netdata.install \
13
- debian/netdata.lintian-overrides \
14
- debian/rules \
15
- debian/netdata.docs \
16
- debian/netdata.default \
17
- debian/control \
18
- debian/netdata.postinst.in \
19
- debian/netdata.service \
20
- debian/changelog \
21
- debian/netdata.postrm \
22
- rhel/build-netdata-rpm.sh \
23
- $(NULL)
24
-
25
-dist_noinst_SCRIPTS = \
26
- debian/netdata.init \
27
- $(NULL)
28
-
29
-debian/changelog:
30
- echo "netdata ($(PACKAGE_VERSION)) UNRELEASED; urgency=medium" | \
31
- tr '_' '~' > $@
32
- echo " * Latest release" >> $@
33
- echo " -- Netdata Team <> `date -R`" >> $@
docs/generator/buildyaml.sh
+1
-1
@@ -112,7 +112,7 @@ echo -ne " - 'docs/Why-Netdata.md'
112
113
echo -ne "- Installation:
114
- 'installer/README.md'
115
- - 'docker/README.md'
115
+ - 'packaging/docker/README.md'
116
- 'installer/UPDATE.md'
117
- 'installer/UNINSTALL.md'
118
"
installer/README.md
+1
-1
@@ -134,7 +134,7 @@ Once Netdata is installed, see [Getting Started](../docs/GettingStarted.md).
134
135
## Run Netdata in a Docker container
136
137
-You can [Install Netdata with Docker](../docker/#install-netdata-with-docker).
137
+You can [Install Netdata with Docker](../packaging/docker/#install-netdata-with-docker).
138
139
---
140
packaging/README.md
deleted
-50
@@ -1,50 +0,0 @@
1
-# Packaging Tools
2
-
3
-The programs in folder `packaging` are used when packaging from within git
4
-and are not included in source or binary packages.
5
-
6
-For the most part they are used from the git commit hooks (copy
7
-`../.githooks/*` to `../.git/hooks` to automate checking and the release
8
-process.
9
-
10
-The check-files script pulls in `*.functions` and `*/*.functions` to
11
-do the actual work.
12
-
13
-`packaging.functions` contains generic checks on e.g `ChangeLog`
14
-and `configure.ac` and automates release version, checking, tagging
15
-and post-release update.
16
-
17
-Programs and packages with specific needs should create extra
18
-`whatever.functions` and supporting scripts in a subdirectory.
19
-
20
-Making a release
21
-----------------
22
-`
23
-Just update ChangeLog and configure.ac to specify a suitable version
24
-suffix:
25
-
26
- empty - final release
27
- pre.# - pre-release candidate
28
- rc.# - pre-release candidate
29
-
30
-If it is a final release and there is a package.spec.in, add a new
31
-entry to the top of the %changelog section and update:
32
- PACKAGE_RPM_RELEASE="1"
33
-
34
-The hooks will take over and if everything is OK will tag the release
35
-(you will be asked to sign the tag) and then update the files ready
36
-for further development.
37
-
38
-The release is not pushed out automatically, so if you want to undo
39
-it, run:
40
-
41
-~~~~
42
-git reset --hard HEAD^^
43
-git tag -d vx.y.z
44
-~~~~
45
-
46
-Otherwise you can just push the results; the script outputs the required
47
-instructions upon success.
48
-
49
-Once pushed the infrastructure will build a set of tar-files on the server.
50
-For information on how to verify, sign and make these available, see [here](https://github.com/firehol/infrastructure#firehol-infrastructure)
packaging/check-files
deleted
-129
@@ -1,129 +0,0 @@
1
-#!/bin/bash
2
-# SPDX-License-Identifier: GPL-3.0-or-later
3
-
4
-#
5
-# check-files
6
-#
7
-scriptname=check-files
8
-if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
9
-then
10
- echo >&2
11
- echo >&2
12
- echo >&2 "Cannot create temporary directory."
13
- echo >&2
14
- exit 1
15
-fi
16
-
17
-cleanup() {
18
- status=$?
19
- rm -rf "${MYTMP}"
20
- exit $status
21
-}
22
-
23
-# clean up if we get stopped by Crtl-C or forced logout or normal exit
24
-trap cleanup INT
25
-trap cleanup HUP
26
-trap cleanup 0
27
-
28
-set -e
29
-if [ "$1" = "--debug" ]
30
-then
31
- set -x
32
- shift
33
-fi
34
-
35
-if [ $# -lt 1 ]
36
-then
37
- echo "check-files [--debug] -|filenames"
38
- echo "e.g."
39
- echo " git diff | ./packaging/check-files -"
40
- echo "for a complete check (v.s. empty repo):"
41
- echo " git diff 4b825dc642cb6eb9a060e54bf8d69288fbee4904 | ./packaging/check-files -"
42
- echo "or in .git/hooks/pre-commit:"
43
- echo " exec git diff --cached | ./packaging/check-files -"
44
- exit 1
45
-fi
46
-
47
-if [ ! -x packaging/check-files ]
48
-then
49
- echo "Must be run from base directory"
50
- exit 1
51
-fi
52
-
53
-if [ "$1" = "-" ]
54
-then
55
- from_cache=Y
56
- f=""
57
-else
58
- from_cache=
59
- for f in "$@"
60
- do
61
- if [ ! -f "$f" ]
62
- then
63
- echo "$f: no such file"
64
- exit 1
65
- fi
66
- done
67
-
68
- git status --porcelain "$@" | grep "^?" | cut -c4- > $MYTMP/missing.lst
69
-
70
- while read missing
71
- do
72
- git update-index --add --cacheinfo \
73
- 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 $missing
74
- done < $MYTMP/missing.lst
75
-
76
- empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
77
- git diff $empty_tree -- "$@" > $MYTMP/diff.full
78
- f=$MYTMP/diff.full
79
-
80
- while read missing
81
- do
82
- git update-index --force-remove $missing
83
- done < $MYTMP/missing.lst
84
-fi
85
-
86
-> $MYTMP/diff.lst sed -e "/^+++ b/{p;s:^+++ b/::;w $MYTMP/files.lst" -e "d;}" $f
87
-
88
-#cat $MYTMP/diff.lst
89
-#cat $MYTMP/files.lst
90
-
91
-dirname="${0%/*}"
92
-if [ "$dirname" = "$0" ]; then dirname="."; fi
93
-
94
-for i in $dirname/*.functions $dirname/*/*.functions
95
-do
96
- if [ -f "$i" ]
97
- then
98
- source $i
99
- echo $i | sed -e 's:.*/::' -e 's/\.functions$//' -e 's/\./_/g' >> $MYTMP/fns
100
- fi
101
-done
102
-
103
-status=0
104
-while read fn
105
-do
106
- "${fn}_check_init" $filename || status=1
107
-done < $MYTMP/fns
108
-
109
-while read filename
110
-do
111
- #echo Checking $filename
112
- while read fn
113
- do
114
- if [ $status -eq 0 ]
115
- then
116
- "${fn}_check_file" $filename || status=1
117
- fi
118
- done < $MYTMP/fns
119
-done < $MYTMP/files.lst
120
-
121
-if [ $status -eq 0 ]
122
-then
123
- while read fn
124
- do
125
- "${fn}_check_fin" $filename || status=1
126
- done < $MYTMP/fns
127
-fi
128
-
129
-exit $status
packaging/docker/Dockerfile
renamed
+13
-15
@@ -51,17 +51,13 @@ RUN mkdir -p /app/usr/sbin/ \
51
mv /var/lib/netdata /app/var/lib/ && \
52
mv /etc/netdata /app/etc/ && \
53
mv /usr/sbin/netdata /app/usr/sbin/ && \
54
- mv docker/run.sh /app/usr/sbin/ && \
54
+ mv packaging/docker/run.sh /app/usr/sbin/ && \
55
chmod +x /app/usr/sbin/run.sh
56
57
#####################################################################
58
ARG ARCH
59
FROM multiarch/alpine:${ARCH}
60
61
-# Configure system
62
-ARG NETDATA_UID=201
63
-ARG NETDATA_GID=201
64
-
61
# Reinstall some prerequisites
62
RUN apk --no-cache add curl \
63
fping \
@@ -75,20 +71,22 @@ RUN apk --no-cache add curl \
71
py-yaml \
72
python
73
78
-# fping from alpine apk is on a different location. Moving it.
79
-RUN mv /usr/sbin/fping /usr/local/bin/fping && \
80
- chmod 4755 /usr/local/bin/fping && \
81
- mkdir -p /var/log/netdata && \
82
- # Add netdata user
83
- addgroup -g ${NETDATA_GID} -S netdata && \
84
- adduser -S -H -s /usr/sbin/nologin -u ${NETDATA_GID} -h /etc/netdata -G netdata netdata
85
-
74
# Copy files over
75
COPY --from=builder /app /
76
77
+# Configure system
78
+ARG NETDATA_UID=201
79
+ARG NETDATA_GID=201
80
RUN \
90
- # Apply permissions as described in
91
- # https://github.com/netdata/netdata/tree/master/docs/netdata-security.md#netdata-directories
81
+ # fping from alpine apk is on a different location. Moving it.
82
+ mv /usr/sbin/fping /usr/local/bin/fping && \
83
+ chmod 4755 /usr/local/bin/fping && \
84
+ mkdir -p /var/log/netdata && \
85
+ # Add netdata user
86
+ addgroup -g ${NETDATA_GID} -S netdata && \
87
+ adduser -S -H -s /usr/sbin/nologin -u ${NETDATA_GID} -h /etc/netdata -G netdata netdata && \
88
+ # Apply the permissions as described in
89
+ # https://github.com/netdata/netdata/wiki/netdata-security#netdata-directories
90
chown -R root:netdata /etc/netdata && \
91
chown -R netdata:netdata /var/cache/netdata /var/lib/netdata /usr/share/netdata && \
92
chown -R root:netdata /usr/lib/netdata && \
packaging/docker/README.md
renamed
packaging/docker/build.sh
renamed
+6
-6
@@ -6,6 +6,11 @@
6
7
set -e
8
9
+if [ ! -f .gitignore ]; then
10
+ echo "Run as ./packaging/docker/$(basename "$0") from top level directory of git repository"
11
+ exit 1
12
+fi
13
+
14
if [ "$1" == "" ]; then
15
VERSION=$(git tag --points-at)
16
else
@@ -24,15 +29,11 @@ ARCH_MAP=( ["i386"]="386" ["amd64"]="amd64" ["armhf"]="arm" ["aarch64"]="arm64")
29
30
docker run --rm --privileged multiarch/qemu-user-static:register --reset
31
27
-if [ -f Dockerfile ]; then
28
- cd ../ || exit 1
29
-fi
30
-
32
# Build images using multi-arch Dockerfile.
33
for ARCH in i386 armhf aarch64 amd64; do
34
docker build --build-arg ARCH="${ARCH}-v3.8" \
35
--tag "${REPOSITORY}:${VERSION}-${ARCH}" \
35
- --file docker/Dockerfile ./ &
36
+ --file packaging/docker/Dockerfile ./ &
37
done
38
wait
39
@@ -71,4 +72,3 @@ docker --config /tmp/docker manifest push -p "${REPOSITORY}:${VERSION}"
72
73
# Show current manifest (debugging purpose only)
74
docker --config /tmp/docker manifest inspect "${REPOSITORY}:${VERSION}"
74
-
packaging/docker/run.sh
renamed
packaging/git-build
deleted
-54
@@ -1,54 +0,0 @@
1
-#!/bin/sh
2
-# SPDX-License-Identifier: GPL-3.0-or-later
3
-
4
-# When run from the top-level repository, performs a complete clean
5
-# and maintainer-mode rebuild of the FireHOL package.
6
-
7
-if [ ! -f .gitignore -o ! -f configure.ac ]
8
-then
9
- echo "Run as ./packaging/git-build from an autotools git repository"
10
- exit 1
11
-fi
12
-
13
-# If we are genuinely in a git repo, try to clean it up, otherwise
14
-# just make the assumption
15
-if [ -d .git ]
16
-then
17
- if [ -n "$TRAVIS_TAG" ]
18
- then
19
- echo "Checking we have a good signature during CI build..."
20
- echo "Checking tag: $TRAVIS_TAG"
21
- git tag -v "$TRAVIS_TAG" 2>&1 | tee /tmp/tagcheck
22
- grep -iq "gpg. good signature" /tmp/tagcheck
23
- status=$?
24
- rm -f /tmp/tagcheck
25
- if [ $status -ne 0 ]
26
- then
27
- exit $status
28
- fi
29
- fi
30
-
31
- clean=$(git status -s | grep "^?")
32
-
33
- if [ "$clean" ]
34
- then
35
- if [ "$1" != "-ok" ]
36
- then
37
- echo "Warning: this script runs: git clean -d -f -x"
38
- echo " ensure all required ?? files are added, then re-run with '-ok'"
39
- git status -s | grep '^?'
40
- exit 1
41
- fi
42
- fi
43
-
44
- set -e
45
- git clean -d -f -x
46
- set +e
47
-fi
48
-
49
-set -e
50
-autoreconf -ivf
51
-./configure --enable-maintainer-mode
52
-set +e
53
-make dist || exit
54
-./packaging/tar-compare . netdata-*.tar.gz || exit
packaging/gpg-recv-key
deleted
-65
@@ -1,65 +0,0 @@
1
-#!/bin/sh
2
-
3
-if [ ! "$KEYSERVER" ]
4
-then
5
- echo "No KEYSERVER environment set, e.g.:"
6
- echo " export KEYSERVER=hkps://hkps.pool.sks-keyservers.net"
7
- exit 1
8
-fi
9
-
10
-debug=""
11
-if [ "$debug" ]
12
-then
13
- if [ ! "$GNUPGHOME" ]
14
- then
15
- echo "No GNUPGHOME environment set, e.g.:"
16
- echo " export GNUPGHOME=$HOME/.gnupg"
17
- exit 1
18
- fi
19
-
20
- if [ ! -d "$GNUPGHOME" ]
21
- then
22
- mkdir -p "$GNUPGHOME"
23
- chmod 700 "$GNUPGHOME"
24
- fi
25
-fi
26
-
27
-keyuid="$1"
28
-fingerprint="$2"
29
-
30
-# Modern GPG can import key by fingerprint but the version available
31
-# within travis currently does not, so we extract the short version and
32
-# check it matches manually
33
-key=`echo $fingerprint | cut -f7-10 -d' ' | tr -d ' '`
34
-
35
-gpg --keyserver "$KEYSERVER" --recv-key "$key" || exit 1
36
-gpg --fingerprint "$key" > /tmp/keystatus.$$
37
-status=$?
38
-
39
-cat /tmp/keystatus.$$
40
-if [ $status -ne 0 ]
41
-then
42
- rm -f /tmp/keystatus.$$
43
- exit 2
44
-fi
45
-
46
-if ! grep -q "^uid.*<$keyuid>" /tmp/keystatus.$$
47
-then
48
- rm -f /tmp/keystatus.$$
49
- echo "Did not find expected uid $keyuid"
50
- exit 3
51
-fi
52
-
53
-echo "uid looks good"
54
-
55
-if ! grep -q " $fingerprint$" /tmp/keystatus.$$
56
-then
57
- rm -f /tmp/keystatus.$$
58
- echo "Did not find expected fingerprint $fingerprint"
59
- exit 3
60
-fi
61
-
62
-echo "Fingerprint looks good"
63
-
64
-rm -f /tmp/keystatus.$$
65
-exit 0
packaging/packaging.functions
deleted
-322
@@ -1,322 +0,0 @@
1
-#!/bin/bash
2
-# SPDX-License-Identifier: GPL-3.0-or-later
3
-
4
-packaging_check_init() {
5
- version_check=
6
-}
7
-
8
-packaging_check_file() {
9
- local filename="$1" status=0
10
-
11
- case $filename in
12
- configure.ac)
13
- check_versions || status=1
14
- version_check=Y
15
- ;;
16
- *.spec.in)
17
- check_versions || status=1
18
- version_check=Y
19
- ;;
20
- ChangeLog)
21
- check_versions || status=1
22
- version_check=Y
23
- if [ $status -eq 0 ]
24
- then
25
- check_changelog || status=1
26
- fi
27
- ;;
28
- *)
29
- #echo "No checks found for $filename"
30
- :
31
- ;;
32
- esac
33
- return $status
34
-}
35
-
36
-packaging_check_fin() {
37
- if [ "$version_check" ]
38
- then
39
- version=`get_configure_ac_version`
40
- case "$(match_version $version)" in
41
- prerelease|candidate|release)
42
- try_build || status=1
43
- if [ $status -eq 0 ]
44
- then
45
- cp $MYTMP/build/*.tar.* .
46
- echo "Check $(cd $MYTMP/build && ls *.tar.gz) before pushing tags"
47
- fi
48
- ;;
49
- esac
50
- fi
51
-}
52
-
53
-get_staged_file() {
54
- local optional=0
55
- if [ "$1" = "-o" ]
56
- then
57
- optional=1
58
- shift
59
- fi
60
-
61
- local dir="${1%/*}"
62
- if [ "$dir" = "$1" ]; then dir="."; fi
63
- mkdir -p $MYTMP/files/$dir
64
-
65
- test -f $MYTMP/files/$1 && return 0
66
-
67
- if [ "$from_cache" ]
68
- then
69
- if [ $optional -eq 1 ]
70
- then
71
- git show :$1 > $MYTMP/files/$1 2> /dev/null || rm -f $MYTMP/files/$1
72
- else
73
- git show :$1 > $MYTMP/files/$1
74
- fi
75
- else
76
- if [ $optional -eq 0 -o -f $1 ]
77
- then
78
- cp $1 $MYTMP/files/$1
79
- fi
80
- fi
81
-}
82
-
83
-try_build() {
84
- if [ -f $MYTMP/success ]; then return 0; fi
85
- mkdir -p $MYTMP/build
86
- git archive HEAD | tar -xf - -C "$MYTMP/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
- touch $MYTMP/success
91
- return 0
92
-}
93
-
94
-get_changelog_version() {
95
- get_staged_file ChangeLog
96
- local v=`sed -ne '1s/.*(\(.*\)).*/\1/p' $MYTMP/files/ChangeLog`
97
- if [ ! "$v" ]; then v="No version in ChangeLog!"; fi
98
- echo "$v"
99
-}
100
-
101
-get_configure_ac_version() {
102
- get_staged_file configure.ac
103
- local v=`sed -n \
104
- -e '/define(\[VERSION_MAJOR/s/.*\[\([^[]*\)\].*/\1/p' \
105
- -e '/define(\[VERSION_MINOR/s/.*\[\([^[]*\)\].*/.\1/p' \
106
- -e '/define(\[VERSION_FIX/s/.*\[\([^[]*\)\].*/.\1/p' \
107
- -e '/define(\[VERSION_SUFFIX/s/.*\[\([^[]*\)\].*/\1/p' \
108
- $MYTMP/files/configure.ac | tr -d '\n'`
109
- if [ ! "$v" ]; then v="No version in configure.ac!"; fi
110
- echo "$v"
111
-}
112
-
113
-get_configure_ac_package() {
114
- get_staged_file configure.ac
115
- local v=`sed -n -e 's/AC_INIT(\[\([^]]*\)\].*/\1/p' configure.ac`
116
- if [ ! "$v" ]; then v="noname"; fi
117
- echo "$v"
118
-}
119
-
120
-get_configure_ac_rpmrel() {
121
- get_staged_file configure.ac
122
- local v=`sed -n -e 's/PACKAGE_RPM_RELEASE="\([^"]*\)".*/\1/p' configure.ac`
123
- if [ ! "$v" ]; then v="norpmrel"; fi
124
- echo "$v"
125
-}
126
-
127
-get_spec_version() {
128
- get_staged_file -o "$1".spec.in
129
- test -f $MYTMP/files/"$1".spec.in || return 0 # Spec file is optional
130
- sed -n -e '1,/^%changelog/d' -e '/^*/{' -e 's/.*- \([0-9].*\)/\1/p' -e q -e '}' "$1".spec.in
131
-}
132
-
133
-splitver() {
134
- local maj min fix sfx IFS=.-_
135
-
136
- maj=$1
137
- min=$2
138
- fix=$3
139
- sfx=$4
140
-
141
- set -- $5
142
- eval $maj=\$1 $min=\$2 $fix=\$3 $sfx=\$4
143
-}
144
-
145
-match_version() {
146
- case "$1" in
147
- [0-9]*.[0-9]*.[0-9]*_*)
148
- # x.y.z_ZZZZ = development branch (can be before or after pre/rc)
149
- echo "development"
150
- ;;
151
- [0-9]*.[0-9]*.[0-9]-pre[0-9]*)
152
- echo "prerelease"
153
- ;;
154
- [0-9]*.[0-9]*.[0-9]-rc.[0-9]*)
155
- echo "candidate"
156
- ;;
157
- [0-9]*.[0-9]*.[0-9]*)
158
- echo "release"
159
- ;;
160
- *)
161
- # Unknown
162
- :
163
- ;;
164
- esac
165
-}
166
-
167
-check_versions() {
168
- local status=0 exact=0 prerelease=0
169
-
170
- if [ -f $MYTMP/version-checked ]
171
- then
172
- read status < $MYTMP/version-checked
173
- return $status
174
- fi
175
-
176
- local confver=`get_configure_ac_version`
177
- case "$(match_version $confver)" in
178
- development)
179
- :
180
- ;;
181
- prerelease|candidate|release)
182
- exact=1
183
- ;;
184
- *)
185
- echo "Unrecognised version in configure.ac ($confver)"
186
- status=1
187
- ;;
188
- esac
189
-
190
- local clogver=`get_changelog_version`
191
- case "$(match_version $clogver)" in
192
- development)
193
- echo "Do not include development branch version in ChangeLog ($clogver)"
194
- status=1
195
- ;;
196
- prerelease|candidate)
197
- prerelease=1
198
- ;;
199
- release)
200
- :
201
- ;;
202
- *)
203
- echo "Unrecognised version format in ChangeLog ($clogver)"
204
- status=1
205
- ;;
206
- esac
207
-
208
- local package=`get_configure_ac_package`
209
- local specver=`get_spec_version $package`
210
-
211
- local clogmaj clogmin clogfix clogsfx
212
- local confmaj confmin conffix confsfx
213
- local specmaj specmin specfix specsfx
214
-
215
- splitver clogmaj clogmin clogfix clogsfx "$clogver"
216
- splitver confmaj confmin conffix confsfx "$confver"
217
- splitver specmaj specmin specfix specsfx "$specver"
218
-
219
- if [ "$specver" ]
220
- then
221
- if [ $specmaj -ne $clogmaj \
222
- -o $specmin -ne $clogmin \
223
- -o $specfix -ne $clogfix ]
224
- then
225
- echo "Main version of $package.spec.in ($specver) differs from ChangeLog ($clogver)"
226
- status=1
227
- fi
228
- fi
229
-
230
- if [ $status -eq 0 -a $exact -eq 0 ]
231
- then
232
-
233
- if [ $confmaj -gt $clogmaj \
234
- -o $confmin -gt $clogmin \
235
- -o $conffix -gt $clogfix ]
236
- then
237
- :
238
- elif [ $confmaj -eq $clogmaj \
239
- -a $confmin -eq $clogmin \
240
- -a $conffix -eq $clogfix \
241
- -a $prerelease -eq 1 ]
242
- then
243
- :
244
- else
245
- echo "Version in configure.ac ($confver) lesser than ChangeLog ($clogver)"
246
- status=1
247
- fi
248
- fi
249
-
250
- if [ $exact -eq 1 ]
251
- then
252
- echo "Running additional release checks"
253
-
254
- if [ "$confver" != "$clogver" ]
255
- then
256
- echo "Version in configure.ac ($confver) differs from ChangeLog ($clogver)"
257
- status=1
258
- fi
259
-
260
- if [ "$specver" ]
261
- then
262
- local confrpmrel=`get_configure_ac_rpmrel`
263
- if [ "$specsfx" != "$confrpmrel" ]
264
- then
265
- echo "%changelog suffix in $package.spec.in ($specsfx) differs from configure.ac PACKAGE_RPM_RELEASE ($confrpmrel)"
266
- status=1
267
- fi
268
- fi
269
-
270
- if [ ! "$TRAVIS_TAG" ]
271
- then
272
- if [ "$(git tag -l v$confver)" ]
273
- then
274
- echo "Tag v$confver already exists"
275
- status=1
276
- fi
277
-
278
- if [ "$(git config user.signingkey)" = "" ]
279
- then
280
- echo "You need to set up a PGP signing key e.g.:"
281
- echo " gpg --list-keys"
282
- echo "and"
283
- echo " git config user.signingkey SHORTID"
284
- echo "or"
285
- echo " git config --global user.signingkey SHORTID"
286
- status=1
287
- fi
288
-
289
- git status -s | grep "^?" > $MYTMP/needclean
290
- if [ -s $MYTMP/needclean ]
291
- then
292
- echo "The following files must be dealt with before commit:"
293
- cat $MYTMP/needclean
294
- echo "e.g. add them to .gitignore or remove with 'git clean -fdx'"
295
- status=1
296
- fi
297
- fi
298
- fi
299
-
300
- echo $status > $MYTMP/version-checked
301
- return $status
302
-}
303
-
304
-check_changelog() {
305
- local status=0
306
-
307
- if [ -f $MYTMP/changelog-checked ]
308
- then
309
- read status < $MYTMP/changelog-checked
310
- return $status
311
- fi
312
-
313
- local version=`sed -ne '1s/.*(\(.*\)).*/\1/p' $filename`
314
- if [ "`echo $version | grep '[[:space:]]'`" != "" ]
315
- then
316
- echo "ChangeLog version contains whitespace! Fix it!"
317
- status=1
318
- fi
319
-
320
- echo $status > $MYTMP/changelog-checked
321
- return $status
322
-}
packaging/release-msg
deleted
-60
@@ -1,60 +0,0 @@
1
-#!/bin/bash
2
-# SPDX-License-Identifier: GPL-3.0-or-later
3
-
4
-#
5
-# release-msg
6
-#
7
-scriptname=release-msg
8
-if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
9
-then
10
- echo >&2
11
- echo >&2
12
- echo >&2 "Cannot create temporary directory."
13
- echo >&2
14
- exit 1
15
-fi
16
-
17
-cleanup() {
18
- status=$?
19
- rm -rf "${MYTMP}"
20
- exit $status
21
-}
22
-
23
-# clean up if we get stopped by Crtl-C or forced logout or normal exit
24
-trap cleanup INT
25
-trap cleanup HUP
26
-trap cleanup 0
27
-
28
-set -e
29
-if [ "$1" = "--debug" ]
30
-then
31
- set -x
32
- shift
33
-fi
34
-
35
-if [ $# -lt 1 ]
36
-then
37
- echo "Use only from .git/hooks/prepare-commit-msg"
38
- exit 1
39
-fi
40
-
41
-if [ ! -x packaging/release-msg ]
42
-then
43
- echo "Must be run from base directory"
44
- exit 1
45
-fi
46
-
47
-dirname="${0%/*}"
48
-if [ "$dirname" = "$0" ]; then dirname="."; fi
49
-source $dirname/packaging.functions
50
-
51
-mkdir -p $MYTMP/files
52
-git show :configure.ac > $MYTMP/files/configure.ac
53
-version=`get_configure_ac_version`
54
-case "$(match_version $version)" in
55
- prerelease|candidate|release)
56
- sed -i -e "1s/.*/Prepare release $version/" "$1"
57
- ;;
58
-esac
59
-
60
-exit 0
packaging/tar-compare
deleted
-77
@@ -1,77 +0,0 @@
1
-#!/bin/sh
2
-# SPDX-License-Identifier: GPL-3.0-or-later
3
-
4
-# When provided with a git repo, which has been used to produce a
5
-# distribution tar.gz (with make dist) and the resultant tar-file,
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
-END
29
-)
30
-
31
-scriptname=tar-compare
32
-if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
33
-then
34
- echo >&2
35
- echo >&2
36
- echo >&2 "Cannot create temporary directory."
37
- echo >&2
38
- exit 1
39
-fi
40
-
41
-cleanup() {
42
- status=$?
43
- rm -rf "${MYTMP}"
44
- exit $status
45
-}
46
-
47
-# clean up if we get stopped by Crtl-C or forced logout or normal exit
48
-trap cleanup INT
49
-trap cleanup HUP
50
-trap cleanup 0
51
-
52
-if [ $# -ne 2 ]
53
-then
54
- echo "Usage: tar-compare git-dir tar-gz-file"
55
- exit 1
56
-fi
57
-
58
-mkdir $MYTMP/unpack
59
-tar xfzC "$2" $MYTMP/unpack || exit
60
-(cd "$1" && find . -type f | sort > $MYTMP/git-list)
61
-(cd "$MYTMP/unpack"/* && find . -type f | sort > $MYTMP/tar-list)
62
-
63
-comm -23 $MYTMP/git-list $MYTMP/tar-list | cut -f2- -d'/' > $MYTMP/only-in-git
64
-
65
-while read name
66
-do
67
- eval "case $name in $ignore,) : ;; *) echo 'In git but not tar: $name' >> '$MYTMP/out' ;; esac"
68
-done < $MYTMP/only-in-git
69
-
70
-if [ -s $MYTMP/out ]
71
-then
72
- cat $MYTMP/out
73
- echo "Release tarfile differs from git content unexpectedly."
74
- echo "Ensure all files are packaged, or ignored by packaging/tar-compare"
75
- exit 1
76
-fi
77
-exit 0
packaging/update-tags
deleted
-150
@@ -1,150 +0,0 @@
1
-#!/bin/bash
2
-# SPDX-License-Identifier: GPL-3.0-or-later
3
-
4
-#
5
-# update-tags
6
-#
7
-scriptname=update-tags
8
-if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
9
-then
10
- echo >&2
11
- echo >&2
12
- echo >&2 "Cannot create temporary directory."
13
- echo >&2
14
- exit 1
15
-fi
16
-
17
-cleanup() {
18
- status=$?
19
- if [ $status -ne 0 ]
20
- then
21
- echo "FAILED."
22
- if [ "$TAGVER" ]
23
- then
24
- git tag -d "$TAGVER"
25
- fi
26
- echo "To re-run manually:"
27
- echo " git diff HEAD^ | ./packaging/update-tags -"
28
- echo "To undo commit:"
29
- echo " git reset HEAD^"
30
- fi
31
- rm -rf "${MYTMP}"
32
- exit $status
33
-}
34
-
35
-# clean up if we get stopped by Crtl-C or forced logout or normal exit
36
-trap cleanup INT
37
-trap cleanup HUP
38
-trap cleanup 0
39
-
40
-set -e
41
-if [ "$1" = "--debug" ]
42
-then
43
- set -x
44
- shift
45
-fi
46
-
47
-if [ $# -lt 1 ]
48
-then
49
- echo "Use only from .git/hooks/post-commit"
50
- exit 1
51
-fi
52
-
53
-if [ ! -x packaging/update-tags ]
54
-then
55
- echo "Must be run from base directory"
56
- exit 1
57
-fi
58
-
59
-if [ "$1" = "-" ]
60
-then
61
- from_cache=Y
62
- f=""
63
-else
64
- from_cache=
65
- for f in "$@"
66
- do
67
- if [ ! -f "$f" ]
68
- then
69
- echo "$f: no such file"
70
- exit 1
71
- fi
72
- done
73
-
74
- git status --porcelain "$@" | grep "^?" | cut -c4- > $MYTMP/missing.lst
75
-
76
- while read missing
77
- do
78
- git update-index --add --cacheinfo \
79
- 100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 $missing
80
- done < $MYTMP/missing.lst
81
-
82
- empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
83
- git diff $empty_tree -- "$@" > $MYTMP/diff.full
84
- f=$MYTMP/diff.full
85
-
86
- while read missing
87
- do
88
- git update-index --force-remove $missing
89
- done < $MYTMP/missing.lst
90
-fi
91
-
92
-> $MYTMP/diff.lst sed -e "/^+++ b/{p;s:^+++ b/::;w $MYTMP/files.lst" -e "d;}" $f
93
-
94
-#cat $MYTMP/diff.lst
95
-#cat $MYTMP/files.lst
96
-
97
-dirname="${0%/*}"
98
-if [ "$dirname" = "$0" ]; then dirname="."; fi
99
-source $dirname/packaging.functions
100
-
101
-status=0
102
-while read filename
103
-do
104
- #echo Checking $filename
105
- case $filename in
106
- configure.ac|ChangeLog)
107
- mkdir -p $MYTMP/files
108
- git show HEAD:configure.ac > $MYTMP/files/configure.ac
109
- version=`get_configure_ac_version`
110
- case "$(match_version $version)" in
111
- prerelease|candidate|release)
112
- do_release=Y
113
- ;;
114
- esac
115
- ;;
116
- *)
117
- #echo "No checks found for $filename"
118
- :
119
- ;;
120
- esac
121
-done < $MYTMP/files.lst
122
-
123
-if [ "$do_release" ]
124
-then
125
- echo "Tagging new release with:"
126
- echo " git tag -s \"v$version\" -m \"Release version $version\""
127
- git tag -s "v$version" -m "Release version $version"
128
- TAGVER="v$version"
129
-
130
- splitver confmaj confmin conffix confsfx "$version"
131
- if [ ! "$confsfx" ]
132
- then
133
- echo "Incrementing version in configure.ac:"
134
- conffix=`expr $conffix + 1`
135
- sed -i -e "s/define(\[VERSION_FIX\], \[.*])/define([VERSION_FIX], [$conffix])/" configure.ac
136
- fi
137
-
138
- echo "Resetting suffix in configure.ac:"
139
- sed -i -e 's/define(\[VERSION_SUFFIX\], \[.*])/define([VERSION_SUFFIX], [_rolling])/' configure.ac
140
- sed -i -e 's:^PACKAGE_RPM_RELEASE=.*:PACKAGE_RPM_RELEASE="0.0.$(echo VERSION_SUFFIX | sed s/^_//)":' configure.ac
141
-
142
- echo "Committing new configure.ac:"
143
- git commit --no-verify -m "Post release $version" -- configure.ac
144
- echo ""
145
- echo "Verify, then:"
146
- echo " git push origin"
147
- echo " git push origin tag $TAGVER"
148
-fi
149
-
150
-exit $status