Merge branch 'improve-bump-package-version-to-update-rpm-changelog' into 'master'

Improve bump package version to update rpm changelog

See merge request kasm-technologies/internal/KasmVNC!34
This commit is contained in:
Matthew McClaskey 2022-03-31 14:37:02 +00:00
commit 92c449d87b
3 changed files with 56 additions and 14 deletions

View File

@ -7,24 +7,12 @@ update_version_to_meet_packaging_standards() {
sed -e 's/\([0-9]\)-\([a-zA-Z]\)/\1~\2/') sed -e 's/\([0-9]\)-\([a-zA-Z]\)/\1~\2/')
} }
add_debian_revision_to_new_version() {
echo "$new_version-1"
}
bump_rpm() { bump_rpm() {
sed -i "s/^Version:.\+/Version: $new_version/" centos/kasmvncserver.spec builder/bump-package-version-rpm "$new_version"
} }
bump_deb() { bump_deb() {
local image="debbump_package_version:dev" builder/bump-package-version-deb "$new_version"
local L_UID=$(id -u)
local L_GID=$(id -g)
local debian_version=$(add_debian_revision_to_new_version)
docker build -t "$image" -f builder/dockerfile.bump-package-version .
docker run --rm -v "$PWD":/src --user "$L_UID:$L_GID" \
"$image" /bin/bash -c \
"cd /src && builder/bump-package-version-inside-docker-deb $debian_version"
} }
new_version="$1" new_version="$1"

View File

@ -0,0 +1,23 @@
#!/bin/bash
set -eo pipefail
new_version="$1"
add_debian_revision_to_new_version() {
echo "$new_version-1"
}
bump_deb() {
local image="debbump_package_version:dev"
local L_UID=$(id -u)
local L_GID=$(id -g)
local debian_version=$(add_debian_revision_to_new_version)
docker build -t "$image" -f builder/dockerfile.bump-package-version .
docker run --rm -v "$PWD":/src --user "$L_UID:$L_GID" \
"$image" /bin/bash -c \
"cd /src && builder/bump-package-version-inside-docker-deb $debian_version"
}
bump_deb

View File

@ -0,0 +1,31 @@
#!/bin/bash
set -eo pipefail
new_version="$1"
specs="centos/kasmvncserver.spec
oracle/kasmvncserver.spec"
bump_version() {
sed -i "s/^Version:.\+/Version: $new_version/" "$1"
}
detect_release_version() {
release_version=$(sed -ne 's/^Release:\s\+//p' "$1" | sed -e 's/%.\+$//')
}
bump_changelog() {
detect_release_version "$1"
local date=$(date +'%a %b %d %Y')
local changelog_version="$new_version-$release_version"
local new_changelog_entry="* $date KasmTech <info@kasmweb.com> - $changelog_version\n- Upstream release"
sed -i -e "s/%changelog/%changelog\n$new_changelog_entry/" "$1"
}
IFS=$'\n'
for spec_file in $specs; do
bump_version $spec_file
bump_changelog $spec_file
done