summaryrefslogtreecommitdiffstats
path: root/bin/d-i_build.sh
diff options
context:
space:
mode:
authorPhilip Hands <phil@hands.com>2016-06-17 11:37:01 +0200
committerHolger Levsen <holger@layer-acht.org>2016-06-18 23:32:58 +0200
commit1466bd88e1f023b6e1b69c7c62d0b5ba047eb227 (patch)
tree867073226da3caa2eeea948e686ec28d10d99bc5 /bin/d-i_build.sh
parent75cadfb9e859a4800d4f9262e14dcb9860b7d0cd (diff)
downloadjenkins.debian.net-1466bd88e1f023b6e1b69c7c62d0b5ba047eb227.tar.xz
d-i: set --buildresult to .. to get artifacts to land somewhere that we own
Signed-off-by: Holger Levsen <holger@layer-acht.org>
Diffstat (limited to 'bin/d-i_build.sh')
-rwxr-xr-xbin/d-i_build.sh79
1 files changed, 40 insertions, 39 deletions
diff --git a/bin/d-i_build.sh b/bin/d-i_build.sh
index 10de8327..f045594c 100755
--- a/bin/d-i_build.sh
+++ b/bin/d-i_build.sh
@@ -7,12 +7,8 @@ DEBUG=false
. /srv/jenkins/bin/common-functions.sh
common_init "$@"
-replace_origin_pu() {
- PREFIX=$1 ; shift
- BRANCH=$1 ; shift
- expr "$BRANCH" : 'origin/pu/' >/dev/null || return 1
- echo "${PREFIX}${BRANCH#origin/pu/}"
-}
+RESULT_DIR=$(readlink -f ..)
+ISO_DIR=/srv/d-i/isos
clean_workspace() {
#
@@ -37,6 +33,40 @@ clean_workspace() {
echo
}
+replace_origin_pu() {
+ PREFIX=$1 ; shift
+ BRANCH=$1 ; shift
+ expr "$BRANCH" : 'origin/pu/' >/dev/null || return 1
+ echo "${PREFIX}${BRANCH#origin/pu/}"
+}
+
+iso_target() {
+ UI=$1 ; shift
+ echo "${ISO_DIR}/mini-${UI}$(replace_origin_pu "-" $PU_GIT_BRANCH).iso"
+}
+
+preserve_artifacts() {
+ #
+ # Check is we're in a pu/* branch, and if so save the udebs
+ #
+ if PU_BRANCH_DIR=$(replace_origin_pu "/srv/udebs/" $GIT_BRANCH) ; then
+ mkdir -p $PU_BRANCH_DIR
+ cp ${RESULT_DIR}/*.udeb $PU_BRANCH_DIR
+ fi
+
+ #
+ # Alternatively, if we built an images tarball and were triggered by a pu/ branch
+ #
+ IMAGETAR=${RESULT_DIR}/debian-installer-images_*.tar.gz
+ if [ -f $IMAGETAR -a "$PU_GIT_BRANCH" ] ; then
+ [ -d ${ISO_DIR} ] || mkdir ${ISO_DIR}
+
+ tar -xvzf $IMAGETAR --no-anchored mini.iso
+ mv -f installer-*/*/images/netboot/gtk/mini.iso $(iso_target gtk)
+ mv -f installer-*/*/images/netboot/mini.iso $(iso_target text)
+ fi
+}
+
pdebuild_package() {
#
# check if we need to do anything
@@ -85,40 +115,13 @@ pdebuild_package() {
if PU_BRANCH_DIR=$(replace_origin_pu "/srv/udebs/" $PU_GIT_BRANCH) ; then
cp $PU_BRANCH_DIR/* build/localudebs
fi
- pdebuild --use-pdebuild-internal --debbuildopts "-j$NUM_CPU -b" -- --http-proxy $http_proxy
+ pdebuild --use-pdebuild-internal --debbuildopts "-j$NUM_CPU -b" --buildresult ${RESULT_DIR} -- --http-proxy $http_proxy
# cleanup
echo
- cat /var/cache/pbuilder/result/${SOURCE}_*changes
+ cat ${RESULT_DIR}/${SOURCE}_*changes
echo
- sudo dcmd rm /var/cache/pbuilder/result/${SOURCE}_*changes
-}
-
-preserve_pu_udebs() {
- #
- # Check is we're in a pu/* branch
- #
- if PU_BRANCH_DIR=$(replace_origin_pu "/srv/udebs/" $GIT_BRANCH) ; then
- mkdir -p $PU_BRANCH_DIR
- cp $WORKSPACE/../*.udeb $PU_BRANCH_DIR
- fi
-}
-
-iso_target() {
- UI=$1 ; shift
-
- echo "/srv/d-i/isos/mini-${UI}$(replace_origin_pu "-" $PU_GIT_BRANCH).iso"
-}
-
-preserve_miniiso() {
- #
- # check if we built the images
- #
- IMAGETAR=../debian-installer-images_*.tar.gz
- [ -f $IMAGETAR ] || return 0
-
- tar -xvzf $IMAGETAR --no-anchored mini.iso
- mv -f installer-*/*/images/netboot/gtk/mini.iso $(iso_target gtk)
- mv -f installer-*/*/images/netboot/mini.iso $(iso_target text)
+ preserve_artifacts
+ sudo dcmd rm ${RESULT_DIR}/${SOURCE}_*changes
}
clean_workspace
@@ -128,8 +131,6 @@ clean_workspace
#
if [ "$1" = "" ] ; then
pdebuild_package
- preserve_pu_udebs
- preserve_miniiso
else
echo do something else ; exit 1
fi