Merge lp:~jelmer/brz-builder/fixes into lp:brz-builder
- fixes
- Merge into trunk
Proposed by
Jelmer Vernooij
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | 188 |
Merged at revision: | 187 |
Proposed branch: | lp:~jelmer/brz-builder/fixes |
Merge into: | lp:brz-builder |
Diff against target: |
335 lines (+41/-33) 9 files modified
brzbuildrecipe/dailydeb.py (+3/-3) brzbuildrecipe/deb_util.py (+6/-6) brzbuildrecipe/deb_version.py (+2/-2) brzbuildrecipe/main.py (+2/-2) brzbuildrecipe/ppa.py (+1/-1) brzbuildrecipe/recipe.py (+15/-10) brzbuildrecipe/tests/test_deb_version.py (+4/-4) brzbuildrecipe/tests/test_recipe.py (+7/-4) releaser.conf (+1/-1) |
To merge this branch: | bzr merge lp:~jelmer/brz-builder/fixes |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij | Approve | ||
Review via email:
|
Commit message
Fix tests, compatibility with newer breezy.
Description of the change
Fix tests, compatibility with newer breezy.
To post a comment you must log in.
Revision history for this message
![](/+icing/build/overlay/assets/skins/sam/images/close.gif)
Jelmer Vernooij (jelmer) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'brzbuildrecipe/dailydeb.py' |
2 | --- brzbuildrecipe/dailydeb.py 2020-02-22 01:55:36 +0000 |
3 | +++ brzbuildrecipe/dailydeb.py 2022-08-19 17:37:12 +0000 |
4 | @@ -161,7 +161,7 @@ |
5 | control_path = os.path.join(working_directory, "debian", "control") |
6 | if not os.path.exists(control_path): |
7 | if args.package is None: |
8 | - raise errors.BzrCommandError( |
9 | + raise errors.CommandError( |
10 | "No control file to " |
11 | "take the package name from, and --package not " |
12 | "specified.") |
13 | @@ -178,7 +178,7 @@ |
14 | append_version=args.append_version) |
15 | else: |
16 | if args.append_version: |
17 | - raise errors.BzrCommandError( |
18 | + raise errors.CommandError( |
19 | "--append-version only " |
20 | "supported for autobuild recipes (with a 'deb-version' " |
21 | "header)") |
22 | @@ -203,7 +203,7 @@ |
23 | package_version.upstream_version, args.working_basedir) |
24 | except errors.NoSuchTag as e: |
25 | if not args.allow_fallback_to_native: |
26 | - raise errors.BzrCommandError( |
27 | + raise errors.CommandError( |
28 | "Unable to find the upstream source. Import it " |
29 | "as tag %s or build with " |
30 | "--allow-fallback-to-native." % e.tag_name) |
31 | |
32 | === modified file 'brzbuildrecipe/deb_util.py' |
33 | --- brzbuildrecipe/deb_util.py 2020-02-22 01:55:36 +0000 |
34 | +++ brzbuildrecipe/deb_util.py 2022-08-19 17:37:12 +0000 |
35 | @@ -164,7 +164,7 @@ |
36 | try: |
37 | substitute_changelog_vars(base_branch, None, cl) |
38 | except SubstitutionUnavailable as e: |
39 | - raise errors.BzrCommandError( |
40 | + raise errors.CommandError( |
41 | "No previous changelog to " |
42 | "take the upstream version from as %s was " |
43 | "used: %s: %s." % (e.name, e.reason, reason)) |
44 | @@ -188,7 +188,7 @@ |
45 | try: |
46 | changelog.Version(version) |
47 | except (changelog.VersionError, ValueError) as e: |
48 | - raise errors.BzrCommandError( |
49 | + raise errors.CommandError( |
50 | "Invalid deb-version: %s: %s" % (version, e)) |
51 | cl.new_block( |
52 | package=package, version=version, |
53 | @@ -255,9 +255,9 @@ |
54 | success_exit_codes = [0] |
55 | if proc.returncode not in success_exit_codes: |
56 | if quiet: |
57 | - raise errors.BzrCommandError("%s: %s" % (error_msg, output)) |
58 | + raise errors.CommandError("%s: %s" % (error_msg, output)) |
59 | else: |
60 | - raise errors.BzrCommandError(error_msg) |
61 | + raise errors.CommandError(error_msg) |
62 | |
63 | |
64 | def build_source_package(basedir, tgz_check=True): |
65 | @@ -323,5 +323,5 @@ |
66 | if current_format == "3.0 (quilt)": |
67 | convert_3_0_quilt_to_native(working_tree_path) |
68 | elif current_format not in ("1.0", "3.0 (native)"): |
69 | - raise errors.BzrCommandError("Unknown source format %s" % |
70 | - current_format) |
71 | + raise errors.CommandError("Unknown source format %s" % |
72 | + current_format) |
73 | |
74 | === modified file 'brzbuildrecipe/deb_version.py' |
75 | --- brzbuildrecipe/deb_version.py 2020-02-22 01:55:36 +0000 |
76 | +++ brzbuildrecipe/deb_version.py 2022-08-19 17:37:12 +0000 |
77 | @@ -142,7 +142,7 @@ |
78 | for name in base_branch.list_branch_names(): |
79 | available_tokens.append(var_kls.determine_name(name)) |
80 | available_tokens.append(var_kls.determine_name(None)) |
81 | - raise errors.BzrCommandError( |
82 | + raise errors.CommandError( |
83 | "deb-version not fully " |
84 | "expanded: %s. Valid substitutions in recipe format %s are: %s" |
85 | % (base_branch.deb_version, base_branch.format, |
86 | @@ -150,7 +150,7 @@ |
87 | |
88 | |
89 | def substitute_branch_vars(base_branch, branch_name, branch, revid): |
90 | - """Substitute the branch variables for the given branch name in deb_version. |
91 | + """Substitute the branch variables for the given branch name. |
92 | |
93 | Where deb_version has a place to substitute the revno for a branch |
94 | this will substitute it for the given branch name. |
95 | |
96 | === modified file 'brzbuildrecipe/main.py' |
97 | --- brzbuildrecipe/main.py 2020-02-22 01:55:36 +0000 |
98 | +++ brzbuildrecipe/main.py 2022-08-19 17:37:12 +0000 |
99 | @@ -64,7 +64,7 @@ |
100 | (basename, f) = get_recipe_from_location( |
101 | recipe_location, possible_transports) |
102 | except errors.NoSuchFile: |
103 | - raise errors.BzrCommandError( |
104 | + raise errors.CommandError( |
105 | "Specified recipe does not exist: %s" % recipe_location) |
106 | try: |
107 | parser = RecipeParser(f, filename=recipe_location) |
108 | @@ -169,6 +169,6 @@ |
109 | location, possible_transports=possible_transports) |
110 | else: |
111 | if revspec is not None: |
112 | - raise errors.BzrCommandError( |
113 | + raise errors.CommandError( |
114 | "--revision only supported when building from branch") |
115 | return base_branch |
116 | |
117 | === modified file 'brzbuildrecipe/ppa.py' |
118 | --- brzbuildrecipe/ppa.py 2020-02-22 01:55:36 +0000 |
119 | +++ brzbuildrecipe/ppa.py 2022-08-19 17:37:12 +0000 |
120 | @@ -51,7 +51,7 @@ |
121 | if not sourceRecords: |
122 | if time.time() - 900 > start: |
123 | # Over 15 minutes and no source yet, upload FAIL. |
124 | - raise errors.BzrCommandError( |
125 | + raise errors.CommandError( |
126 | "No source record in %s/%s for " |
127 | "package %s=%s after 15 minutes." % ( |
128 | owner_name, archive_name, package_name, version)) |
129 | |
130 | === modified file 'brzbuildrecipe/recipe.py' |
131 | --- brzbuildrecipe/recipe.py 2020-02-22 16:11:41 +0000 |
132 | +++ brzbuildrecipe/recipe.py 2022-08-19 17:37:12 +0000 |
133 | @@ -38,6 +38,11 @@ |
134 | from breezy.config import NoWhoami |
135 | from breezy.merge import MergeIntoMerger |
136 | |
137 | +try: |
138 | + from breezy.revisionspec import InvalidRevisionSpec |
139 | +except ImportError: # breezy < 3.3 |
140 | + from breezy.errors import InvalidRevisionSpec |
141 | + |
142 | |
143 | def subprocess_setup(): |
144 | signal.signal(signal.SIGPIPE, signal.SIG_DFL) |
145 | @@ -175,7 +180,7 @@ |
146 | def get(self): |
147 | revno = self.get_revno() |
148 | if revno is None: |
149 | - raise errors.BzrCommandError( |
150 | + raise errors.CommandError( |
151 | "Can't substitute revno of " |
152 | "branch %s in deb-version, as it's revno can't be " |
153 | "determined" % revno) |
154 | @@ -233,7 +238,7 @@ |
155 | try: |
156 | revno = extract_svn_revnum(rev) |
157 | except errors.InvalidRevisionId: |
158 | - raise errors.BzrCommandError( |
159 | + raise errors.CommandError( |
160 | "unable to expand %s for %r in %r: " |
161 | "not a Subversion revision" % ( |
162 | self.name, self.revid, self.branch)) |
163 | @@ -269,7 +274,7 @@ |
164 | try: |
165 | commit_sha = extract_git_foreign_revid(rev) |
166 | except errors.InvalidRevisionId: |
167 | - raise errors.BzrCommandError( |
168 | + raise errors.CommandError( |
169 | "unable to expand %s for %r in %r: " |
170 | "not a Git revision" % ( |
171 | self.name, self.revid, self.branch)) |
172 | @@ -290,7 +295,7 @@ |
173 | if revid in reverse_tag_dict: |
174 | return list(reverse_tag_dict[revid])[0] |
175 | else: |
176 | - raise errors.BzrCommandError( |
177 | + raise errors.CommandError( |
178 | "No tags set on branch %s mainline" % self.branch_name) |
179 | |
180 | |
181 | @@ -322,8 +327,8 @@ |
182 | except errors.FileExists: |
183 | pass |
184 | except errors.NoSuchFile: |
185 | - raise errors.BzrCommandError('Parent of "%s" does not exist.' |
186 | - % to_transport.base) |
187 | + raise errors.CommandError('Parent of "%s" does not exist.' |
188 | + % to_transport.base) |
189 | |
190 | |
191 | def pull_or_branch( |
192 | @@ -399,7 +404,7 @@ |
193 | conflicts = tree_to.conflicts() |
194 | if len(conflicts) > 0: |
195 | # FIXME: better reporting |
196 | - raise errors.BzrCommandError("Conflicts... aborting.") |
197 | + raise errors.CommandError("Conflicts... aborting.") |
198 | except BaseException: |
199 | if created_br_to: |
200 | br_to.unlock() |
201 | @@ -430,7 +435,7 @@ |
202 | try: |
203 | merge_revid = merge_revspec.as_revision_id( |
204 | child_branch.branch) |
205 | - except errors.InvalidRevisionSpec as e: |
206 | + except InvalidRevisionSpec as e: |
207 | # Give the user a hint if they didn't mean to speciy |
208 | # a revspec. |
209 | e.extra = ( |
210 | @@ -459,7 +464,7 @@ |
211 | merger.set_pending() |
212 | if conflict_count: |
213 | # FIXME: better reporting |
214 | - raise errors.BzrCommandError("Conflicts from merge") |
215 | + raise errors.CommandError("Conflicts from merge") |
216 | config = br_to.get_config() |
217 | try: |
218 | committer = config.username() |
219 | @@ -510,7 +515,7 @@ |
220 | |
221 | if conflict_count: |
222 | # FIXME: better reporting |
223 | - raise errors.BzrCommandError("Conflicts from merge") |
224 | + raise errors.CommandError("Conflicts from merge") |
225 | tree_to.commit( |
226 | "Merge %s of %s" % |
227 | (subpath, urlutils.unescape_for_display(child_branch.url, 'utf-8'))) |
228 | |
229 | === modified file 'brzbuildrecipe/tests/test_deb_version.py' |
230 | --- brzbuildrecipe/tests/test_deb_version.py 2020-02-22 16:11:41 +0000 |
231 | +++ brzbuildrecipe/tests/test_deb_version.py 2022-08-19 17:37:12 +0000 |
232 | @@ -188,7 +188,7 @@ |
233 | resolve_revisions( |
234 | branch1, substitute_branch_vars=substitute_branch_vars) |
235 | self.assertRaises( |
236 | - errors.BzrCommandError, check_expanded_deb_version, branch1) |
237 | + errors.CommandError, check_expanded_deb_version, branch1) |
238 | |
239 | def test_substitute_svn_not_svn(self): |
240 | br = self.make_branch("source") |
241 | @@ -197,7 +197,7 @@ |
242 | source.commit("two") |
243 | branch1 = BaseRecipeBranch("source", "foo-{svn-revno}", 0.4) |
244 | e = self.assertRaises( |
245 | - errors.BzrCommandError, resolve_revisions, |
246 | + errors.CommandError, resolve_revisions, |
247 | branch1, None, substitute_branch_vars) |
248 | self.assertTrue(str(e).startswith( |
249 | "unable to expand {svn-revno} "), e) |
250 | @@ -220,7 +220,7 @@ |
251 | source.commit("two") |
252 | branch1 = BaseRecipeBranch("source", "foo-{git-commit}", 0.4) |
253 | e = self.assertRaises( |
254 | - errors.BzrCommandError, resolve_revisions, |
255 | + errors.CommandError, resolve_revisions, |
256 | branch1, None, substitute_branch_vars) |
257 | self.assertTrue(str(e).startswith("unable to expand {git-commit} "), e) |
258 | |
259 | @@ -249,7 +249,7 @@ |
260 | source.commit("two") |
261 | branch1 = BaseRecipeBranch("source", "foo-{latest-tag}", 0.4) |
262 | e = self.assertRaises( |
263 | - errors.BzrCommandError, resolve_revisions, branch1, |
264 | + errors.CommandError, resolve_revisions, branch1, |
265 | substitute_branch_vars=substitute_branch_vars) |
266 | self.assertTrue( |
267 | str(e).startswith("No tags set on branch None mainline"), e) |
268 | |
269 | === modified file 'brzbuildrecipe/tests/test_recipe.py' |
270 | --- brzbuildrecipe/tests/test_recipe.py 2020-02-22 01:55:36 +0000 |
271 | +++ brzbuildrecipe/tests/test_recipe.py 2022-08-19 17:37:12 +0000 |
272 | @@ -24,11 +24,14 @@ |
273 | TestCaseInTempDir, |
274 | TestCaseWithTransport, |
275 | ) |
276 | + |
277 | + |
278 | from ..recipe import ( |
279 | BaseRecipeBranch, |
280 | build_tree, |
281 | ensure_basedir, |
282 | InstructionParseError, |
283 | + InvalidRevisionSpec, |
284 | ForbiddenInstructionError, |
285 | MERGE_INSTRUCTION, |
286 | NEST_INSTRUCTION, |
287 | @@ -596,7 +599,7 @@ |
288 | ensure_basedir(to_transport) |
289 | self.assertPathExists("a") |
290 | e = self.assertRaises( |
291 | - errors.BzrCommandError, ensure_basedir, |
292 | + errors.CommandError, ensure_basedir, |
293 | transport.get_transport("b/c")) |
294 | self.assertTrue('Parent of "' in str(e)) |
295 | self.assertTrue('" does not exist.' in str(e)) |
296 | @@ -825,7 +828,7 @@ |
297 | merged_branch = RecipeBranch("merged", "source2") |
298 | base_branch.merge_branch(merged_branch) |
299 | self.assertRaises( |
300 | - errors.BzrCommandError, build_tree, base_branch, "target") |
301 | + errors.CommandError, build_tree, base_branch, "target") |
302 | self.assertPathExists("target") |
303 | tree = workingtree.WorkingTree.open("target") |
304 | self.assertEqual(source1_rev_id, tree.last_revision()) |
305 | @@ -968,7 +971,7 @@ |
306 | rev_id = source.commit("two") |
307 | source.branch.tags.set_tag("one", rev_id) |
308 | e = self.assertRaises( |
309 | - errors.BzrCommandError, pull_or_branch, tree_to, br_to, |
310 | + errors.CommandError, pull_or_branch, tree_to, br_to, |
311 | source.branch, to_transport, rev_id, accelerator_tree=source) |
312 | self.assertEqual("Conflicts... aborting.", str(e)) |
313 | tree_to.unlock() |
314 | @@ -1005,7 +1008,7 @@ |
315 | merged_branch = RecipeBranch("merged", "source", revspec="debian") |
316 | base_branch.merge_branch(merged_branch) |
317 | e = self.assertRaises( |
318 | - errors.InvalidRevisionSpec, build_tree, base_branch, "target") |
319 | + InvalidRevisionSpec, build_tree, base_branch, "target") |
320 | self.assertTrue( |
321 | str(e).startswith( |
322 | "Requested revision: 'debian' does not exist in branch: ")) |
323 | |
324 | === modified file 'releaser.conf' |
325 | --- releaser.conf 2022-08-19 17:26:43 +0000 |
326 | +++ releaser.conf 2022-08-19 17:37:12 +0000 |
327 | @@ -1,7 +1,7 @@ |
328 | # See https://github.com/jelmer/releaser |
329 | timeout_days: 5 |
330 | tag_name: "$VERSION" |
331 | -verify_command: "flake8 && BRZ_PLUGINS_AT=loom@`pwd` brz selftest -s bp.builder" |
332 | +verify_command: "flake8 && PYTHONPATH=`pwd` python3 -m unittest brzbuildrecipe.tests.test_suite" |
333 | update_version { |
334 | path: "setup.py" |
335 | new_line: "version = $TUPLED_STATUS_VERSION" |