From ce8f2579084c9fdd3be0130cb3caae12320efee3 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Mon, 21 Nov 2011 23:48:56 +0100 Subject: [PATCH] support multi-distribution setup Based on patch by Alexander Wirt, thanks! --- scripts/build-and-provide-package | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/scripts/build-and-provide-package b/scripts/build-and-provide-package index 9098bc5..4df2b43 100755 --- a/scripts/build-and-provide-package +++ b/scripts/build-and-provide-package @@ -80,14 +80,20 @@ build_info() { identify_sourcefile() { if [ -n "${sources:-}" ]; then echo "*** Variable \$sources set. Consider switching to ArtifactDeployer plugin setup. ***" - sourcefile=$(echo "${sources}/"*.dsc) + if [ -z "${distribution:-}" ]; then + sourcefile=$(echo "${sources}/"*.dsc) + else + sourcefile=$(echo "${sources}/distribution=${distribution}/"*.dsc) + fi + if [ "$sourcefile" = 'sources/*.dsc' ] ; then bailout 1 "Error: no sourcefile (*.dsc) found. Exiting." fi + case "$sourcefile" in *\ *) echo "*** Multiple source files (*.dsc) present in $(pwd): ***" - ls -la "${sources}/" - bailout 1 "Error: Please re-run source job to force clean rebuild." + ls -la "${sources}/" + bailout 1 "Error: Please re-run source job to force clean rebuild." ;; esac p="$(basename $sourcefile .dsc)" @@ -96,7 +102,14 @@ identify_sourcefile() { sources="unset" echo "*** Identifying newest package version ***" newest_version="0" - for file in "${JENKINS_HOME}/userContent/${PACKAGE}-source/"*.dsc ; do + + if [ -z "$distribution:-}" ]; then + local bpath="${JENKINS_HOME}/userContent/${PACKAGE}-source/" + else + local bpath="${JENKINS_HOME}/userContent/${PACKAGE}-source/distribution=${distribution}/" + fi + + for file in "${bpath}"/*.dsc; do SOURCE_PACKAGE="$(awk '/^Source: / {print $2}' $file)" p="$(basename $file .dsc)" if [ "$p" = '*' ] ; then @@ -109,8 +122,9 @@ identify_sourcefile() { base_version="${cur_version}" fi done + echo "*** Found package version $newest_version ***" - sourcefile="${JENKINS_HOME}/userContent/${PACKAGE}-source/${SOURCE_PACKAGE}"_*"${newest_version}".dsc + sourcefile="${bpath}/${SOURCE_PACKAGE}"_*"${newest_version}".dsc #archtype="$(awk '/^Architecture/ {print $2}' ${JENKINS_HOME}/userContent/${PACKAGE}-source/${SOURCE_PACKAGE}_*${newest_version}.dsc)" fi