Skip to content

Commit a696434

Browse files
committed
Include packaging hooks
1 parent 558fe30 commit a696434

13 files changed

+833
-2
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,7 @@ stamp-h1
2424

2525
iprange
2626
iprange.spec
27+
28+
*.tar.gz
29+
*.tar.bz2
30+
*.tar.xz

Makefile.am

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,4 +25,5 @@ EXTRA_DIST = \
2525
.gitignore \
2626
README.md \
2727
iprange-9999.ebuild \
28+
autogen.sh \
2829
$(NULL)

configure.ac

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,22 @@ AC_PREREQ(2.60)
55

66
define([VERSION_MAJOR], [1])
77
define([VERSION_MINOR], [0])
8-
define([VERSION_FIX], [0])
8+
define([VERSION_FIX], [1])
99
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
1010
define([VERSION_SUFFIX], [_master])
1111

12+
dnl Set to "1" for a first RPM release of a new version
13+
PACKAGE_RPM_RELEASE="0.0.$(echo VERSION_SUFFIX | sed s/^_//)"
14+
1215
AC_INIT([iprange], VERSION_NUMBER[]VERSION_SUFFIX)
16+
17+
AM_MAINTAINER_MODE([disable])
18+
if test x"$USE_MAINTAINER_MODE" = xyes; then
19+
AC_MSG_NOTICE(***************** MAINTAINER MODE *****************)
20+
PACKAGE_BUILT_DATE=$(date '+%d %b %Y')
21+
fi
22+
1323
PACKAGE_RPM_VERSION="VERSION_NUMBER"
14-
PACKAGE_RPM_RELEASE="0.0.$(echo VERSION_SUFFIX | sed 's/^_//')"
1524
AC_SUBST([PACKAGE_RPM_VERSION])
1625
AC_SUBST([PACKAGE_RPM_RELEASE])
1726

hooks/post-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
if [ -x ./packaging/update-tags ]
3+
then
4+
exec git diff HEAD^ | ./packaging/update-tags -
5+
fi

hooks/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
if [ -x ./packaging/check-files ]
3+
then
4+
exec git diff --cached | ./packaging/check-files -
5+
fi

hooks/prepare-commit-msg

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
test -x ./packaging/release-msg && exec ./packaging/release-msg "$@"

packaging/README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
Packaging Tools
2+
===============
3+
4+
The programs in this folder are used when packaging from within git
5+
and are not included in source or binary packages.
6+
7+
For the most part they are used from the git commit hooks (copy
8+
`../hooks/*` to `../.git/hooks` to automate checking and the release
9+
process.
10+
11+
The check-files script pulls in `*.functions` and `*/*.functions` to
12+
do the actual work.
13+
14+
`packaging.functions` contains generic checks on e.g `ChangeLog`
15+
and `configure.ac` and automates release version, checking, tagging
16+
and post-release update.
17+
18+
Programs and packages with specific needs should create extra
19+
`whatever.functions` and supporting scripts in a subdirectory.
20+
21+
Making a release
22+
----------------
23+
`
24+
Just update ChangeLog and configure.ac to specify a suitable version
25+
suffix:
26+
27+
empty - final release
28+
pre.# - pre-release candidate
29+
rc.# - pre-release candidate
30+
31+
If it is a final release and there is a package.spec.in, add a new
32+
entry to the top of the %changelog section and update:
33+
PACKAGE_RPM_RELEASE="1"
34+
35+
The hooks will take over and if everything is OK will tag the release
36+
(you will be asked to sign the tag) and then update the files ready
37+
for further development.
38+
39+
The release is not pushed out automatically, so if you want to undo
40+
it, run:
41+
42+
~~~~
43+
git reset --hard HEAD^^
44+
git tag -d vx.y.z
45+
~~~~
46+
47+
Otherwise you can just push the results; the script outputs the required
48+
instructions upon success.
49+
50+
Once pushed the infrastructure will build a set of tar-files on the server.
51+
For information on how to verify, sign and make these available, see:
52+
53+
https://github.com/firehol/infrastructure/raw/master/doc/release.txt

packaging/check-files

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
#!/bin/bash
2+
3+
#
4+
# check-files
5+
#
6+
scriptname=check-files
7+
if ! MYTMP=$(mktemp -d -t $scriptname-XXXXXX)
8+
then
9+
echo >&2
10+
echo >&2
11+
echo >&2 "Cannot create temporary directory."
12+
echo >&2
13+
exit 1
14+
fi
15+
16+
cleanup() {
17+
status=$?
18+
rm -rf "${MYTMP}"
19+
exit $status
20+
}
21+
22+
# clean up if we get stopped by Crtl-C or forced logout or normal exit
23+
trap cleanup INT
24+
trap cleanup HUP
25+
trap cleanup 0
26+
27+
set -e
28+
if [ "$1" = "--debug" ]
29+
then
30+
set -x
31+
shift
32+
fi
33+
34+
if [ $# -lt 1 ]
35+
then
36+
echo "check-files [--debug] -|filenames"
37+
echo "e.g."
38+
echo " git diff | ./packaging/check-files -"
39+
echo "or in .git/hooks/pre-commit:"
40+
echo " exec git diff --cached | ./packaging/check-files -"
41+
exit 1
42+
fi
43+
44+
if [ ! -x packaging/check-files ]
45+
then
46+
echo "Must be run from base directory"
47+
exit 1
48+
fi
49+
50+
if [ "$1" = "-" ]
51+
then
52+
from_cache=Y
53+
f=""
54+
else
55+
from_cache=
56+
for f in "$@"
57+
do
58+
if [ ! -f "$f" ]
59+
then
60+
echo "$f: no such file"
61+
exit 1
62+
fi
63+
done
64+
65+
git status --porcelain "$@" | grep "^?" | cut -c4- > $MYTMP/missing.lst
66+
67+
while read missing
68+
do
69+
git update-index --add --cacheinfo \
70+
100644 e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 $missing
71+
done < $MYTMP/missing.lst
72+
73+
empty_tree=4b825dc642cb6eb9a060e54bf8d69288fbee4904
74+
git diff $empty_tree -- "$@" > $MYTMP/diff.full
75+
f=$MYTMP/diff.full
76+
77+
while read missing
78+
do
79+
git update-index --force-remove $missing
80+
done < $MYTMP/missing.lst
81+
fi
82+
83+
> $MYTMP/diff.lst sed -e "/^+++ b/{p;s:^+++ b/::;w $MYTMP/files.lst" -e "d;}" $f
84+
85+
#cat $MYTMP/diff.lst
86+
#cat $MYTMP/files.lst
87+
88+
dirname="${0%/*}"
89+
if [ "$dirname" = "$0" ]; then dirname="."; fi
90+
91+
for i in $dirname/*.functions $dirname/*/*.functions
92+
do
93+
if [ -f "$i" ]
94+
then
95+
source $i
96+
echo $i | sed -e 's:.*/::' -e 's/\.functions$//' -e 's/\./_/g' >> $MYTMP/fns
97+
fi
98+
done
99+
100+
status=0
101+
while read fn
102+
do
103+
"${fn}_check_init" $filename || status=1
104+
done < $MYTMP/fns
105+
106+
while read filename
107+
do
108+
#echo Checking $filename
109+
while read fn
110+
do
111+
if [ $status -eq 0 ]
112+
then
113+
"${fn}_check_file" $filename || status=1
114+
fi
115+
done < $MYTMP/fns
116+
done < $MYTMP/files.lst
117+
118+
if [ $status -eq 0 ]
119+
then
120+
while read fn
121+
do
122+
"${fn}_check_fin" $filename || status=1
123+
done < $MYTMP/fns
124+
fi
125+
126+
exit $status

packaging/git-build

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#!/bin/sh
2+
3+
# When run from the top-level repository, performs a complete clean
4+
# and maintainer-mode rebuild of the FireHOL package.
5+
6+
if [ ! -f .gitignore -o ! -f configure.ac -o ! -x autogen.sh ]
7+
then
8+
echo "Run as ./packaging/git-build from an autotools git repository"
9+
exit 1
10+
fi
11+
12+
# If we are genuinely in a git repo, try to clean it up, otherwise
13+
# just make the assumption
14+
if [ -d .git ]
15+
then
16+
clean=$(git status -s | grep "^?")
17+
18+
if [ "$clean" ]
19+
then
20+
if [ "$1" != "-ok" ]
21+
then
22+
echo "Warning: this script runs: git clean -d -f -x"
23+
echo " ensure all required ?? files are added, then re-run with '-ok'"
24+
git status -s | grep '^?'
25+
exit 1
26+
fi
27+
fi
28+
29+
set -e
30+
git clean -d -f -x
31+
set +e
32+
fi
33+
34+
set -e
35+
./autogen.sh
36+
./configure --enable-maintainer-mode
37+
set +e
38+
make dist
39+
status=$?
40+
exit $status

0 commit comments

Comments
 (0)