[kernel] r5179 - in people/waldi/linux-2.6/debian: . bin

Bastian Blank waldi at costa.debian.org
Mon Jan 2 23:15:07 UTC 2006


Author: waldi
Date: Mon Jan  2 23:15:05 2006
New Revision: 5179

Modified:
   people/waldi/linux-2.6/debian/bin/apply.py
   people/waldi/linux-2.6/debian/bin/unpatch
   people/waldi/linux-2.6/debian/rules.real
Log:
* debian/bin/apply.py: Implement arch and subarch specific patches.
* debian/bin/unpatch: Remove old code.
* debian/rules.real: Fix patch package installation.


Modified: people/waldi/linux-2.6/debian/bin/apply.py
==============================================================================
--- people/waldi/linux-2.6/debian/bin/apply.py	(original)
+++ people/waldi/linux-2.6/debian/bin/apply.py	Mon Jan  2 23:15:05 2006
@@ -4,7 +4,7 @@
 from warnings import warn
 import debian_linux
 
-_default_home = ""
+_default_home = "@home@"
 _default_revisions = "@revisions@"
 _default_source = "@source@"
 
@@ -44,13 +44,37 @@
             else:
                 raise RuntimeError, 'Undefined operation "%s" in series %s' % (operation, name)
 
-            self.append((operation, patch, patchinfo))
+            add = {}
+            for s in items[2:]:
+                s = tuple(s.split('_'))
+                if len(s) > 2:
+                    raise RuntimeError, "parse error"
+                if len(s) == 2:
+                    raise RuntimeError, "Patch per flavour is not supported currently"
+                add[s] = True
+
+            self.append((operation, patch, patchinfo, add))
 
     def __repr__(self):
         return '<%s object for %s>' % (self.__class__.__name__, self.name)
 
-    def apply(self):
-        for operation, patch, patchinfo in self:
+    def _check_add(self, add, options):
+        i = []
+        if options.arch is not None:
+            i.append(options.arch)
+        if options.subarch is not None:
+            i.append(options.subarch)
+        if add.has_key(tuple(i)):
+            return True
+        return False
+
+    def apply(self, options):
+        for operation, patch, patchinfo, add in self:
+            if add and not self._check_add(add, options):
+                print """\
+  (.) IGNORED   %s\
+""" % patch
+                continue
             if operation == '+':
                 self.patch_apply(patch, patchinfo)
             elif operation == '-':
@@ -62,8 +86,13 @@
 """ % patch
         print "--> %s fully applied." % self.name
 
-    def deapply(self):
+    def deapply(self, options):
         for operation, patch, patchinfo in self[::-1]:
+            if add and not self._check_add(add, options):
+                print """\
+  (.) IGNORED   %s\
+""" % patch
+                continue
             if operation == '+':
                 self.patch_deapply(patch, patchinfo)
             elif operation == '-':
@@ -165,7 +194,7 @@
         warn('No %s file, assuming pristine Linux %s' % (version_file, source.upstream))
         current = version()
         current.upstream = source.upstream
-        current.revision = None
+        current.revision = '0'
 
     if current.revision not in revisions:
         raise RuntimeError, "Current revision is not in our list of revisions"
@@ -184,14 +213,14 @@
         s = series.read_all(consider, home)
         file(version_file, 'w').write('unstable\n')
         for i in s:
-            i.apply()
+            i.apply(options)
         file(version_file, 'w').write('%s\n' % target)
     elif current_index > target_index:
         consider = revisions[current_index + 1:target_index:-1]
         s = series.read_all(consider, home)
         file(version_file, 'w').write('unstable\n')
         for i in s:
-            i.deapply()
+            i.deapply(options)
         file(version_file, 'w').write('%s\n' % target)
 
 def parse_options():
@@ -253,4 +282,5 @@
         main()
     except RuntimeError, e:
         sys.stderr.write("Error: %s\n" % e)
+        raise SystemExit, 1
 

Modified: people/waldi/linux-2.6/debian/bin/unpatch
==============================================================================
--- people/waldi/linux-2.6/debian/bin/unpatch	(original)
+++ people/waldi/linux-2.6/debian/bin/unpatch	Mon Jan  2 23:15:05 2006
@@ -1,8 +1,5 @@
 #!/bin/sh
-# $Id: unpatch,v 1.3 2003/06/30 12:49:09 herbert Exp $
-
 set -e
 
-upstream=${override_upstream:- at upstream@}
-
-/usr/src/kernel-patches/all/$upstream/apply/debian $upstream-0
+upstream="@upstream@"
+exec "/usr/src/kernel-patches/all/$upstream/apply/debian" "$upstream-0"

Modified: people/waldi/linux-2.6/debian/rules.real
==============================================================================
--- people/waldi/linux-2.6/debian/rules.real	(original)
+++ people/waldi/linux-2.6/debian/rules.real	Mon Jan  2 23:15:05 2006
@@ -105,7 +105,7 @@
 	rm -rf '$(DIR)'
 	mkdir -p '$(DIR)'
 	cp -al $(srcfiles) '$(DIR)'
-	cd '$(DIR)'; python2.4 '$(CURDIR)/debian/bin/apply.py'  --overwrite-home='$(CURDIR)/debian/patches-debian' --overwrite-source='$(SOURCE_VERSION)' --overwrite-revisions='$(REVISIONS)'
+	cd '$(DIR)'; python2.4 '$(CURDIR)/debian/bin/apply.py' -a '$(ARCH)' --overwrite-home='$(CURDIR)/debian/patches-debian' --overwrite-source='$(SOURCE_VERSION)' --overwrite-revisions='$(REVISIONS)'
 	#make-kpkg does this when building kernel-source.
 	mv '$(DIR)/scripts/package/Makefile' '$(DIR)/scripts/package/Makefile.dist'
 	mv '$(DIR)/scripts/package/builddeb' '$(DIR)/scripts/package/builddeb.dist'
@@ -253,7 +253,11 @@
 	dh_installdirs $(DH_OPTIONS) '$(pbase)/apply' '$(pbase)/debian' '$(pbase)/unpatch'
 	dh_install $(DH_OPTIONS) debian/patches-debian/* '$(pbase)/debian'
 #	Install the debian patches
-	sed -e 's/@version@/$(SOURCE_VERSION)/g' -e 's/@revisions@/$(REVISIONS)/' debian/bin/apply > '$(pfull)/apply/debian'
+	sed \
+	  -e 's, at home@,$(pbase)/debian,' \
+	  -e 's, at revisions@,$(REVISIONS),' \
+	  -e 's, at source@,$(SOURCE_VERSION),' \
+	  debian/bin/apply.py > '$(pfull)/apply/debian'
 	sed -e 's/@upstream@/$(SOURCE_UPSTREAM)/g' debian/bin/unpatch > '$(pfull)/unpatch/debian'
 	chmod 755 '$(pfull)/apply/debian' '$(pfull)/unpatch/debian'
 	chmod 644 '$(pfull)/debian/'*.patch



More information about the Kernel-svn-changes mailing list