[kernel] r6715 - in dists/trunk/firmware-nonfree: . debian debian/templates ipw3945 qlogic qlogic-fw

Bastian Blank waldi at costa.debian.org
Sat May 27 07:32:49 UTC 2006


Author: waldi
Date: Sat May 27 07:32:43 2006
New Revision: 6715

Added:
   dists/trunk/firmware-nonfree/debian/bin/
   dists/trunk/firmware-nonfree/debian/bin/gencontrol.py   (contents, props changed)
   dists/trunk/firmware-nonfree/debian/rules.defs
   dists/trunk/firmware-nonfree/debian/rules.real
   dists/trunk/firmware-nonfree/defines
   dists/trunk/firmware-nonfree/ipw3945/
   dists/trunk/firmware-nonfree/ipw3945/defines
   dists/trunk/firmware-nonfree/qlogic/
   dists/trunk/firmware-nonfree/qlogic/defines
Removed:
   dists/trunk/firmware-nonfree/qlogic-fw/
Modified:
   dists/trunk/firmware-nonfree/debian/changelog
   dists/trunk/firmware-nonfree/debian/rules
   dists/trunk/firmware-nonfree/debian/templates/control.binary.in
   dists/trunk/firmware-nonfree/debian/templates/control.binary.udeb.in

Log:
* debian/bin, ipw3945, qlogic: New directory.
* debian/bin/gencontrol.py, debian/rules.defs, debian/rules.real: Add.
* debian/changelog: Fix package name.
* debian/rules: Use linux-2.6 gencontrol support.
* debian/templates/control.binary.in, debian/templates/control.binary.udeb.in:
  Update.
* defines, ipw3945/defines, qlogic/defines: Add.
* qlogic-fw: Remove.


Added: dists/trunk/firmware-nonfree/debian/bin/gencontrol.py
==============================================================================
--- (empty file)
+++ dists/trunk/firmware-nonfree/debian/bin/gencontrol.py	Sat May 27 07:32:43 2006
@@ -0,0 +1,188 @@
+#!/usr/bin/env python2.4
+import sys
+sys.path.append(sys.argv[1]+ "/lib/python")
+import debian_linux.config
+from debian_linux.debian import *
+from debian_linux.utils import *
+
+class packages_list(sorted_dict):
+    def append(self, package):
+        self[package['Package']] = package
+
+    def extend(self, packages):
+        for package in packages:
+            self[package['Package']] = package
+
+class gencontrol(object):
+    def __init__(self):
+        self.config = config_reader()
+        self.templates = templates()
+
+    def __call__(self):
+        packages = packages_list()
+        makefile = []
+
+        self.do_source(packages)
+        self.do_main(packages, makefile)
+
+        self.write_control(packages.itervalues())
+        self.write_makefile(makefile)
+
+    def do_source(self, packages):
+        source = self.templates["control.source"]
+        packages['source'] = self.process_package(source[0], ())
+
+    def do_main(self, packages, makefile):
+        config_entry = self.config['base',]
+        vars = {}
+        vars.update(config_entry)
+        makeflags = {}
+
+        self.do_main_makefile(makefile, makeflags)
+
+        for package in iter(self.config['base',]['packages']):
+            self.do_package(packages, makefile, package, vars.copy(), makeflags.copy())
+
+    def do_main_makefile(self, makefile, makeflags):
+        for i in ('build', 'binary-arch', 'setup', 'source'):
+            makefile.append(("%s-%%:" % i, ["@true"]))
+
+    def do_package(self, packages, makefile, package, vars, makeflags):
+        config_entry = self.config['base', package]
+        vars.update(config_entry)
+        vars['package'] = package
+
+        makeflags['PACKAGE'] = package
+
+        #self.do_package_setup(vars, makeflags, package)
+        self.do_package_makefile(makefile, package, makeflags)
+        self.do_package_packages(packages, makefile, package, vars, makeflags)
+
+    def do_package_makefile(self, makefile, package, makeflags):
+        makeflags_string = ' '.join(["%s='%s'" % i for i in makeflags.iteritems()])
+
+        cmds_binary_indep = []
+        cmds_binary_indep.append(("$(MAKE) -f debian/rules.real binary-indep %s" % makeflags_string))
+        makefile.append(("binary-indep::", cmds_binary_indep))
+
+    def do_package_packages(self, packages, makefile, package, vars, makeflags):
+        binary = self.templates["control.binary"]
+        binary_udeb = self.templates["control.binary.udeb"]
+        packages_binary = self.process_packages(binary + binary_udeb, vars)
+
+        packages.extend(packages_binary)
+
+    def process_relation(self, key, e, in_e, vars):
+        in_dep = in_e[key]
+        dep = package_relation_list()
+        for in_groups in in_dep:
+            groups = package_relation_group()
+            for in_item in in_groups:
+                item = package_relation()
+                item.name = self.substitute(in_item.name, vars)
+                if in_item.version is not None:
+                    item.version = self.substitute(in_item.version, vars)
+                item.arches = in_item.arches
+                groups.append(item)
+            dep.append(groups)
+        e[key] = dep
+
+    def process_description(self, e, in_e, vars):
+        in_desc = in_e['Description']
+        desc = in_desc.__class__()
+        desc.short = self.substitute(in_desc.short, vars)
+        for i in in_desc.long:
+            desc.long.append(self.substitute(i, vars))
+        e['Description'] = desc
+
+    def process_package(self, in_entry, vars):
+        e = package()
+        for key, value in in_entry.iteritems():
+            if isinstance(value, package_relation_list):
+                self.process_relation(key, e, in_entry, vars)
+            elif key == 'Description':
+                self.process_description(e, in_entry, vars)
+            elif key[:2] == 'X-':
+                pass
+            else:
+                e[key] = self.substitute(value, vars)
+        return e
+
+    def process_packages(self, in_entries, vars):
+        entries = []
+        for i in in_entries:
+            entries.append(self.process_package(i, vars))
+        return entries
+
+    def substitute(self, s, vars):
+        if isinstance(s, (list, tuple)):
+            for i in xrange(len(s)):
+                s[i] = self.substitute(s[i], vars)
+            return s
+        def subst(match):
+            return vars[match.group(1)]
+        return re.sub(r'@([a-z_]+)@', subst, s)
+
+    def write_control(self, list):
+        self.write_rfc822(file("debian/control", 'w'), list)
+
+    def write_makefile(self, out_list):
+        out = file("debian/rules.gen", 'w')
+        for item in out_list:
+            if isinstance(item, (list, tuple)):
+                out.write("%s\n" % item[0])
+                cmd_list = item[1]
+                if isinstance(cmd_list, basestring):
+                    cmd_list = cmd_list.split('\n')
+                for j in cmd_list:
+                    out.write("\t%s\n" % j)
+            else:
+                out.write("%s\n" % item)
+
+    def write_rfc822(self, f, list):
+        for entry in list:
+            for key, value in entry.iteritems():
+                f.write("%s: %s\n" % (key, value))
+            f.write('\n')
+
+class config_reader(debian_linux.config.config_reader):
+    schema = {
+        'packages': debian_linux.config.schema_item_list(),
+    }
+
+    def __init__(self):
+        super(config_reader, self).__init__(['.'])
+        self._read_base()
+
+    def _read_base(self):
+        files = self._get_files(self.config_name)
+        config = debian_linux.config.config_parser(self.schema, files)
+
+        packages = config['base',]['packages']
+
+        for section in iter(config):
+            real = list(section)
+            if real[-1] in packages:
+                real.insert(0, 'base')
+            else:
+                real.insert(0, real.pop())
+            self[tuple(real)] = config[section]
+
+        for package in packages:
+            self._read_package(package)
+
+    def _read_package(self, package):
+        files = self._get_files("%s/%s" % (package, self.config_name))
+        config = debian_linux.config.config_parser(self.schema, files)
+
+        for section in iter(config):
+            real = list(section)
+            real[0:0] = [real.pop()]
+            real[1:1] = [package]
+            real = tuple(real)
+            s = self.get(real, {})
+            s.update(config[section])
+            self[tuple(real)] = s
+
+if __name__ == '__main__':
+    gencontrol()()

Modified: dists/trunk/firmware-nonfree/debian/changelog
==============================================================================
--- dists/trunk/firmware-nonfree/debian/changelog	(original)
+++ dists/trunk/firmware-nonfree/debian/changelog	Sat May 27 07:32:43 2006
@@ -1,4 +1,4 @@
-firmware (0.1) unstable; urgency=low
+firmware-nonfree (0.1) unstable; urgency=low
 
   * Initial release.
 

Modified: dists/trunk/firmware-nonfree/debian/rules
==============================================================================
--- dists/trunk/firmware-nonfree/debian/rules	(original)
+++ dists/trunk/firmware-nonfree/debian/rules	Sat May 27 07:32:43 2006
@@ -1,52 +1,8 @@
 #!/usr/bin/make -f
+SHELL := sh -e
 
-BLOBS   = $(subst _fw,, $(basename $(notdir $(wildcard qlogic-fw/*bin))))
-PACKAGE = firmware 
-PKGUDEB = firmware-di
+include debian/rules.defs
+include /usr/src/linux-support-$(KERNELVERSION)/modules/rules.include
 
-build: build-indep
-
-build-indep: 
-	dh_testdir
-	for pkg in $(PKGUDEB) $(PACKAGE) ; do \
-		for fw in $(BLOBS) ; do \
-			mkdir -p $(CURDIR)/debian/$$pkg-$$fw/lib/firmware/ ; \
-			mkdir -p $(CURDIR)/debian/$$pkg-$$fw/usr/share/initramfs-tools/hooks/ ; \
-			sed -e "s/@firmware@/$$fw/" < $(CURDIR)/initramfs-hook > $(CURDIR)/debian/$$pkg-$$fw/usr/share/initramfs-tools/hooks/firmware-$$fw ; \
-			chmod 755 $(CURDIR)/debian/$$pkg-$$fw/usr/share/initramfs-tools/hooks/firmware-$$fw ; \
-			install -o root -g root -m 644 $(CURDIR)/qlogic-fw/$$fw\_fw.bin $(CURDIR)/debian/$$pkg-$$fw/lib/firmware/ ; \
-		done ; \
-	done ; \
-	for fw in $(BLOBS) ; do \
-		cp $(CURDIR)/debian/templates/firmware.postinst.in $(CURDIR)/debian/$$pkg-$$fw.postinst ; \
-	done 
-
-debian/control:
-	cat debian/templates/control.source.in > debian/control
-	for fw in $(BLOBS);	do cat $(CURDIR)/debian/templates/control.binary.in | sed "s/@controller@/$$fw/" ; done >> $(CURDIR)/debian/control
-	for fw in $(BLOBS);	do cat $(CURDIR)/debian/templates/control.binary.udeb.in | sed "s/@controller@/$$fw/" ; done >> $(CURDIR)/debian/control
-
-clean: debian/control
-	dh_testdir
-	dh_clean
-	-rm $(CURDIR)/debian/*.postinst
-
-install: install-indep
-install-indep:
-
-binary-arch:
-
-binary-indep:
-	dh_testdir
-	dh_testroot
-	dh_installchangelogs
-	dh_installdocs
-	dh_compress
-	dh_fixperms
-	dh_installdeb
-	dh_gencontrol
-	dh_md5sums
-	dh_builddeb
-	
-binary: binary-indep
+GENCONTROL = debian/bin/gencontrol.py /usr/src/linux-support-$(KERNELVERSION)
 

Added: dists/trunk/firmware-nonfree/debian/rules.defs
==============================================================================
--- (empty file)
+++ dists/trunk/firmware-nonfree/debian/rules.defs	Sat May 27 07:32:43 2006
@@ -0,0 +1 @@
+KERNELVERSION := 2.6.17-rc5

Added: dists/trunk/firmware-nonfree/debian/rules.real
==============================================================================
--- (empty file)
+++ dists/trunk/firmware-nonfree/debian/rules.real	Sat May 27 07:32:43 2006
@@ -0,0 +1,34 @@
+SHELL  := sh -e
+DEB_HOST_ARCH     := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_ARCH)
+DEB_HOST_GNU_TYPE := $(shell dpkg-architecture -a$(ARCH) -qDEB_HOST_GNU_TYPE)
+DEB_BUILD_ARCH    := $(shell dpkg-architecture -a$(ARCH) -qDEB_BUILD_ARCH)
+
+export DH_OPTIONS
+
+include debian/rules.defs
+include /usr/src/linux-support-$(KERNELVERSION)/modules/rules.real.include
+
+#
+# Targets
+#
+binary-indep: install
+
+install-base:
+	dh_installdirs
+	dh_installchangelogs
+	dh_installdocs
+	dh_compress
+	dh_fixperms
+	dh_installdeb
+	dh_gencontrol -- $(GENCONTROL_ARGS)
+	dh_md5sums
+	dh_builddeb
+
+install: PACKAGE_NAME = firmware-$(PACKAGE) -pfirmware-$(PACKAGE)-di
+install: PACKAGE_NAME_UDEB = firmware-$(PACKAGE)-di
+install: DH_OPTIONS = -p$(PACKAGE_NAME) -p$(PACKAGE_NAME_UDEB)
+install:
+	dh_testdir
+	dh_testroot
+	$(MAKE) -f debian/rules.real install-base
+

Modified: dists/trunk/firmware-nonfree/debian/templates/control.binary.in
==============================================================================
--- dists/trunk/firmware-nonfree/debian/templates/control.binary.in	(original)
+++ dists/trunk/firmware-nonfree/debian/templates/control.binary.in	Sat May 27 07:32:43 2006
@@ -1,4 +1,4 @@
-Package: firmware- at name@
+Package: firmware- at package@
 Architecture: all
 Section: non-free/base
 Priority: optional

Modified: dists/trunk/firmware-nonfree/debian/templates/control.binary.udeb.in
==============================================================================
--- dists/trunk/firmware-nonfree/debian/templates/control.binary.udeb.in	(original)
+++ dists/trunk/firmware-nonfree/debian/templates/control.binary.udeb.in	Sat May 27 07:32:43 2006
@@ -1,8 +1,8 @@
-Package: firmware- at name@-di
+Package: firmware- at package@-di
 XC-Package-Type: udeb
+Architecture: all
 Section: non-free/debian-installer
 Priority: optional
-Architecture: all
 Description: Binary firmware for @desc@
  This package contains the binary firmware for @longdesc at .
 

Added: dists/trunk/firmware-nonfree/defines
==============================================================================
--- (empty file)
+++ dists/trunk/firmware-nonfree/defines	Sat May 27 07:32:43 2006
@@ -0,0 +1,4 @@
+[base]
+packages:
+ ipw3945
+ qlogic

Added: dists/trunk/firmware-nonfree/ipw3945/defines
==============================================================================
--- (empty file)
+++ dists/trunk/firmware-nonfree/ipw3945/defines	Sat May 27 07:32:43 2006
@@ -0,0 +1,6 @@
+[base]
+desc: IPW3945
+files:
+ ipw3945.ucode
+longdesc: IPW3945
+

Added: dists/trunk/firmware-nonfree/qlogic/defines
==============================================================================
--- (empty file)
+++ dists/trunk/firmware-nonfree/qlogic/defines	Sat May 27 07:32:43 2006
@@ -0,0 +1,10 @@
+[base]
+desc: QLOGIC
+files:
+ ql2100_fw.bin
+ ql2200_fw.bin
+ ql2300_fw.bin
+ ql2322_fw.bin
+ ql2400_fw.bin
+longdesc: QLOGIC
+



More information about the Kernel-svn-changes mailing list