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
1diff --git a/germinate/germinator.py b/germinate/germinator.py
2index 25911a3..9b4e340 100644
3--- a/germinate/germinator.py
4+++ b/germinate/germinator.py
5@@ -465,6 +465,9 @@ class Germinator(object):
6
7 self._packages[pkg]["Essential"] = section.get("Essential", "")
8
9+ self._packages[pkg]["Architecture"] = \
10+ section.get("Architecture", self._arch)
11+
12 for field in "Pre-Depends", "Depends", "Recommends", "Built-Using":
13 value = section.get(field, "")
14 try:
15@@ -1252,6 +1255,20 @@ class Germinator(object):
16 return False
17 return "no-follow-build-depends" not in structure.features
18
19+ def _follow_build_depends_all(self, structure, seed=None):
20+ """
21+ Test whether Build-Depends should be followed for Architecture: all
22+ packages (not required for the special case of partial
23+ architectures)
24+ Defaults to True if not explicitly specified.
25+ """
26+ if seed is not None:
27+ if "follow-build-depends-all" in seed._features:
28+ return True
29+ if "no-follow-build-depends-all" in seed._features:
30+ return False
31+ return "no-follow-build-depends-all" not in structure.features
32+
33 def _add_reverse(self, pkg, field, rdep):
34 """Add a reverse dependency entry."""
35 if "Reverse-Depends" not in self._packages[pkg]:
36@@ -1642,6 +1659,12 @@ class Germinator(object):
37 output._all_srcs.add(pkg_src)
38 seed._build_srcs.add(pkg_src)
39
40+ # Special-case not following build dependencies of arch: all
41+ # packages
42+ if not self._follow_build_depends_all(seed.structure, seed) and \
43+ self._packages[pkg]["Architecture"] == "all":
44+ continue
45+
46 if self._follow_build_depends(seed.structure, seed):
47 for build_depends in BUILD_DEPENDS:
48 self._add_dependency_tree(
49diff --git a/germinate/tests/test_germinator.py b/germinate/tests/test_germinator.py
50index 5b84c63..aaab106 100644
51--- a/germinate/tests/test_germinator.py
52+++ b/germinate/tests/test_germinator.py
53@@ -177,6 +177,7 @@ class TestGerminator(TestCase):
54 "Provides": [],
55 "Kernel-Version": "",
56 "Multi-Arch": "none",
57+ "Architecture": "i386",
58 }, germinator._packages["hello"])
59 self.assertEqual("deb", germinator._packagetype["hello"])
60 self.assertIn("hello-dependency", germinator._packages)
61@@ -195,6 +196,7 @@ class TestGerminator(TestCase):
62 "Provides": [],
63 "Kernel-Version": "",
64 "Multi-Arch": "foreign",
65+ "Architecture": "i386",
66 }, germinator._packages["hello-dependency"])
67 self.assertEqual("deb", germinator._packagetype["hello-dependency"])
68 self.assertEqual({}, germinator._provides)
69@@ -321,6 +323,44 @@ class TestGerminator(TestCase):
70 shutil.rmtree(self.archive_dir)
71 shutil.rmtree(self.seeds_dir)
72
73+ def test_build_depends_all(self):
74+ """Confirm build-depends of arch: all packages are recursed when
75+ follow-build-depends-all is set, and not when
76+ no-follow-build-depends-all is set.
77+ """
78+ self.addSource("focal", "main", "hello", "1.0-1", ["hello"],
79+ fields={"Build-Depends": "gettext"})
80+ self.addPackage("focal", "main", "i386", "hello", "1.0-1",
81+ fields={"Architecture": "all"})
82+ self.addSource("focal", "main", "gettext", "0.18.1.1-5ubuntu3",
83+ ["gettext"])
84+ self.addPackage("focal", "main", "i386", "gettext",
85+ "0.18.1.1-5ubuntu3")
86+ branch = "collection.focal"
87+ archive = TagFile(
88+ "focal", "main", "i386", "file://%s" % self.archive_dir)
89+ for sense in ("no-", ""):
90+ self.addSeed(branch, "base")
91+ self.addSeedPackage(branch, "base", "hello")
92+ self.addStructureLine(branch,
93+ "feature %sfollow-build-depends-all" % sense)
94+ germinator = Germinator("i386")
95+ germinator.parse_archive(archive)
96+ structure = self.openSeedStructure(branch)
97+ germinator.plant_seeds(structure)
98+ germinator.grow(structure)
99+
100+ expected = set()
101+ if sense == "":
102+ expected.add("gettext")
103+ self.assertEqual(
104+ expected, germinator.get_build_depends(structure, "base"),
105+ "Build-Depends: gettext from Architecture: all package "
106+ "incorrectly %s" % "included" if sense == "no-" else "omitted")
107+
108+ shutil.rmtree(self.seeds_dir)
109+ shutil.rmtree(self.archive_dir)
110+
111 def test_build_depends_profiles(self):
112 """Test that https://wiki.debian.org/BuildProfileSpec restrictions
113 are parseable.
114diff --git a/man/germinate.1 b/man/germinate.1
115index 9f80f03..cd4e48f 100644
116--- a/man/germinate.1
117+++ b/man/germinate.1
118@@ -168,10 +168,18 @@ The following flags are currently defined:
119 Follow Build-Depends fields.
120 This flag is only recognised in individual seed files, not in
121 .Pa STRUCTURE .
122+.It follow\-build\-depends\-all
123+Follow Build-Depends fields for Architecture: all packages. This has no
124+effect if
125+.Pa no\-follow\-build\-depends
126+is set.
127 .It follow\-recommends
128 Treat Recommends fields as if they were Depends.
129 .It no\-follow\-build\-depends
130 Do not follow Build-Depends fields.
131+.It no\-follow\-build\-depends\-all
132+Do not follow Build-Depends fields for Architecture: all packages, even
133+though Build-Depends are followed for other packages.
134 .It no\-follow\-recommends
135 Do not treat Recommends fields as if they were Depends.
136 This flag is only recognised in individual seed files, not in

Subscribers

People subscribed via source and target branches

to all changes: