From 06c7e47a22d13ae63f3652b5bdfad53dd898c1ce Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Wed, 20 Dec 2023 21:51:53 +0100 Subject: [PATCH 1/3] build: add special handling for a release candidate Signed-off-by: Reuben Miller --- ci/build_scripts/version.sh | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/ci/build_scripts/version.sh b/ci/build_scripts/version.sh index ae66d822d2e..bafd9b94a29 100755 --- a/ci/build_scripts/version.sh +++ b/ci/build_scripts/version.sh @@ -155,8 +155,20 @@ set_version_variables() { else APK_VERSION="${GIT_SEMVER//\~/_rc}" fi - DEB_VERSION="$GIT_SEMVER" - RPM_VERSION="$GIT_SEMVER" + + if [[ "$GIT_SEMVER" = *-rc* ]]; then + # Debian expects a tilde as a seperator + DEB_VERSION="${GIT_SEMVER//-/\~}" + else + DEB_VERSION="$GIT_SEMVER" + fi + + if [[ "$GIT_SEMVER" = *-rc* ]]; then + # RPM expects a tilde as a seperator + RPM_VERSION="${GIT_SEMVER//-/\~}" + else + RPM_VERSION="$GIT_SEMVER" + fi # container tags are quite limited, so replace forbidden characters with '-' CONTAINER_VERSION="${GIT_SEMVER//[^a-zA-Z0-9_.-]/-}" From 09498d6ddf2dd8f964ca1f29bd6ac73a0d2a8e44 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Wed, 20 Dec 2023 21:52:14 +0100 Subject: [PATCH 2/3] build: use linux package specific version numbers Signed-off-by: Reuben Miller --- .../virtual/nfpm.tedge-full.yaml | 42 +++++++++---------- .../virtual/nfpm.tedge-minimal.yaml | 12 +++--- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/configuration/package_manifests/virtual/nfpm.tedge-full.yaml b/configuration/package_manifests/virtual/nfpm.tedge-full.yaml index c8ec751cca4..d5f511c25b3 100644 --- a/configuration/package_manifests/virtual/nfpm.tedge-full.yaml +++ b/configuration/package_manifests/virtual/nfpm.tedge-full.yaml @@ -26,36 +26,36 @@ overrides: # slightly different formats apk: depends: - - tedge = ${GIT_SEMVER} - - tedge-mapper = ${GIT_SEMVER} - - tedge-agent = ${GIT_SEMVER} + - tedge = ${APK_VERSION} + - tedge-mapper = ${APK_VERSION} + - tedge-agent = ${APK_VERSION} # Watchdog does not make sense on apk as it does not use systemd - # - tedge-watchdog = ${GIT_SEMVER} - - tedge-apt-plugin = ${GIT_SEMVER} - - c8y-remote-access-plugin = ${GIT_SEMVER} - - c8y-firmware-plugin = ${GIT_SEMVER} + # - tedge-watchdog = ${APK_VERSION} + - tedge-apt-plugin = ${APK_VERSION} + - c8y-remote-access-plugin = ${APK_VERSION} + - c8y-firmware-plugin = ${APK_VERSION} rpm: depends: # FIXME: Work out a better way to reference the full package specific version which includes the release number (-1) suffix # without having to manually add it - ca-certificates - - tedge = ${GIT_SEMVER}-1 - - tedge-mapper = ${GIT_SEMVER}-1 - - tedge-agent = ${GIT_SEMVER}-1 - - tedge-watchdog = ${GIT_SEMVER}-1 + - tedge = ${RPM_VERSION}-1 + - tedge-mapper = ${RPM_VERSION}-1 + - tedge-agent = ${RPM_VERSION}-1 + - tedge-watchdog = ${RPM_VERSION}-1 # tedge-apt-plugin does not make sense on rpm - # - tedge-apt-plugin = ${GIT_SEMVER}-1 - - c8y-remote-access-plugin = ${GIT_SEMVER}-1 - - c8y-firmware-plugin = ${GIT_SEMVER}-1 + # - tedge-apt-plugin = ${RPM_VERSION}-1 + - c8y-remote-access-plugin = ${RPM_VERSION}-1 + - c8y-firmware-plugin = ${RPM_VERSION}-1 deb: depends: - - tedge (= ${GIT_SEMVER}) - - tedge-mapper (= ${GIT_SEMVER}) - - tedge-agent (= ${GIT_SEMVER}) - - tedge-watchdog (= ${GIT_SEMVER}) - - tedge-apt-plugin (= ${GIT_SEMVER}) - - c8y-remote-access-plugin (= ${GIT_SEMVER}) - - c8y-firmware-plugin (= ${GIT_SEMVER}) + - tedge (= ${DEB_VERSION}) + - tedge-mapper (= ${DEB_VERSION}) + - tedge-agent (= ${DEB_VERSION}) + - tedge-watchdog (= ${DEB_VERSION}) + - tedge-apt-plugin (= ${DEB_VERSION}) + - c8y-remote-access-plugin (= ${DEB_VERSION}) + - c8y-firmware-plugin (= ${DEB_VERSION}) deb: fields: diff --git a/configuration/package_manifests/virtual/nfpm.tedge-minimal.yaml b/configuration/package_manifests/virtual/nfpm.tedge-minimal.yaml index 0eaeeb0f65a..2e643410eae 100644 --- a/configuration/package_manifests/virtual/nfpm.tedge-minimal.yaml +++ b/configuration/package_manifests/virtual/nfpm.tedge-minimal.yaml @@ -26,18 +26,18 @@ overrides: # slightly different formats apk: depends: - - tedge = ${GIT_SEMVER} - - tedge-mapper = ${GIT_SEMVER} + - tedge = ${APK_VERSION} + - tedge-mapper = ${APK_VERSION} rpm: depends: # FIXME: Work out a better way to reference the full package specific version which includes the release number (-1) suffix # without having to manually add it - - tedge = ${GIT_SEMVER}-1 - - tedge-mapper = ${GIT_SEMVER}-1 + - tedge = ${RPM_VERSION}-1 + - tedge-mapper = ${RPM_VERSION}-1 deb: depends: - - tedge (= ${GIT_SEMVER}) - - tedge-mapper (= ${GIT_SEMVER}) + - tedge (= ${DEB_VERSION}) + - tedge-mapper (= ${DEB_VERSION}) deb: fields: From 6ec5fb394ba80f4623233906cf66570e8821eca4 Mon Sep 17 00:00:00 2001 From: Reuben Miller Date: Wed, 20 Dec 2023 21:52:29 +0100 Subject: [PATCH 3/3] build: load dotenv file if found Signed-off-by: Reuben Miller --- ci/build_scripts/version.sh | 4 ++-- justfile | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/ci/build_scripts/version.sh b/ci/build_scripts/version.sh index bafd9b94a29..e031dd56980 100755 --- a/ci/build_scripts/version.sh +++ b/ci/build_scripts/version.sh @@ -157,14 +157,14 @@ set_version_variables() { fi if [[ "$GIT_SEMVER" = *-rc* ]]; then - # Debian expects a tilde as a seperator + # Debian expects a tilde as a separator DEB_VERSION="${GIT_SEMVER//-/\~}" else DEB_VERSION="$GIT_SEMVER" fi if [[ "$GIT_SEMVER" = *-rc* ]]; then - # RPM expects a tilde as a seperator + # RPM expects a tilde as a separator RPM_VERSION="${GIT_SEMVER//-/\~}" else RPM_VERSION="$GIT_SEMVER" diff --git a/justfile b/justfile index 5d11e52de02..547cb2f1fac 100644 --- a/justfile +++ b/justfile @@ -1,4 +1,5 @@ set ignore-comments +set dotenv-load VERSION := `./ci/build_scripts/version.sh 2>/dev/null || exit 0` # Detect the default target based on the user's CPU arch.