summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/pkg/CMakeLists.txt24
-rw-r--r--src/pkg/debian/control.in (renamed from src/pkg/debian/control)4
-rwxr-xr-xsrc/pkg/debian/rules.in13
-rw-r--r--src/vpp-api/python/CMakeLists.txt6
4 files changed, 37 insertions, 10 deletions
diff --git a/src/pkg/CMakeLists.txt b/src/pkg/CMakeLists.txt
index 357d966ddee..a5a0ffe5827 100644
--- a/src/pkg/CMakeLists.txt
+++ b/src/pkg/CMakeLists.txt
@@ -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
diff --git a/src/pkg/debian/control b/src/pkg/debian/control.in
index 48de48ab115..0b0c621e50c 100644
--- a/src/pkg/debian/control
+++ b/src/pkg/debian/control.in
@@ -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
diff --git a/src/pkg/debian/rules.in b/src/pkg/debian/rules.in
index ceef46a297a..f09db38e2a1 100755
--- a/src/pkg/debian/rules.in
+++ b/src/pkg/debian/rules.in
@@ -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
diff --git a/src/vpp-api/python/CMakeLists.txt b/src/vpp-api/python/CMakeLists.txt
index 910df6bfd6b..6450fd92f2d 100644
--- a/src/vpp-api/python/CMakeLists.txt
+++ b/src/vpp-api/python/CMakeLists.txt
@@ -11,7 +11,11 @@
# 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(