forked from untangle/ngfw_pkgtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpromote-release.sh
executable file
·65 lines (53 loc) · 2.16 KB
/
promote-release.sh
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
55
56
57
58
59
60
61
62
63
64
65
#! /bin/bash
usage() {
echo "Usage: $0 [-s] [-w] [-A architecture] [-C <component>] [-T (dsc|udeb|deb)] -r <repository> -f <fromDistribution> -d <toDistribution> -v <version>"
echo "-s : simulate"
echo "-w : wipe out <toDistribution> first"
echo "-C <component> : only act on component <component>"
echo "-T (dsc,udeb,deb) : only act on source/udeb/deb packages"
echo "-A <arch> : only act on architecture <arch>"
echo "-r : repository to use"
echo "-f : source distribution to promote from"
echo "-v : version (needs to be a full x.y.z)"
exit 1
}
while getopts "A:T:C:shwr:f:v:" opt ; do
case "$opt" in
s) simulate=1 && EXTRA_ARGS="$EXTRA_ARGS -s" ;;
r) REPOSITORY=$OPTARG ;;
C) COMPONENT="$OPTARG" && EXTRA_ARGS="$EXTRA_ARGS -C $COMPONENT" ;;
A) ARCHITECTURE="$OPTARG" && EXTRA_ARGS="$EXTRA_ARGS -A $ARCHITECTURE" ;;
T) TYPE="$OPTARG" && EXTRA_ARGS="$EXTRA_ARGS -T $TYPE" ;;
w) WIPE_OUT_TARGET=1 ;;
f) FROM_DISTRIBUTION=$OPTARG ;;
v) VERSION=$OPTARG ;;
h) usage ;;
\?) usage ;;
esac
done
shift $(($OPTIND - 1))
if [ ! $# = 0 ] ; then
usage
fi
[ -z "$REPOSITORY" -o -z "$FROM_DISTRIBUTION" -o -z "$VERSION" ] && usage && exit 1
##########
# MAIN
# include common variables
. $(dirname $0)/release-constants.sh
# wipe out target distribution first
[ -n "$WIPE_OUT_TARGET" ] && ${PKGTOOLS}/remove-packages.sh $EXTRA_ARGS -r $REPOSITORY -d $VERSION
${PKGTOOLS}/copy-packages.sh $EXTRA_ARGS -r $REPOSITORY $FROM_DISTRIBUTION $VERSION
# generate changelog
if [ -z "$simulate" ] ; then
changelog_file=$(mktemp "promotion-${REPOSITORY}-${FROM_DISTRIBUTION}-to-${VERSION}_$(date -Iminutes)-XXXXXXX.txt")
diffCommand="python3 ${PKGTOOLS}/changelog.py --log-level info --version $VERSION --tag-type promotion --create-tags"
$diffCommand >| $changelog_file
mutt -F $MUTT_CONF_FILE -a $changelog_file -s "[Distro promotion] $REPOSITORY: $FROM_DISTRIBUTION promoted to $VERSION" -- $RECIPIENT <<EOF
Effective $(date).
Attached is the changelog for this promotion, generated by running
the following command:
$diffCommand
--ReleaseMaster ($USER@$(hostname)), version $PKGTOOLS_VERSION
EOF
fi
/bin/rm -f ${changelog_file}