From f2d55279415a5ddcc1616487ef1da78db0fadafb Mon Sep 17 00:00:00 2001 From: Adriano Oliveira Date: Fri, 26 Aug 2022 00:46:06 +0000 Subject: [PATCH] Create Debian python3-nsenter package The nsenter package is used in the scope of the k8s coredump handler. This package is required so the handler is able to specify separate namespaces for the applications when they generate a coredump. Story: 2010261 Task: 46159 Depends-On: https://review.opendev.org/c/starlingx/tools/+/854684 Test Plan: PASS: Verify STX Debian builds properly PASS: Verify STX Debian deploys properly PASS: Verify python3-nsenter package was properly installed PASS: Verify k8s-coredump runs properly Signed-off-by: Adriano Oliveira Change-Id: Idf0ebb90e1c91ae4f83fb7c6a85039e57e4f80bb --- debian_pkg_dirs | 1 + .../debian/deb_folder/changelog | 5 +++ .../python3-nsenter/debian/deb_folder/control | 16 +++++++ .../debian/deb_folder/copyright | 42 +++++++++++++++++++ .../python3-nsenter/debian/deb_folder/rules | 10 +++++ python/python3-nsenter/debian/meta_data.yaml | 11 +++++ .../patches/0001-Empty-requirements.txt.patch | 23 ++++++++++ .../0002-Remove-nsenter-entry-point.patch | 33 +++++++++++++++ python/python3-nsenter/debian/patches/series | 2 + 9 files changed, 143 insertions(+) create mode 100644 python/python3-nsenter/debian/deb_folder/changelog create mode 100644 python/python3-nsenter/debian/deb_folder/control create mode 100644 python/python3-nsenter/debian/deb_folder/copyright create mode 100755 python/python3-nsenter/debian/deb_folder/rules create mode 100644 python/python3-nsenter/debian/meta_data.yaml create mode 100644 python/python3-nsenter/debian/patches/0001-Empty-requirements.txt.patch create mode 100644 python/python3-nsenter/debian/patches/0002-Remove-nsenter-entry-point.patch create mode 100644 python/python3-nsenter/debian/patches/series diff --git a/debian_pkg_dirs b/debian_pkg_dirs index afd6b6352..da2c44eb1 100644 --- a/debian_pkg_dirs +++ b/debian_pkg_dirs @@ -77,6 +77,7 @@ ostree/ostree ostree/ostree-upgrade-mgr python/dh-python python/python-nss +python/python3-nsenter python/python3-setuptools security/keyrings.alt security/python-keyring diff --git a/python/python3-nsenter/debian/deb_folder/changelog b/python/python3-nsenter/debian/deb_folder/changelog new file mode 100644 index 000000000..df536bbe5 --- /dev/null +++ b/python/python3-nsenter/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +nsenter (0.2) unstable; urgency=medium + + * Initial release. + + -- Adriano Oliveira Wed, 24 Aug 2023 10:14:40 -0300 diff --git a/python/python3-nsenter/debian/deb_folder/control b/python/python3-nsenter/debian/deb_folder/control new file mode 100644 index 000000000..9019f5cef --- /dev/null +++ b/python/python3-nsenter/debian/deb_folder/control @@ -0,0 +1,16 @@ +Source: nsenter +Section: admin +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 12), + dh-python, + flake8, + python3-setuptools, + python3-all +Standards-Version: 4.4.1 + +Package: python3-nsenter +Architecture: all +Depends: ${python3:Depends}, ${misc:Depends} +Description: Enables entering the Linux kernel namespaces + A python client library for Linux kernel namespaces diff --git a/python/python3-nsenter/debian/deb_folder/copyright b/python/python3-nsenter/debian/deb_folder/copyright new file mode 100644 index 000000000..bb68bfec4 --- /dev/null +++ b/python/python3-nsenter/debian/deb_folder/copyright @@ -0,0 +1,42 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: python-fmclient +Source: https://opendev.org/starlingx/fault + +Files: * +Copyright: (c) 2022 Wind River Systems, Inc +Copyright: Others (See individual files for more details) +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. + +# If you want to use GPL v2 or later for the /debian/* files use +# the following clauses, or change it to suit. Delete these two lines +Files: debian/* +Copyright: 2022 Wind River Systems, Inc +License: Apache-2 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian-based systems the full text of the Apache version 2.0 license + can be found in `/usr/share/common-licenses/Apache-2.0'. diff --git a/python/python3-nsenter/debian/deb_folder/rules b/python/python3-nsenter/debian/deb_folder/rules new file mode 100755 index 000000000..80fda3f73 --- /dev/null +++ b/python/python3-nsenter/debian/deb_folder/rules @@ -0,0 +1,10 @@ +#!/usr/bin/make -f +#export DH_VERBOSE = 1 + +export PYBUILD_NAME=python3-nsenter + +%: + dh $@ --with python3 --buildsystem=pybuild + +override_dh_auto_test: + # nothing done diff --git a/python/python3-nsenter/debian/meta_data.yaml b/python/python3-nsenter/debian/meta_data.yaml new file mode 100644 index 000000000..d94f98c36 --- /dev/null +++ b/python/python3-nsenter/debian/meta_data.yaml @@ -0,0 +1,11 @@ +--- +debname: nsenter +debver: 0.2 +dl_path: + name: nsenter-0.2.tar.gz + url: https://files.pythonhosted.org/packages/a5/46/1bfe9cca7f2e12cb2d7d9082b14feb785bc63628fb795a34d53ef57a8b93/nsenter-0.2.tar.gz + md5sum: a9e19cde39c93d91716f0be7dd0e14c5 + sha256sum: 876a18cb03de85948e4cd72fd4cfda4879561b7264f5722603f6437d452a25cb +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/python/python3-nsenter/debian/patches/0001-Empty-requirements.txt.patch b/python/python3-nsenter/debian/patches/0001-Empty-requirements.txt.patch new file mode 100644 index 000000000..f43c0c14e --- /dev/null +++ b/python/python3-nsenter/debian/patches/0001-Empty-requirements.txt.patch @@ -0,0 +1,23 @@ +From 6ea9709c2477a41ff310255c5da42c4766b3fc22 Mon Sep 17 00:00:00 2001 +From: Adriano Oliveira +Date: Tue, 13 Sep 2022 07:42:52 -0700 +Subject: [PATCH] Empty requirements.txt + +In python 3 pathlib, contextlib and argparse are included + +Signed-off-by: Adriano Oliveira +--- + requirements.txt | 3 --- + 1 file changed, 3 deletions(-) + +diff --git a/requirements.txt b/requirements.txt +index 60e8060..e69de29 100644 +--- a/requirements.txt ++++ b/requirements.txt +@@ -1,3 +0,0 @@ +-pathlib +-contextlib2 +-argparse +-- +2.17.1 + diff --git a/python/python3-nsenter/debian/patches/0002-Remove-nsenter-entry-point.patch b/python/python3-nsenter/debian/patches/0002-Remove-nsenter-entry-point.patch new file mode 100644 index 000000000..e6e8156e4 --- /dev/null +++ b/python/python3-nsenter/debian/patches/0002-Remove-nsenter-entry-point.patch @@ -0,0 +1,33 @@ +From 17cd3519838741e2bcb5285a8f6f1acbc8c78048 Mon Sep 17 00:00:00 2001 +From: Adriano Oliveira +Date: Thu, 15 Sep 2022 13:59:58 -0700 +Subject: [PATCH] Remove nsenter entry point + +The original nsenter entry point conflicts with /usr/bin/nsenter +binary. + +Signed-off-by: Adriano Oliveira +--- + setup.py | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/setup.py b/setup.py +index 69ca693..b88117e 100644 +--- a/setup.py ++++ b/setup.py +@@ -39,10 +39,10 @@ def setup_package(): + 'Operating System :: POSIX :: Linux', + 'License :: OSI Approved :: Apache Software License'], + test_suite='tests', +- setup_requires=['flake8'], + install_requires=get_install_requirements('requirements.txt'), + packages=setuptools.find_packages(exclude=['tests', 'tests.*']), +- entry_points={'console_scripts': ['nsenter = nsenter:main']} ++ entry_points={ ++ } + ) + + if __name__ == '__main__': +-- +2.17.1 + diff --git a/python/python3-nsenter/debian/patches/series b/python/python3-nsenter/debian/patches/series new file mode 100644 index 000000000..62c7d7895 --- /dev/null +++ b/python/python3-nsenter/debian/patches/series @@ -0,0 +1,2 @@ +0001-Empty-requirements.txt.patch +0002-Remove-nsenter-entry-point.patch