Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLevente Polyak <anthraxx@archlinux.org>2022-09-11 12:31:39 +0200
committerLevente Polyak <anthraxx@archlinux.org>2023-03-19 22:02:04 +0100
commitb9d20c10a988775bc444ceaf872766fec32b54b5 (patch)
treebfbd8cc4c4f5381ea8d22049f98dbf2128c6c3c9
parent184441895606f59dc85c695c627660758ca2b882 (diff)
archrelease: fix git tag conversion and use library function for it
This allows us to reuse the code and have the conversion in a single place instead of cluttering rules across different execution units. It also fixes the implementations according to the specs of git-check-ref-format. Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
-rw-r--r--lib/common.sh10
-rw-r--r--src/archrelease.in13
2 files changed, 16 insertions, 7 deletions
diff --git a/lib/common.sh b/lib/common.sh
index d345307..577bb6e 100644
--- a/lib/common.sh
+++ b/lib/common.sh
@@ -255,6 +255,16 @@ getpkgdesc() {
}
+get_tag_from_pkgver() {
+ local pkgver=$1
+ local tag=${pkgver}
+
+ tag=${tag/:/-}
+ tag=${tag//~/.}
+ echo "${tag}"
+}
+
+
is_debug_package() {
local pkgfile=${1} pkgbase pkgname pkgdesc
pkgbase="$(getpkgbase "${pkgfile}")"
diff --git a/src/archrelease.in b/src/archrelease.in
index 3607d19..3dd969b 100644
--- a/src/archrelease.in
+++ b/src/archrelease.in
@@ -37,17 +37,17 @@ fi
. ./PKGBUILD
pkgbase=${pkgbase:-$pkgname}
pkgver=$(get_full_version "$pkgbase")
-tag_pkgver=release-${pkgver/:/-}
+gittag=$(get_tag_from_pkgver "$pkgver")
-if git rev-parse "$tag_pkgver" >/dev/null 2>&1; then
- die "archrelease: the tag $pkgver already exists in the repository!"
+if git rev-parse "$gittag" >/dev/null 2>&1; then
+ die "archrelease: the tag $gittag for version $pkgver already exists in the repository!"
fi
# If the tag exists we check if it's properly signed and that it
# matches the working directory PKGBUILD.
-if git tag --verify "$tag_pkgver" &> /dev/null; then
+if git tag --verify "$gittag" &> /dev/null; then
cwd_checksum=$(sha256sum PKGBUILD|cut -d' ' -f1)
- tag_checksum=$(git show $tag_pkgver:PKGBUILD | sha256sum |cut -d' ' -f1)
+ tag_checksum=$(git show "${gittag}:PKGBUILD" | sha256sum |cut -d' ' -f1)
if [[ "$cwd_checksum" != "$tag_checksum" ]]; then
die "tagged PKGBUILD is not the same as the working dir PKGBUILD"
fi
@@ -55,7 +55,6 @@ if git tag --verify "$tag_pkgver" &> /dev/null; then
fi
stat_busy "Releasing package"
-printf -v tag_list ", %s" "$@"; tag_list="${tag_list#, }"
-git tag -s -m "archrelease: released $pkgbase-$pkgver to $tag_list" "$tag_pkgver" || abort
+git tag --sign --message="Package release ${pkgver}" "$gittag" || abort
git push --tags main || abort
stat_done