git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git quiltimport and git apply fail importing the PREEMPT_RT patches
@ 2009-03-20 19:06 Uwe Kleine-König
  2009-03-20 19:18 ` [PATCH] quiltimport: use quilt to do patch/series parsing and application Uwe Kleine-König
  0 siblings, 1 reply; 2+ messages in thread
From: Uwe Kleine-König @ 2009-03-20 19:06 UTC (permalink / raw)
  To: git
  Cc: Dan Nicholson, Eric W. Biederman, Gerrit Pape,
	Johannes Schindelin, Junio C Hamano, Pierre Habouzit

Hello,

	~/gsrc/linux-2.6$ git version
	git version 1.5.6.5

(but with newer git I get the same)

	~/gsrc/linux-2.6$ git checkout v2.6.29-rc8
	Note: moving to "v2.6.29-rc8" which isn't a local branch
	If you want to create a new branch from this checkout, you may do so
	(now or later) by using -b with the checkout command again. Example:
	  git checkout -b <new_branch_name>

	~/gsrc/linux-2.6$ wget -O - http://www.kernel.org/pub/linux/kernel/projects/rt/patch-2.6.29-rc8-rt2-broken-out.tar.bz2 | tar xjf -

	~/gsrc/linux-2.6$ git quiltimport --author="do <nt@kn.ow>"
	origin.patch.bz2
	Patch is empty.  Was it split wrong?

hhmmm, quilt seems to support packed patches.

After bunzip2 origin.patch.bz2 and editing series accordingly I get:

	~/gsrc/linux-2.6$ git quiltimport --author="do <nt@kn.ow>"
	origin.patch
	.dotest/patch:12188: space before tab in indent.
			.platform_data  = &markeins_flash_data,
	.dotest/patch:19521: trailing whitespace.
		
	.dotest/patch:20778: trailing whitespace.
		[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4,	/* BR_ISSUED */ 
	.dotest/patch:21259: trailing whitespace.
		[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x230e4,	/* BR_ISSUED */ 
	.dotest/patch:21548: trailing whitespace.
		[PERF_COUNT_BRANCH_INSTRUCTIONS] = 0x410a0,	/* BR_PRED */ 
	error: cannot apply binary patch to 'Documentation/logo.gif' without full index line
	error: Documentation/logo.gif: patch does not apply

The hunk for Documentation/logo.gif looks as follows:

	diff --git a/Documentation/logo.gif b/Documentation/logo.gif
	deleted file mode 100644
	index 2eae75f..0000000
	Binary files a/Documentation/logo.gif and /dev/null differ

For me this looks complete enough to be applicable:

	~/gsrc/linux-2.6$ git ls-tree HEAD:Documentation | grep logo.gif
	100644 blob 2eae75fecfb965f49065c680063a40c594736ee5	logo.gif

(For these who want to look into the 2nd issue, here is an easier
reproduction recipe:

	~/gsrc/linux-2.6$ git apply --index -C1 - << EOF
	> diff --git a/Documentation/logo.gif b/Documentation/logo.gif
	> deleted file mode 100644
	> index 2eae75f..0000000
	> Binary files a/Documentation/logo.gif and /dev/null differ
	> EOF
	error: cannot apply binary patch to 'Documentation/logo.gif' without full index line
	error: Documentation/logo.gif: patch does not apply

)

For the first issue I have a patch that I'll send as a reply to this
mail.  Luckily this works around the second problem, too :-)

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-König            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH] quiltimport: use quilt to do patch/series parsing and application
  2009-03-20 19:06 git quiltimport and git apply fail importing the PREEMPT_RT patches Uwe Kleine-König
@ 2009-03-20 19:18 ` Uwe Kleine-König
  0 siblings, 0 replies; 2+ messages in thread
From: Uwe Kleine-König @ 2009-03-20 19:18 UTC (permalink / raw)
  To: git
  Cc: Dan Nicholson, Eric W. Biederman, Gerrit Pape,
	Johannes Schindelin, Junio C Hamano, Pierre Habouzit

quilt supports packed patches that are not recognized by quiltimport.
Instead of adding this feature explicitly, use quilt to do the dirty
work.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
Cc: Dan Nicholson <dbn.lists@gmail.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Cc: Gerrit Pape <pape@smarden.org>
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>
Cc: Pierre Habouzit <madcoder@debian.org>
---
Hello,

note I didn't test it deeply, but I succeeded to import the preempt-rt patch.

Things that might be worth testing are:

	missing patches referenced in series
	patch conflicts

Best regards
Uwe

 git-quiltimport.sh |   51 ++++++++++++++++++++++++---------------------------
 1 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/git-quiltimport.sh b/git-quiltimport.sh
index 9a6ba2b..8b76682 100755
--- a/git-quiltimport.sh
+++ b/git-quiltimport.sh
@@ -51,6 +51,7 @@ if ! [ -d "$QUILT_PATCHES" ] ; then
 	echo "The \"$QUILT_PATCHES\" directory does not exist."
 	exit 1
 fi
+export QUILT_PATCHES
 
 # Temporary directories
 tmp_dir="$GIT_DIR"/rebase-apply
@@ -62,31 +63,23 @@ tmp_info="$tmp_dir/info"
 # Find the intial commit
 commit=$(git rev-parse HEAD)
 
+# TODO: assert wc == index == HEAD
+# TODO: assert .pc doesn't exist
+
+# detach HEAD
+git checkout -q "$commit"
+
 mkdir $tmp_dir || exit 2
-while read patch_name level garbage <&3
+while quilt unapplied > /dev/null
 do
-	case "$patch_name" in ''|'#'*) continue;; esac
-	case "$level" in
-	-p*)	;;
-	''|'#'*)
-		level=;;
-	*)
-		echo "unable to parse patch level, ignoring it."
-		level=;;
-	esac
-	case "$garbage" in
-	''|'#'*);;
-	*)
-		echo "trailing garbage found in series file: $garbage"
-		exit 1;;
-	esac
-	if ! [ -f "$QUILT_PATCHES/$patch_name" ] ; then
-		echo "$patch_name doesn't exist. Skipping."
-		continue
-	fi
+	# apply patch
+	quilt push || exit 3
+
+	patch_name="$(quilt top)";
+
 	echo $patch_name
-	git mailinfo "$tmp_msg" "$tmp_patch" \
-		<"$QUILT_PATCHES/$patch_name" >"$tmp_info" || exit 3
+	(quilt header; echo "---") | git mailinfo "$tmp_msg" "$tmp_patch" \
+		>"$tmp_info" || exit 3
 	test -s "$tmp_patch" || {
 		echo "Patch is empty.  Was it split wrong?"
 		exit 1
@@ -129,10 +122,14 @@ do
 	fi
 
 	if [ -z "$dry_run" ] ; then
-		git apply --index -C1 ${level:+"$level"} "$tmp_patch" &&
-		tree=$(git write-tree) &&
-		commit=$( (echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit-tree $tree -p $commit) &&
-		git update-ref -m "quiltimport: $patch_name" HEAD $commit || exit 4
+		quilt files | git update-index --add --remove --stdin &&
+		(echo "$SUBJECT"; echo; cat "$tmp_msg") | git commit -F - ||
+		exit 4
 	fi
-done 3<"$QUILT_PATCHES/series"
+done
+
+if [ -n "$dry_run" ] ; then
+	quilt pop -a;
+fi
+
 rm -rf $tmp_dir || exit 5
-- 
1.6.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-03-20 19:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-20 19:06 git quiltimport and git apply fail importing the PREEMPT_RT patches Uwe Kleine-König
2009-03-20 19:18 ` [PATCH] quiltimport: use quilt to do patch/series parsing and application Uwe Kleine-König

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).