From c499d4a8b33e564af06692f95bf444e17977d9dd Mon Sep 17 00:00:00 2001 From: Tracey Bogue Date: Wed, 27 Oct 2021 13:57:50 -0500 Subject: [PATCH] Add Debian packaging for platform-armada app Create Debian packages for python-k8sapp-platform and stx-platform-helm packages. Story: 2009101 Task: 43792 Signed-off-by: Tracey Bogue Change-Id: Ide6966a733599a5654081e1525f961f35a7922d4 --- debian_pkg_dirs | 2 + .../debian/deb_folder/changelog | 5 ++ .../debian/deb_folder/control | 28 ++++++++ .../debian/deb_folder/copyright | 41 ++++++++++++ .../python3-k8sapp-platform-wheels.install | 1 + .../python3-k8sapp-platform.install | 2 + .../debian/deb_folder/rules | 26 ++++++++ .../debian/deb_folder/source/format | 1 + python-k8sapp-platform/debian/meta_data.yaml | 7 ++ stx-platform-helm/debian/deb_folder/changelog | 5 ++ stx-platform-helm/debian/deb_folder/control | 21 ++++++ stx-platform-helm/debian/deb_folder/copyright | 41 ++++++++++++ stx-platform-helm/debian/deb_folder/rules | 66 +++++++++++++++++++ .../debian/deb_folder/source/format | 1 + .../deb_folder/stx-platform-helm.install | 2 + stx-platform-helm/debian/dl_hook | 22 +++++++ stx-platform-helm/debian/meta_data.yaml | 7 ++ 17 files changed, 278 insertions(+) create mode 100644 debian_pkg_dirs create mode 100644 python-k8sapp-platform/debian/deb_folder/changelog create mode 100644 python-k8sapp-platform/debian/deb_folder/control create mode 100644 python-k8sapp-platform/debian/deb_folder/copyright create mode 100644 python-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform-wheels.install create mode 100644 python-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform.install create mode 100755 python-k8sapp-platform/debian/deb_folder/rules create mode 100644 python-k8sapp-platform/debian/deb_folder/source/format create mode 100644 python-k8sapp-platform/debian/meta_data.yaml create mode 100644 stx-platform-helm/debian/deb_folder/changelog create mode 100644 stx-platform-helm/debian/deb_folder/control create mode 100644 stx-platform-helm/debian/deb_folder/copyright create mode 100755 stx-platform-helm/debian/deb_folder/rules create mode 100644 stx-platform-helm/debian/deb_folder/source/format create mode 100644 stx-platform-helm/debian/deb_folder/stx-platform-helm.install create mode 100755 stx-platform-helm/debian/dl_hook create mode 100644 stx-platform-helm/debian/meta_data.yaml diff --git a/debian_pkg_dirs b/debian_pkg_dirs new file mode 100644 index 0000000..f9e6835 --- /dev/null +++ b/debian_pkg_dirs @@ -0,0 +1,2 @@ +python-k8sapp-platform +stx-platform-helm diff --git a/python-k8sapp-platform/debian/deb_folder/changelog b/python-k8sapp-platform/debian/deb_folder/changelog new file mode 100644 index 0000000..d0b2492 --- /dev/null +++ b/python-k8sapp-platform/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +python3-k8sapp-platform (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Tracey Bogue Wed, 27 Oct 2021 11:25:42 +0000 diff --git a/python-k8sapp-platform/debian/deb_folder/control b/python-k8sapp-platform/debian/deb_folder/control new file mode 100644 index 0000000..4a2f8a2 --- /dev/null +++ b/python-k8sapp-platform/debian/deb_folder/control @@ -0,0 +1,28 @@ +Source: python3-k8sapp-platform +Section: libs +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13), + dh-python, + python3-all, + python3-pbr, + python3-setuptools, + python3-wheel +Standards-Version: 4.5.1 +Homepage: https://www.starlingx.io + +Package: python3-k8sapp-platform +Section: libs +Architecture: any +Depends: ${misc:Depends}, ${python3:Depends} +Description: StarlingX Sysinv Platform Extensions + This package contains sysinv plugins for the platform armada + K8S app. + +Package: python3-k8sapp-platform-wheels +Section: libs +Architecture: any +Depends: ${misc:Depends}, ${python3:Depends}, python3-wheel +Description: StarlingX Sysinv Platform Extension Wheels + This package contains python wheels for the platform armada + K8S app plugins. diff --git a/python-k8sapp-platform/debian/deb_folder/copyright b/python-k8sapp-platform/debian/deb_folder/copyright new file mode 100644 index 0000000..5a0c276 --- /dev/null +++ b/python-k8sapp-platform/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: python3-k8sapp-platform +Source: https://opendev.org/starlingx/platform-armada-app/ + +Files: * +Copyright: (c) 2013-2021 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'. + +# 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: 2021 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-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform-wheels.install b/python-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform-wheels.install new file mode 100644 index 0000000..a3ad79d --- /dev/null +++ b/python-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform-wheels.install @@ -0,0 +1 @@ +plugins/platform-integ-apps/*.whl diff --git a/python-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform.install b/python-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform.install new file mode 100644 index 0000000..d45375a --- /dev/null +++ b/python-k8sapp-platform/debian/deb_folder/python3-k8sapp-platform.install @@ -0,0 +1,2 @@ +usr/lib/python3/dist-packages/k8sapp_platform-1.0.0.egg-info/* +usr/lib/python3/dist-packages/k8sapp_platform/* diff --git a/python-k8sapp-platform/debian/deb_folder/rules b/python-k8sapp-platform/debian/deb_folder/rules new file mode 100755 index 0000000..cbc061a --- /dev/null +++ b/python-k8sapp-platform/debian/deb_folder/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f +# export DH_VERBOSE = 1 + +export APP_NAME=platform-integ-apps +export PBR_VERSION=1.0.0 +export PYBUILD_NAME=k8sapp-platform +export SKIP_PIP_INSTALL=1 +export ROOT=debian/tmp + +%: + dh $@ --with=python3 --buildsystem=pybuild + +override_dh_auto_install: + python3 setup.py install --install-layout=deb --root $(ROOT) + python3 setup.py bdist_wheel \ + --universal \ + -d $(ROOT)/plugins/$(APP_NAME) + +override_dh_python3: + dh_python3 --shebang=/usr/bin/python3 + +ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) +override_dh_auto_test: + # (tbogue) FIXME + PYTHONDIR=$(CURDIR) stestr run || true +endif diff --git a/python-k8sapp-platform/debian/deb_folder/source/format b/python-k8sapp-platform/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/python-k8sapp-platform/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/python-k8sapp-platform/debian/meta_data.yaml b/python-k8sapp-platform/debian/meta_data.yaml new file mode 100644 index 0000000..50a5728 --- /dev/null +++ b/python-k8sapp-platform/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: python3-k8sapp-platform +debver: 1.0-1 +src_path: k8sapp_platform +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true diff --git a/stx-platform-helm/debian/deb_folder/changelog b/stx-platform-helm/debian/deb_folder/changelog new file mode 100644 index 0000000..648b079 --- /dev/null +++ b/stx-platform-helm/debian/deb_folder/changelog @@ -0,0 +1,5 @@ +stx-platform-helm (1.0-1) unstable; urgency=medium + + * Initial release. + + -- Tracey Bogue Wed, 27 Oct 2021 12:29:42 +0000 diff --git a/stx-platform-helm/debian/deb_folder/control b/stx-platform-helm/debian/deb_folder/control new file mode 100644 index 0000000..9371c1f --- /dev/null +++ b/stx-platform-helm/debian/deb_folder/control @@ -0,0 +1,21 @@ +Source: stx-platform-helm +Section: libs +Priority: optional +Maintainer: StarlingX Developers +Build-Depends: debhelper-compat (= 13), + chartmuseum, + helm, + openstack-helm-infra, + procps, + python3-k8sapp-platform, + python3-k8sapp-platform-wheels +Standards-Version: 4.5.1 +Homepage: https://www.starlingx.io + +Package: stx-platform-helm +Section: libs +Architecture: any +Depends: ${misc:Depends} +Description: StarlingX Platform Armada Helm Charts + This package contains Armada helm charts for the platform armada + application. diff --git a/stx-platform-helm/debian/deb_folder/copyright b/stx-platform-helm/debian/deb_folder/copyright new file mode 100644 index 0000000..462153b --- /dev/null +++ b/stx-platform-helm/debian/deb_folder/copyright @@ -0,0 +1,41 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: stx-platform-helm +Source: https://opendev.org/starlingx/platform-armada-app/ + +Files: * +Copyright: (c) 2013-2021 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'. + +# 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: 2021 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/stx-platform-helm/debian/deb_folder/rules b/stx-platform-helm/debian/deb_folder/rules new file mode 100755 index 0000000..5edaca1 --- /dev/null +++ b/stx-platform-helm/debian/deb_folder/rules @@ -0,0 +1,66 @@ +#!/usr/bin/make -f +# export DH_VERBOSE = 1 + +export ROOT = debian/tmp +export APP_FOLDER = $(ROOT)/usr/local/share/applications/helm +export EXTRA_CHARTS = $(ROOT)/opt/extracharts + +export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ') +export MAJOR = $(shell echo $(DEB_VERSION) | cut -f 1 -d '.') +export MINOR_PATCH = $(shell echo $(DEB_VERSION) | cut -f 2 -d '.') + +export APP_NAME = platform-integ-apps +export APP_VERSION = $(MAJOR).$(MINOR_PATCH) +export APP_TARBALL = $(APP_NAME)-$(APP_VERSION).tgz +export HELM_FOLDER = /usr/lib/helm +export HELM_REPO = stx-platform +export STAGING = staging +export TOOLKIT_VERSION = 0.2.19 + +%: + dh $@ + +override_dh_auto_build: + # Stage helm-toolkit in the local repo. + cp $(HELM_FOLDER)/helm-toolkit-$(TOOLKIT_VERSION).tgz helm-charts/ + # Host a server for the helm charts. + chartmuseum --debug --port=8879 --context-path='/charts' --storage="local" \ + --storage-local-rootdir="./helm-charts" & + sleep 2 + helm repo add local http://localhost:8879/charts + # Create the TGZ file. + cd helm-charts && make rbd-provisioner + cd helm-charts && make ceph-pools-audit + cd helm-charts && make cephfs-provisioner + cd helm-charts && make node-feature-discovery + # Terminate the helm chart server. + pkill chartmuseum + # Setup the staging directory. + mkdir -p $(STAGING) + cp files/metadata.yaml $(STAGING) + cp manifests/manifest.yaml $(STAGING) + mkdir -p $(STAGING)/charts + cp helm-charts/*.tgz $(STAGING)/charts + # Populate metadata. + sed -i 's/@APP_NAME@/$(APP_NAME)/g' $(STAGING)/metadata.yaml + sed -i 's/@APP_VERSION@/$(APP_VERSION)/g' $(STAGING)/metadata.yaml + sed -i 's/@HELM_REPO@/$(HELM_REPO)/g' $(STAGING)/metadata.yaml + # Copy the plugins: installed in the buildroot + mkdir -p $(STAGING)/plugins + cp /plugins/$(APP_NAME)/*.whl $(STAGING)/plugins + # Create the app package. + cd $(STAGING) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5 + tar cfz $(APP_TARBALL) -C $(STAGING)/ . + # Cleanup staging + rm -rf $(STAGING) + +override_dh_auto_install: + # Install the app tar file. + install -d -m 755 $(APP_FOLDER) + install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER) + install -d -m 755 $(EXTRA_CHARTS) + install -p -D -m 755 helm-charts/node-feature-discovery-*.tgz $(EXTRA_CHARTS) + +override_dh_auto_test: + +override_dh_usrlocal: diff --git a/stx-platform-helm/debian/deb_folder/source/format b/stx-platform-helm/debian/deb_folder/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/stx-platform-helm/debian/deb_folder/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/stx-platform-helm/debian/deb_folder/stx-platform-helm.install b/stx-platform-helm/debian/deb_folder/stx-platform-helm.install new file mode 100644 index 0000000..d0be6f3 --- /dev/null +++ b/stx-platform-helm/debian/deb_folder/stx-platform-helm.install @@ -0,0 +1,2 @@ +opt/extracharts/* +usr/local/share/applications/helm/* diff --git a/stx-platform-helm/debian/dl_hook b/stx-platform-helm/debian/dl_hook new file mode 100755 index 0000000..a4bc13d --- /dev/null +++ b/stx-platform-helm/debian/dl_hook @@ -0,0 +1,22 @@ +#!/bin/bash +set -x + +PKG_BUILD_NAME=$1 +PKG_BUILD_ROOT=$(realpath `pwd`/${PKG_BUILD_NAME}) +PKG_DIR="stx-platform-helm" + +STX_BASE=$(realpath ${MY_REPO}/stx) +SRC=$(realpath ${STX_BASE}/platform-armada-app/${PKG_DIR}/${PKG_DIR}) + +CHART_PKG="node-feature-discovery" +NFD_HELM_CHARTS=$(realpath ${STX_BASE}/helm-charts/${CHART_PKG}/${CHART_PKG}/helm-charts) + +mkdir -p ${PKG_BUILD_ROOT} + +# Copy node-feature-discovery helm charts to the build directory. +cp -pr ${NFD_HELM_CHARTS} ${PKG_BUILD_ROOT} + +# Copy source files to the build directory. +cp -pr ${SRC}/files ${PKG_BUILD_ROOT} +cp -pr ${SRC}/helm-charts/* ${PKG_BUILD_ROOT}/helm-charts +cp -pr ${SRC}/manifests ${PKG_BUILD_ROOT} diff --git a/stx-platform-helm/debian/meta_data.yaml b/stx-platform-helm/debian/meta_data.yaml new file mode 100644 index 0000000..fc91723 --- /dev/null +++ b/stx-platform-helm/debian/meta_data.yaml @@ -0,0 +1,7 @@ +--- +debname: stx-platform-helm +debver: 1.0-1 +dl_hook: dl_hook +revision: + dist: $STX_DIST + PKG_GITREVCOUNT: true