Skip to content

Commit 51a0864

Browse files
authored
packaging: new timestamp format and add output dir option (apache#4471)
* Packaging: new timestamp format and add output dir option * apache#4471 packaging: echo message after moving packages
1 parent 2f7e55a commit 51a0864

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

packaging/build-deb.sh

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ note that you can override/provide "branding" string with "-b, --brand" flag as
4343
Optional arguments:
4444
-b, --brand string Set branding to be used in package name (it will override any branding string in POM version)
4545
-T, --use-timestamp Use epoch timestamp instead of SNAPSHOT in the package name (if not provided, use "SNAPSHOT")
46+
-o, --output-directory The output directory of packages
4647
4748
Other arguments:
4849
-h, --help Display this help message and exit
@@ -84,6 +85,16 @@ while [ -n "$1" ]; do
8485
fi
8586
;;
8687

88+
-o | --output-directory)
89+
if [ -n "$OUTPUT_DIR" ]; then
90+
echo "ERROR: you have already entered value for -o, --output-directory"
91+
exit 1
92+
else
93+
OUTPUT_DIR=$2
94+
shift 2
95+
fi
96+
;;
97+
8798
-*|*)
8899
echo "ERROR: no such option $1. -h or --help for help"
89100
exit 1
@@ -96,7 +107,7 @@ if [ -z "$(which dch)" ] ; then
96107
exit 1
97108
fi
98109

99-
NOW="$(date +%s)"
110+
NOW="$(date +'%Y%m%dT%H%M%S')"
100111
PWD=$(cd $(dirname "$0") && pwd -P)
101112
cd $PWD/../
102113

@@ -139,15 +150,21 @@ else
139150
fi
140151
fi
141152

142-
/bin/cp debian/changelog /tmp/changelog.orig
153+
/bin/cp debian/changelog debian/changelog.$NOW
143154

144155
dch -b -v "${VERSION}~${DISTCODE}" -u low -m "Apache CloudStack Release ${VERSION}"
145156
sed -i '0,/ UNRELEASED;/s// unstable;/g' debian/changelog
146157

147158
dpkg-checkbuilddeps
148159
dpkg-buildpackage -uc -us -b
149160

150-
/bin/mv /tmp/changelog.orig debian/changelog
161+
/bin/mv debian/changelog.$NOW debian/changelog
162+
163+
if [ -n "$OUTPUT_DIR" ];then
164+
mkdir -p "$OUTPUT_DIR"
165+
mv ../*${VERSION}* "$OUTPUT_DIR"
166+
echo "====== CloudStack packages have been moved to $OUTPUT_DIR ======"
167+
fi
151168

152169
if [ "$USE_TIMESTAMP" == "true" ]; then
153170
(cd $PWD; git reset --hard)

0 commit comments

Comments
 (0)