diff options
author | Ben Hutchings <ben@decadent.org.uk> | 2018-09-11 00:59:07 +0100 |
---|---|---|
committer | Ben Hutchings <ben@decadent.org.uk> | 2018-09-11 01:12:58 +0100 |
commit | db8e7a2186e5f33e0e1665653f3b480b5e3986d9 (patch) | |
tree | 30bf43aacf714728786ee6f930339ccac3dbaac9 | |
parent | 9f0cf5debfe6e1056c6c63deab6cdc5b1783c12b (diff) | |
download | kernel_replicant_linux-db8e7a2186e5f33e0e1665653f3b480b5e3986d9.tar.gz kernel_replicant_linux-db8e7a2186e5f33e0e1665653f3b480b5e3986d9.tar.bz2 kernel_replicant_linux-db8e7a2186e5f33e0e1665653f3b480b5e3986d9.zip |
Add support for specifying build-dependencies in binary package templates
This will allow removing a lot of the repetition introduced in the
preceding commits.
-rw-r--r-- | debian/README.source | 8 | ||||
-rw-r--r-- | debian/changelog | 1 | ||||
-rw-r--r-- | debian/lib/python/debian_linux/gencontrol.py | 29 |
3 files changed, 38 insertions, 0 deletions
diff --git a/debian/README.source b/debian/README.source index 5131e29bd6ad..06fe9115caf2 100644 --- a/debian/README.source +++ b/debian/README.source @@ -189,6 +189,14 @@ into the templates: Normally, the arch-specific contents should be controlled by adjusting the corresponding defines file. +Build-dependencies that relate to specific binary packages can be +specified in a Build-Depends field in the template for that binary +package. gencontrol.py will append the value to the source package's +Build-Depends-Arch or Build-Depends-Indep field, as appropriate. It +will also use the binary package's Architecture and Build-Profile as +the architecture-qualification and/or restriction for each build- +dependency that doesn't already have them. + TODO: - Patches applied to the upstream source - How to define a flavour diff --git a/debian/changelog b/debian/changelog index ca13dc57ebde..042c9e6f32e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,7 @@ linux (4.19~rc3-1~exp2) UNRELEASED; urgency=medium * debian/lib/python: Use raw strings for all regexes * debian/control: Fix restrictions for build-deps on asciidoctor and patchutils + * Add support for specifying build-dependencies in binary package templates -- Ben Hutchings <ben@decadent.org.uk> Mon, 10 Sep 2018 22:25:53 +0100 diff --git a/debian/lib/python/debian_linux/gencontrol.py b/debian/lib/python/debian_linux/gencontrol.py index b4764e244805..c46f9991df90 100644 --- a/debian/lib/python/debian_linux/gencontrol.py +++ b/debian/lib/python/debian_linux/gencontrol.py @@ -91,6 +91,7 @@ class Gencontrol(object): self.do_main(packages, makefile) self.do_extra(packages, makefile) + self.merge_build_depends(packages) self.write(packages, makefile) def do_source(self, packages): @@ -313,6 +314,34 @@ class Gencontrol(object): return re.sub(r'@([-_a-z0-9]+)@', subst, str(s)) + def merge_build_depends(self, packages): + # Merge Build-Depends pseudo-fields from binary packages into the + # source package + source = packages["source"] + arch_all = PackageArchitecture("all") + for name, package in packages.items(): + if name == "source": + continue + dep = package.get("Build-Depends") + if not dep: + continue + del package["Build-Depends"] + for group in dep: + for item in group: + if package["Architecture"] != arch_all and not item.arches: + item.arches = sorted(package["Architecture"]) + if package.get("Build-Profiles") and not item.restrictions: + profiles = package["Build-Profiles"] + assert profiles[0] == "<" and profiles[-1] == ">" + item.restrictions = re.split(r"\s+", profiles[1:-1]) + if package["Architecture"] == arch_all: + dep_type = "Build-Depends-Indep" + else: + dep_type = "Build-Depends-Arch" + if dep_type not in source: + source[dep_type] = PackageRelation() + source[dep_type].extend(dep) + def write(self, packages, makefile): self.write_control(packages.values()) self.write_makefile(makefile) |