[kernel] r9504 - in dists/trunk/linux-2.6/debian: bin lib/python/debian_linux patches/debian/dfsg patches/series

Bastian Blank waldi at alioth.debian.org
Wed Sep 12 12:27:17 UTC 2007


Author: waldi
Date: Wed Sep 12 12:27:17 2007
New Revision: 9504

Log:
* debian/bin/genorig.py: Apply debian patch.
* debian/lib/python/debian_linux/debian.py: Export dfsg version.
* debian/lib/python/debian_linux/patches.py: Add.
* debian/patches/debian/dfsg/drivers-media-video-dabus.patch,
  debian/patches/debian/dfsg/drivers-net-dgrs.patch,
  debian/patches/debian/dfsg/drivers-net-tokenring-3c359-smctr.patch: Fix.
* debian/patches/series/orig-0: Move from debian/patches/series/orig-1.


Added:
   dists/trunk/linux-2.6/debian/lib/python/debian_linux/patches.py
   dists/trunk/linux-2.6/debian/patches/series/orig-0
      - copied unchanged from r8229, /dists/trunk/linux-2.6/debian/patches/series/orig-1
Removed:
   dists/trunk/linux-2.6/debian/patches/series/orig-1
Modified:
   dists/trunk/linux-2.6/debian/bin/genorig.py
   dists/trunk/linux-2.6/debian/lib/python/debian_linux/debian.py
   dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-media-video-dabus.patch
   dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-dgrs.patch
   dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-tokenring-3c359-smctr.patch

Modified: dists/trunk/linux-2.6/debian/bin/genorig.py
==============================================================================
--- dists/trunk/linux-2.6/debian/bin/genorig.py	(original)
+++ dists/trunk/linux-2.6/debian/bin/genorig.py	Wed Sep 12 12:27:17 2007
@@ -4,32 +4,34 @@
 sys.path.append("debian/lib/python")
 
 import os, os.path, re, shutil
-from debian_linux.debian import Changelog
+from debian_linux.debian import Changelog, VersionLinux
+from debian_linux.patches import PatchSeries
 
-class main(object):
+class Main(object):
     def __init__(self, input_tar, input_patch = None):
         self.log = sys.stdout.write
 
         self.input_tar = input_tar
         self.input_patch = input_patch
 
-        changelog = Changelog()[0]
+        changelog = Changelog(version = VersionLinux)[0]
         source = changelog.source
-        version = changelog.version.upstream
-        self.orig = '%s-%s' % (source, version)
-        self.orig_tar = '%s_%s.orig.tar.gz' % (source, version)
+        self.version = changelog.version
+        self.orig = '%s-%s' % (source, changelog.version.upstream)
+        self.orig_tar = '%s_%s.orig.tar.gz' % (source, changelog.version.upstream)
 
     def __call__(self):
         import tempfile
         self.dir = tempfile.mkdtemp(prefix = 'genorig', dir = 'debian')
         try:
-            self.extract()
-            self.patch()
+            self.upstream_extract()
+            self.upstream_patch()
+            self.debian_patch()
             self.tar()
         finally:
             shutil.rmtree(self.dir)
 
-    def extract(self):
+    def upstream_extract(self):
         self.log("Extracting tarball %s\n" % self.input_tar)
         match = re.match(r'(^|.*/)(?P<dir>linux-\d+\.\d+\.\d+(-\S+)?)\.tar(\.(?P<extension>(bz2|gz)))?$', self.input_tar)
         if not match:
@@ -43,7 +45,7 @@
             raise RuntimeError("Can't extract tarball")
         os.rename(os.path.join(self.dir, match.group('dir')), os.path.join(self.dir, self.orig))
 
-    def patch(self):
+    def upstream_patch(self):
         if self.input_patch is None:
             return
         self.log("Patching source with %s\n" % self.input_patch)
@@ -62,6 +64,17 @@
         if os.spawnv(os.P_WAIT, '/bin/sh', ['sh', '-c', ' '.join(cmdline)]):
             raise RuntimeError("Can't patch source")
 
+    def debian_patch(self):
+        version = self.version.linux_dfsg
+        if version is None:
+            name = "orig-0"
+        else:
+            name = "orig-" + version
+        self.log("Patching source with debian patch (series %s)\n" % name)
+        fp = file("debian/patches/series/" + name)
+        series = PatchSeries(name, "debian/patches", fp)
+        series(dir = os.path.join(self.dir, self.orig))
+
     def tar(self):
         out = os.path.join("../orig", self.orig_tar)
         try:
@@ -78,4 +91,4 @@
         os.chmod(out, 0644)
 
 if __name__ == '__main__':
-    main(*sys.argv[1:])()
+    Main(*sys.argv[1:])()

Modified: dists/trunk/linux-2.6/debian/lib/python/debian_linux/debian.py
==============================================================================
--- dists/trunk/linux-2.6/debian/lib/python/debian_linux/debian.py	(original)
+++ dists/trunk/linux-2.6/debian/lib/python/debian_linux/debian.py	Wed Sep 12 12:27:17 2007
@@ -105,7 +105,10 @@
     )
 )?
 (?:
-    \.dfsg\.\d+
+    \.dfsg\.
+    (?P<dfsg>
+        \d+
+    )
 )?
 -
 (?:[^-]+)
@@ -126,6 +129,7 @@
             self.linux_upstream = '-'.join((d['version'], d['modifier']))
         else:
             self.linux_upstream = d['version']
+        self.linux_dfsg = d['dfsg']
  
 class PackageFieldList(list):
     def __init__(self, value = None):

Added: dists/trunk/linux-2.6/debian/lib/python/debian_linux/patches.py
==============================================================================
--- (empty file)
+++ dists/trunk/linux-2.6/debian/lib/python/debian_linux/patches.py	Wed Sep 12 12:27:17 2007
@@ -0,0 +1,117 @@
+import os, shutil
+
+class Operation(object):
+    def __init__(self, name, fp, data):
+        self.name, self.fp, self.data = name, fp, data
+
+    def __call__(self, dir = '.', reverse = False):
+        try:
+            if not reverse:
+                self.do(dir)
+            else:
+                self.do_reverse(dir)
+            self._log(True)
+        except:
+            self._log(False)
+            raise
+
+    def _log(self, result):
+        if result:
+            s = "OK"
+        else:
+            s = "FAIL"
+        print """  (%s) %-4s %s""" % (self.operation, s, self.name)
+
+    def do(self, dir):
+        raise NotImplementedError
+
+    def do_reverse(self, dir):
+        raise NotImplementedError
+
+class OperationPatch(Operation):
+    def _call(self, dir, extraargs):
+        cmdline = "cd %s; patch -p1 -f -s -t --no-backup-if-mismatch %s" % (dir, extraargs)
+        f = os.popen(cmdline, 'wb')
+        shutil.copyfileobj(self.fp, f)
+        if f.close():
+            raise RuntimeError("Patch failed")
+
+    def patch_push(self, dir):
+        self._call(dir, '--fuzz=1')
+
+    def patch_pop(self, dir):
+        self._call(dir, '-R')
+
+class OperationPatchPush(OperationPatch):
+    operation = '+'
+
+    do = OperationPatch.patch_push
+    do_reverse = OperationPatch.patch_pop
+
+class OperationPatchPop(OperationPatch):
+    operation = '-'
+
+    do = OperationPatch.patch_pop
+    do_reverse = OperationPatch.patch_push
+
+class OperationRemoveFiles(Operation):
+    operation = 'X'
+
+    def do(self, dir):
+        for line in self.fp:
+            line = line.strip()
+            if not line or line[0] == '#':
+                continue
+
+            os.unlink(os.path.join(dir, line))
+
+class PatchSeries(list):
+    operations = {
+        '+': OperationPatchPush,
+        '-': OperationPatchPop,
+        'X': OperationRemoveFiles,
+    }
+
+    def __init__(self, name, root, fp):
+        self.name, self.root = name, root
+
+        from gzip import GzipFile
+        from bz2 import BZ2File
+
+        for line in fp:
+            line = line.strip()
+
+            if not len(line) or line[0] == '#':
+                continue
+
+            items = line.split(' ')
+            operation, filename = items[:2]
+            data = dict(i.split('=', 1) for i in items[2:])
+
+            if operation in self.operations:
+                f = os.path.join(self.root, filename)
+                for suffix, cls in (('', file), ('.bz2', BZ2File), ('.gz', GzipFile)):
+                    f1 = f + suffix
+                    if os.path.exists(f1):
+                        fp = cls(f1)
+                        break
+                else:
+                    raise RuntimeError("Can't find patch %s for series %s" % (filename, self.name))
+            else:
+                raise RuntimeError('Undefined operation "%s" in series %s' % (operation, name))
+
+            self.append(self.operations[operation](filename, fp, data))
+
+    def __call__(self, cond = bool, dir = '.', reverse = False):
+        if not reverse:
+            for i in self:
+                if cond(i):
+                    i(dir = dir, reverse = False)
+        else:
+            for i in self[::-1]:
+                if cond(i):
+                    i(dir = dir, reverse = True)
+
+    def __repr__(self):
+        return '<%s object for %s>' % (self.__class__.__name__, self.name)
+

Modified: dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-media-video-dabus.patch
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-media-video-dabus.patch	(original)
+++ dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-media-video-dabus.patch	Wed Sep 12 12:27:17 2007
@@ -1,10 +1,8 @@
 diff -ruN a/drivers/media/Kconfig b/drivers/media/Kconfig
 --- a/drivers/media/Kconfig	2007-02-04 19:44:54.000000000 +0100
 +++ b/drivers/media/Kconfig	2007-02-05 16:24:30.000000000 +0100
-@@ -85,18 +85,4 @@
- 	tristate
- 	depends on I2C
- 
+@@ -85,16 +85,0 @@
+-if DAB
 -config USB_DABUSB
 -	tristate "DABUSB driver"
 -	depends on USB
@@ -18,16 +16,10 @@
 -
 -	  To compile this driver as a module, choose M here: the
 -	  module will be called dabusb.
+-endif # DAB
 -
- endmenu
 diff -ruN a/drivers/media/video/Makefile b/drivers/media/video/Makefile
 --- a/drivers/media/video/Makefile	2007-02-04 19:44:54.000000000 +0100
 +++ b/drivers/media/video/Makefile	2007-02-05 16:24:30.000000000 +0100
-@@ -94,7 +94,6 @@
- obj-$(CONFIG_VIDEO_CAFE_CCIC) += cafe_ccic.o
- obj-$(CONFIG_VIDEO_OV7670) 	+= ov7670.o
- 
+@@ -94,1 +94,0 @@
 -obj-$(CONFIG_USB_DABUSB)        += dabusb.o
- obj-$(CONFIG_USB_OV511)         += ov511.o
- obj-$(CONFIG_USB_SE401)         += se401.o
- obj-$(CONFIG_USB_STV680)        += stv680.o

Modified: dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-dgrs.patch
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-dgrs.patch	(original)
+++ dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-dgrs.patch	Wed Sep 12 12:27:17 2007
@@ -1,10 +1,7 @@
 diff -ruN a/drivers/net/Kconfig b/drivers/net/Kconfig
 --- a/drivers/net/Kconfig	2007-02-04 19:44:54.000000000 +0100
 +++ b/drivers/net/Kconfig	2007-02-05 16:31:22.000000000 +0100
-@@ -1471,21 +1471,6 @@
- 	tristate "TOSHIBA TC35815 Ethernet support"
- 	depends on NET_PCI && PCI && TOSHIBA_JMR3927
- 
+@@ -1471,15 +1471,0 @@
 -config DGRS
 -	tristate "Digi Intl. RightSwitch SE-X support"
 -	depends on NET_PCI && (PCI || EISA)
@@ -20,17 +17,8 @@
 -	  <file:Documentation/networking/net-modules.txt>.  The module
 -	  will be called dgrs.
 -
- config EEPRO100
- 	tristate "EtherExpressPro/100 support (eepro100, original Becker driver)"
- 	depends on NET_PCI && PCI
 diff -ruN a/drivers/net/Makefile b/drivers/net/Makefile
 --- a/drivers/net/Makefile	2007-02-04 19:44:54.000000000 +0100
 +++ b/drivers/net/Makefile	2007-02-05 16:31:22.000000000 +0100
-@@ -38,7 +38,6 @@
- 
- obj-$(CONFIG_OAKNET) += oaknet.o 8390.o
- 
+@@ -38,1 +38,0 @@
 -obj-$(CONFIG_DGRS) += dgrs.o
- obj-$(CONFIG_VORTEX) += 3c59x.o
- obj-$(CONFIG_TYPHOON) += typhoon.o
- obj-$(CONFIG_NE2K_PCI) += ne2k-pci.o 8390.o

Modified: dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-tokenring-3c359-smctr.patch
==============================================================================
--- dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-tokenring-3c359-smctr.patch	(original)
+++ dists/trunk/linux-2.6/debian/patches/debian/dfsg/drivers-net-tokenring-3c359-smctr.patch	Wed Sep 12 12:27:17 2007
@@ -1,13 +1,10 @@
 diff -ruN a/drivers/net/tokenring/Kconfig b/drivers/net/tokenring/Kconfig
 --- a/drivers/net/tokenring/Kconfig	2006-11-29 21:57:37.000000000 +0000
 +++ b/drivers/net/tokenring/Kconfig	2007-01-05 15:26:27.000000000 +0000
-@@ -64,24 +64,6 @@
- 	  To compile this driver as a module, choose M here: the module will be
- 	  called lanstreamer.
- 
+@@ -64,18 +64,0 @@
 -config 3C359
 -	tristate "3Com 3C359 Token Link Velocity XL adapter support"
--	depends on TR && PCI
+-	depends on PCI
 -	---help---
 -	  This is support for the 3Com PCI Velocity XL cards, specifically
 -	  the 3Com 3C359, please note this is not for the 3C339 cards, you
@@ -23,16 +20,10 @@
 -	  Linux Token Ring Project site for the latest information at
 -	  <http://www.linuxtr.net>
 -
- config TMS380TR
- 	tristate "Generic TMS380 Token Ring ISA/PCI adapter support"
- 	depends on TR && (PCI || ISA && ISA_DMA_API || MCA)
-@@ -166,21 +148,5 @@
- 	  To compile this driver as a module, choose M here: the module will be
- 	  called madgemc.
- 
+@@ -166,16 +148,0 @@
 -config SMCTR
 -	tristate "SMC ISA/MCA adapter support"
--	depends on TR && (ISA || MCA_LEGACY) && (BROKEN || !64BIT)
+-	depends on (ISA || MCA_LEGACY) && (BROKEN || !64BIT)
 -	---help---
 -	  This is support for the ISA and MCA SMC Token Ring cards,
 -	  specifically SMC TokenCard Elite (8115T) and SMC TokenCard Elite/A
@@ -46,14 +37,9 @@
 -	  To compile this driver as a module, choose M here: the module will be
 -	  called smctr.
 -
- endmenu
- 
 diff -ruN a/drivers/net/tokenring/Makefile b/drivers/net/tokenring/Makefile
 --- a/drivers/net/tokenring/Makefile	2006-11-29 21:57:37.000000000 +0000
 +++ b/drivers/net/tokenring/Makefile	2007-01-05 15:26:04.000000000 +0000
-@@ -11,5 +11,3 @@
- obj-$(CONFIG_PROTEON) 	+= proteon.o
- obj-$(CONFIG_TMSPCI) 	+= tmspci.o
- obj-$(CONFIG_SKISA) 	+= skisa.o
+@@ -11,2 +11,0 @@
 -obj-$(CONFIG_SMCTR) 	+= smctr.o
 -obj-$(CONFIG_3C359)	+= 3c359.o



More information about the Kernel-svn-changes mailing list