diff --git a/debian/changelog b/debian/changelog index 1fb351304f7d4ef82fd03d5cf8af60542880d692..8d384c154e794358745470169e8e312842e3e896 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,12 @@ +apertis-dev-tools (0.2024.17) apertis; urgency=medium + + * apertis-pkg-merge-local: Add new tool. + Add a tool to help when a package update cannot be done by CI. This tool + should help developers to perform the merge in a similar way as the CI + and also help to run some basic checks. + + -- Walter Lozano <walter.lozano@collabora.com> Tue, 14 Jan 2025 09:34:26 -0300 + apertis-dev-tools (0.2024.16) apertis; urgency=medium * Drop unneeded dependencies. diff --git a/tools/Makefile b/tools/Makefile index d300d056592e53f96e084aec0d5ba6d7ebd4b12d..783a1101adefa71ae409a84158856d4f563db100 100644 --- a/tools/Makefile +++ b/tools/Makefile @@ -7,6 +7,7 @@ TOOLS = \ ade \ apertis-abi-compare \ apertis-images \ + apertis-pkg-merge-local \ apertis-pkg-merge-updates \ apertis-pkg-merge-upstream-to-downstreams \ apertis-pkg-pull-updates \ diff --git a/tools/apertis-pkg-merge-local b/tools/apertis-pkg-merge-local new file mode 100755 index 0000000000000000000000000000000000000000..5e84ae4c5f5de92127c2b199adec46d8d1a6ab34 --- /dev/null +++ b/tools/apertis-pkg-merge-local @@ -0,0 +1,102 @@ +#!/bin/bash + +DOWNSTREAM_BRANCH=${DOWNSTREAM_BRANCH:=apertis/v2026dev0} +UPSTREAM_BRANCH=${UPSTREAM_BRANCH:="debian/trixie"} + +DOWNSTREAM_BRANCH_OLD=${DOWNSTREAM_BRANCH_OLD:="apertis/v2025"} +UPSTREAM_BRANCH_OLD=${UPSTREAM_BRANCH_OLD:="debian/bookworm"} + +echo Using $DOWNSTREAM_BRANCH $UPSTREAM_BRANCH as current branches +echo Using $DOWNSTREAM_BRANCH_OLD $UPSTREAM_BRANCH_OLD as old branches + +merge() { + # Configure git merge to use dpkg-mergechangelogs + if ! grep -q -v dpkg-mergechangelogs ".git/info/attributes" 2> /dev/null; then + echo "debian/changelog merge=dpkg-mergechangelogs" >> ".git/info/attributes" + fi + git config "merge.dpkg-mergechangelogs.name" "debian/changelog merge driver" + git config "merge.dpkg-mergechangelogs.driver" "dpkg-mergechangelogs %O %A %B %A" + + # Get proposed branch + proposed_branch=`git branch -a | grep "remotes/origin/proposed-updates/$UPSTREAM_BRANCH"` + proposed_branch=`echo $proposed_branch | sed 's;remotes/origin/;;g'` + + if [ "$proposed_branch" = "" ] ; then + echo "Unable to find proposed branch" + exit + fi + + # Checkout proposed updates branch + git checkout $proposed_branch + + # Reset proposed updates branch to apertis branch to have it as first ancestor + # same as CI does + git reset --hard origin/$DOWNSTREAM_BRANCH + + git merge origin/$UPSTREAM_BRANCH -m "Merge $UPSTREAM_BRANCH into $DOWNSTREAM_BRANCH" + + echo Use the following commands to finish the merge + echo + echo To fix remaining conflicts: + echo " git mergetool" + echo + echo To check the changelog merge: + echo " git difftool origin/$UPSTREAM_BRANCH debian/changelog" + echo " git difftool origin/$DOWNSTREAM_BRANCH debian/changelog" + echo + echo To run a final check: + echo + echo Show new delta against upstream + echo " "`basename $0` diff + echo " "`basename $0` diff_old + echo + echo To finish the merge + echo " git merge --continue" + echo + echo To commit the changes + echo " "`basename $0` commit +} + +diff() { + echo Diff against $UPSTREAM_BRANCH $EXTRA_ARGS + git diff $EXTRA_ARGS origin/$UPSTREAM_BRANCH ':(exclude)debian/apertis' ':(exclude)debian/changelog' +} + +diff_old() { + echo Diff in previous release $EXTRA_ARGS + git diff $EXTRA_ARGS origin/$UPSTREAM_BRANCH_OLD origin/$DOWNSTREAM_BRANCH_OLD ':(exclude)debian/apertis' ':(exclude)debian/changelog' +} + +commit() { + dch --force-distribution --distribution apertis --local +apertis --upstream Rebase on top of $UPSTREAM_BRANCH + git add debian/changelog + git diff --cached + DIR=`pwd` + PACKAGE=`basename $DIR` + VERSION=`dpkg-parsechangelog -S version` + echo Release $PACKAGE version $VERSION + git commit -sm "Release $PACKAGE version $VERSION" +} + +COMMAND=$1 +shift +EXTRA_ARGS=$@ + +case "$COMMAND" in +merge) + merge + ;; +diff) + diff + ;; +diff_old) + diff_old + ;; +commit) + commit + ;; +*) + echo Unknown command + echo Usage `basename $0` '[merge|diff|diff_old|commit]' + ;; +esac