-
Notifications
You must be signed in to change notification settings - Fork 27
/
push
executable file
·54 lines (43 loc) · 1.75 KB
/
push
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# This script pushes the package to the remote repository. It
# - Sets the timestamp in the first line of the file CHANGE_LOG
# - Sets the version ID in the file configure.ac
# - Sets the version ID in the file delivery/release-vars.sh
# - Commits the above changes
# - Tags the commit with the version ID
# - Pushes to the remote repository
# - Executes a "make dist"
set -e # exit on unhandled error
# Go to the top-level directory of the working tree.
cd `dirname $0`
# Get and vet the package version information from the CHANGE_LOG file.
versionId=`awk '{print $1;exit}' CHANGE_LOG`
majorId=`echo $versionId | cut -d . -f 1`
minorId=`echo $versionId | cut -d . -f 2`
bugfixId=`echo $versionId | cut -d . -f 3`
rcId=`echo $versionId | cut -d . -f 4` # might be empty
test "$majorId"
test "$minorId"
test "$bugfixId"
# Ensure the current time in the top line of the CHANGE_LOG file.
awk 'NR==1{print $1"\t'`date --iso-8601=seconds`'"}NR>1' CHANGE_LOG \
>CHANGE_LOG.tmp
mv CHANGE_LOG.tmp CHANGE_LOG
# Set the package version in the autoconf configuration-file.
sed '/^AC_INIT(/s/\[[0-9][0-9.]*\]/['$versionId']/' configure.ac \
>configure.ac.tmp
mv configure.ac.tmp configure.ac
autoreconf -fi # Because new version ID in "configure.ac"
# Set the package version in the release-variables file.
sed "/^export *PKG_VERSION=/cexport PKG_VERSION=$versionId" \
delivery/release-vars.sh >delivery/release-vars.sh.tmp
mv delivery/release-vars.sh.tmp delivery/release-vars.sh
# Set the tag
tag="v$versionId"
# Commit the changes.
git commit -a -m $tag
# Tag the version if on the main branch.
git status | head -1 | grep -E 'master|main' >/dev/null && git tag -f $tag
# Push to the remote repository
git push --mirror
# Create a distribution
make dist