Compare commits

...
4 Commits
Author SHA1 Message Date
Arjan van de Ven f092f66d8d update packages file 2024-12-19 06:03:26 +00:00
Brett T. Warden 704e8c90b8 Cleanup parsing of version from specfile in catchup targets
Make sure we only parse %{version} one time while doing a catchup.
2024-12-05 17:11:40 -08:00
Brett T. Warden 1ca80a16a3 Implement catchup targets
Implement a new target 'catchup' that will backport upstream commits
from the current package version to HEAD.
Implement a new target 'catchup-<commit|tag>' that will backport
upstream commits up to the target, as resolvable by git. This powers
'catchup'.
Rework the target 'backport-<commit>' to clone and use the upstream
git repository instead of using GitHub URLs. This also simplifies the
resolution of targets to full commit hashes, as needed to ensure unique
patch names and entries in 'series'.

'make catchup' will backport all the patches to catch this package up to
the upstream's HEAD
'make catchup-v5.0' will backport all the patches to catch this package
up to tag "v5.0" upstream.
'make catchup-ffdcba' will backport all the patches between this
package's current version and the upstream commit ffdcba.
'make backport-ffdcba' will backport ONLY upstream commit ffdcba.

All targets will produce patches named "backport-<commit>.patch", where
<commit> is the full SHA1 commit hash, regardless of whether you used an
abbreviated hash (or a tag, for catchup-%).

Patches are added to 'series' in chronological order, unless they're
already anywhere in that file.
2024-12-05 16:00:31 -08:00
Arjan van de Ven 27e359bda0 update packages file 2024-12-05 19:57:20 +00:00
2 changed files with 59 additions and 15 deletions
+56 -14
View File
@@ -582,27 +582,69 @@ cloc: $(SRPMFILE)
@$(MOCK) --clean --scrub=chroot --uniqueext=$(PKG_NAME) @$(MOCK) --clean --scrub=chroot --uniqueext=$(PKG_NAME)
cat results/cloc.txt cat results/cloc.txt
#help backport-<commit>: Retrieve a commit from the upstream git repository and save it as a backport patch. #help catchup: Backport the commits from the current version to the upstream HEAD (not release).
#help Currently only works with GitHub repositories. The giturl is read from options.conf. #help Only works if giturl is defined and the current package version can be mapped to a git tag.
backport-%: catchup:
@commit=$*; \ $(MAKE) catchup-HEAD
echo "Backporting commit: $${commit}"; \
giturl=$$(grep -E '^giturl\s*=\s*https://github.com' options.conf | sed 's/giturl\s*=\s*//' | sed 's/\.git$$//' | sed 's/\/$$//' 2>/dev/null); \ #help catchup-<commit|tag>: Backport the commits from the current version to the specified commit or tag.
#help Only works if giturl is defined and the current package version can be mapped to a git tag.
catchup-%:
@target=$*; \
giturl=$$(grep -E '^giturl\s*=\s*\S+' options.conf | sed 's/giturl\s*=\s*//' 2>/dev/null); \
if [[ -z "$${giturl}" ]]; then \ if [[ -z "$${giturl}" ]]; then \
echo "Error: giturl not defined in options.conf"; \ echo "Error: giturl not defined in options.conf"; \
exit 1; \ exit 1; \
fi; \ fi; \
if ! curl -s -L -o $@.patch $${giturl}/commit/$*.patch || [[ "Not Found" == $$(< $@.patch) ]]; then \ mkdir -p results; \
rm -f $@.patch; \ if [[ -d results/$(PKG_NAME) ]]; then \
echo "Error: Failed to download commit $*"; \ echo "Reusing existing repository..."; \
git -C results/$(PKG_NAME) fetch origin; \
else \
echo "Cloning upstream repository..."; \
git -C results clone "$${giturl}" $(PKG_NAME); \
fi; \
if ! git -C results/$(PKG_NAME) rev-parse --verify --quiet "$${target}" >/dev/null; then \
echo "Error: Target commit/tag $${target} not found"; \
exit 1; \ exit 1; \
fi; \ fi; \
patch=$@.patch; \ version=$$(rpm -q --qf '%{VERSION}\n' --specfile $(SPECFILE) | head -1); \
full_commit=$$(head -1 $@.patch | grep -oE '\b$*\S+' 2>/dev/null); \ echo "Version: $${version}"; \
if ! [[ -z "$${full_commit}" ]]; then \ current_tag=$$(git -C results/$(PKG_NAME) tag --list | grep -E "^($(PKG_NAME)-)?v?$${version}$$") || { \
patch=backport-$${full_commit}.patch; \ echo "Error: No tag found for current package version"; \
mv $@.patch $${patch}; \ exit 1; \
}; \
echo "Catching up from $${current_tag} to $${target}"; \
for commit in $$(git -C results/$(PKG_NAME) log --reverse --pretty=oneline $${current_tag}..$${target} | cut -d' ' -f1); do \
$(MAKE) backport-$${commit}; \
done;
#help backport-<commit>: Retrieve a commit from the upstream git repository and save it as a backport patch.
#help The giturl is read from options.conf.
backport-%:
@commit=$*; \
echo "Backporting commit: $${commit}"; \
giturl=$$(grep -E '^giturl\s*=\s*\S+' options.conf | sed 's/giturl\s*=\s*//' 2>/dev/null); \
if [[ -z "$${giturl}" ]]; then \
echo "Error: giturl not defined in options.conf"; \
exit 1; \
fi; \ fi; \
mkdir -p results; \
if [[ -d results/$(PKG_NAME) ]]; then \
echo "Reusing existing repository..."; \
git -C results/$(PKG_NAME) fetch origin; \
else \
echo "Cloning upstream repository..."; \
git -C results clone "$${giturl}" $(PKG_NAME); \
fi; \
full_commit=$$(git -C results/$(PKG_NAME) show --pretty=oneline $${commit} 2>/dev/null | head -1 | cut -d' ' -f 1); \
if [[ -z "$${full_commit}" ]]; then \
echo "Error: Commit for $${commit} not found"; \
exit 1; \
fi; \
patch=backport-$${full_commit}.patch; \
git -C results/$(PKG_NAME) format-patch -1 --stdout $${full_commit} > $${patch}; \
if [[ -s $${patch} ]]; then \ if [[ -s $${patch} ]]; then \
echo "$${patch} created"; \ echo "$${patch} created"; \
grep -qE "^$${patch}$$" series 2>/dev/null || echo "$${patch}" >> series; \ grep -qE "^$${patch}$$" series 2>/dev/null || echo "$${patch}" >> series; \
+3 -1
View File
@@ -1858,6 +1858,7 @@ irrlicht
irrlichtmt irrlichtmt
irssi irssi
isa-l isa-l
isl
iso-codes iso-codes
isodate isodate
isomd5sum isomd5sum
@@ -2385,6 +2386,7 @@ libva
libva-intel-driver libva-intel-driver
libva-utils libva-utils
libvdpau libvdpau
libversion
libvirt libvirt
libvirt-dbus libvirt-dbus
libvirt-glib libvirt-glib
@@ -4991,6 +4993,7 @@ scour
scowl scowl
screen screen
scummvm scummvm
scx
sddm sddm
sddm-kcm sddm-kcm
seahorse seahorse
@@ -5171,7 +5174,6 @@ usb-modeswitch-data
usbredir usbredir
usbutils usbutils
userspace-rcu userspace-rcu
usrbinjava
usrbinvi usrbinvi
usrsctp usrsctp
utf8proc utf8proc