From 6be5639d8ce2f6e282db6f3d19699a341b9b491c Mon Sep 17 00:00:00 2001 From: Alexandru Avadanii Date: Thu, 15 Sep 2016 19:01:09 +0200 Subject: fuel-plugin-ovs: Simplify debian version strings Remove all suffixes from OVS debian packages, and simplify the plugin code handling the fetching of said packages. While at it, enable: - local mirror caches, by mounting /etc/hosts in the docker builder - HACK: mismatch between debian source versions and debian binaries Related-bug: ARMBAND-89 Change-Id: Ifbf0e11c90cf7b2f76ce72af8ca3469a33bee071 Signed-off-by: Alexandru Avadanii --- ...Add-support-for-downloading-prebuilt-DEBs.patch | 37 +++++----- ...009-build-docker-Use-host-s-network-stack.patch | 30 ++++++++ ...l.sh-AArch64-Fix-dpkg-installation-issues.patch | 82 ---------------------- ...-build-prebuilt-DEBs-src-bin-ver-mismatch.patch | 72 +++++++++++++++++++ 4 files changed, 118 insertions(+), 103 deletions(-) create mode 100644 patches/fuel-plugin-ovs/0009-build-docker-Use-host-s-network-stack.patch delete mode 100644 patches/fuel-plugin-ovs/0009-install.sh-AArch64-Fix-dpkg-installation-issues.patch create mode 100644 patches/fuel-plugin-ovs/0010-HACK-build-prebuilt-DEBs-src-bin-ver-mismatch.patch (limited to 'patches/fuel-plugin-ovs') diff --git a/patches/fuel-plugin-ovs/0008-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch b/patches/fuel-plugin-ovs/0008-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch index 70ea6fa9..0f7e072c 100644 --- a/patches/fuel-plugin-ovs/0008-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch +++ b/patches/fuel-plugin-ovs/0008-AArch64-Add-support-for-downloading-prebuilt-DEBs.patch @@ -5,14 +5,14 @@ Subject: [PATCH] AArch64: Add support for downloading prebuilt DEBs Signed-off-by: Alexandru Avadanii --- ovs_build/build-ovs-armband-fetch.sh | 45 ++++++++++++++++++++++++++++++++++++ - ovs_build/build-ovs-dpdk.sh | 21 ++++++++++++++++- - ovs_build/build-ovs-nsh-dpdk.sh | 17 +++++++++++++- - 3 files changed, 81 insertions(+), 2 deletions(-) + ovs_build/build-ovs-dpdk.sh | 18 ++++++++++++++- + ovs_build/build-ovs-nsh-dpdk.sh | 15 +++++++++++- + 3 files changed, 76 insertions(+), 2 deletions(-) create mode 100755 ovs_build/build-ovs-armband-fetch.sh diff --git a/ovs_build/build-ovs-armband-fetch.sh b/ovs_build/build-ovs-armband-fetch.sh new file mode 100755 -index 0000000..2a041e2 +index 0000000..a810b93 --- /dev/null +++ b/ovs_build/build-ovs-armband-fetch.sh @@ -0,0 +1,45 @@ @@ -36,7 +36,7 @@ index 0000000..2a041e2 +function armband_fetch() { + local name=$1 + local ver=${2//\+/\\\+} -+ local repo_base_url=${3:-https://linux.enea.com/mos-repos/ubuntu/9.0} ++ local repo_base_url=${3:-http://linux.enea.com/mos-repos/ubuntu/9.0} + local repo_Sources_url=${4:-dists/mos9.0-fuel-plugin-ovs/main/source/Sources} + local repo_Packages_url=${5:-dists/mos9.0-fuel-plugin-ovs/main/binary-arm64/Packages} + local found=false @@ -62,17 +62,14 @@ index 0000000..2a041e2 + fi +} diff --git a/ovs_build/build-ovs-dpdk.sh b/ovs_build/build-ovs-dpdk.sh -index f3c2e5b..ed8f126 100755 +index a0c50e3..8d70265 100755 --- a/ovs_build/build-ovs-dpdk.sh +++ b/ovs_build/build-ovs-dpdk.sh -@@ -13,11 +13,16 @@ export DEB_BUILD_OPTIONS='parallel=8 nocheck' +@@ -13,11 +13,13 @@ export DEB_BUILD_OPTIONS='parallel=8 nocheck' # AArch64 specifics, repository base URL, debian build versions AARCH64_REPO=${AARCH64_REPO:-'https://linux.enea.com/mos-repos/ubuntu/9.0'} AARCH64_DPDK_DEBV=${AARCH64_DPDK_DEBV:-'0~u14.04+mos1+mos9.0+amos1'} -+AARCH64_OVS_DEBV=${AARCH64_OVS_DEBV:-'1+amos1'} -+AARCH64_OVS_DPDK_DEBV=${AARCH64_OVS_DPDK_DEBV:-${AARCH64_OVS_DEBV}} -+# AArch64 original source version for prebuilt OVS (~MM.DD suffixed) -+AARCH64_OVS_VER=${AARCH64_OVS_VER:-'2.5.90~08.08'} ++AARCH64_OVS_DEBV=${AARCH64_OVS_DEBV:-'2.5.90-1'} # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH) # All archs should be represented in `dpkg --print-architecture` format @@ -83,7 +80,7 @@ index f3c2e5b..ed8f126 100755 BUILD_ARCH=$(dpkg --print-architecture) UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}} -@@ -91,6 +96,20 @@ for ARCH in ${UBUNTU_ARCH}; do +@@ -92,6 +94,20 @@ for ARCH in ${UBUNTU_ARCH}; do cd ${BUILD_DEST}/ovs debian/rules build; fakeroot debian/rules binary @@ -93,8 +90,8 @@ index f3c2e5b..ed8f126 100755 + source ${BUILD_SRC}/build-ovs-armband-fetch.sh + # Fetch Sources/Packages from Armband and construct list of packages to download + armband_fetch 'dpdk' "16.07-${AARCH64_DPDK_DEBV}" -+ armband_fetch 'openvswitch-dpdk' "${AARCH64_OVS_VER}-${AARCH64_OVS_DPDK_DEBV}" -+ armband_fetch 'openvswitch' "${AARCH64_OVS_VER}-${AARCH64_OVS_DEBV}" ++ armband_fetch 'openvswitch-dpdk' "${AARCH64_OVS_DEBV}" ++ armband_fetch 'openvswitch' "${AARCH64_OVS_DEBV}" + # libxenstore (equivalent to `apt-get download` for native build) + AARCH64_LIBXENSTORE='libxenstore3.0_4.4.2-0ubuntu0.14.04.6_arm64.deb' + wget -c "http://ports.ubuntu.com/pool/main/x/xen/${AARCH64_LIBXENSTORE}" @@ -105,17 +102,15 @@ index f3c2e5b..ed8f126 100755 # Store DEBs in <${BUILD_DEB}/${ARCH}/> dir and cleanup diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh -index 59d8a79..9f026ac 100755 +index 59d8a79..9d8a837 100755 --- a/ovs_build/build-ovs-nsh-dpdk.sh +++ b/ovs_build/build-ovs-nsh-dpdk.sh -@@ -11,10 +11,16 @@ DIR="$(dirname `readlink -f $0`)" +@@ -11,10 +11,14 @@ DIR="$(dirname `readlink -f $0`)" export DEB_BUILD_OPTIONS='parallel=8 nocheck' +# AArch64 specifics, repository base URL, debian build versions -+AARCH64_OVS_DEBV=${AARCH64_OVS_DEBV:-'1.nsh+amos2'} -+# AArch64 original source version for prebuilt OVS (~MM.DD suffixed) -+AARCH64_OVS_VER=${AARCH64_OVS_VER:-'2.5.90~04.05'} ++AARCH64_OVS_NSH_DEBV=${AARCH64_OVS_NSH_DEBV:-'2.5.90-1.nsh'} + # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH) # All archs should be represented in `dpkg --print-architecture` format @@ -126,7 +121,7 @@ index 59d8a79..9f026ac 100755 BUILD_ARCH=$(dpkg --print-architecture) UBUNTU_ARCH=${UBUNTU_ARCH:-${BUILD_ARCH}} -@@ -119,6 +125,15 @@ openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low +@@ -119,6 +123,15 @@ openvswitch (${OVS_VER}-1.nsh) unstable; urgency=low -- Open vSwitch team $(date --rfc-2822) EOF debian/rules build; fakeroot debian/rules binary @@ -135,7 +130,7 @@ index 59d8a79..9f026ac 100755 + if [ ${ARCH} = 'arm64' ]; then + source ${DIR}/build-ovs-armband-fetch.sh + # FIXME(armband): https://jira.opnfv.org/browse/ARMBAND-86 -+ armband_fetch 'openvswitch' "${AARCH64_OVS_VER}-${AARCH64_OVS_DEBV}" ++ armband_fetch 'openvswitch' "${AARCH64_OVS_NSH_DEBV}" + else + echo "WARNING: Architecture [${ARCH}] does not provide precompiled DEBs, skipping!" + fi diff --git a/patches/fuel-plugin-ovs/0009-build-docker-Use-host-s-network-stack.patch b/patches/fuel-plugin-ovs/0009-build-docker-Use-host-s-network-stack.patch new file mode 100644 index 00000000..e0606819 --- /dev/null +++ b/patches/fuel-plugin-ovs/0009-build-docker-Use-host-s-network-stack.patch @@ -0,0 +1,30 @@ +From: Alexandru Avadanii +Date: Thu, 15 Sep 2016 19:16:34 +0200 +Subject: [PATCH] build: docker: Use host's network stack + +Similar to Fuel@OPNFV build process, we want to mount /etc/hosts +in the builder container to be able to use local mirror caches. + +Signed-off-by: Alexandru Avadanii +--- + pre_build_hook | 6 ++++-- + 1 file changed, 4 insertions(+), 2 deletions(-) + +diff --git a/pre_build_hook b/pre_build_hook +index 3e46a37..4866219 100755 +--- a/pre_build_hook ++++ b/pre_build_hook +@@ -28,9 +28,11 @@ function build_pkg { + cd ${DIR}/ovs_build + if [ "${USE_DOCKER}" = true ]; then + sudo docker build -t ovs_build . +- sudo docker run -e "UBUNTU_ARCH=${UBUNTU_ARCH}" -v ${DEB_DIR}:/deb \ ++ sudo docker run -e "UBUNTU_ARCH=${UBUNTU_ARCH}" \ ++ -v ${DEB_DIR}:/deb -v /etc/hosts:/etc/hosts \ + -t ovs_build /ovs_build/build-ovs-dpdk.sh +- sudo docker run -e "UBUNTU_ARCH=${UBUNTU_ARCH}" -v ${DEB_DIR_NSH}:/deb \ ++ sudo docker run -e "UBUNTU_ARCH=${UBUNTU_ARCH}" \ ++ -v ${DEB_DIR_NSH}:/deb -v /etc/hosts:/etc/hosts \ + -t ovs_build /ovs_build/build-ovs-nsh-dpdk.sh + else + rm -rf /tmp/ovs-build-{,nsh-}dpdk; mkdir -p /tmp/ovs-build-{,nsh-}dpdk diff --git a/patches/fuel-plugin-ovs/0009-install.sh-AArch64-Fix-dpkg-installation-issues.patch b/patches/fuel-plugin-ovs/0009-install.sh-AArch64-Fix-dpkg-installation-issues.patch deleted file mode 100644 index 8f7a259f..00000000 --- a/patches/fuel-plugin-ovs/0009-install.sh-AArch64-Fix-dpkg-installation-issues.patch +++ /dev/null @@ -1,82 +0,0 @@ -From: Alexandru Avadanii -Date: Wed, 14 Sep 2016 16:42:48 +0200 -Subject: [PATCH] install.sh: AArch64: Fix dpkg installation issues - -There are 2 minor issues with our Armband version string of -openvswitch packages shipped for fuel-plugin-ovs: - -1. Setting up openvswitch-datapath-dkms (2.5.90~08.08-1+amos1) - ... Error! Could not find module source directory. - -This happens because our version string has a "+" char in it, -and the /usr/src path looked for is trimmed at that char, -hence dkms installation is looking for -"/usr/src/openvswitch-2.5.90~08.08" directory instead of -"/usr/src/openvswitch-2.5.90~08.08+amos1". - -Temporary fix will be to add the following to install.sh: -ln -s openvswitch-2.5.90~08.08+amos1/ openvswitch-2.5.90~08.08 - -2. dpkg -i complains about "breaks" dependencies in debian/control -when reinstalling OVS 2.5.90. - -This happens because of faulty dpkg version comparison algorithm: -$ dpkg --compare-versions 2.5.90~08.08-1+amos1 - gt 2.5.90 && echo "This should work!" -$ - -The temporary fix will be to add --force-breaks to dpkg invocation. - -Related-bug: ARMBAND-89 - -Signed-off-by: Alexandru Avadanii ---- - deployment_scripts/install.sh | 26 ++++++++++++++++++-------- - 1 file changed, 18 insertions(+), 8 deletions(-) - -diff --git a/deployment_scripts/install.sh b/deployment_scripts/install.sh -index 46d74bb..169c64a 100644 ---- a/deployment_scripts/install.sh -+++ b/deployment_scripts/install.sh -@@ -17,10 +17,20 @@ if [ $nsh = 'true' ]; then - fi - - curl http://$host:8080/plugins/fuel-plugin-ovs-0.9/repositories/ubuntu/${ovs} | tar -xzv --dpkg -i openvswitch-datapath-dkms_*.deb --dpkg -i openvswitch-common_*.deb --dpkg -i openvswitch-switch_*.deb --dpkg -i python-openvswitch_*.deb -+ -+# FIXME(armband): https://jira.opnfv.org/browse/ARMBAND-89 -+# e.g.: ln -s openvswitch-2.5.90~08.08+amos1 openvswitch-2.5.90~08.08 -+for usr_src_ovs in /usr/src/openvswitch-*+*; do -+ echo ${usr_src_ovs} -+ if [ -d ${usr_src_ovs} ]; then -+ ln -sf ${usr_src_ovs} ${usr_src_ovs%+*} -+ fi -+done -+ -+dpkg -i --force-breaks openvswitch-datapath-dkms_*.deb -+dpkg -i --force-breaks openvswitch-common_*.deb -+dpkg -i --force-breaks openvswitch-switch_*.deb -+dpkg -i --force-breaks python-openvswitch_*.deb - if [ $dpdk = 'true' ]; then - if [ $nsh = 'true' -o -n $dpdk_socket_mem ]; then - dpkg -i libxenstore3.0*.deb -@@ -28,12 +38,12 @@ if [ $dpdk = 'true' ]; then - # FIXME(armband): arm64 DPDK ships individual libs, install them all - dpdk_deb_name=$(ls dpdk_*) - dpdk_deb_suffix=${dpdk_deb_name#dpdk_} -- dpkg -i *${dpdk_deb_suffix%_*}*.deb -+ dpkg -i --force-breaks *${dpdk_deb_suffix%_*}*.deb - else -- dpkg -i libdpdk0_*.deb -- dpkg -i dpdk_*.deb -+ dpkg -i --force-breaks libdpdk0_*.deb -+ dpkg -i --force-breaks dpdk_*.deb - fi -- dpkg -i openvswitch-switch-dpdk_*.deb -+ dpkg -i --force-breaks openvswitch-switch-dpdk_*.deb - fi - if ! [ $nsh = 'true' -a -n $dpdk_socket_mem ]; then - #Set to 0, dpdk init script mount hugepages but don't change current allocation diff --git a/patches/fuel-plugin-ovs/0010-HACK-build-prebuilt-DEBs-src-bin-ver-mismatch.patch b/patches/fuel-plugin-ovs/0010-HACK-build-prebuilt-DEBs-src-bin-ver-mismatch.patch new file mode 100644 index 00000000..818203f3 --- /dev/null +++ b/patches/fuel-plugin-ovs/0010-HACK-build-prebuilt-DEBs-src-bin-ver-mismatch.patch @@ -0,0 +1,72 @@ +From: Alexandru Avadanii +Date: Thu, 15 Sep 2016 19:41:58 +0200 +Subject: [PATCH] HACK: build: prebuilt DEBs: src/bin ver mismatch + +Our debian source version is not always in sync with the debian +binaries versions, see related bug for a complete description of +this issue. + +This is a temporary chance which should be dropped once the package +versions are aligned. + +Related-bug: ARMBAND-89 +Signed-off-by: Alexandru Avadanii +--- + ovs_build/build-ovs-armband-fetch.sh | 16 ++++++++++++---- + ovs_build/build-ovs-nsh-dpdk.sh | 2 +- + 2 files changed, 13 insertions(+), 5 deletions(-) + +diff --git a/ovs_build/build-ovs-armband-fetch.sh b/ovs_build/build-ovs-armband-fetch.sh +index a810b93..8ab22cc 100755 +--- a/ovs_build/build-ovs-armband-fetch.sh ++++ b/ovs_build/build-ovs-armband-fetch.sh +@@ -17,7 +17,7 @@ set -eux + # dists/mos9.0-fuel-plugin-ovs/main/binary-arm64/Packages + function armband_fetch() { + local name=$1 +- local ver=${2//\+/\\\+} ++ local src_ver=${2//\+/\\\+} + local repo_base_url=${3:-http://linux.enea.com/mos-repos/ubuntu/9.0} + local repo_Sources_url=${4:-dists/mos9.0-fuel-plugin-ovs/main/source/Sources} + local repo_Packages_url=${5:-dists/mos9.0-fuel-plugin-ovs/main/binary-arm64/Packages} +@@ -30,16 +30,24 @@ function armband_fetch() { + wget -c "${repo_base_url}/${repo_Packages_url}" + fi + +- L=$(grep -Pzo "(?s)(?<=^Package: ${name}\n^Binary: )(\N*?)(?=\n^Version: ${ver})" \ ++ L=$(grep -Pzo "(?s)(?<=^Package: ${name}\n^Binary: )(\N*?)(?=\n^Version: ${src_ver})" \ + Sources | tr -d ',') + for deb_binary in ${L}; do +- D=$(grep -Po "(?<=^Filename: )(.*?\/${deb_binary}_${ver}_.*?\.deb)" Packages) || true ++ # FIXME(armband): https://jira.opnfv.org/browse/ARMBAND-89 ++ # Until we align source and binaries versions for nsh, convert on the fly ++ # e.g.: debian source 2.5.90~04.05-1.nsh+amos2 => debian binary 2.5.90-1.nsh ++ deb_ver=${src_ver} ++ if [[ ${deb_ver} == *~*-* ]]; then ++ deb_ver=${deb_ver//~*-/-} ++ deb_ver=${deb_ver%\\\+*} ++ fi ++ D=$(grep -Po "(?<=^Filename: )(.*?\/${deb_binary}_${deb_ver}_.*?\.deb)" Packages) || true + if [ -n "${D}" ]; then + wget -c "${repo_base_url}/${D}" && found=true + fi + done + if [ ${found} = false ]; then +- echo "ERROR: Could not find DEBs for pkg/ver: ${name}/${ver}" ++ echo "ERROR: Could not find DEBs for pkg|src_ver|deb_ver: ${name}|${src_ver}|${deb_ver}" + exit 1 + fi + } +diff --git a/ovs_build/build-ovs-nsh-dpdk.sh b/ovs_build/build-ovs-nsh-dpdk.sh +index 9d8a837..aebcb94 100755 +--- a/ovs_build/build-ovs-nsh-dpdk.sh ++++ b/ovs_build/build-ovs-nsh-dpdk.sh +@@ -12,7 +12,7 @@ DIR="$(dirname `readlink -f $0`)" + export DEB_BUILD_OPTIONS='parallel=8 nocheck' + + # AArch64 specifics, repository base URL, debian build versions +-AARCH64_OVS_NSH_DEBV=${AARCH64_OVS_NSH_DEBV:-'2.5.90-1.nsh'} ++AARCH64_OVS_NSH_DEBV=${AARCH64_OVS_NSH_DEBV:-'2.5.90~04.05-1.nsh+amos2'} + + # Keep track of native arch (BUILD_ARCH) and target arch(s) (UBUNTU_ARCH) + # All archs should be represented in `dpkg --print-architecture` format -- cgit 1.2.3-korg