misc: fix ubuntu 20.04 python deps 10/27010/4
authorDamjan Marion <damarion@cisco.com>
Tue, 12 May 2020 10:22:18 +0000 (12:22 +0200)
committerFlorin Coras <florin.coras@gmail.com>
Fri, 15 May 2020 23:42:40 +0000 (23:42 +0000)
Type: fix
Change-Id: I9cdfbffd6333d090f970422bf047aaa90c1e4c65
Signed-off-by: Damjan Marion <damarion@cisco.com>
Makefile
src/pkg/CMakeLists.txt
src/pkg/debian/control.in [moved from src/pkg/debian/control with 97% similarity]
src/pkg/debian/rules.in
src/vpp-api/python/CMakeLists.txt

index 3514071..709fb73 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -65,8 +65,7 @@ DEB_DEPENDS  = curl build-essential autoconf automake ccache
 DEB_DEPENDS += debhelper dkms git libtool libapr1-dev dh-systemd
 DEB_DEPENDS += libconfuse-dev git-review exuberant-ctags cscope pkg-config
 DEB_DEPENDS += lcov chrpath autoconf indent clang-format libnuma-dev
-DEB_DEPENDS += python-all python3-all python3-setuptools
-DEB_DEPENDS += python-virtualenv python-pip check
+DEB_DEPENDS += python3-all python3-setuptools check
 DEB_DEPENDS += libboost-all-dev libffi-dev python3-ply libmbedtls-dev
 DEB_DEPENDS += cmake ninja-build uuid-dev python3-jsonschema python3-yaml
 DEB_DEPENDS += python3-venv  # ensurepip
@@ -75,20 +74,21 @@ DEB_DEPENDS += python3-dev   # needed for python3 -m pip install psutil
 
 LIBFFI=libffi6 # works on all but 20.04
 
-ifeq ($(OS_VERSION_ID),16.04)
-       DEB_DEPENDS += python-dev
-       DEB_DEPENDS += libssl-dev
-else ifeq ($(OS_VERSION_ID),18.04)
-       DEB_DEPENDS += python-dev
+ifeq ($(OS_VERSION_ID),18.04)
+       DEB_DEPENDS += python-dev python-all python-pip python-virtualenv
        DEB_DEPENDS += libssl-dev
        DEB_DEPENDS += clang-9
 else ifeq ($(OS_VERSION_ID),20.04)
+       DEB_DEPENDS += python3-virtualenv
        LIBFFI=libffi7
 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-8)
        DEB_DEPENDS += libssl-dev
+       DEB_DEPENDS += python-dev python-all python-pip python-virtualenv
        APT_ARGS = -t jessie-backports
 else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-9)
        DEB_DEPENDS += libssl1.0-dev
+       DEB_DEPENDS += python-all python-pip
+       DEB_DEPENDS += python-dev python-all python-pip python-virtualenv
 else
        DEB_DEPENDS += libssl-dev
 endif
index 357d966..a5a0ffe 100644 (file)
@@ -20,14 +20,34 @@ execute_process(
   OUTPUT_STRIP_TRAILING_WHITESPACE
 )
 
-foreach(f rules changelog)
+# parse /etc/os-release
+file(READ "/etc/os-release" os_release)
+string(REPLACE "\n" ";" os_release ${os_release})
+foreach(l ${os_release})
+  string(REPLACE "=" ";" l ${l})
+  list(GET l 0 _name)
+  list(GET l 1 _value)
+  string(REPLACE "\"" "" _value ${_value})
+  set(OS_${_name} ${_value})
+endforeach()
+
+if (OS_ID STREQUAL "ubuntu" AND OS_VERSION_ID VERSION_LESS 20.04)
+  set(VPP_DEB_BUILD_DEPENDS "python-all, python3-all, python3-setuptools")
+  set(VPP_DEB_WITH_PYTHON2 "yes")
+else()
+  set(VPP_DEB_BUILD_DEPENDS "python3-all, python3-setuptools")
+  set(VPP_DEB_WITH_PYTHON2 "no")
+endif()
+
+foreach(f rules changelog control)
   configure_file(
     ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}.in
     ${CMAKE_BINARY_DIR}/debian/${f}
+    @ONLY
   )
 endforeach()
 
-foreach(f control copyright vpp.preinst vpp.postrm vpp.postinst vpp.service)
+foreach(f copyright vpp.preinst vpp.postrm vpp.postinst vpp.service)
   file(COPY
     ${CMAKE_CURRENT_SOURCE_DIR}/debian/${f}
     DESTINATION ${CMAKE_BINARY_DIR}/debian
similarity index 97%
rename from src/pkg/debian/control
rename to src/pkg/debian/control.in
index 48de48a..0b0c621 100644 (file)
@@ -5,9 +5,7 @@ Maintainer: fd.io VPP Packaging Team <vpp-dev@fd.io>
 Build-Depends: debhelper (>= 9),
                dh-systemd,
               dh-python,
-              python-all,
-              python3-all,
-              python3-setuptools
+              @VPP_DEB_BUILD_DEPENDS@
 Standards-Version: 3.9.4
 
 Package: vpp
index ceef46a..f09db38 100755 (executable)
@@ -9,18 +9,23 @@ include /usr/share/dpkg/default.mk
 
 export PYBUILD_NAME = vpp-api
 export PYBUILD_DIR = @CMAKE_SOURCE_DIR@/vpp-api/python
-export PYBUILD_DESTDIR_python2=debian/vpp-api-python/
-export PYBUILD_DISABLE_python2=test
 export PYBUILD_DESTDIR_python3=debian/python3-vpp-api/
 export PYBUILD_DISABLE_python3=test
 export PYBUILD_SYSTEM=distutils
-
+ifeq (@VPP_DEB_WITH_PYTHON2@,yes)
+export PYBUILD_DESTDIR_python2=debian/vpp-api-python/
+export PYBUILD_DISABLE_python2=test
 buildvers := $(shell pyversions -sv)
+DH_WITH = systemd,python2,python3
+else
+DH_WITH = systemd,python3
+endif
+
 build3vers := $(shell py3versions -sv)
 
 # main packaging script based on dh7 syntax
 %:
-       dh $@ --with systemd,python2,python3 --buildsystem=pybuild
+       dh $@ --with $(DH_WITH) --buildsystem=pybuild
 
 override_dh_strip:
        dh_strip --dbg-package=vpp-dbg
index 910df6b..6450fd9 100644 (file)
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-find_package(Python3 COMPONENTS Interpreter)
+if (CMAKE_VERSION VERSION_LESS 3.12)
+  find_package(PythonInterp 2.7)
+else()
+  find_package(Python3 COMPONENTS Interpreter)
+endif()
 
 if(PYTHONINTERP_FOUND)
   install(