{"thread":{"id":"17655","subject":"Re: [PATCH] rpm2git (was RPM to GIT tree integration?)","startedAt":"2009-02-08T16:51:04Z","lastAt":"2009-02-09T21:14:10Z","messageCount":2,"participants":["Alex Bennee","Federico Mena Quintero"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"103760","messageId":"b2cdc9f30902080851j724e9fa9s35ff159b775ad614@mail.gmail.com","threadId":"17655","inReplyTo":null,"subject":"Re: [PATCH] rpm2git (was RPM to GIT tree integration?)","fromName":"Alex Bennee","fromEmail":"kernel-hacker@bennee.com","sentAt":"2009-02-08T16:51:04Z","receivedAt":"2009-02-08T16:51:04Z","isPatch":true,"sender":{"key":"kernel-hacker@bennee.com","avatar":null},"body":"2009/2/7 James Davidson <james@greycastle.net>:\n> On Fri Feb 06, 2009 at 05:05:49PM +0000, Alex Bennee <kernel-hacker@bennee.com> wrote:\n>> This is a wild shot in the dark but I thought I'd better ask in case\n>> some one has. Has anyone created a script/tool that can take a src RPM and\n>> apply it's patches (in sequence) to an existing GIT tree?\n>\n> This may be what you are looking for:\n> http://www.gnome.org/~federico/news-2008-07.html#rpm2git\n\nPretty much what I wanted although the script breaks on fancy SPEC's\nthat use variables to evaluate version (like Fedora Core's kernel).\nThe attached patch allows the specification of the branch by hand.\nCC'd to federico.\n\n--\nAlex, homepage: http://www.bennee.com/~alex/\nCV: http://www.bennee.com/~alex/cv.php\n\n\nFrom dd1b69bacb376882da3f820c09451fb764b44116 Mon Sep 17 00:00:00 2001\nFrom: Alex Bennee <alex@bennee.com>\nDate: Sun, 8 Feb 2009 16:45:34 +0000\nSubject: [PATCH] Allow the specification of an exact branch.\n\nComplex RPMs like the Fedora Core kernel evalulate version on the fly. Allow\nthe user to overide the simple grep of the spec file\n---\n Makefile             |    2 +-\n rpm2git.in           |   19 ++++++++++++-------\n 2 files changed, 13 insertions(+), 8 deletions(-)\n mode change 100644 => 100755 rpm2git-patch-helper\n mode change 100644 => 100755 rpm2git.in\n\ndiff --git a/Makefile b/Makefile\nindex 38e836e..d08f20a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1,4 +1,4 @@\n-PREFIX=/usr/local\n+PREFIX=${HOME}/\n LIBDIR=$(PREFIX)/lib\n BINDIR=$(PREFIX)/bin\n \ndiff --git a/rpm2git-patch-helper b/rpm2git-patch-helper\nold mode 100644\nnew mode 100755\ndiff --git a/rpm2git.in b/rpm2git.in\nold mode 100644\nnew mode 100755\nindex e834398..4496c36\n--- a/rpm2git.in\n+++ b/rpm2git.in\n@@ -241,8 +241,8 @@ def rpm2git (from_ref, specfile, dest_branch_name):\n def main (args):\n     option_parser = optparse.OptionParser (\n         usage=\n-\"\"\"usage: %prog --from-ref=<refname> --spec=<specfile> --dest-branch-prefix=<name>\n-example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilus.spec --dest-branch-prefix=opensuse\"\"\")\n+\"\"\"usage: %prog --from-ref=<rexfname> --spec=<specfile> --dest-branch-prefix=<name>\n+example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilus.spec [--dest-branch-prefix=opensuse|--dest-branch=name]\"\"\")\n \n     option_parser.add_option (\"\",\n                               \"--from-ref\", dest=\"from_ref\",\n@@ -253,6 +253,10 @@ example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilu\n                               metavar=\"FILE\",\n                               help=\"Specfile to use to extract patches and version/release info\")\n     option_parser.add_option (\"\",\n+                              \"--dest-branch\", dest=\"dest_branch_name\",\n+                              metavar=\"string\",\n+                              help=\"name of branch that will be generated\")\n+    option_parser.add_option (\"\",\n                               \"--dest-branch-prefix\", dest=\"dest_branch_prefix\",\n                               metavar=\"string\",\n                               help=\"Prefix to use for the branch name that will be generated\")\n@@ -269,7 +273,8 @@ example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilu\n \n     (options, args) = option_parser.parse_args (args)\n \n-    if not (options.from_ref and options.spec and options.dest_branch_prefix) or len (args) != 1:\n+    if not (options.from_ref and options.spec and\n+            (options.dest_branch_prefix or options.dest_branch_name)):\n         print_err (\"Invalid usage; type '%s --help' for instructions\" % sys.argv[0])\n         return 1\n \n@@ -285,10 +290,10 @@ example: %prog --from-ref=NAUTILUS_2_23_1 --spec=/usr/src/packages/SPECS/nautilu\n \n     log (\"----- rpm2git start -----\")\n \n-    dest_branch_name = make_dest_branch_name_from_specfile (options.spec, options.dest_branch_prefix)\n-    if dest_branch_name == None:\n-        log (\"could not generate destination branch name; aborting\")\n-        return 1\n+    if options.dest_branch_name:\n+        dest_branch_name = options.dest_branch_name\n+    else :\n+        dest_branch_name = make_dest_branch_name_from_specfile (options.spec, options.dest_branch_prefix)\n \n     log (\"Will use destination branch name = %s\", dest_branch_name)\n     \n-- \n1.6.0.6\n\n"},{"id":"103900","messageId":"1234214050.328.567.camel@cacharro.xalalinux.org","threadId":"17655","inReplyTo":"b2cdc9f30902080851j724e9fa9s35ff159b775ad614@mail.gmail.com","subject":"Re: [PATCH] rpm2git (was RPM to GIT tree integration?)","fromName":"Federico Mena Quintero","fromEmail":"federico@novell.com","sentAt":"2009-02-09T21:14:10Z","receivedAt":"2009-02-09T21:14:10Z","isPatch":true,"sender":{"key":"federico@novell.com","avatar":null},"body":"On Sun, 2009-02-08 at 16:51 +0000, Alex Bennee wrote:\n\n> Pretty much what I wanted although the script breaks on fancy SPEC's\n> that use variables to evaluate version (like Fedora Core's kernel).\n> The attached patch allows the specification of the branch by hand.\n> CC'd to federico.\n\nVery nice, thanks!  I just pushed this to gitorious, with a few\nstylistic changes.\n\n  Federico\n"}]}