Use dh_listpackages to determine which packages to build
The packages we should build are restricted by: * Package configuration in debian/config (limits which binary packages are included in debian/control) * Architecture (specified per package in debian/templates/control.* and then in debian/control) * Build profile (specified per package in debian/templates/control.* and then in debian/control) The logic for these restrictions is currently repeated in debian/rules.real, but sometimes it becomes inconsistent with debian/control (as with my recent changes for libbpf). dh_listpackages reads debian/control and filters it by the current host architecture and build profiles, so that it reliably reports which packages we should build. Therefore: * Replace the logic in debian/rules.real with checks for package names in the output of dh_listpackages * Remove the redundant flag variables passed by debian/rules and debian/rules.gen * Remove the special-casing of stage1 in debian/rules and debian/rules.gen
This commit is contained in:
parent
46fcfa88d1
commit
fdd6dadb4a
|
@ -77,10 +77,6 @@ class Gencontrol(Base):
|
|||
'ABINAME': self.abiname_version + self.abiname_part,
|
||||
'SOURCEVERSION': self.version.complete,
|
||||
})
|
||||
if not self.config.merge('packages').get('tools-unversioned', True):
|
||||
makeflags['DO_TOOLS_UNVERSIONED'] = False
|
||||
if not self.config.merge('packages').get('tools-versioned', True):
|
||||
makeflags['DO_TOOLS_VERSIONED'] = False
|
||||
makeflags['SOURCE_BASENAME'] = self.vars['source_basename']
|
||||
|
||||
# Prepare to generate debian/tests/control
|
||||
|
@ -167,10 +163,6 @@ class Gencontrol(Base):
|
|||
|
||||
makeflags = makeflags.copy()
|
||||
makeflags['ALL_FEATURESETS'] = ' '.join(fs_enabled)
|
||||
if not self.config.merge('packages').get('docs', True):
|
||||
makeflags['DO_DOCS'] = False
|
||||
if not self.config.merge('packages').get('source', True):
|
||||
makeflags['DO_SOURCE'] = False
|
||||
super(Gencontrol, self).do_main_makefile(makefile, makeflags, extra)
|
||||
|
||||
def do_main_packages(self, packages, vars, makeflags, extra):
|
||||
|
@ -264,13 +256,10 @@ class Gencontrol(Base):
|
|||
packages_headers_arch[-1]['Depends'])
|
||||
else:
|
||||
packages_headers_arch = []
|
||||
makeflags['DO_HEADERS_ALL'] = False
|
||||
|
||||
if self.config.merge('packages').get('libc-dev', True):
|
||||
libc_dev = self.templates["control.libc-dev"]
|
||||
packages_headers_arch[0:0] = self.process_packages(libc_dev, {})
|
||||
else:
|
||||
makeflags['DO_LIBC'] = False
|
||||
|
||||
merge_packages(packages, packages_headers_arch, arch)
|
||||
|
||||
|
@ -280,8 +269,6 @@ class Gencontrol(Base):
|
|||
self.process_packages(
|
||||
self.templates["control.config"], vars),
|
||||
arch)
|
||||
else:
|
||||
makeflags['DO_CONFIG'] = False
|
||||
|
||||
cmds_build_arch = ["$(MAKE) -f debian/rules.real build-arch-arch %s" %
|
||||
makeflags]
|
||||
|
@ -292,12 +279,6 @@ class Gencontrol(Base):
|
|||
makefile.add('binary-arch_%s_real' % arch, cmds=cmds_binary_arch,
|
||||
deps=['setup_%s' % arch])
|
||||
|
||||
# For stage1 build profile
|
||||
makefile.add('binary-libc-dev_%s' % arch,
|
||||
['source_none_real'],
|
||||
["$(MAKE) -f debian/rules.real install-libc-dev_%s %s" %
|
||||
(arch, makeflags)])
|
||||
|
||||
udeb_packages = self.installer_packages.get(arch, [])
|
||||
if udeb_packages:
|
||||
merge_packages(packages, udeb_packages, arch)
|
||||
|
|
|
@ -5,6 +5,7 @@ linux (4.19.13-2) UNRELEASED; urgency=medium
|
|||
|
||||
[ Ben Hutchings ]
|
||||
* [ia64,m68k] libbpf: Really don't build on architectures without perf events
|
||||
* Use dh_listpackages to determine which packages to build
|
||||
|
||||
-- John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> Sun, 30 Dec 2018 10:30:57 +0100
|
||||
|
||||
|
|
|
@ -17,15 +17,6 @@ endif
|
|||
ifdef DEBIAN_KERNEL_JOBS
|
||||
MAKEFLAGS += -j$(DEBIAN_KERNEL_JOBS)
|
||||
endif
|
||||
BUILD_STAGE1 := $(filter stage1,$(DEB_BUILD_PROFILES))
|
||||
ifneq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
|
||||
# This only disables building the linux-doc package.
|
||||
# The rules for tools packages check separately for the 'nodoc' profile.
|
||||
MAKEFLAGS += DO_DOCS=False
|
||||
endif
|
||||
ifneq (,$(filter pkg.linux.notools,$(DEB_BUILD_PROFILES)))
|
||||
MAKEFLAGS += DO_TOOLS_VERSIONED=False DO_TOOLS_UNVERSIONED=False
|
||||
endif
|
||||
|
||||
.NOTPARALLEL:
|
||||
|
||||
|
@ -41,31 +32,21 @@ build: build-arch build-indep
|
|||
|
||||
build-arch: debian/control
|
||||
dh_testdir
|
||||
ifndef BUILD_STAGE1
|
||||
$(MAKE) -f debian/rules.gen build-arch_$(DEB_HOST_ARCH)
|
||||
endif
|
||||
|
||||
build-indep: debian/control
|
||||
dh_testdir
|
||||
ifndef BUILD_STAGE1
|
||||
$(MAKE) -f debian/rules.gen build-indep
|
||||
endif
|
||||
|
||||
binary: binary-indep binary-arch
|
||||
|
||||
binary-arch: build-arch
|
||||
dh_testdir
|
||||
ifdef BUILD_STAGE1
|
||||
$(MAKE) -f debian/rules.gen binary-libc-dev_$(DEB_HOST_ARCH)
|
||||
else
|
||||
$(MAKE) -f debian/rules.gen binary-arch_$(DEB_HOST_ARCH)
|
||||
endif
|
||||
|
||||
binary-indep: build-indep
|
||||
dh_testdir
|
||||
ifndef BUILD_STAGE1
|
||||
$(MAKE) -f debian/rules.gen binary-indep
|
||||
endif
|
||||
|
||||
DIR_ORIG = ../orig/$(SOURCE)-$(VERSION_UPSTREAM)
|
||||
TAR_ORIG_NAME = $(SOURCE)_$(VERSION_UPSTREAM).orig.tar.xz
|
||||
|
|
|
@ -55,74 +55,54 @@ MAKEOVERRIDES =
|
|||
# Targets
|
||||
#
|
||||
|
||||
build-arch-arch:
|
||||
build-indep:
|
||||
binary-arch-arch:
|
||||
binary-indep:
|
||||
packages_enabled := $(shell dh_listpackages)
|
||||
define if_package
|
||||
$(if $(filter $(1),$(packages_enabled)),$(2))
|
||||
endef
|
||||
|
||||
ifeq (,$(filter pkg.linux.nosource,$(DEB_BUILD_PROFILES)))
|
||||
ifneq ($(DO_CONFIG),False)
|
||||
binary-arch-arch: install-config_$(ARCH)
|
||||
endif
|
||||
endif
|
||||
ifneq ($(DO_HEADERS_ALL),False)
|
||||
binary-arch-arch: install-headers_$(ARCH)
|
||||
endif
|
||||
ifneq ($(DO_LIBC),False)
|
||||
binary-arch-arch: install-libc-dev_$(ARCH)
|
||||
endif
|
||||
binary-arch-flavour: install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
|
||||
ifeq ($(DEBUG),True)
|
||||
binary-arch-flavour: install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
|
||||
endif
|
||||
binary-arch-flavour: install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
|
||||
build-arch-arch: \
|
||||
$(call if_package, linux-kbuild-$(VERSION), build-kbuild) \
|
||||
$(call if_package, linux-perf-$(VERSION), build-perf) \
|
||||
$(call if_package, linux-bootwrapper-$(ABINAME), build-bootwrapper) \
|
||||
$(call if_package, usbip, build-usbip) \
|
||||
$(call if_package, linux-cpupower, build-cpupower) \
|
||||
$(call if_package, liblockdep-dev, build-liblockdep) \
|
||||
$(call if_package, libbpf-dev, build-libbpf) \
|
||||
$(call if_package, hyperv-daemons, build-hyperv-daemons)
|
||||
binary-arch-arch: \
|
||||
$(call if_package, $(SOURCE_BASENAME)-config-$(VERSION), install-config_$(ARCH)) \
|
||||
$(call if_package, linux-headers-$(ABINAME)-all, install-headers_$(ARCH)) \
|
||||
$(call if_package, linux-libc-dev, install-libc-dev_$(ARCH)) \
|
||||
$(call if_package, linux-kbuild-$(VERSION), install-kbuild) \
|
||||
$(call if_package, linux-perf-$(VERSION), install-perf) \
|
||||
$(call if_package, linux-bootwrapper-$(ABINAME), install-bootwrapper) \
|
||||
$(call if_package, usbip, install-usbip) \
|
||||
$(call if_package, linux-cpupower, install-cpupower) \
|
||||
$(call if_package, liblockdep-dev, install-liblockdep) \
|
||||
$(call if_package, libbpf-dev, install-libbpf) \
|
||||
$(call if_package, hyperv-daemons, install-hyperv-daemons)
|
||||
|
||||
ifneq ($(DO_DOCS),False)
|
||||
binary-indep: install-doc
|
||||
ifeq (,$(filter nodoc,$(DEB_BUILD_PROFILES)))
|
||||
build-indep: $(STAMPS_DIR)/build-doc
|
||||
endif
|
||||
endif
|
||||
ifeq (,$(filter pkg.linux.nosource,$(DEB_BUILD_PROFILES)))
|
||||
ifneq ($(DO_SOURCE),False)
|
||||
binary-indep: install-source
|
||||
endif
|
||||
endif
|
||||
binary-indep: install-support
|
||||
build-indep: \
|
||||
$(call if_package, $(SOURCE_BASENAME)-doc-$(VERSION), $(STAMPS_DIR)/build-doc)
|
||||
binary-indep: \
|
||||
$(call if_package, $(SOURCE_BASENAME)-doc-$(VERSION), install-doc) \
|
||||
$(call if_package, $(SOURCE_BASENAME)-source-$(VERSION), install-source) \
|
||||
$(call if_package, $(SOURCE_BASENAME)-support-$(ABINAME), install-support) \
|
||||
$(call if_package, lockdep, install-lockdep)
|
||||
|
||||
ifneq ($(DO_TOOLS_VERSIONED),False)
|
||||
build-arch-arch: build-kbuild
|
||||
binary-arch-arch: install-kbuild
|
||||
ifneq ($(filter alpha amd64 arm64 armel armhf hppa i386 mips mips64 mips64el mipsel mipsr6 mipsr6el mips64r6 mips64r6el mipsn32 mipsn32el mipsn32r6 mipsn32r6el powerpc ppc64 ppc64el s390 s390x sh4 sparc sparc64,$(DEB_HOST_ARCH)),)
|
||||
ifeq ($(filter nopython,$(DEB_BUILD_PROFILES)),)
|
||||
build-arch-arch: build-perf
|
||||
binary-arch-arch: install-perf
|
||||
endif
|
||||
endif
|
||||
ifneq ($(filter powerpc powerpcspe ppc64,$(DEB_HOST_ARCH)),)
|
||||
build-arch-arch: build-bootwrapper
|
||||
binary-arch-arch: install-bootwrapper
|
||||
endif
|
||||
endif
|
||||
ifneq ($(DO_TOOLS_UNVERSIONED),False)
|
||||
build-arch-arch: build-usbip build-cpupower build-liblockdep
|
||||
binary-arch-arch: install-usbip install-cpupower install-liblockdep
|
||||
ifneq ($(filter alpha amd64 arm64 arm64ilp32 armel armhf hppa i386 mips mips64 mips64el mips64r6 mips64r6el mipsel mipsn32 mipsn32el mipsn32r6 mipsn32r6el mipsr6 mipsr6el powerpc powerpcspe ppc64 ppc64el riscv64 s390 s390x sh3 sh4 sparc sparc64 x32,$(DEB_HOST_ARCH)),)
|
||||
build-arch-arch: build-libbpf
|
||||
binary-arch-arch: install-libbpf
|
||||
endif
|
||||
ifneq ($(filter i386 amd64 x32,$(DEB_HOST_ARCH)),)
|
||||
build-arch-arch: build-hyperv-daemons
|
||||
binary-arch-arch: install-hyperv-daemons
|
||||
endif
|
||||
binary-indep: install-lockdep
|
||||
endif
|
||||
binary-arch-flavour: \
|
||||
$(call if_package, $(IMAGE_PACKAGE_NAME), install-image_$(ARCH)_$(FEATURESET)_$(FLAVOUR)) \
|
||||
$(call if_package, linux-image-$(REAL_VERSION)-dbg, install-image-dbg_$(ARCH)_$(FEATURESET)_$(FLAVOUR)) \
|
||||
$(call if_package, linux-headers-$(REAL_VERSION), install-headers_$(ARCH)_$(FEATURESET)_$(FLAVOUR))
|
||||
|
||||
binary-indep-featureset: install-common-headers_$(FEATURESET)
|
||||
binary-indep-featureset: \
|
||||
$(call if_package, linux-headers-$(ABINAME)-common$(LOCALVERSION), install-common-headers_$(FEATURESET))
|
||||
|
||||
build-arch-flavour: $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
|
||||
build-arch-flavour: \
|
||||
$(call if_package, $(IMAGE_PACKAGE_NAME), $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR))
|
||||
|
||||
setup-arch-flavour: $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR)
|
||||
setup-arch-flavour: \
|
||||
$(call if_package, $(IMAGE_PACKAGE_NAME), $(STAMPS_DIR)/setup_$(ARCH)_$(FEATURESET)_$(FLAVOUR))
|
||||
|
||||
source-featureset: $(STAMPS_DIR)/source_$(FEATURESET)
|
||||
|
||||
|
@ -541,6 +521,7 @@ install-signed-template_$(ARCH): DH_OPTIONS = -p$(PACKAGE_NAME)
|
|||
install-signed-template_$(ARCH): PACKAGE_DIR = debian/$(PACKAGE_NAME)
|
||||
install-signed-template_$(ARCH): CODE_SIGNING_DIR = $(PACKAGE_DIR)/usr/share/code-signing/$(PACKAGE_NAME)
|
||||
install-signed-template_$(ARCH):
|
||||
ifneq (,$(filter $(PACKAGE_NAME),$(packages_enabled)))
|
||||
dh_testdir
|
||||
dh_testroot
|
||||
dh_prep
|
||||
|
@ -555,6 +536,7 @@ install-signed-template_$(ARCH):
|
|||
debian/signing_templates/source \
|
||||
$(CODE_SIGNING_DIR)/source-template/debian/
|
||||
+$(MAKE_SELF) install-base
|
||||
endif # enabled
|
||||
|
||||
install-udeb_$(ARCH): export KW_DEFCONFIG_DIR=debian/installer
|
||||
install-udeb_$(ARCH): export KW_CONFIG_DIR=debian/installer
|
||||
|
@ -563,6 +545,8 @@ ifeq ($(UDEB_UNSIGNED_TEST_BUILD),True)
|
|||
install-udeb_$(ARCH): export DEB_BUILD_PROFILES=pkg.linux.udeb-unsigned-test-build
|
||||
endif
|
||||
install-udeb_$(ARCH):
|
||||
# Logically we should check for %-di here, but that would break test builds
|
||||
ifneq (,$(filter linux-image-%,$(packages_enabled)))
|
||||
dh_testdir
|
||||
dh_prep
|
||||
ifeq ($(UDEB_UNSIGNED_TEST_BUILD),True)
|
||||
|
@ -580,6 +564,7 @@ ifeq ($(UDEB_UNSIGNED_TEST_BUILD),False)
|
|||
dh_gencontrol
|
||||
dh_builddeb
|
||||
endif
|
||||
endif # enabled
|
||||
|
||||
install-source: PACKAGE_NAME = $(SOURCE_BASENAME)-source-$(VERSION)
|
||||
install-source: DH_OPTIONS = -p$(PACKAGE_NAME)
|
||||
|
|
Loading…
Reference in New Issue