mirror of
https://github.com/opnsense/tools.git
synced 2026-05-28 04:35:46 -04:00
build/sync: turn the port_dir_mfc script into a 'sync' step
This commit is contained in:
parent
a42b22f862
commit
b6cd7fbabe
4 changed files with 65 additions and 45 deletions
4
Makefile
4
Makefile
|
|
@ -26,8 +26,8 @@
|
|||
STEPS= audit arm base boot chroot clean clone compress confirm \
|
||||
connect core distfiles download dvd fingerprint info \
|
||||
kernel list make.conf nano options packages plugins ports \
|
||||
prefetch print rebase release rename serial sign \
|
||||
skim test update upload verify vga vm xtools
|
||||
prefetch print rebase release rename serial sign skim \
|
||||
sync test update upload verify vga vm xtools
|
||||
SCRIPTS= custom distribution factory hotfix nightly watch
|
||||
|
||||
.PHONY: ${STEPS} ${SCRIPTS}
|
||||
|
|
|
|||
11
README.md
11
README.md
|
|
@ -371,7 +371,7 @@ Available clean options are:
|
|||
* vm: remove vm image
|
||||
* xtools: remove xtools set
|
||||
|
||||
How the port tree is synced with its upstream repository
|
||||
How the port tree is updated via its upstream repository
|
||||
--------------------------------------------------------
|
||||
|
||||
The ports tree has a few of our modifications and is sometimes a
|
||||
|
|
@ -422,6 +422,15 @@ for standalone use on the host use:
|
|||
|
||||
# make make.conf
|
||||
|
||||
Syncing a ports branch from PORTSDIR
|
||||
------------------------------------
|
||||
|
||||
When maintaining branches the master branch holds updates that
|
||||
we want to cherry-pick to another branch. To ease the process
|
||||
the sync step can deal with the complexity involved:
|
||||
|
||||
# make sync-category/port[,category/port[,...]]
|
||||
|
||||
Reading and modifying version numbers of build sets and images
|
||||
--------------------------------------------------------------
|
||||
|
||||
|
|
|
|||
|
|
@ -27,8 +27,8 @@
|
|||
|
||||
set -e
|
||||
|
||||
SELF=skim
|
||||
FROM=FreeBSD
|
||||
SELF=skim
|
||||
|
||||
. ./common.sh
|
||||
|
||||
|
|
|
|||
|
|
@ -27,52 +27,63 @@
|
|||
|
||||
set -e
|
||||
|
||||
DIR=${1:-.}
|
||||
BRANCH=${2:-master}
|
||||
FROM=FreeBSD
|
||||
SELF=sync
|
||||
|
||||
if git diff --quiet ${BRANCH} ${DIR}; then
|
||||
echo ">>> Cherry-pick already complete."
|
||||
exit 0
|
||||
fi
|
||||
. ./common.sh
|
||||
|
||||
echo -n ">>> Run a git-cherry-pick or raw merge? [r/G]: "
|
||||
GIT="git -C ${PORTSDIR}"
|
||||
|
||||
read YN < /dev/tty
|
||||
case ${YN} in
|
||||
[rR])
|
||||
git diff -R ${BRANCH} ${DIR} | git apply
|
||||
git add ${DIR}
|
||||
git commit -m \
|
||||
"${DIR}: sync with upstream
|
||||
for ARG in ${@}; do
|
||||
# ARG should be "category/name" but not strictly checked
|
||||
|
||||
Taken from: ${FROM}"
|
||||
exit 0
|
||||
;;
|
||||
*)
|
||||
# FALLTHROUGH
|
||||
;;
|
||||
esac
|
||||
|
||||
COMMITS=
|
||||
|
||||
for HASH in $(git log --oneline ${BRANCH} ${DIR} | awk '{ print $1 }'); do
|
||||
if git diff --quiet ${HASH} ${DIR}; then
|
||||
# found no more changes
|
||||
break
|
||||
if [ ! -d ${PORTSDIR}/${ARG} ]; then
|
||||
echo ">>> Sync did not find the port ${ARG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# reverse commit order for cherry-pick
|
||||
COMMITS="${HASH} ${COMMITS}"
|
||||
if ${GIT} diff --quiet ${PORTSBRANCH} ${ARG}; then
|
||||
echo ">>> Sync already complete for ${ARG}"
|
||||
continue
|
||||
fi
|
||||
|
||||
|
||||
COMMITS=
|
||||
|
||||
for HASH in $(${GIT} log --oneline ${PORTSBRANCH} ${ARG} | \
|
||||
awk '{ print $1 }'); do
|
||||
if ${GIT} diff --quiet ${HASH} ${ARG}; then
|
||||
# found no more changes
|
||||
break
|
||||
fi
|
||||
|
||||
# reverse commit order for cherry-pick
|
||||
COMMITS="${HASH} ${COMMITS}"
|
||||
done
|
||||
|
||||
FAILED=
|
||||
|
||||
for COMMIT in ${COMMITS}; do
|
||||
if ! (${GIT} cherry-pick ${COMMIT} || \
|
||||
${GIT} cherry-pick --skip); then
|
||||
FAILED=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -n "${FAILED}" ]; then
|
||||
${GIT} diff -R ${PORTSBRANCH} ${ARG} | ${GIT} apply
|
||||
${GIT} add ${ARG}
|
||||
${GIT} commit -m \
|
||||
"${ARG}: sync with upstream
|
||||
|
||||
Taken from: ${FROM}"
|
||||
fi
|
||||
|
||||
if ! ${GIT} diff --quiet ${PORTSBRANCH} ${ARG}; then
|
||||
echo ">>> Sync failed due to non-emtpy diff for ${ARG}" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ">>> Sync succeeded for ${ARG}"
|
||||
done
|
||||
|
||||
for COMMIT in ${COMMITS}; do
|
||||
git cherry-pick ${COMMIT} || git cherry-pick --skip
|
||||
done
|
||||
|
||||
if ! git diff --quiet ${BRANCH} ${DIR}; then
|
||||
echo ">>> Cherry-pick failed due to non-emtpy diff." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ">>> Cherry-pick finished successfully."
|
||||
Loading…
Reference in a new issue