tools: gen-rpi-kodi-patch.sh supports rebase script

This commit is contained in:
MilhouseVH 2016-07-01 14:30:06 +01:00
parent 0eb99ab8e8
commit 7c8b287186
2 changed files with 43 additions and 6 deletions

View File

@ -18,6 +18,7 @@ usage()
echo
echo "Example: ${me} jarvis_rbp_backports d11fabefb909e75e7186bd9ecd0cbff9e8b24577"
echo "Example: ${me} jarvis_rbp_backports Jarvis"
echo "Example: ${me} newclock5 master"
echo
echo "For sha, see https://github.com/xbmc/xbmc/compare/Jarvis...popcornmix:jarvis_rbp_backports (replace branches as appropriate)"
exit 1
@ -58,9 +59,20 @@ else
BASEREV="xbmc/${BASEREV}"
fi
# Apply the following config change to reduce chance of duplicate hashes
git config --local core.abbrev 40
git fetch --all --depth=${DEPTH}
git reset --hard origin/${BRANCH}
TOPREV="$(git log --oneline --grep "UNSTABLE: This is a placeholder. Commits after this point are considered experimental." | awk '{print $1}')"
if [ -n "${TOPREV}" ]; then
echo "Found UNSTABLE placeholder with rev ${TOPREV}, making this the new HEAD"
git reset --hard ${TOPREV}
else
echo "WARNING: UNSTABLE placeholder not found, assuming it is not present in branch ${BRANCH}"
fi
if [ -d addons/skin.confluence ]; then
SKIN1=skin.confluence
SKIN2=kodi-theme-Confluence
@ -69,6 +81,7 @@ else
SKIN2=kodi-theme-Estuary
fi
GIT_SEQUENCE_EDITOR=${BIN}/rpi-kodi-rebase.sh git rebase -i ${BASEREV}
git format-patch --no-signature --stdout ${BASEREV} -- addons/${SKIN1} | sed -E 's#addons/skin\.[^/]*/##g' >/tmp/skin.patch
git format-patch --no-signature --stdout ${BASEREV} -- . ":!addons/${SKIN1}" >/tmp/kodi.patch
@ -89,13 +102,21 @@ echo "git checkout -b somebranch"
BRANCH="${BRANCH//_/-}"
echo
echo "cp /tmp/skin.patch projects/RPi/patches/${SKIN2}/${SKIN2}-001-${BRANCH}.patch"
echo "cp /tmp/skin.patch projects/RPi2/patches/${SKIN2}/${SKIN2}-001-${BRANCH}.patch"
echo "git commit -am \"RPi/RPi2: Update ${SKIN2} support patches\""
if [ -s /tmp/skin.patch ]; then
echo "cp /tmp/skin.patch projects/RPi/patches/${SKIN2}/${SKIN2}-001-backport.patch"
echo "cp /tmp/skin.patch projects/RPi2/patches/${SKIN2}/${SKIN2}-001-backport.patch"
echo "git commit -am \"RPi/RPi2: Update ${SKIN2} support patches\""
else
echo "NO SKIN PATCH REQUIRED"
fi
echo
echo "cp /tmp/kodi.patch projects/RPi/patches/kodi/kodi-001-${BRANCH}.patch"
echo "cp /tmp/kodi.patch projects/RPi2/patches/kodi/kodi-001-${BRANCH}.patch"
echo "git commit -am \"RPi/RPi2: Update kodi support patches\""
if [ -s /tmp/kodi.patch ]; then
echo "cp /tmp/kodi.patch projects/RPi/patches/kodi/kodi-001-backport.patch"
echo "cp /tmp/kodi.patch projects/RPi2/patches/kodi/kodi-001-backport.patch"
echo "git commit -am \"RPi/RPi2: Update kodi support patches\""
else
echo "NO KODI PATCH REQUIRED"
fi
echo

16
tools/RPi/rpi-kodi-rebase.sh Executable file
View File

@ -0,0 +1,16 @@
#!/bin/bash
TODO=$1
# Drop commits not used
DROP_COMMITS="
THIS_IS_A_PLACEHOLDER, REPLACE WITH COMMIT DESCRIPTION ONCE THERE IS SOMETHING TO BE DROPPED!
"
IFS=$'\n'
for COMMIT in $DROP_COMMITS; do
sed -i -E "s/^pick ([0-9a-f]+) (${COMMIT}.*)/drop \1 \2/g" $TODO
done
grep -E "^drop " $TODO > /tmp/dropped
sed -i -E "/^drop /d" $TODO