Fix apt-cache show cmd failure on Debian-10 52/29752/2
authorDave Wallace <[email protected]>
Wed, 4 Nov 2020 18:50:22 +0000 (13:50 -0500)
committerDave Wallace <[email protected]>
Wed, 4 Nov 2020 20:47:32 +0000 (15:47 -0500)
- The version of apt-cache on debian-10 does not produce
  the same output as the versions in Ubuntu distros.
  Refactor extraction of vpp-ext-deps package name from
  apt-cache output.

Change-Id: I92c297d91f6acf332be6a54bc1eaac83a4d3d7da
Signed-off-by: Dave Wallace <[email protected]>
jjb/scripts/setup_vpp_dpdk_dev_env.sh

index d42af48..7ba87b3 100644 (file)
@@ -31,14 +31,17 @@ function setup {
         if [ "${OS_ID,,}" == "ubuntu" ] || [ "${OS_ID,,}" == "debian" ] ; then
             if [ "${STREAM}" != "master" ]; then
                 echo "stream '${STREAM}' is not master: replacing packagecloud apt sources list with stream specific list"
-                sudo rm  -f /etc/apt/sources.list.d/fdio_master.list
+                sudo apt-get -y remove vpp-ext-deps || true
+                sudo rm -f /etc/apt/sources.list.d/fdio_master.list
                 curl -s $INSTALL_URL/script.deb.sh | sudo bash
             fi
             sudo apt-get update -qq || true
-            curr_vpp_ext_deps="/root/Downloads/$(basename $(apt-cache show vpp-ext-deps | grep Filename | head -1 | cut -d' ' -f2))"
-            if [ -f "$curr_vpp_ext_deps" ] ; then
-                echo "Installing cached vpp-ext-deps pkg: $curr_vpp_ext_deps"
-                sudo dpkg -i $curr_vpp_ext_deps
+            local vpp_ext_deps_version="$(apt-cache show vpp-ext-deps | mawk '/Version/ {print $2}' | head -1)"
+            local vpp_ext_deps_arch="$(apt-cache show vpp-ext-deps | mawk '/Architecture/ {print $2}' | head -1)"
+            local vpp_ext_deps_pkg="/root/Downloads/vpp-ext-deps_${vpp_ext_deps_version}_${vpp_ext_deps_arch}.deb"
+            if [ -f "$vpp_ext_deps_pkg" ] ; then
+                echo "Installing cached vpp-ext-deps pkg: $vpp_ext_deps_pkg"
+                sudo dpkg -i $vpp_ext_deps_pkg
             else
                 echo "Installing vpp-ext-deps from packagecloud.io"
                 local force_opts="--allow-downgrades --allow-remove-essential"