[kernel] r8125 - dists/sid/linux-2.6/debian/bin

Bastian Blank waldi at alioth.debian.org
Fri Jan 5 17:14:02 CET 2007


Author: waldi
Date: Fri Jan  5 17:14:02 2007
New Revision: 8125

Added:
   dists/sid/linux-2.6/debian/bin/genorig.py
      - copied, changed from r8098, dists/trunk/linux-2.6/debian/bin/genorig.py
Log:
debian/bin/genorig.py: Add.


Copied: dists/sid/linux-2.6/debian/bin/genorig.py (from r8098, dists/trunk/linux-2.6/debian/bin/genorig.py)
==============================================================================
--- dists/trunk/linux-2.6/debian/bin/genorig.py	(original)
+++ dists/sid/linux-2.6/debian/bin/genorig.py	Fri Jan  5 17:14:02 2007
@@ -3,12 +3,11 @@
 import sys
 sys.path.append("debian/lib/python")
 
-import os, os.path, re
+import os, os.path, re, shutil
 from debian_linux.debian import read_changelog
-from debian_linux.utils import rmtree
 
 class main(object):
-    def __init__(self, input_tar, input_patch = None):
+    def __init__(self, input_tar, input_patch):
         self.log = sys.stdout.write
 
         self.input_tar = input_tar
@@ -28,7 +27,7 @@
             self.patch()
             self.tar()
         finally:
-            rmtree(self.dir)
+            shutil.rmtree(self.dir)
 
     def extract(self):
         self.log("Extracting tarball %s\n" % self.input_tar)
@@ -45,23 +44,10 @@
         os.rename(os.path.join(self.dir, match.group('dir')), os.path.join(self.dir, self.orig))
 
     def patch(self):
-        if self.input_patch is None:
-            return
-        self.log("Patching source with %s\n" % self.input_patch)
-        match = re.match(r'(^|.*/)(patch-\d+\.\d+\.\d+(-\S+)?(\.(?P<extension>(bz2|gz))))?$', self.input_patch)
-        if not match:
-            raise RuntimeError("Can't identify name of patch")
-        cmdline = []
-        if match.group('extension') == 'bz2':
-            cmdline.append('bzcat')
-        elif match.group('extension') == 'gz':
-            cmdline.append('zcat')
-        else:
-            cmdline.append('cat')
-        cmdline.append(self.input_patch)
-        cmdline.append('| (cd %s; patch -p1 -f -s -t --no-backup-if-mismatch)' % os.path.join(self.dir, self.orig))
-        if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]):
-            raise RuntimeError("Can't patch source")
+        self.log("Patching with debian patch source-%s\n" % self.input_patch)
+        cmdline = 'cd %s; python2.4 ../../bin/patch.apply --overwrite-home=../../patches --orig=%s' % (os.path.join(self.dir, self.orig), self.input_patch)
+        if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', cmdline]):
+            raise RuntimeError("Can't extract tarball")
 
     def tar(self):
         out = os.path.join("../orig", self.orig_tar)



More information about the Kernel-svn-changes mailing list