Merge ~vorlon/germinate:feature-no-follow-build-depends-all into germinate:master

Proposed by Steve Langasek
Status: Superseded
Proposed branch: ~vorlon/germinate:feature-no-follow-build-depends-all
Merge into: germinate:master
Diff against target: 136 lines (+71/-0)
3 files modified
germinate/germinator.py (+23/-0)
germinate/tests/test_germinator.py (+40/-0)
man/germinate.1 (+8/-0)
Reviewer Review Type Date Requested Status
Colin Watson Needs Fixing
Review via email: mp+375373@code.launchpad.net

This proposal has been superseded by a proposal from 2019-11-21.

Description of the change

I want to be able to use germinate to calculate the packageset for a minimum self-hosting i386 port based on the compatibility libraries we want to support. That needs to include build-dependencies, but only the build-dependencies of packages that we actually build on i386 - which does not include Arch: all packages which themselves satisfy (build-)dependencies for packages in our set.

This MP proposes a new feature that lets us truncate on build-dependencies of arch: all binary packages.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) wrote :

In addition to the inline comments below, the new feature flags need to be documented in man/germinate.1. When writing this review I noticed that the previously-added (no-)follow-build-depends flags had not been properly documented there, so I did so; you'll thus want to rebase this on master before doing anything else, as that will provide a clearer structure in the documentation into which you can slot in descriptions of the new flags.

review: Needs Fixing
8b3e547... by Steve Langasek

Document no-follow-build-depends-all in the manpage.

7b7c007... by Steve Langasek

Test case for feature follow-build-depends-all.

Unmerged commits

8b3e547... by Steve Langasek

Document no-follow-build-depends-all in the manpage.

ad17b5d... by Steve Langasek

Add a new feature, follow-build-depends-all.

This tells whether to follow build-dependencies of packages which are
Architecture: all. This is useful for germinating packagesets for partial
architectures, where the architecture-all binaries will never be built on
that arch but instead of some primary arch, so we should truncate traversal
of build-dependencies to exclude packages we don't need built on the partial
arch.

7b7c007... by Steve Langasek

Test case for feature follow-build-depends-all.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/germinate/germinator.py b/germinate/germinator.py
index 25911a3..9b4e340 100644
--- a/germinate/germinator.py
+++ b/germinate/germinator.py
@@ -465,6 +465,9 @@ class Germinator(object):
465465
466 self._packages[pkg]["Essential"] = section.get("Essential", "")466 self._packages[pkg]["Essential"] = section.get("Essential", "")
467467
468 self._packages[pkg]["Architecture"] = \
469 section.get("Architecture", self._arch)
470
468 for field in "Pre-Depends", "Depends", "Recommends", "Built-Using":471 for field in "Pre-Depends", "Depends", "Recommends", "Built-Using":
469 value = section.get(field, "")472 value = section.get(field, "")
470 try:473 try:
@@ -1252,6 +1255,20 @@ class Germinator(object):
1252 return False1255 return False
1253 return "no-follow-build-depends" not in structure.features1256 return "no-follow-build-depends" not in structure.features
12541257
1258 def _follow_build_depends_all(self, structure, seed=None):
1259 """
1260 Test whether Build-Depends should be followed for Architecture: all
1261 packages (not required for the special case of partial
1262 architectures)
1263 Defaults to True if not explicitly specified.
1264 """
1265 if seed is not None:
1266 if "follow-build-depends-all" in seed._features:
1267 return True
1268 if "no-follow-build-depends-all" in seed._features:
1269 return False
1270 return "no-follow-build-depends-all" not in structure.features
1271
1255 def _add_reverse(self, pkg, field, rdep):1272 def _add_reverse(self, pkg, field, rdep):
1256 """Add a reverse dependency entry."""1273 """Add a reverse dependency entry."""
1257 if "Reverse-Depends" not in self._packages[pkg]:1274 if "Reverse-Depends" not in self._packages[pkg]:
@@ -1642,6 +1659,12 @@ class Germinator(object):
1642 output._all_srcs.add(pkg_src)1659 output._all_srcs.add(pkg_src)
1643 seed._build_srcs.add(pkg_src)1660 seed._build_srcs.add(pkg_src)
16441661
1662 # Special-case not following build dependencies of arch: all
1663 # packages
1664 if not self._follow_build_depends_all(seed.structure, seed) and \
1665 self._packages[pkg]["Architecture"] == "all":
1666 continue
1667
1645 if self._follow_build_depends(seed.structure, seed):1668 if self._follow_build_depends(seed.structure, seed):
1646 for build_depends in BUILD_DEPENDS:1669 for build_depends in BUILD_DEPENDS:
1647 self._add_dependency_tree(1670 self._add_dependency_tree(
diff --git a/germinate/tests/test_germinator.py b/germinate/tests/test_germinator.py
index 5b84c63..aaab106 100644
--- a/germinate/tests/test_germinator.py
+++ b/germinate/tests/test_germinator.py
@@ -177,6 +177,7 @@ class TestGerminator(TestCase):
177 "Provides": [],177 "Provides": [],
178 "Kernel-Version": "",178 "Kernel-Version": "",
179 "Multi-Arch": "none",179 "Multi-Arch": "none",
180 "Architecture": "i386",
180 }, germinator._packages["hello"])181 }, germinator._packages["hello"])
181 self.assertEqual("deb", germinator._packagetype["hello"])182 self.assertEqual("deb", germinator._packagetype["hello"])
182 self.assertIn("hello-dependency", germinator._packages)183 self.assertIn("hello-dependency", germinator._packages)
@@ -195,6 +196,7 @@ class TestGerminator(TestCase):
195 "Provides": [],196 "Provides": [],
196 "Kernel-Version": "",197 "Kernel-Version": "",
197 "Multi-Arch": "foreign",198 "Multi-Arch": "foreign",
199 "Architecture": "i386",
198 }, germinator._packages["hello-dependency"])200 }, germinator._packages["hello-dependency"])
199 self.assertEqual("deb", germinator._packagetype["hello-dependency"])201 self.assertEqual("deb", germinator._packagetype["hello-dependency"])
200 self.assertEqual({}, germinator._provides)202 self.assertEqual({}, germinator._provides)
@@ -321,6 +323,44 @@ class TestGerminator(TestCase):
321 shutil.rmtree(self.archive_dir)323 shutil.rmtree(self.archive_dir)
322 shutil.rmtree(self.seeds_dir)324 shutil.rmtree(self.seeds_dir)
323325
326 def test_build_depends_all(self):
327 """Confirm build-depends of arch: all packages are recursed when
328 follow-build-depends-all is set, and not when
329 no-follow-build-depends-all is set.
330 """
331 self.addSource("focal", "main", "hello", "1.0-1", ["hello"],
332 fields={"Build-Depends": "gettext"})
333 self.addPackage("focal", "main", "i386", "hello", "1.0-1",
334 fields={"Architecture": "all"})
335 self.addSource("focal", "main", "gettext", "0.18.1.1-5ubuntu3",
336 ["gettext"])
337 self.addPackage("focal", "main", "i386", "gettext",
338 "0.18.1.1-5ubuntu3")
339 branch = "collection.focal"
340 archive = TagFile(
341 "focal", "main", "i386", "file://%s" % self.archive_dir)
342 for sense in ("no-", ""):
343 self.addSeed(branch, "base")
344 self.addSeedPackage(branch, "base", "hello")
345 self.addStructureLine(branch,
346 "feature %sfollow-build-depends-all" % sense)
347 germinator = Germinator("i386")
348 germinator.parse_archive(archive)
349 structure = self.openSeedStructure(branch)
350 germinator.plant_seeds(structure)
351 germinator.grow(structure)
352
353 expected = set()
354 if sense == "":
355 expected.add("gettext")
356 self.assertEqual(
357 expected, germinator.get_build_depends(structure, "base"),
358 "Build-Depends: gettext from Architecture: all package "
359 "incorrectly %s" % "included" if sense == "no-" else "omitted")
360
361 shutil.rmtree(self.seeds_dir)
362 shutil.rmtree(self.archive_dir)
363
324 def test_build_depends_profiles(self):364 def test_build_depends_profiles(self):
325 """Test that https://wiki.debian.org/BuildProfileSpec restrictions365 """Test that https://wiki.debian.org/BuildProfileSpec restrictions
326 are parseable.366 are parseable.
diff --git a/man/germinate.1 b/man/germinate.1
index 9f80f03..cd4e48f 100644
--- a/man/germinate.1
+++ b/man/germinate.1
@@ -168,10 +168,18 @@ The following flags are currently defined:
168Follow Build-Depends fields.168Follow Build-Depends fields.
169This flag is only recognised in individual seed files, not in169This flag is only recognised in individual seed files, not in
170.Pa STRUCTURE .170.Pa STRUCTURE .
171.It follow\-build\-depends\-all
172Follow Build-Depends fields for Architecture: all packages. This has no
173effect if
174.Pa no\-follow\-build\-depends
175is set.
171.It follow\-recommends176.It follow\-recommends
172Treat Recommends fields as if they were Depends.177Treat Recommends fields as if they were Depends.
173.It no\-follow\-build\-depends178.It no\-follow\-build\-depends
174Do not follow Build-Depends fields.179Do not follow Build-Depends fields.
180.It no\-follow\-build\-depends\-all
181Do not follow Build-Depends fields for Architecture: all packages, even
182though Build-Depends are followed for other packages.
175.It no\-follow\-recommends183.It no\-follow\-recommends
176Do not treat Recommends fields as if they were Depends.184Do not treat Recommends fields as if they were Depends.
177This flag is only recognised in individual seed files, not in185This flag is only recognised in individual seed files, not in

Subscribers

People subscribed via source and target branches

to all changes: