[csw-devel] SF.net SVN: opencsw:[305] utilities/patch_assist.py
wahwah at users.sourceforge.net
wahwah at users.sourceforge.net
Mon Feb 21 02:22:06 CET 2011
Revision: 305
http://opencsw.svn.sourceforge.net/opencsw/?rev=305&view=rev
Author: wahwah
Date: 2011-02-21 01:22:06 +0000 (Mon, 21 Feb 2011)
Log Message:
-----------
patch_assist.py: Removing an obsolete file
Replaced by 'makepatch' in gar.
Removed Paths:
-------------
utilities/patch_assist.py
Deleted: utilities/patch_assist.py
===================================================================
--- utilities/patch_assist.py 2011-02-21 01:13:11 UTC (rev 304)
+++ utilities/patch_assist.py 2011-02-21 01:22:06 UTC (rev 305)
@@ -1,45 +0,0 @@
-#!/opt/csw/bin/python2.6
-# coding=utf-8
-
-"""This file makes it easier to create a casual patch when working with GAR."""
-
-import optparse
-import shutil
-import os.path
-import logging
-import subprocess
-
-def main():
- logging.basicConfig(level=logging.DEBUG)
- parser = optparse.OptionParser()
- parser.add_option("-n", "--patch-name", dest="patch_name",
- help="Patch name")
- options, args = parser.parse_args()
-
- file_path = args[0]
- base_path, file_name = os.path.split(file_path)
- # Make a backup copy if it doesn't exist
- orig_file_path = os.path.join(base_path, "%s.orig" % file_name)
- if not os.path.exists(orig_file_path):
- shutil.copy(file_path, orig_file_path)
- path_parts = file_path.split("/")
- worksrc = "/".join(path_parts[0:3])
- relative_file_path = "/".join(path_parts[3:])
- patch_path = os.path.join("files", "%s.patch" % options.patch_name)
- # Edit the file
- subprocess.call(["vim", file_path])
- # e.g.
- # work/solaris8-sparc/build-isa-sparcv8/nspr-4.8/mozilla/nsprpub/configure
- args = ["gdiff", "-u", relative_file_path + ".orig", relative_file_path]
- logging.debug("Creating a diff: %s %s", args, worksrc)
- diff_proc = subprocess.Popen(args, cwd=worksrc, stdout=subprocess.PIPE)
- stdout, stderr = diff_proc.communicate()
- diff_proc.wait()
- fd = open(patch_path, "w")
- fd.write(stdout)
- fd.close()
- print "cat", patch_path
-
-
-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