From 3122022383117e272d4c65c1d3f5ccd47b0f21f2 Mon Sep 17 00:00:00 2001 From: Ray Kinsella Date: Fri, 1 Jul 2022 17:15:26 +0100 Subject: [PATCH] build: initial pybuild based deb packaging Initial version of deb pkg, based on pybuild. Reverted to classic setup.py, because debian tooling does not yet understand the newer pyproject.toml. Yamale is absent from the list of package dependencies as there is as yet no upstream debian packaging for it, will need to work around with documentation and install with pip for the moment. Autotest of the debian packaging is also disabled for the moment. Systemd service is automatically installed and bould to the vpp service, but does not become active until the user creates the configuration /etc/vpp/config.yaml Signed-off-by: Ray Kinsella --- Makefile | 12 +++++++++--- README.md | 5 +++-- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 12 ++++++++++++ debian/rules | 6 ++++++ debian/vppcfg.service | 13 +++++++++++++ pyproject.toml | 17 ----------------- setup.py | 21 +++++++++++++++++++++ 9 files changed, 70 insertions(+), 22 deletions(-) create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/rules create mode 100644 debian/vppcfg.service delete mode 100644 pyproject.toml create mode 100644 setup.py diff --git a/Makefile b/Makefile index abffe8a..d8d31ce 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,12 @@ VPPCFG:=vppcfg PYTHON?=python3 PIP?=pip PIP_DEPENDS=build yamale netaddr pylint -PIP_DEPENDS+=argparse pyyaml ipaddress pyinstaller black +PIP_DEPENDS+=argparse pyyaml ipaddress black +WIPE=dist $(VPPCFG).egg-info .pybuild debian/vppcfg debian/vppcfg.*.log +WIPE+=debian/vppcfg.*.debhelper debian/.debhelper debian/files +WIPE+=debian/vppcfg.substvars WHL_INSTALL=dist/$(VPPCFG)-$(VERSION)-py3-none-any.whl - .PHONY: build build: $(PYTHON) -m build @@ -19,10 +21,14 @@ install-deps: install: sudo $(PIP) install $(WHL_INSTALL) +.PHONY: pkg-deb +pkg-deb: + dpkg-buildpackage -uc -us -b + .PHONY: uninstall uninstall: sudo $(PIP) uninstall $(VPPCFG) .PHONY: wipe wipe: - $(RM) -rf dist $(VPPCFG).egg-info + $(RM) -rf $(WIPE) diff --git a/README.md b/README.md index 4f3df68..1e98286 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,9 @@ $ make build ## Install the tool with PIP $ make install -### - +## To build & install debian packaging +$ make pkg-deb +$ sudo deb -i ../vppcfg_0.0.1_amd64.deb ``` ## Running diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..0d51377 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +vppcfg (0.0.1) unstable; urgency=low + + * Initial public release + + -- Ray Kinsella Thu, 30 Jun 2022 14:00:00 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..f11c82a --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..473b85e --- /dev/null +++ b/debian/control @@ -0,0 +1,12 @@ +Source: vppcfg +Section: python +Priority: extra +Maintainer: Ray Kinsella +Build-Depends: debhelper (>= 9), python3-all, dh-python +Standards-Version: 3.9.5 + +Package: vppcfg +Architecture: any +Pre-Depends: dpkg (>= 1.16.1), python3.8, ${misc:Pre-Depends} +Depends: python3-netaddr, python3-ipaddr, ${misc:Depends} +Description: A configuration tool for FD.io VPP \ No newline at end of file diff --git a/debian/rules b/debian/rules new file mode 100644 index 0000000..22d2abd --- /dev/null +++ b/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +%: + dh $@ --with python3 --buildsystem=pybuild --with systemd + +override_dh_auto_test: diff --git a/debian/vppcfg.service b/debian/vppcfg.service new file mode 100644 index 0000000..01b55f4 --- /dev/null +++ b/debian/vppcfg.service @@ -0,0 +1,13 @@ +[Unit] +Description=vppcfg +BindsTo=vpp.service +After=vpp.service +ConditionPathExists=/etc/vpp/config.yaml + +[Service] +Type=oneshot +ExecStart=vppcfg apply -c /etc/vpp/config.yaml +RemainAfterExit=yes + +[Install] +WantedBy=multi-user.target diff --git a/pyproject.toml b/pyproject.toml deleted file mode 100644 index 829bc4e..0000000 --- a/pyproject.toml +++ /dev/null @@ -1,17 +0,0 @@ -[build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - -[project] -name = "vppcfg" -version = "0.0.1" -dependencies = [ - 'requests', - 'importlib-metadata; python_version<"3.8"', -] - -[project.scripts] -vppcfg = "vppcfg:vppcfg.main" - -[options] -include_package_data = true \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..20a8a36 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +from setuptools import setup, find_packages + +setup( + name="vppcfg", + version="0.0.1", + install_requires=[ + "requests", + 'importlib-metadata; python_version == "3.8"', + "yamale", + "netaddr", + "ipaddress", + "vpp_papi", + ], + packages=["vppcfg", "vppcfg/config", "vppcfg/vpp"], + entry_points={ + "console_scripts": [ + "vppcfg = vppcfg.vppcfg:main", + ] + }, + include_package_data=True, +)