Add support for specifying build-dependencies in binary package templates
This will allow removing a lot of the repetition introduced in the preceding commits.
This commit is contained in:
parent
9f0cf5debf
commit
db8e7a2186
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue