Skip to content
Snippets Groups Projects
Commit a088ceb9 authored by Walter Lozano's avatar Walter Lozano
Browse files

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.

Signed-off-by: default avatarWalter Lozano <walter.lozano@collabora.com>
parent ec220285
No related branches found
No related tags found
2 merge requests!102Backport v2025 <- v2026dev1: Release apertis-dev-tools version 0.2024.18,!99apertis-pkg-merge-local: Add new tool
......@@ -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 \
......
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment