[csw-devel] SF.net SVN: gar:[11376] csw/mgar/gar/v2/lib/python/patch_package.py

wahwah at users.sourceforge.net wahwah at users.sourceforge.net
Fri Oct 22 10:01:18 CEST 2010


Revision: 11376
          http://gar.svn.sourceforge.net/gar/?rev=11376&view=rev
Author:   wahwah
Date:     2010-10-22 08:01:18 +0000 (Fri, 22 Oct 2010)

Log Message:
-----------
mGAR v2: patchpkg, the first version of the user interface.

Modified Paths:
--------------
    csw/mgar/gar/v2/lib/python/patch_package.py

Modified: csw/mgar/gar/v2/lib/python/patch_package.py
===================================================================
--- csw/mgar/gar/v2/lib/python/patch_package.py	2010-10-22 08:00:58 UTC (rev 11375)
+++ csw/mgar/gar/v2/lib/python/patch_package.py	2010-10-22 08:01:18 UTC (rev 11376)
@@ -3,7 +3,12 @@
 # A utility to patch an existing package.
 # 
 # Usage:
-# patchpkg --dir /tmp/foo --patch foo.patch --catalogname foo
+# patchpkg --srv4-file /tmp/foo-1.0-sparc-CSW.pkg.gz --export /work/dir
+# cd /work/dir/CSWfoo
+# vim ...
+# git commit -a -m "Change description..."
+# git format-patch HEAD^
+# patchpkg --srv4-file /tmp/foo-1.0-sparc-CSW.pkg.gz --patch /work/dir/0001-...patch
 
 import datetime
 import optparse
@@ -17,16 +22,10 @@
 
 def main():
   parser = optparse.OptionParser()
-  parser.add_option("--dir", "-d", dest="dir",
-      help="Directory with packages.")
+  parser.add_option("--srv4-file", "-s", dest="srv4_file",
+      help="Package to modify, e.g. foo-1.0-sparc-CSW.pkg.gz")
   parser.add_option("--patch", "-p", dest="patch",
       help="Patch to apply")
-  parser.add_option("--patch-sparc", dest="patch_sparc",
-      help="Patch to apply (sparc specific)")
-  parser.add_option("--patch-x86", dest="patch_x86",
-      help="Patch to apply (x86 specific)")
-  parser.add_option("--catalogname", "-c", dest="catalogname",
-      help="Catalogname")
   parser.add_option("--debug", dest="debug",
       action="store_true", default=False,
       help="Debug")
@@ -35,13 +34,20 @@
   options, args = parser.parse_args()
   logging_level = logging.DEBUG if options.debug else logging.INFO
   logging.basicConfig(level=logging_level)
-  logging.debug("Start!")
-  ps = package.PackageSurgeon(
-      "/home/maciej/tmp/mozilla-1.7.5-SunOS5.8-sparc-CSW.pkg.gz",
-      debug=options.debug)
-  # ps.Export("/home/maciej/tmp")
-  ps.Patch("/home/maciej/tmp/0001-Removing-nspr.m4-and-headers.patch")
-  ps.ToSrv4("/home/maciej/tmp")
+  if options.export and options.srv4_file:
+    ps = package.PackageSurgeon(
+        options.srv4_file,
+        debug=options.debug)
+    ps.Export(options.export)
+  elif options.srv4_file and options.patch:
+    ps = package.PackageSurgeon(
+        options.srv4_file,
+        debug=options.debug)
+    ps.Patch(options.patch)
+    base_dir, pkg_basename = os.path.split(options.srv4_file)
+    ps.ToSrv4(base_dir)
+  else:
+    print "See --help for usage information"
 
 if __name__ == '__main__':
   main()


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.


More information about the devel mailing list