From 63a86cf8e1d12dc7affdbba096659ec1c94e73b8 Mon Sep 17 00:00:00 2001 From: Bastian Blank Date: Sun, 22 Jan 2006 18:34:58 +0000 Subject: [PATCH] * Use own header install target. * Add preliminary modul gencontrol support. * Set version on dependencies of headers-all package. r5335: waldi | 2006-01-07 02:09:14 +0100 debian/rules.real: Fix wildcard for source copy. r5354: waldi | 2006-01-08 16:25:37 +0100 * debian/bin/gencontrol.py: Calculate LOCALVERSION and LOCALVERSION_HEADERS. * debian/rules.real: Remove LOCALVERSION. r5368: waldi | 2006-01-09 01:20:17 +0100 Use minimal headers package build, as we can use a clean tree for that. It puts all arches into the package for now. * debian/bin/gencontrol.py: Set LOCALVERSION on subarch level. * debian/bin/install-header: Remove. * debian/rules.real: Add minimal headers package build. r5538: waldi | 2006-01-21 12:43:55 +0100 debian/rules.real: Only install neccesary files into headers packages. r5539: waldi | 2006-01-21 12:44:44 +0100 * debian/modules: New directory. * debian/modules/gencontrol.py: Add for modules build. r5540: waldi | 2006-01-21 12:56:20 +0100 * debian/bin/gencontrol.py: Set version on dependencies of headers-all package. * debian/rules.real - Fix headers package name. - Install debian/modules into headers-all package. svn path=/dists/trunk/linux-2.6/; revision=5565 --- debian/bin/gencontrol.py | 12 +++++++ debian/bin/install-header | 29 ---------------- debian/modules/gencontrol.py | 41 +++++++++++++++++++++++ debian/rules.real | 65 +++++++++++++++++------------------- 4 files changed, 83 insertions(+), 64 deletions(-) delete mode 100644 debian/bin/install-header create mode 100755 debian/modules/gencontrol.py diff --git a/debian/bin/gencontrol.py b/debian/bin/gencontrol.py index 79ce16c48..bcdf1a5e3 100755 --- a/debian/bin/gencontrol.py +++ b/debian/bin/gencontrol.py @@ -48,6 +48,10 @@ class gencontrol(debian_linux.gencontrol.gencontrol): for i in ('kernel-header-dirs', 'KERNEL_HEADER_DIRS'),: if config_entry.has_key(i[0]): makeflags[i[1]] = config_entry[i[0]] + localversion_headers = '' + if subarch != 'none': + localversion_headers = '-' + subarch + makeflags['LOCALVERSION_HEADERS'] = localversion_headers def do_subarch_packages(self, packages, makefile, arch, subarch, vars, makeflags, extra): headers_subarch = self.templates["control.headers.subarch"] @@ -83,6 +87,14 @@ class gencontrol(debian_linux.gencontrol.gencontrol): ): if config_entry.has_key(i[0]): makeflags[i[1]] = config_entry[i[0]] + localversion = '' + localversion_headers = '' + if subarch != 'none': + localversion = '-' + subarch + localversion_headers = '-' + subarch + localversion += '-' + flavour + makeflags['LOCALVERSION'] = localversion + makeflags['LOCALVERSION_HEADERS'] = localversion_headers def do_flavour_packages(self, packages, makefile, arch, subarch, flavour, vars, makeflags, extra): image = self.templates["control.image"] diff --git a/debian/bin/install-header b/debian/bin/install-header deleted file mode 100644 index a7cff3b4d..000000000 --- a/debian/bin/install-header +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# This is the make-kpkg hook file, which runs when make-kpkg is invoked -# (from debian/rules) to create the flavour-independent kernel-headers -# package. The major tasks it performs is removing unneeded -# include/asm-* directories. -# -set -e - -# The scripts/ directory should be supplied for each flavour, since some -# archs do some *very* strange things... -rm -rf scripts - -# XXX: once we're using a linux-headers-$(version)-$(debnum) that's Arch: all, -# we'll want to drop this bit of code. The asm-* directories should remain. -DIRS="generic $(for i in $KERNEL_HEADER_DIRS; do echo -n '|' $i; done)" - -rm -f include/asm -eval " -for i in include/asm-*; do - case \${i#include/asm-} in - $DIRS) - ;; - *) - rm -rf "\$i" - ;; - esac -done -" diff --git a/debian/modules/gencontrol.py b/debian/modules/gencontrol.py new file mode 100755 index 000000000..284d162ad --- /dev/null +++ b/debian/modules/gencontrol.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python2.4 +import sys +sys.path.append(sys.path[0] + "/../lib/python") +import debian_linux.gencontrol + +class gencontrol(debian_linux.gencontrol.gencontrol): + def do_main_packages(self, packages): + vars = self.changelog_vars + + main = self.templates["control.main"] + packages.extend(self.process_packages(main, vars)) + + def do_flavour_packages(self, packages, makefile, arch, subarch, flavour, vars, makeflags, extra): + modules = self.templates["control.modules"] + modules = self.process_packages(modules, vars) + + for package in modules: + name = package['Package'] + if packages.has_key(name): + package = packages.get(name) + package['Architecture'].append(arch) + else: + package['Architecture'] = [arch] + packages.append(package) + + packages.extend(modules) + + makeflags_string = ' '.join(["%s='%s'" % i for i in makeflags.iteritems()]) + + cmds_binary_arch = [] + cmds_binary_arch.append(("$(MAKE) -f debian/rules.real binary-arch-flavour %s" % makeflags_string,)) + cmds_build = [] + cmds_build.append(("$(MAKE) -f debian/rules.real build %s" % makeflags_string,)) + cmds_setup = [] + cmds_setup.append(("$(MAKE) -f debian/rules.real setup-flavour %s" % makeflags_string,)) + makefile.append(("binary-arch-%s-%s-%s-real:" % (arch, subarch, flavour), cmds_binary_arch)) + makefile.append(("build-%s-%s-%s-real:" % (arch, subarch, flavour), cmds_build)) + makefile.append(("setup-%s-%s-%s-real:" % (arch, subarch, flavour), cmds_setup)) + +if __name__ == '__main__': + gencontrol(sys.path[0] + "/../arch")() diff --git a/debian/rules.real b/debian/rules.real index 3fe07550f..95746897a 100644 --- a/debian/rules.real +++ b/debian/rules.real @@ -17,12 +17,8 @@ export PYTHONPATH = $(CURDIR)/debian/lib/python # ifeq ($(SUBARCH),none) basedir := debian/arch/$(ARCH) - LOCALVERSION := -$(FLAVOUR) - LOCALVERSION_HEADERS := else basedir := debian/arch/$(ARCH)/$(SUBARCH) - LOCALVERSION := -$(SUBARCH)-$(FLAVOUR) - LOCALVERSION_HEADERS := -$(SUBARCH) endif -include $(basedir)/Makefile.inc @@ -36,20 +32,14 @@ include debian/rules.defs # in Makefile.inc. @flavour@ in the expressions is going to be # replaced by the flavour for which the command is run. # -kpkg_header += make-kpkg --append-to-version '$(KPKG_ABINAME)$(LOCALVERSION_HEADERS)' -kpkg_header += --arch '$(ARCH)' -kpkg_header += --stem linux -kpkg_header += --config defconfig kpkg_image := make-kpkg --append-to-version '$(KPKG_ABINAME)$(LOCALVERSION)' kpkg_image += --arch '$(ARCH)' kpkg_image += --stem linux kpkg_image += --initrd ifdef KPKG_SUBARCH kpkg_image += --subarch '$(KPKG_SUBARCH)' - kpkg_header += --subarch '$(KPKG_SUBARCH)' endif ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) - kpkg_header += --cross-compile='$(DEB_HOST_GNU_TYPE)' kpkg_image += --cross-compile='$(DEB_HOST_GNU_TYPE)' endif setup_env := env -u ABINAME -u ARCH -u SUBARCH -u FLAVOUR -u VERSION @@ -73,7 +63,7 @@ binary-indep: install-doc install-patch install-source install-tree build: $(STAMPS_DIR)/build-$(ARCH)-$(SUBARCH)-$(FLAVOUR) setup-arch: $(STAMPS_DIR)/source -setup-subarch: $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH) +setup-subarch: setup-flavour: $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR) # @@ -103,7 +93,7 @@ define patch_cmd cd '$(DIR)'; python2.4 '$(CURDIR)/debian/bin/apply.py' --overwrite-home='$(CURDIR)/debian/patches' --overwrite-source='$(SOURCE_VERSION)' --overwrite-revisions='$(REVISIONS)' endef -srcfiles := $(filter-out debian, $(wildcard *)) +srcfiles := $(filter-out debian, $(wildcard * .[^.]*)) $(STAMPS_DIR)/source: DIR=$(BUILD_DIR)/source $(STAMPS_DIR)/source: debian/bin/apply.py rm -rf '$(DIR)' @@ -152,14 +142,6 @@ $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(BUILD_DIR)/config.$(ARCH)-$ cd '$(DIR)'; $(setup_env) $(kpkg_image) configure touch '$@' -$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/source-$(ARCH)-$(SUBARCH) -$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH) -$(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH): $(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH) - rm -rf '$(DIR)' - cp -al '$(SOURCE_DIR)' '$(DIR)' - cd '$(DIR)'; $(setup_env) $(kpkg_header) configure - touch '$@' - install-base: dh_compress dh_fixperms @@ -211,26 +193,39 @@ install-image-$(ARCH)-$(SUBARCH)-$(FLAVOUR): $(STAMPS_DIR)/build-$(ARCH)-$(SUBAR done rm -rf '$(DIR)' -install-header-$(ARCH)-$(SUBARCH): SOURCE_DIR=$(BUILD_DIR)/build-$(ARCH)-$(SUBARCH) -install-header-$(ARCH)-$(SUBARCH): DIR=$(BUILD_DIR)/$@ -install-header-$(ARCH)-$(SUBARCH): $(STAMPS_DIR)/setup-$(ARCH)-$(SUBARCH) - rm -rf '$(DIR)' - cp -al '$(SOURCE_DIR)' '$(DIR)' - install debian/bin/install-header '$(DIR)/install-header' - cd '$(DIR)'; $(setup_env) HEADER_CLEAN_HOOK='$(CURDIR)/$(DIR)/install-header' $(kpkg_header) kernel-headers - cat '$(DIR)/debian/files' >> debian/files - @for i in $$(awk '{ print $$1; }' '$(DIR)/debian/files'); do \ - echo "mv \"$(BUILD_DIR)/$$i\" .."; \ - mv "$(BUILD_DIR)/$$i" ..; \ - done - rm -rf '$(DIR)' +install-header-$(ARCH)-$(SUBARCH): PACKAGE_NAME = linux-headers-$(VERSION)-$(ABINAME)$(LOCALVERSION_HEADERS) +install-header-$(ARCH)-$(SUBARCH): export DH_OPTIONS = -p$(PACKAGE_NAME) +install-header-$(ARCH)-$(SUBARCH): BASE_DIR = /usr/src/$(PACKAGE_NAME) +install-header-$(ARCH)-$(SUBARCH): SOURCE_DIR = $(BUILD_DIR)/source-$(ARCH)-$(SUBARCH) +install-header-$(ARCH)-$(SUBARCH): DIR = $(CURDIR)/debian/$(PACKAGE_NAME)/$(BASE_DIR) +install-header-$(ARCH)-$(SUBARCH): $(STAMPS_DIR)/source-$(ARCH)-$(SUBARCH) + dh_testdir + dh_testroot + dh_clean -k -d + cd $(SOURCE_DIR); \ + ( \ + find . \ + -path './Documentation/*' -prune -o \ + -path './arch/*' -prune -o \ + -path './include/asm*' -prune -o \ + -path './scripts/*' -prune -o \ + -path './include/' -o \ + \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Rules.make' \) -print; \ + for i in $(KERNEL_HEADER_DIRS); do \ + find arch/$$i \ + \( -name 'Makefile*' -o -name 'Kconfig*' -o -name 'Rules.make' \) -print; \ + find include/asm-$$i -print; \ + done; \ + ) \ + | \ + cpio -pd --preserve-modification-time $(DIR) + $(MAKE) -f debian/rules.real install-base install-headers-all: DH_OPTIONS = -plinux-headers-$(VERSION) install-headers-all: dh_testdir dh_testroot - dh_install $(DH_OPTIONS) debian/arch '/usr/src/linux-headers-$(VERSION)' - dh_install $(DH_OPTIONS) debian/lib '/usr/src/linux-headers-$(VERSION)' + dh_install $(DH_OPTIONS) debian/arch debian/lib debian/modules '/usr/src/linux-headers-$(VERSION)' dh_installdocs $(DH_OPTIONS) dh_installchangelogs $(DH_OPTIONS) dh_python $(DH_OPTIONS) -V 2.4 /usr/src/linux-headers-$(VERSION)/lib/python