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 <mdr@ashroe.eu>
This commit is contained in:
Ray Kinsella
2022-07-01 17:15:26 +01:00
parent 1affc2b59c
commit 3122022383
9 changed files with 70 additions and 22 deletions

View File

@ -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)

View File

@ -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

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
vppcfg (0.0.1) unstable; urgency=low
* Initial public release
-- Ray Kinsella <mdr@ashroe.eu> Thu, 30 Jun 2022 14:00:00 +0000

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
9

12
debian/control vendored Normal file
View File

@ -0,0 +1,12 @@
Source: vppcfg
Section: python
Priority: extra
Maintainer: Ray Kinsella <mdr@ashroe.eu>
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

6
debian/rules vendored Normal file
View File

@ -0,0 +1,6 @@
#!/usr/bin/make -f
%:
dh $@ --with python3 --buildsystem=pybuild --with systemd
override_dh_auto_test:

13
debian/vppcfg.service vendored Normal file
View File

@ -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

View File

@ -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

21
setup.py Normal file
View File

@ -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,
)