diff --git a/build_scripts/assets/deb/control.j2 b/build_scripts/assets/deb/control.j2 index 29e9d26780..27a0ca3e76 100644 --- a/build_scripts/assets/deb/control.j2 +++ b/build_scripts/assets/deb/control.j2 @@ -1,5 +1,5 @@ Package: chia-blockchain-cli -Version: {{ CHIA_INSTALLER_VERSION }} +Version: {{ CHIA_DEB_CONTROL_VERSION }} Architecture: {{ PLATFORM }} Maintainer: Chia Network Inc Description: Chia Blockchain diff --git a/build_scripts/build_linux_deb-2-installer.sh b/build_scripts/build_linux_deb-2-installer.sh index e4d85cc25d..b2e1b86259 100644 --- a/build_scripts/build_linux_deb-2-installer.sh +++ b/build_scripts/build_linux_deb-2-installer.sh @@ -51,12 +51,20 @@ bash ./build_license_directory.sh # Builds CLI only .deb # need j2 for templating the control file +format_deb_version_string() { + version_str=$1 + # Use sed to conform to expected apt versioning conventions: + # - conditionally insert a hyphen before 'rc' or 'beta' if not already present + # - replace '.dev' with '-dev' + echo "$version_str" | sed -E 's/([0-9])(rc|beta)/\1-\2/g; s/\.dev/-dev/g' +} pip install j2cli CLI_DEB_BASE="chia-blockchain-cli_$CHIA_INSTALLER_VERSION-1_$PLATFORM" mkdir -p "dist/$CLI_DEB_BASE/opt/chia" mkdir -p "dist/$CLI_DEB_BASE/usr/bin" mkdir -p "dist/$CLI_DEB_BASE/DEBIAN" mkdir -p "dist/$CLI_DEB_BASE/etc/systemd/system" +CHIA_DEB_CONTROL_VERSION=$(format_deb_version_string "$CHIA_INSTALLER_VERSION"); export CHIA_DEB_CONTROL_VERSION j2 -o "dist/$CLI_DEB_BASE/DEBIAN/control" assets/deb/control.j2 cp assets/systemd/*.service "dist/$CLI_DEB_BASE/etc/systemd/system/" cp -r dist/daemon/* "dist/$CLI_DEB_BASE/opt/chia/"