git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Bennee <kernel-hacker@bennee.com>
To: Alex Bennee <kernel-hacker@bennee.com>,
	git@vger.kernel.org, federico@gnome.org
Subject: Re: [PATCH] rpm2git (was RPM to GIT tree integration?)
Date: Sun, 8 Feb 2009 16:51:04 +0000	[thread overview]
Message-ID: <b2cdc9f30902080851j724e9fa9s35ff159b775ad614@mail.gmail.com> (raw)

[-- 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


             reply	other threads:[~2009-02-08 16:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-08 16:51 Alex Bennee [this message]
2009-02-09 21:14 ` [PATCH] rpm2git (was RPM to GIT tree integration?) Federico Mena Quintero

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b2cdc9f30902080851j724e9fa9s35ff159b775ad614@mail.gmail.com \
    --to=kernel-hacker@bennee.com \
    --cc=federico@gnome.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).