Marcel Telka
2023-10-16 a82bcd9742bf821608fa1e434fcc5c66cc6cb31d
tools/python-integrate-project: replace patch refresh code by refresh-patches target

1 files modified
42 ■■■■ changed files
tools/python-integrate-project 42 ●●●● patch | view | raw | blame | history
tools/python-integrate-project
@@ -257,43 +257,19 @@
sed -i -e 's/sha256:TODO/sha256:'"$SHA256"'/g' Makefile
git add Makefile
# Unpack sources and apply patches
! $GMAKE patch > /dev/null 2>&1 && printf "FATAL: 'gmake patch' failed!\n" >&2 && exit 1
# Refresh patches
rm -rf patches
! $GMAKE prep > /dev/null 2>&1 && printf "FATAL: 'gmake prep' failed!\n" >&2 && exit 1
git checkout patches > /dev/null 2>&1
mkdir -p patches
PATCHES=$($GMAKE print-value-PATCHES)
SOURCE_DIR=$($GMAKE print-value-SOURCE_DIR)
cd "$SOURCE_DIR"
for p in $PATCHES ; do
    QUILT_PATCHES=../patches quilt import --quiltrc /dev/null "../$p" > /dev/null 2>&1
    (($? == 1)) && printf 'FATAL: failed to import old patch %s!\n' "$p" && exit 1
    QUILT_PATCHES=../patches quilt push --quiltrc /dev/null -q > /dev/null 2>&1
    (($? == 1)) && printf 'FATAL: failed to apply old patch %s!\n' "$p" && exit 1
    QUILT_PATCHES=../patches quilt refresh --quiltrc /dev/null -p 1 --no-timestamps --no-index > /dev/null 2>&1
    (($? == 1)) && printf 'FATAL: failed to refresh old patch %s!\n' "$p" && exit 1
done
touch ../patches/series
QUILT_PATCHES=../patches quilt pop --quiltrc /dev/null -a -q > /dev/null 2>&1
(($? == 1)) && printf 'FATAL: failed to remove patches!\n' && exit 1
rm -f ../patches/series
cd "$DIR"
for p in $PATCHES ; do
    quilt import --quiltrc /dev/null -p 0 "$p" > /dev/null 2>&1
    (($? == 1)) && printf 'FATAL: failed to import new patch %s!\n' "$p" && exit 1
    quilt push --quiltrc /dev/null -q > /dev/null 2>&1
    (($? == 1)) && printf 'FATAL: failed to apply new patch %s!\n' "$p" && exit 1
    quilt refresh --quiltrc /dev/null -p 0 --no-timestamps --no-index > /dev/null 2>&1
    (($? == 1)) && printf 'FATAL: failed to refresh new patch %s!\n' "$p" && exit 1
done
# cleanup
rm -rf .pc patches/series
rmdir patches > /dev/null 2>&1
$GMAKE clobber > /dev/null 2>&1
! $GMAKE refresh-patches > /dev/null 2>&1 && printf "FATAL: 'gmake refresh-patches' failed!\n" >&2 && exit 1
git add patches 2>/dev/null
# Unpack sources
# Cleanup after patch refresh
$GMAKE clobber > /dev/null 2>&1
# Prepare sources
! $GMAKE prep > /dev/null 2>&1 && printf "FATAL: 'gmake prep' failed!\n" >&2 && exit 1
SOURCE_DIR=$($GMAKE print-value-SOURCE_DIR)
COMPONENT_SUBDIR=$($GMAKE print-value-COMPONENT_SUBDIR)
[[ -n "$COMPONENT_SUBDIR" ]] && COMPONENT_SUBDIR="/$COMPONENT_SUBDIR"