Files
snmp-armada-app/stx-snmp-helm/debian/deb_folder/rules
Igor Soares 6917a3f5b2 Application versioning based on build release
This change will automatically adjust versioning of the application
tarball and python plugins to reflect the same version reported by
SW_VERION in /etc/build.info.

Test plan:
PASS: build-pkgs -a & build-image
PASS: Confirm that the tarball version matches the platform version
PASS: Apply application

Story: 2010929
Task: 49351

Change-Id: I62934c3392b36101f99da6ca6be5e6d036b315bb
Signed-off-by: Igor Soares <Igor.PiresSoares@windriver.com>
2023-12-29 12:30:54 -03:00

62 lines
1.7 KiB
Makefile
Executable File

#!/usr/bin/make -f
# export DH_VERBOSE = 1
export ROOT = debian/tmp
export APP_FOLDER = $(ROOT)/usr/local/share/applications/helm
export DEB_VERSION = $(shell dpkg-parsechangelog | egrep '^Version:' | cut -f 2 -d ' ')
export RELEASE = $(shell cat /etc/build.info | grep SW_VERSION | cut -d'"' -f2)
export REVISION = $(shell echo $(DEB_VERSION) | cut -f 4 -d '.')
export APP_NAME = snmp
export APP_VERSION = $(RELEASE)-$(REVISION)
export APP_TARBALL_FLUXCD = $(APP_NAME)-$(APP_VERSION).tgz
export HELM_REPO = stx-platform
export STAGING_FLUXCD = staging-fluxcd
%:
dh $@
override_dh_auto_build:
############
# COMMON #
############
# Create the TGZ file.
cd helm-charts && make
############
# FLUXCD #
############
# Setup the staging directory for fluxcd package.
mkdir -p $(STAGING_FLUXCD)
cp files/metadata.yaml $(STAGING_FLUXCD)
cp -R fluxcd-manifests $(STAGING_FLUXCD)
mkdir -p $(STAGING_FLUXCD)/charts
cp helm-charts/*.tgz $(STAGING_FLUXCD)/charts
# Populate metadata.
cd $(STAGING_FLUXCD)
sed -i 's/APP_REPLACE_NAME/$(APP_NAME)/g' $(STAGING_FLUXCD)/metadata.yaml
sed -i 's/APP_REPLACE_VERSION/$(APP_VERSION)/g' $(STAGING_FLUXCD)/metadata.yaml
sed -i 's/HELM_REPLACE_REPO/$(HELM_REPO)/g' $(STAGING_FLUXCD)/metadata.yaml
# Copy the plugins: installed in the buildroot
mkdir -p $(STAGING_FLUXCD)/plugins
cp /plugins/*.whl $(STAGING_FLUXCD)/plugins
# Create the app package.
cd $(STAGING_FLUXCD) && find . -type f ! -name '*.md5' -print0 | xargs -0 md5sum > checksum.md5
tar cfz $(APP_TARBALL_FLUXCD) -C $(STAGING_FLUXCD)/ .
# Cleanup staging.
rm -rf $(STAGING_FLUXCD)
override_dh_auto_install:
# Install the app tar file.
install -d -m 755 $(APP_FOLDER)
install -p -D -m 755 $(APP_TARBALL_FLUXCD) $(APP_FOLDER)
override_dh_usrlocal: