Skip to content

Commit 641676b

Browse files
committed
msys2-runtime(update-patches): determine the base tag automatically
When upgrading to a newer upstream version, we cannot rely on the base tag that is recorded in the PKGBUILD file. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent dbc0d43 commit 641676b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

msys2-runtime/update-patches.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ die "Clean worktree required"
1717
git rm 0*.patch ||
1818
die "Could not remove previous patches"
1919

20-
base_tag=refs/tags/cygwin-"$(sed -n -e 's/^pkgver=//p' <PKGBUILD)"
20+
base_tag=refs/tags/"$(expr "$(git -C src/msys2-runtime/ describe --tags HEAD)" : '^\(cygwin-[0-9.]*\)')"
2121
source_url=$(sed -ne 's/git+https:/https:/' -e 's/^source=\([^:]\+::\)\?["'\'']\?\([^"'\''#?=&,;[:space:]]\+[^)"'\''#?=&,;[:space:]]\).*/\2/p' <PKGBUILD)
2222

2323
git -C src/msys2-runtime fetch --no-tags "$source_url" "$base_tag:$base_tag"
@@ -60,6 +60,7 @@ in_sources="$(echo "$patches" | sed "{s/^/ /;:1;N;s/\\n/\\\\n /;b1
6060
in_prepare="$(echo "$patches" | sed -n '{:1;s|^| |;H;${x;s/\n/ \\\\\\n/g;p;q};n;b1}')"
6161
sed -i -e "/^ 0.*\.patch$/{:1;N;/[^)]$/b1;s|.*|$in_sources)|}" \
6262
-e "/^ *apply_git_am_with_msg .*\\\\$/{s/.*/ apply_git_am_with_msg \\\\/p;:2;N;/[^}]$/b2;s|.*|$in_prepare\\n\\}|}" \
63+
-e "s/^\\(pkgver=\\).*/\\1${base_tag#refs/tags/cygwin-}/" \
6364
PKGBUILD ||
6465
die "Could not update the patch set in PKGBUILD"
6566

0 commit comments

Comments
 (0)