[kernel] r8124 - dists/sid/linux-2.6/debian/templates
Bastian Blank
waldi at alioth.debian.org
Fri Jan 5 17:13:45 CET 2007
Author: waldi
Date: Fri Jan 5 17:13:45 2007
New Revision: 8124
Modified:
dists/sid/linux-2.6/debian/templates/patch.apply.in
Log:
debian/templates/patch.apply.in: Add some sort of support to patch origs.
Modified: dists/sid/linux-2.6/debian/templates/patch.apply.in
==============================================================================
--- dists/sid/linux-2.6/debian/templates/patch.apply.in (original)
+++ dists/sid/linux-2.6/debian/templates/patch.apply.in Fri Jan 5 17:13:45 2007
@@ -195,6 +195,63 @@
return ret
+class series_orig(series):
+ def __init__(self, name, home):
+ self.name = name
+
+ filename = os.path.join(home, 'series', 'orig-' + name)
+ if not os.path.exists(filename):
+ raise RuntimeError, "Can't find series file for %s" % name
+
+ f = file(filename)
+ for line in f.readlines():
+ line = line.strip()
+
+ if len(line) == 0 or line[0] == '#':
+ continue
+
+ items = line.split(' ')
+ operation, patch = items[:2]
+
+ if operation == '+':
+ patchfile = os.path.join(home, patch)
+ for suffix, type in (('', 0), ('.bz2', 1), ('.gz', 2)):
+ if os.path.exists(patchfile + suffix):
+ patchinfo = patchfile + suffix, type
+ break
+ else:
+ raise RuntimeError, "Can't find patch %s for series %s" % (patchfile, name)
+ elif operation == 'X':
+ patchfile = os.path.join(home, patch)
+ if os.path.exists(patchfile):
+ patchinfo = patchfile
+ else:
+ raise RuntimeError, "Can't find patch %s for series %s" % (patchfile, name)
+ else:
+ raise RuntimeError, 'Undefined operation "%s" in series %s' % (operation, name)
+
+ self.append((operation, patch, patchinfo))
+
+ def apply(self):
+ for operation, patch, patchinfo in self:
+ if operation == '+':
+ self.patch_apply(patch, patchinfo)
+ elif operation == 'X':
+ self.files_remove(patch, patchinfo)
+ print "--> %s fully applied." % self.name
+
+ def files_remove(self, patch, patchinfo):
+ for line in file(patchinfo):
+ line = line.strip()
+ if len(line) == 0 or line[0] == '#':
+ continue
+
+ os.unlink(line)
+
+ print """\
+ (X) OK %s\
+""" % patch
+
class version(object):
__slots__ = "upstream", "revision"
@@ -288,6 +345,12 @@
print "Too much arguments"
return
+ if options.orig:
+ do_orig(options)
+ else:
+ do(options, args)
+
+def do(options, args):
home = options.home
revisions = ['0'] + options.revisions.split()
source = version(options.source)
@@ -360,6 +423,9 @@
i.apply()
vfile.commit(target, real_extra)
+def do_orig(options):
+ series_orig(options.orig, options.home).apply()
+
def parse_options():
from optparse import OptionParser
parser = OptionParser(
@@ -400,6 +466,10 @@
default = _default_source, dest = 'source',
help = "overwrite source [default: %default]",
)
+ parser.add_option(
+ '--orig',
+ dest = 'orig',
+ )
options, args = parser.parse_args()
More information about the Kernel-svn-changes
mailing list