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