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 ce02b2f..b6dfc6b 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, +)