git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] rpm2git (was RPM to GIT tree integration?)
@ 2009-02-08 16:51 Alex Bennee
  2009-02-09 21:14 ` Federico Mena Quintero
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Bennee @ 2009-02-08 16:51 UTC (permalink / raw)
  To: Alex Bennee, git, federico

[-- Attachment #1: Type: text/plain, Size: 760 bytes --]

2009/2/7 James Davidson <james@greycastle.net>:
> On Fri Feb 06, 2009 at 05:05:49PM +0000, Alex Bennee <kernel-hacker@bennee.com> wrote:
>> This is a wild shot in the dark but I thought I'd better ask in case
>> some one has. Has anyone created a script/tool that can take a src RPM and
>> apply it's patches (in sequence) to an existing GIT tree?
>
> This may be what you are looking for:
> http://www.gnome.org/~federico/news-2008-07.html#rpm2git

Pretty much what I wanted although the script breaks on fancy SPEC's
that use variables to evaluate version (like Fedora Core's kernel).
The attached patch allows the specification of the branch by hand.
CC'd to federico.

--
Alex, homepage: http://www.bennee.com/~alex/
CV: http://www.bennee.com/~alex/cv.php

[-- Attachment #2: 0001-Allow-the-specification-of-an-exact-branch.patch --]
[-- Type: application/octet-stream, Size: 3554 bytes --]

From dd1b69bacb376882da3f820c09451fb764b44116 Mon Sep 17 00:00:00 2001
From: Alex Bennee <alex@bennee.com>
Date: Sun, 8 Feb 2009 16:45:34 +0000
Subject: [PATCH] Allow the specification of an exact branch.

Complex RPMs like the Fedora Core kernel evalulate version on the fly. Allow
the user to overide the simple grep of the spec file
---
 Makefile             |    2 +-
 rpm2git.in           |   19 ++++++++++++-------
 2 files changed, 13 insertions(+), 8 deletions(-)
 mode change 100644 => 100755 rpm2git-patch-helper
 mode change 100644 => 100755 rpm2git.in

diff --git a/Makefile b/Makefile
index 38e836e..d08f20a 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-PREFIX=/usr/local
+PREFIX=${HOME}/
 LIBDIR=$(PREFIX)/lib
 BINDIR=$(PREFIX)/bin
 
diff --git a/rpm2git-patch-helper b/rpm2git-patch-helper
old mode 100644
new mode 100755
diff --git a/rpm2git.in b/rpm2git.in
old mode 100644
new mode 100755
index e834398..4496c36
--- a/rpm2git.in
+++ b/rpm2git.in
@@ -241,8 +241,8 @@ def rpm2git (from_ref, specfile, dest_branch_name):
 def main (args):
     option_parser = optparse.OptionParser (
         usage=
-"""usage: %prog --from-ref=<refname> --spec=<specfile> --dest-branch-prefix=<name>
-example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilus.spec --dest-branch-prefix=opensuse""")
+"""usage: %prog --from-ref=<rexfname> --spec=<specfile> --dest-branch-prefix=<name>
+example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilus.spec [--dest-branch-prefix=opensuse|--dest-branch=name]""")
 
     option_parser.add_option ("",
                               "--from-ref", dest="from_ref",
@@ -253,6 +253,10 @@ example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilu
                               metavar="FILE",
                               help="Specfile to use to extract patches and version/release info")
     option_parser.add_option ("",
+                              "--dest-branch", dest="dest_branch_name",
+                              metavar="string",
+                              help="name of branch that will be generated")
+    option_parser.add_option ("",
                               "--dest-branch-prefix", dest="dest_branch_prefix",
                               metavar="string",
                               help="Prefix to use for the branch name that will be generated")
@@ -269,7 +273,8 @@ example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilu
 
     (options, args) = option_parser.parse_args (args)
 
-    if not (options.from_ref and options.spec and options.dest_branch_prefix) or len (args) != 1:
+    if not (options.from_ref and options.spec and
+            (options.dest_branch_prefix or options.dest_branch_name)):
         print_err ("Invalid usage; type '%s --help' for instructions" % sys.argv[0])
         return 1
 
@@ -285,10 +290,10 @@ example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilu
 
     log ("----- rpm2git start -----")
 
-    dest_branch_name = make_dest_branch_name_from_specfile (options.spec, options.dest_branch_prefix)
-    if dest_branch_name == None:
-        log ("could not generate destination branch name; aborting")
-        return 1
+    if options.dest_branch_name:
+        dest_branch_name = options.dest_branch_name
+    else :
+        dest_branch_name = make_dest_branch_name_from_specfile (options.spec, options.dest_branch_prefix)
 
     log ("Will use destination branch name = %s", dest_branch_name)
     
-- 
1.6.0.6


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

end of thread, other threads:[~2009-02-09 21:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-08 16:51 [PATCH] rpm2git (was RPM to GIT tree integration?) Alex Bennee
2009-02-09 21:14 ` Federico Mena Quintero

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).