Browse Source

Make patch and update scripts a bit nicer

Matthias Schiffer 10 years ago
parent
commit
1b33134353
3 changed files with 12 additions and 3 deletions
  1. 1 0
      Makefile
  2. 9 2
      scripts/patch.sh
  3. 2 1
      scripts/update.sh

+ 1 - 0
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)

+ 9 - 2
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

+ 2 - 1
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