diff --git a/Makefile b/Makefile index 3e8d26ba35d7913c738085335a14138b958062dd..9925550b62145b6f455661a54910474f4df5d48b 100644 --- a/Makefile +++ b/Makefile @@ -21,6 +21,7 @@ export TOPDIR update: FORCE $(GLUONDIR)/scripts/update.sh $(GLUONDIR) + $(GLUONDIR)/scripts/patch.sh $(GLUONDIR) patch: FORCE $(GLUONDIR)/scripts/patch.sh $(GLUONDIR) diff --git a/scripts/patch.sh b/scripts/patch.sh index 6302141f3e1a9a43233ace0054c93608bbb96b8d..0e431b3983e1ae1c91d3c1577fc3a0bd443bbeba 100755 --- a/scripts/patch.sh +++ b/scripts/patch.sh @@ -7,8 +7,15 @@ shopt -s nullglob for module in $GLUON_MODULES; do dir="$1"/$module - git -C $dir checkout -B patched base + git -C $dir checkout -B patching base if [ -z "$1"/patches/$module/*.patch ]; then continue; fi - git -C "$dir" am "$1"/patches/$module/*.patch + git -C "$dir" am "$1"/patches/$module/*.patch || ( + git -C "$dir" am --abort + git -C "$dir" checkout patched + git -C "$dir" branch -D patching + false + ) + git -C "$dir" checkout -B patched + git -C "$dir" branch -d patching done diff --git a/scripts/update.sh b/scripts/update.sh index 40d2b50c409d41f4e2d7ae84a6cc1c10c3aba202..2bda671fe3661f7fd14d3c362275193d02b70d5b 100755 --- a/scripts/update.sh +++ b/scripts/update.sh @@ -11,6 +11,7 @@ for module in $GLUON_MODULES; do eval repo=\${MODULE_${var}_REPO} eval commit=\${MODULE_${var}_COMMIT} git -C "$dir" init - git -C "$dir" fetch $repo + + git -C "$dir" checkout $commit 2>/dev/null || git -C "$dir" fetch $repo git -C "$dir" checkout -B base $commit done