From 3c1f62f9477d0933e620724de8d0847103971531 Mon Sep 17 00:00:00 2001 From: Michael Prokop Date: Thu, 14 Aug 2014 08:49:06 +0200 Subject: [PATCH] MT#8603 Use repos' Packages file for identifying ngcp-installer version As noticed by Victor the trunk installations using the development.sh script retrieved the latest version of the installer, no matter to which repository this binary belonged to (so even if it's not listed in release-trunk-${debian_release}). This causes problems when you are using trunk installations and someone is working on installer on branches, reviewing changes, etc. To avoid this problem we take a look at the Packages file of the according repository instead. This isn't limited only to trunk builds, but also for the release builds, to avoid any possible problems with multiple deb files inside the pool directory (which isn't the case yet, but we *could* do that now). Change-Id: Ie215e70e9317133750cdf0e4b264a3b2c6f083fa --- deployment.sh | 40 ++++++++++++++++------------------------ 1 file changed, 16 insertions(+), 24 deletions(-) diff --git a/deployment.sh b/deployment.sh index bc3b255..fec71cc 100755 --- a/deployment.sh +++ b/deployment.sh @@ -1260,41 +1260,33 @@ get_installer_path() { # use pool directory according for ngcp release if $PRO_EDITION ; then + if [ -n "$CROLE" ]; then + local installer_package='ngcp-installer-carrier' + else + local installer_package='ngcp-installer-pro' + fi + local repos_base_path="http://deb.sipwise.com/sppro/${SP_VERSION}/dists/${DEBIAN_RELEASE}/main/binary-amd64/" INSTALLER_PATH="http://deb.sipwise.com/sppro/${SP_VERSION}/pool/main/n/ngcp-installer/" else + local installer_package='ngcp-installer-ce' + local repos_base_path="http://deb.sipwise.com/spce/${SP_VERSION}/dists/${DEBIAN_RELEASE}/main/binary-amd64/" INSTALLER_PATH="http://deb.sipwise.com/spce/${SP_VERSION}/pool/main/n/ngcp-installer/" fi # use a separate repos for trunk releases if $TRUNK_VERSION ; then - INSTALLER_PATH='http://deb.sipwise.com/autobuild/pool/main/n/ngcp-installer/' - fi - - wget --directory-prefix=debs --no-directories -r --no-parent "$INSTALLER_PATH" - - # Get rid of unused ngcp-installer-pro-ha-v3 packages to avoid version number problems - rm -f debs/ngcp-installer-pro-ha-v3* - - # As soon as a *tagged* version against $DEBIAN_RELEASE enters the pool - # (e.g. during release time) the according package which includes the - # $DEBIAN_RELEASE string disappears, in such a situation instead choose the - # highest version number instead. - local count_distri_package="$(find ./debs -type f -a -name \*\+${DEBIAN_RELEASE}\*.deb)" - if [ -z "$count_distri_package" ] ; then - echo "Could not find any $DEBIAN_RELEASE specific packages, going for highest version number instead." - logit "Could not find any $DEBIAN_RELEASE specific packages, going for highest version number instead." - else - echo "Found $DEBIAN_RELEASE specific packages, getting rid of all packages without gbp and $DEBIAN_RELEASE in their name." - logit "Found $DEBIAN_RELEASE specific packages, getting rid of all packages without gbp and $DEBIAN_RELEASE in their name." - # get rid of files not matching the Debian relase we want to install - find ./debs -type f -a ! -name \*\+${DEBIAN_RELEASE}\* -exec rm {} + + local repos_base_path="http://deb.sipwise.com/autobuild/dists/release-trunk-${DEBIAN_RELEASE}/main/binary-amd64/" + INSTALLER_PATH="http://deb.sipwise.com/autobuild/pool/main/n/ngcp-installer/" fi - local version=$(dpkg-scanpackages debs /dev/null 2>/dev/null | awk '/Version/ {print $2}' | sort -ur) + wget --timeout=30 -O Packages "${repos_base_path}/Packages" + # sed: display paragraphs matching the "Package: ..." string, then grab string "^Version: " and display the actual version via awk + # sort -u to avoid duplicates in repositories shipping the ngcp-installer-pro AND ngcp-installer-pro-ha-v3 debs + local version=$(sed "/./{H;\$!d;};x;/Package: ${installer_package}/b;d" Packages | awk '/^Version: / {print $2}' | sort -u) - [ -n "$version" ] || die "Error: installer version could not be detected." + [ -n "$version" ] || die "Error: installer version for ngcp ${SP_VERSION}, Debian release $DEBIAN_RELEASE with installer package $installer_package could not be detected." - if $PRO_EDITION ; then + if "$PRO_EDITION" ; then if [ -n "$CROLE" ]; then INSTALLER="ngcp-installer-carrier_${version}_all.deb" else