From a82bcd9742bf821608fa1e434fcc5c66cc6cb31d Mon Sep 17 00:00:00 2001
From: Marcel Telka <marcel@telka.sk>
Date: Mon, 16 Oct 2023 18:17:10 +0200
Subject: [PATCH] tools/python-integrate-project: replace patch refresh code by refresh-patches target

---
 tools/python-integrate-project |   42 +++++++++---------------------------------
 1 files changed, 9 insertions(+), 33 deletions(-)

diff --git a/tools/python-integrate-project b/tools/python-integrate-project
index 2341c3a..8554c2e 100755
--- a/tools/python-integrate-project
+++ b/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"
 

--
Gitblit v1.9.3