diff -Nru breezy-debian-2.8.65/apt_repo.py breezy-debian-2.8.67/apt_repo.py --- breezy-debian-2.8.65/apt_repo.py 1970-01-01 00:00:00.000000000 +0000 +++ breezy-debian-2.8.67/apt_repo.py 2022-04-20 22:15:53.000000000 +0000 @@ -0,0 +1,103 @@ +#!/usr/bin/python3 +# Copyright (C) 2018 Jelmer Vernooij +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + +import subprocess + + +class NoAptSources(Exception): + """No apt sources were configured.""" + + +class AptSourceError(Exception): + """An error occured while running 'apt source'.""" + + def __init__(self, reason): + self.reason = reason + + +class Apt: + + def iter_sources(self, distribution): + raise NotImplementedError(self.iter_sources) + + def iter_binaries(self, distribution): + raise NotImplementedError(self.iter_binaries) + + def retrieve_source(self, package_name, target_directory): + raise NotImplementedError(self.retrieve_source) + + +class LocalApt(Apt): + + def iter_sources(self, distribution): + import apt_pkg + from debian.deb822 import Deb822 + apt_pkg.init() + + # TODO(jelmer): Filter by distribution + + sources = apt_pkg.SourceRecords() + sources.restart() + while sources.step(): + source = Deb822(sources.record) + yield source + + def iter_binaries(self, distribution): + import apt + from debian.deb822 import Deb822 + + # TODO(jelmer): Filter by distribution + + cache = apt.Cache() + for pkg in cache: + for version in pkg.versions: + yield version._records + + def retrieve_source(self, package_name, target): + try: + subprocess.run( + ["apt", "source", package_name], + cwd=target, + check=True, + stderr=subprocess.PIPE, + ) + except subprocess.CalledProcessError as e: + stderr = e.stderr.splitlines() + if stderr[-1] == ( + b"E: You must put some 'source' URIs in your sources.list" + ): + raise NoAptSources() + CS = b"\x1b[1;31mE: \x1b[0m" + CE = b"\x1b[0m" + if stderr[-1] == ( + CS + b"You must put some 'deb-src' URIs in your sources.list" + + CE + ): + raise NoAptSources() + if stderr[-1].startswith(b"E: "): + raise AptSourceError(stderr[-1][3:].decode()) + if stderr[-1].startswith(CS): + raise AptSourceError(stderr[-1][len(CS): -len(CE)].decode()) + raise AptSourceError( + [line.decode("utf-8", "surrogateescape") for line in stderr] + ) + + +class RemoteApt(Apt): + + def __init__(self, mirror_uri): + self.mirror_uri = mirror_uri diff -Nru breezy-debian-2.8.65/cmds.py breezy-debian-2.8.67/cmds.py --- breezy-debian-2.8.65/cmds.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/cmds.py 2022-04-20 22:15:53.000000000 +0000 @@ -1650,5 +1650,10 @@ target_dir=(td if not skip_upload else None), builder=builder) if not skip_upload: - dput_changes(changes_files['source']) + try: + source_path = changes_files['source'] + except KeyError: + raise BzrCommandError( + 'No source package was created by build command') + dput_changes(source_path) local_tree.branch.push(branch) diff -Nru breezy-debian-2.8.65/config.py breezy-debian-2.8.67/config.py --- breezy-debian-2.8.65/config.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/config.py 2022-04-20 22:15:53.000000000 +0000 @@ -75,6 +75,13 @@ def __init__(self, text): try: self.metadata = yaml.safe_load(text) + except yaml.composer.ComposerError as e: + all_metadata = [x for x in yaml.safe_load_all(text) if x is not None] + if len(all_metadata) != 1: + raise UpstreamMetadataSyntaxError( + 'debian/upstream/metadata', Exception('multiple documents found')) + warning('ignoring empty extra documents in debian/upstream/metadata') + self.metadata = all_metadata[0] except (yaml.scanner.ScannerError, yaml.composer.ComposerError, yaml.parser.ParserError) as e: raise UpstreamMetadataSyntaxError('debian/upstream/metadata', e) diff -Nru breezy-debian-2.8.65/debian/changelog breezy-debian-2.8.67/debian/changelog --- breezy-debian-2.8.65/debian/changelog 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/debian/changelog 2022-04-20 22:15:53.000000000 +0000 @@ -1,3 +1,16 @@ +breezy-debian (2.8.67) unstable; urgency=medium + + * Cope with multiple documents in debian/upstream/metadata. + + -- Jelmer Vernooij Wed, 20 Apr 2022 23:15:53 +0100 + +breezy-debian (2.8.66) unstable; urgency=medium + + * Fix locking behaviour in export_with_nested. + * Rely on upstream_version_add_revision from debmutate. + + -- Jelmer Vernooij Sun, 10 Apr 2022 17:32:44 +0100 + breezy-debian (2.8.65) unstable; urgency=medium * Improve compatibility with newer versions of Breezy. diff -Nru breezy-debian-2.8.65/import_dsc.py breezy-debian-2.8.67/import_dsc.py --- breezy-debian-2.8.65/import_dsc.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/import_dsc.py 2022-04-20 22:15:53.000000000 +0000 @@ -39,9 +39,6 @@ controldir, osutils, ) -from ...export import ( - export, - ) from ...config import ConfigObj from ...errors import ( BzrError, @@ -63,6 +60,7 @@ ) from .extract import extract from .util import ( + export_with_nested, extract_orig_tarballs, get_commit_info_from_changelog, md5sum_filename, @@ -214,8 +212,9 @@ revid = revisions[component] if component is not None: component_tree = tree.branch.repository.revision_tree(revid) - export(component_tree, os.path.join(tree.basedir, component), - format='dir') + export_with_nested( + component_tree, os.path.join(tree.basedir, component), + format='dir') parent_ids.append(revid) tree.set_parent_ids(parent_ids) diff -Nru breezy-debian-2.8.65/Makefile breezy-debian-2.8.67/Makefile --- breezy-debian-2.8.65/Makefile 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/Makefile 2022-04-20 22:15:53.000000000 +0000 @@ -1,6 +1,5 @@ BRZ ?= $(shell which brz) BRZ_OPTIONS ?= -Derror -PYTHON ?= $(shell which python3) SETUP ?= $(PYTHON) ./setup.py TESTS ?= "^breezy.plugins.debian." "^unittest" @@ -24,4 +23,4 @@ -d breezy-debian -p po -o breezy-debian.pot check: - BRZ_PLUGINS_AT=debian@$(shell pwd) $(PYTHON) $(PYTHON_OPTIONS) $(BRZ) $(BRZ_OPTIONS) selftest $(TEST_OPTIONS) $(TESTS) + BRZ_PLUGINS_AT=debian@$(shell pwd) $(BRZ) $(BRZ_OPTIONS) selftest $(TEST_OPTIONS) $(TESTS) diff -Nru breezy-debian-2.8.65/merge_upstream.py breezy-debian-2.8.67/merge_upstream.py --- breezy-debian-2.8.65/merge_upstream.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/merge_upstream.py 2022-04-20 22:15:53.000000000 +0000 @@ -129,7 +129,7 @@ package, current_version, tempdir) else: db.create_empty_upstream_tree(tempdir) - if db.pristine_upstream_source.has_version(package, version): + if db.pristine_upstream_source.has_version(package, version, try_hard=False): raise UpstreamAlreadyImported(version) parents = {None: []} diff -Nru breezy-debian-2.8.65/po/breezy-debian.pot breezy-debian-2.8.67/po/breezy-debian.pot --- breezy-debian-2.8.65/po/breezy-debian.pot 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/po/breezy-debian.pot 2022-04-20 22:15:53.000000000 +0000 @@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: breezy-debian\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-02-04 18:28+0000\n" +"POT-Creation-Date: 2022-02-22 11:38+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -17,250 +17,249 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: __init__.py:358 +#: __init__.py:231 #, python-format msgid "" "Not attempting to fix packaging branch ancestry, missing pristine tar data " "for version %s." msgstr "" -#: cmds.py:142 +#: cmds.py:123 +msgid "" +"There are uncommitted changes in the working tree. You must commit before " +"using this command" +msgstr "" + +#: cmds.py:146 #, python-format msgid "No distribution specified, and no changelog, assuming '%s'" msgstr "" -#: cmds.py:152 +#: cmds.py:156 #, python-format msgid "Using distribution %s" msgstr "" -#: cmds.py:155 +#: cmds.py:159 #, python-format msgid "" "No distribution specified, and no previous distribution in changelog. " "Assuming '%s'" msgstr "" -#: cmds.py:161 +#: cmds.py:166 #, python-format msgid "Unknown target distribution: %s" msgstr "" -#: cmds.py:236 +#: cmds.py:271 #, python-format msgid "Building package in %s mode" msgstr "" -#: cmds.py:344 +#: cmds.py:391 msgid "Building using working tree" msgstr "" -#: cmds.py:353 +#: cmds.py:399 msgid "bzr builddeb --revision takes exactly one revision specifier." msgstr "" -#: cmds.py:355 +#: cmds.py:401 #, python-format msgid "Building branch from revision %s" msgstr "" -#: cmds.py:456 +#: cmds.py:507 +#, python-format +msgid "Unable to parse upstream metadata file %s: %s" +msgstr "" + +#: cmds.py:510 msgid "Reusing existing build dir" msgstr "" -#: cmds.py:569 +#: cmds.py:522 #, python-format -msgid "Tar now in %s" +msgid "Unable to parse changelog: %s" msgstr "" -#: cmds.py:772 -msgid "Merge upstream in native mode is not supported." +#: cmds.py:651 +#, python-format +msgid "Tar now in %s" msgstr "" -#: cmds.py:781 -#, python-format -msgid "Using upstream branch %s" +#: cmds.py:833 +msgid "Merge upstream in native mode is not supported." msgstr "" -#: cmds.py:791 +#: cmds.py:844 #, python-format msgid "Using upstream branch %s (from configuration)" msgstr "" -#: cmds.py:812 +#: cmds.py:895 msgid "--snapshot requires an upstream branch source" msgstr "" -#: cmds.py:820 +#: cmds.py:904 +msgid "" +"no upstream source location known; add watch file or specify upstream " +"repository?" +msgstr "" + +#: cmds.py:911 msgid "--revision can only be used with a valid upstream branch" msgstr "" -#: cmds.py:823 +#: cmds.py:915 msgid "merge-upstream takes only a single --revision" msgstr "" -#: cmds.py:840 +#: cmds.py:932 msgid "" "You must specify the version number using --version or specify --snapshot to " "merge a snapshot from the upstream branch." msgstr "" -#: cmds.py:845 +#: cmds.py:938 msgid "You must specify the version number using --version." msgstr "" -#: cmds.py:847 +#: cmds.py:940 #, python-format msgid "Using version string %s." msgstr "" -#: cmds.py:884 +#: cmds.py:988 #, python-format msgid "Upstream version %s has already been merged." msgstr "" -#: cmds.py:892 +#: cmds.py:994 msgid "An entry for the new upstream version has been added to the changelog." msgstr "" -#: cmds.py:895 +#: cmds.py:997 msgid "The new upstream version has been imported." msgstr "" -#: cmds.py:897 +#: cmds.py:999 msgid "" "You should now resolve the conflicts, review the changes, and then commit." msgstr "" -#: cmds.py:900 +#: cmds.py:1002 msgid "You should now review the changes and then commit." msgstr "" -#: cmds.py:977 +#: cmds.py:1078 msgid "There is no tree to import the packages in to" msgstr "" -#: cmds.py:980 cmds.py:1304 -msgid "" -"There are uncommitted changes in the working tree. You must commit before " -"using this command" -msgstr "" - -#: cmds.py:994 +#: cmds.py:1093 msgid "" "You must give the location of at least one source package to install, or use " "the --file option." msgstr "" -#: cmds.py:1000 +#: cmds.py:1099 msgid "import-dsc in merge mode is not yet supported." msgstr "" -#: cmds.py:1017 +#: cmds.py:1116 #, python-format msgid "" "Unable to find the tag for the previous upstream version (%(version)s) in " -"the branch. Consider importing it via import-upstream.If it is already " +"the branch. Consider importing it via import-upstream. If it is already " "present in the branch please make sure it is tagged as %(tag)r." msgstr "" -#: cmds.py:1097 +#: cmds.py:1202 #, python-format msgid "Version %s is already present." msgstr "" -#: cmds.py:1128 +#: cmds.py:1233 msgid "bzr import-upstream --revision takes exactly one revision specifier." msgstr "" -#: cmds.py:1136 +#: cmds.py:1243 #, python-format msgid "Imported %(location)s as tag:%(tag)s.\n" msgstr "" -#: cmds.py:1140 +#: cmds.py:1247 #, python-format msgid "Imported %(location)s (%(component)s) as tag:%(tag)s.\n" msgstr "" -#: cmds.py:1215 +#: cmds.py:1328 msgid "" "This command only works for merge mode packages. See /usr/share/doc/bzr-" "builddeb/user_manual/merge.html for more information." msgstr "" -#: cmds.py:1251 +#: cmds.py:1365 #, python-format msgid "Running \"%s\" in the exported directory." msgstr "" -#: cmds.py:1253 +#: cmds.py:1367 msgid "" "If you want to cancel your changes then exit with a non-zero exit code, e.g. " "run \"exit 1\"." msgstr "" -#: cmds.py:1258 +#: cmds.py:1375 msgid "Not updating the working tree as the command failed." msgstr "" -#: cmds.py:1260 +#: cmds.py:1382 +msgid "After build processing failed. Aborting." +msgstr "" + +#: cmds.py:1383 msgid "Copying debian/ back" msgstr "" -#: cmds.py:1273 +#: cmds.py:1396 msgid "Copying back debian/ failed" msgstr "" -#: cmds.py:1275 +#: cmds.py:1398 msgid "" "If any files were added or removed you should run \"bzr add\" or \"bzr rm\" " "as appropriate." msgstr "" -#: cmds.py:1313 +#: cmds.py:1434 msgid "" "The changelog still targets 'UNRELEASED', so apparently hasn't been uploaded." msgstr "" -#: cmds.py:1322 +#: cmds.py:1442 msgid "" "This version has already been marked uploaded. Use --force to force marking " "this new version." msgstr "" -#: cmds.py:1326 +#: cmds.py:1446 #, python-format msgid "Tag '%s' created.\n" msgstr "" -#: cmds.py:1369 -#, python-format -msgid "Package prepared in %s" -msgstr "" - -#: cmds.py:1434 +#: cmds.py:1513 msgid "No unmerged revisions" msgstr "" -#: merge_quilt.py:109 -#, python-format -msgid "Applying %d quilt patches." -msgstr "" - -#: merge_quilt.py:121 +#: upstream/branch.py:481 #, python-format -msgid "Unapplying %d quilt patches." -msgstr "" - -#: merge_quilt.py:136 -#, python-format -msgid "Committing with %d patches applied and %d patches unapplied." +msgid "No upstream upstream-revision format specified, trying %s" msgstr "" -#: upstream/branch.py:384 -#, python-format -msgid "No upstream upstream-revision format specified, trying %s" +#: upstream/branch.py:536 +msgid "No upstream releases found, falling back to snapshot." msgstr "" # help of 'dont-purge' option of 'builddeb' command @@ -269,78 +268,63 @@ msgstr "" # help of 'result-dir' option of 'builddeb' command -#: cmds.py:69 +#: cmds.py:70 msgid "Directory in which to place the resulting package files." msgstr "" # help of 'builder' option of 'builddeb' command -#: cmds.py:72 +#: cmds.py:74 msgid "Command to build the package." msgstr "" # help of 'merge' option of 'builddeb' command -#: cmds.py:75 +#: cmds.py:78 msgid "Merge the debian part of the source in to the upstream tarball." msgstr "" # help of 'split' option of 'builddeb' command -#: cmds.py:77 +#: cmds.py:81 msgid "Automatically create an .orig.tar.gz from a full source branch." msgstr "" # help of 'build-dir' option of 'builddeb' command -#: cmds.py:79 +#: cmds.py:84 msgid "The dir to use for building." msgstr "" +# help of 'orig-dir' option of 'builddeb' command +#: cmds.py:87 +msgid "" +"Directory containing the .orig.tar.gz files. For use when only debian/ is " +"versioned." +msgstr "" + # help of 'native' option of 'builddeb' command -#: cmds.py:85 +#: cmds.py:92 msgid "Build a native package." msgstr "" # help of 'export-upstream' option of 'builddeb' command -#: cmds.py:87 +#: cmds.py:95 msgid "Create the .orig.tar.gz from specified bzr branch before building." msgstr "" # help of 'export-upstream-revision' option of 'builddeb' command -#: cmds.py:90 +#: cmds.py:99 msgid "Select the upstream revision that will be exported." msgstr "" -# help of 'orig-dir' option of 'builddeb' command -#: cmds.py:256 -msgid "" -"Directory containing the .orig.tar.gz files. For use when only debian/ is " -"versioned." -msgstr "" - -# help of 'quick' option of 'builddeb' command -#: cmds.py:256 -msgid "" -"Quickly build the package, uses quick-builder, which defaults to \"fakeroot " -"debian/rules binary\"." -msgstr "" - -# help of 'reuse' option of 'builddeb' command -#: cmds.py:256 -msgid "" -"Try to avoid exporting too much on each build. Only works in merge mode; it " -"saves unpacking the upstream tarball each time. Implies --dont-purge and --" -"use-existing." -msgstr "" - -#: cmds.py:257 +#: cmds.py:300 msgid "Builds a Debian package from a branch." msgstr "" -#: cmds.py:259 +#: cmds.py:302 msgid "" "If BRANCH is specified it is assumed that the branch you wish to build is\n" "located there. If it is not specified then the current directory is used." msgstr "" -#: cmds.py:262 +#: cmds.py:305 msgid "" "By default, if a working tree is found, it is used to build. Otherwise the\n" "last committed revision found in the branch is used. To force building the\n" @@ -348,18 +332,18 @@ "revision with the --revision option." msgstr "" -#: cmds.py:267 +#: cmds.py:310 msgid "" "If you only wish to export the package, and not build it (especially useful\n" "for merge mode), use --export-only." msgstr "" -#: cmds.py:270 +#: cmds.py:313 msgid "" "To leave the build directory when the build is completed use --dont-purge." msgstr "" -#: cmds.py:272 +#: cmds.py:315 msgid "" "Specify the command to use when building using the --builder option, by\n" "default \"debuild\" is used. It can be overriden by setting the \"builder\"\n" @@ -370,7 +354,7 @@ "accept the options you provide at the end of its command line." msgstr "" -#: cmds.py:279 +#: cmds.py:322 msgid "" "You can also specify directories to use for different things. --build-dir\n" "is the directory to build the packages beneath, which defaults to\n" @@ -381,71 +365,79 @@ "the results in a different directory." msgstr "" -#: cmds.py:287 +#: cmds.py:330 msgid "" -"The --reuse option will be useful if you are in merge mode, and the " -"upstream\n" -"tarball is very large. It attempts to reuse a build directory from an " -"earlier\n" -"build. It will fail if one doesn't exist, but you can create one by using \n" -"--export-only. " +"The --reuse option will be useful if you are in merge mode, and the\n" +"upstream tarball is very large. It attempts to reuse a build directory from\n" +"an earlier build. It will fail if one doesn't exist, but you can create one\n" +"by using --export-only." msgstr "" -#: cmds.py:292 +#: cmds.py:335 msgid "" -"--quick allows you to define a quick-builder in your configuration files, \n" -"which will be used when this option is passed. It defaults to 'fakeroot \n" +"--quick allows you to define a quick-builder in your configuration files,\n" +"which will be used when this option is passed. It defaults to 'fakeroot\n" "debian/rules binary'. It is overriden if --builder is passed. Using this\n" "and --reuse allows for fast rebuilds." msgstr "" -# help of 'working-tree' option of 'builddeb' command -#: cmds.py:297 -msgid "This option has no effect." -msgstr "" - # help of 'export-only' option of 'builddeb' command -#: cmds.py:299 +#: cmds.py:340 msgid "Export only, don't build." msgstr "" # help of 'use-existing' option of 'builddeb' command -#: cmds.py:302 +#: cmds.py:343 msgid "Use an existing build directory." msgstr "" +# help of 'quick' option of 'builddeb' command +#: cmds.py:344 +msgid "" +"Quickly build the package, uses quick-builder, which defaults to \"fakeroot " +"debian/rules binary\"." +msgstr "" + +# help of 'reuse' option of 'builddeb' command +#: cmds.py:347 +msgid "" +"Try to avoid exporting too much on each build. Only works in merge mode; it " +"saves unpacking the upstream tarball each time. Implies --dont-purge and --" +"use-existing." +msgstr "" + # help of 'source' option of 'builddeb' command -#: cmds.py:310 +#: cmds.py:351 msgid "Build a source package." msgstr "" # help of 'package-merge' option of 'builddeb' command -#: cmds.py:315 +#: cmds.py:358 msgid "" "Build using the appropriate -v and -sa options for merging in the changes " "from another source." msgstr "" -#: cmds.py:529 +#: cmds.py:598 msgid "Gets the upstream tar file for the packaging branch." msgstr "" # help of 'directory' option of 'get-orig-source' command -#: cmds.py:532 +#: cmds.py:602 msgid "Directory from which to retrieve the packaging data" msgstr "" -#: cmds.py:576 +#: cmds.py:655 msgid "Merges a new upstream version into the current branch." msgstr "" -#: cmds.py:578 +#: cmds.py:657 msgid "" "Takes a new upstream version and merges it in to your branch, so that your\n" "packaging changes are applied to the new version." msgstr "" -#: cmds.py:581 +#: cmds.py:660 msgid "" "You must supply the source to import from, and in some cases\n" "the version number of the new release. The source can be a .tar.gz, .tar,\n" @@ -453,14 +445,14 @@ "source may also be a remote file described by a URL." msgstr "" -#: cmds.py:586 +#: cmds.py:665 msgid "" "In most situations the version can be guessed from the upstream source.\n" "If the upstream version can not be guessed or if it is guessed\n" "incorrectly then the version number can be specified with --version." msgstr "" -#: cmds.py:590 +#: cmds.py:669 msgid "" "The distribution this version is targetted at can be specified with\n" "--distribution. This will be used to guess the version number suffix\n" @@ -468,7 +460,7 @@ "debian/changelog." msgstr "" -#: cmds.py:595 +#: cmds.py:674 msgid "" "If there is no debian changelog in the branch to retrieve the package\n" "name from then you must pass the --package option. If this version\n" @@ -476,36 +468,36 @@ "to set the new name." msgstr "" -#: cmds.py:602 +#: cmds.py:681 msgid "" " bzr merge-upstream --version 0.2 http://example.org/releases/" "scruff-0.2.tar.gz" msgstr "" -#: cmds.py:604 +#: cmds.py:683 msgid "" "If you are merging a branch as well as the tarball then you can\n" "specify the branch after the tarball, along with -r to specify the\n" "revision of that branch to take::" msgstr "" -#: cmds.py:608 +#: cmds.py:687 msgid "" " bzr merge-upstream --version 0.2 http://example.org/releases/" "scruff-0.2.tar.gz http://scruff.org/bzr/scruff.dev -r tag:0.2" msgstr "" -#: cmds.py:610 +#: cmds.py:689 msgid "" "If there is no upstream release tarball, and you want bzr-builddeb to\n" "create the tarball for you::" msgstr "" -#: cmds.py:613 +#: cmds.py:692 msgid " bzr merge-upstream --version 0.2 http://scruff.org/bzr/scruff.dev" msgstr "" -#: cmds.py:615 +#: cmds.py:694 msgid "" "Note that the created tarball is just the same as the contents of\n" "the branch at the specified revision. If you wish to have something\n" @@ -515,58 +507,68 @@ msgstr "" # help of 'package' option of 'merge-upstream' command -#: cmds.py:624 +#: cmds.py:706 msgid "The name of the source package." msgstr "" # help of 'version' option of 'merge-upstream' command -#: cmds.py:627 +#: cmds.py:710 msgid "The upstream version number of this release, for example \"0.2\"." msgstr "" # help of 'distribution' option of 'merge-upstream' command -#: cmds.py:629 +#: cmds.py:713 msgid "The distribution that this release is targetted at." msgstr "" # help of 'directory' option of 'merge-upstream' command -#: cmds.py:632 +#: cmds.py:716 msgid "Working tree into which to merge." msgstr "" # help of 'last-version' option of 'merge-upstream' command -#: cmds.py:635 +#: cmds.py:719 msgid "The full version of the last time upstream was merged." msgstr "" # help of 'force' option of 'merge-upstream' command -#: cmds.py:638 +#: cmds.py:722 msgid "Force a merge even if the upstream branch has not changed." msgstr "" # help of 'snapshot' option of 'merge-upstream' command -#: cmds.py:640 +#: cmds.py:725 msgid "" "Merge a snapshot from the upstream branch rather than a new upstream release." msgstr "" -# help of 'launchpad' option of 'merge-upstream' command -#: cmds.py:644 -msgid "Use Launchpad to find upstream locations." +# help of 'force-pristine-tar' option of 'merge-upstream' command +#: cmds.py:730 +msgid "Force the use of pristine-tar, even if no pristine-tar branch exists" +msgstr "" + +# help of 'dist-command' option of 'merge-upstream' command +#: cmds.py:735 +msgid "Command to run for creating an upstream tarball from a VCS snapshot." +msgstr "" + +# help of 'guess-upstream-branch-url' option of 'builddeb' command +#: cmds.py:740 +msgid "Guess upstream branch URL if unknown (requires upstream-ontologist)" msgstr "" -#: cmds.py:905 +#: cmds.py:1007 msgid "Import a series of source packages." msgstr "" -#: cmds.py:907 +#: cmds.py:1009 msgid "" "Provide a number of source packages (.dsc files), and they will\n" "be imported to create a branch with history that reflects those\n" "packages." msgstr "" -#: cmds.py:911 +#: cmds.py:1013 msgid "" "The first argument is the distribution that these source packages\n" "were uploaded to, one of \"debian\" or \"ubuntu\". It can also\n" @@ -574,7 +576,7 @@ "which will be resolved to the correct distribution." msgstr "" -#: cmds.py:916 +#: cmds.py:1018 msgid "" "You can also specify a file (possibly remote) that contains a\n" "list of source packages (.dsc files) to import using the --file\n" @@ -583,7 +585,7 @@ "specified on the command line." msgstr "" -#: cmds.py:922 +#: cmds.py:1024 msgid "" "If you have an existing branch containing packaging and you want to\n" "import a .dsc from an upload done from outside the version control\n" @@ -591,22 +593,22 @@ msgstr "" # help of 'file' option of 'import-dsc' command -#: cmds.py:929 +#: cmds.py:1031 msgid "File containing URIs of source packages to import." msgstr "" -#: cmds.py:1036 +#: cmds.py:1135 msgid "Imports an upstream tarball." msgstr "" -#: cmds.py:1038 +#: cmds.py:1137 msgid "" "This will import an upstream tarball in to your branch, but not modify the\n" "working tree. Use merge-upstream if you wish to directly merge the new\n" "upstream version in to your tree." msgstr "" -#: cmds.py:1042 +#: cmds.py:1141 msgid "" "The imported revision can be accessed using the tag name that will be\n" "reported at the end of a successful operation. The revision will include\n" @@ -614,26 +616,26 @@ "tarball when needed." msgstr "" -#: cmds.py:1047 +#: cmds.py:1146 msgid "For instance::" msgstr "" -#: cmds.py:1049 +#: cmds.py:1148 msgid " $ bzr import-upstream 1.2.3 ../package_1.2.3.orig.tar.gz" msgstr "" -#: cmds.py:1051 +#: cmds.py:1150 msgid "" "If upstream is packaged in bzr, you should provide the upstream branch\n" "whose tip commit is the closest match to the tarball::" msgstr "" -#: cmds.py:1054 +#: cmds.py:1153 msgid "" " $ bzr import-upstream 1.2.3 ../package_1.2.3.orig.tar.gz ../upstream" msgstr "" -#: cmds.py:1056 +#: cmds.py:1155 msgid "" "After doing this, commands that assume there is an upstream tarball, like\n" "'bzr builddeb' will be able to recreate the one provided at import-upstream\n" @@ -641,15 +643,15 @@ "the branch." msgstr "" -#: cmds.py:1061 +#: cmds.py:1160 msgid "If you want to manually merge with the imported upstream, you can do::" msgstr "" -#: cmds.py:1063 +#: cmds.py:1162 msgid " $ bzr merge . -r tag:upstream-1.2.3" msgstr "" -#: cmds.py:1065 +#: cmds.py:1164 msgid "" "The imported revision will have file ids taken from your branch, the\n" "upstream branch, or previous tarball imports as necessary. In addition\n" @@ -657,11 +659,17 @@ "import and the tip of the upstream branch if you supply one." msgstr "" -#: cmds.py:1147 +# help of 'force-pristine-tar' option of 'import-upstream' command +#: cmds.py:1174 +msgid "" +"Force creation of a new pristine-tar branch, even if one does not exist." +msgstr "" + +#: cmds.py:1255 msgid "Run a command in an exported package, copying the result back." msgstr "" -#: cmds.py:1149 +#: cmds.py:1257 msgid "" "For a merge mode package the full source is not available, making some\n" "operations difficult. This command allows you to run any command in an\n" @@ -669,98 +677,52 @@ "to your branch if the command is successful." msgstr "" -#: cmds.py:1154 +#: cmds.py:1262 msgid "For instance:" msgstr "" -#: cmds.py:1156 +#: cmds.py:1264 msgid " bzr builddeb-do" msgstr "" -#: cmds.py:1158 +#: cmds.py:1266 msgid "" "will run a shell in the unpacked source. Any changes you make in the\n" -"``debian/`` directory (and only those made in that directory) will be " -"copied\n" -"back to the branch. If you exit with a non-zero exit code (e.g. \"exit " -"1\"),\n" -"then the changes will not be copied back." +"``debian/`` directory (and only those made in that directory) will be\n" +"copied back to the branch. If you exit with a non-zero exit code (e.g.\n" +"\"exit 1\"), then the changes will not be copied back." msgstr "" -#: cmds.py:1163 +#: cmds.py:1271 msgid "You can also specify single commands to be run, e.g." msgstr "" -#: cmds.py:1165 +#: cmds.py:1273 msgid " bzr builddeb-do \"dpatch-edit-patch 01-fix-build\"" msgstr "" -#: cmds.py:1167 +#: cmds.py:1275 msgid "" "Note that only the first argument is used as the command, and so the above\n" "example had to be quoted." msgstr "" -#: cmds.py:1330 -msgid "Helps you create a new package." -msgstr "" - -#: cmds.py:1332 -msgid "" -"This code wraps dh_make to do the Bazaar setup for you, ensuring that\n" -"your branches have all the necessary information and are correctly\n" -"linked to the upstream branches where necessary." -msgstr "" - -#: cmds.py:1336 -msgid "The basic use case is satisfied by" -msgstr "" - -#: cmds.py:1338 -msgid " bzr dh-make project 0.1 http://project.org/project-0.1.tar.gz" -msgstr "" - -#: cmds.py:1340 -msgid "" -"which will import the tarball with the correct tags etc. and then\n" -"run dh_make for you in order to start the packaging." -msgstr "" - -#: cmds.py:1343 -msgid "" -"If there upstream is available in bzr then run the command from the\n" -"root of a branch of that corresponding to the 0.1 release." -msgstr "" - -#: cmds.py:1346 -msgid "" -"If there is no upstream available in bzr then run the command from\n" -"outside a branch and it will create a branch for you in a directory\n" -"named the same as the package name you specify as the second argument." -msgstr "" - -#: cmds.py:1350 -msgid "" -"If you do not wish to use dh_make, but just take advantage of the\n" -"Bazaar specific parts then use the --bzr-only option." -msgstr "" - -# help of 'bzr-only' option of 'dh-make' command -#: cmds.py:1358 -msgid "Don't run dh_make." +# help of 'no-preparation' option of 'builddeb-do' command +#: cmds.py:1281 +msgid "Don't apply/unapply patches." msgstr "" -#: cmds.py:1374 +#: cmds.py:1450 msgid "Format the changes in a branch as a DEP-3 patch." msgstr "" -#: cmds.py:1376 +#: cmds.py:1452 msgid "" "This will generate a patch file containing as much information\n" "specified by DEP-3 (http://dep.debian.net/deps/dep3/) as possible." msgstr "" -#: cmds.py:1379 +#: cmds.py:1455 msgid "" "The patch will contain all changes that are not merged into\n" "the current branch (either that in the current working directory\n" @@ -768,55 +730,55 @@ "in the branch at the specified location." msgstr "" -#: cmds.py:1384 +#: cmds.py:1460 msgid "" "To generate the \"Status\" header, this command will check the\n" "upstream branch to verify if the change has made it upstream,\n" "unless --no-upstream-check was specified." msgstr "" -#: cmds.py:1388 +#: cmds.py:1464 msgid "examples::" msgstr "" -#: cmds.py:1390 +#: cmds.py:1466 msgid "" " bzr dep3-patch lp:~user/project/feature-branch > \\\n" " debian/patches/01_feature" msgstr "" # help of 'directory' option of 'dep3-patch' command -#: cmds.py:1397 +#: cmds.py:1473 msgid "Packaging tree for which to generate patch." msgstr "" # help of 'no-upstream-check' option of 'dep3-patch' command -#: cmds.py:1401 +#: cmds.py:1478 msgid "Don't check whether patch has been merged upstream." msgstr "" -#: cmds.py:1551 +#: cmds.py:1614 msgid "Release a new version of a package." msgstr "" -#: cmds.py:1553 +#: cmds.py:1616 msgid "" "This will update the latest distribution in the changelog,\n" "build the package and upload." msgstr "" -#: cmds.py:1556 +#: cmds.py:1619 msgid "Location can be remote." msgstr "" # help of 'strict' option of 'builddeb' command -#: cmds.py:1560 +#: cmds.py:1624 msgid "" "Refuse to build if there are unknown files in the working tree, --no-strict " "disables the check." msgstr "" # help of 'skip-upload' option of 'debrelease' command -#: cmds.py:1565 +#: cmds.py:1630 msgid "Skip upload." msgstr "" diff -Nru breezy-debian-2.8.65/scripts/deb-auto-backport breezy-debian-2.8.67/scripts/deb-auto-backport --- breezy-debian-2.8.65/scripts/deb-auto-backport 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/scripts/deb-auto-backport 2022-04-20 22:15:53.000000000 +0000 @@ -25,6 +25,9 @@ import tempfile from breezy.plugins.debian.cmds import _build_helper +from breezy.plugins.debian.changelog import ( + debcommit, + ) from breezy.plugins.debian.util import ( dput_changes, ) @@ -111,13 +114,16 @@ author=author, date=format_date(), version=create_bpo_version(since_version, version_suffix), + changes=[''], ) - block = cl[0] changeblock_add_line( - block, - ["Backport to %s." % target_release] + [" +" + line for line in changes], + cl[0], + ["Backport to %s." % target_release] + + [" +" + line for line in changes], ) + debcommit(local_tree, subpath=subpath) + return BackportResult( source=cl[0].package, version=cl[0].version, @@ -128,6 +134,9 @@ async def main(): import argparse + import breezy.bzr + import breezy.git + parser = argparse.ArgumentParser() distro_info = DebianDistroInfo() parser.add_argument( @@ -137,6 +146,7 @@ default=distro_info.stable(), ) parser.add_argument("--dry-run", action="store_true", help="Do a dry run.") + parser.add_argument('--build', action='store_true') parser.add_argument( "--builder", type=str, @@ -157,15 +167,17 @@ local_tree, subpath, args.target_release, author=committer ) - with tempfile.TemporaryDirectory() as td: - builder = args.builder.replace("${LAST_VERSION}", str(result.since_version)) - target_changes = _build_helper( - local_tree, subpath, local_tree.branch, td, builder=builder - ) - debsign(target_changes['source']) + if args.build: + with tempfile.TemporaryDirectory() as td: + builder = args.builder.replace( + "${LAST_VERSION}", str(result.since_version)) + target_changes = _build_helper( + local_tree, subpath, local_tree.branch, td, builder=builder + ) + debsign(target_changes['source']) - if not args.dry_run: - dput_changes(target_changes['source']) + if not args.dry_run: + dput_changes(target_changes['source']) if os.environ.get('SVP_API') == '1': with open(os.environ['SVP_RESULT'], 'w') as f: diff -Nru breezy-debian-2.8.65/scripts/deb-import-uncommitted breezy-debian-2.8.67/scripts/deb-import-uncommitted --- breezy-debian-2.8.65/scripts/deb-import-uncommitted 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/scripts/deb-import-uncommitted 2022-04-20 22:15:53.000000000 +0000 @@ -39,14 +39,11 @@ DistributionBranchSet, ) from breezy.plugins.debian.util import MissingChangelogError +from breezy.plugins.debian.apt_repo import LocalApt, NoAptSources, AptSourceError BRANCH_NAME = "missing-commits" -class NoAptSources(Exception): - """No apt sources were configured.""" - - def connect_udd_mirror(): import psycopg2 @@ -58,13 +55,6 @@ ) -class AptSourceError(Exception): - """An error occured while running 'apt source'.""" - - def __init__(self, reason): - self.reason = reason - - def select_vcswatch_packages(): conn = connect_udd_mirror() cursor = conn.cursor() @@ -135,35 +125,6 @@ ) -def retrieve_source(package_name, target): - try: - subprocess.run( - ["apt", "source", package_name], - cwd=target, - check=True, - stderr=subprocess.PIPE, - ) - except subprocess.CalledProcessError as e: - stderr = e.stderr.splitlines() - if stderr[-1] == ( - b"E: You must put some 'source' URIs in your " b"sources.list" - ): - raise NoAptSources() - CS = b"\x1b[1;31mE: \x1b[0m" - CE = b"\x1b[0m" - if stderr[-1] == ( - CS + b"You must put some 'deb-src' URIs in your sources.list" + CE - ): - raise NoAptSources() - if stderr[-1].startswith(b"E: "): - raise AptSourceError(stderr[-1][3:].decode()) - if stderr[-1].startswith(CS): - raise AptSourceError(stderr[-1][len(CS): -len(CE)].decode()) - raise AptSourceError( - [line.decode("utf-8", "surrogateescape") for line in stderr] - ) - - def import_uncommitted(tree, subpath): cl_path = os.path.join(subpath, "debian/changelog") try: @@ -175,7 +136,8 @@ with contextlib.ExitStack() as es: archive_source = es.enter_context(tempfile.TemporaryDirectory()) - retrieve_source(package_name, archive_source) + apt = LocalApt() + apt.retrieve_source(package_name, archive_source) [subdir] = [e.path for e in os.scandir(archive_source) if e.is_dir()] with open(os.path.join(subdir, "debian", "changelog"), "r") as f: archive_cl = Changelog(f) diff -Nru breezy-debian-2.8.65/scripts/deb-move-orphaned breezy-debian-2.8.67/scripts/deb-move-orphaned --- breezy-debian-2.8.65/scripts/deb-move-orphaned 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/scripts/deb-move-orphaned 2022-04-20 22:15:53.000000000 +0000 @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright (C) 2019 Jelmer Vernooij # # This program is free software; you can redistribute it and/or modify diff -Nru breezy-debian-2.8.65/scripts/deb-new-upstream breezy-debian-2.8.67/scripts/deb-new-upstream --- breezy-debian-2.8.65/scripts/deb-new-upstream 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/scripts/deb-new-upstream 2022-04-20 22:15:53.000000000 +0000 @@ -284,6 +284,14 @@ RELEASE_BRANCH_NAME = "new-upstream-release" SNAPSHOT_BRANCH_NAME = "new-upstream-snapshot" DEFAULT_DISTRIBUTION = "unstable" +VALUE_IMPORT = { + 'release': 20, + 'snapshot': 10 +} +VALUE_MERGE = { + 'release': 40, + 'snapshot': 30, +} def is_big_version_jump(old_upstream_version, new_upstream_version): @@ -385,7 +393,7 @@ def detect_include_upstream_history( - tree, upstream_branch_source, package, old_upstream_version + packaging_branch, upstream_branch_source, package, old_upstream_version ): # Simple heuristic: Find the old upstream version and see if it's present # in the history of the packaging branch @@ -403,8 +411,8 @@ ) return False - graph = tree.branch.repository.get_graph() - ret = graph.is_ancestor(revision, tree.last_revision()) + graph = packaging_branch.repository.get_graph() + ret = graph.is_ancestor(revision, packaging_branch.last_revision()) if ret: logging.info( "Including upstream history, since previous upstream version " @@ -487,7 +495,7 @@ old_upstream_version=None, new_upstream_version=None, trust_package=False, - snapshot=False, + version_kind: str = "release", allow_ignore_upstream_branch=False, top_level=False, create_dist=None, @@ -512,7 +520,7 @@ try: upstream_branch = open_branch(upstream_branch_url) except BranchOpenError as e: - if not snapshot and allow_ignore_upstream_branch: + if version_kind != "snapshot" and allow_ignore_upstream_branch: logging.warning( "Upstream branch %s inaccessible; ignoring. %s", upstream_branch_location, @@ -523,7 +531,7 @@ upstream_branch = None upstream_branch_browse = None except urlutils.InvalidURL as e: - if not snapshot and allow_ignore_upstream_branch: + if version_kind != "snapshot" and allow_ignore_upstream_branch: logging.warning( "Upstream branch location %s invalid; ignoring. %s", e.path, e) @@ -545,7 +553,7 @@ config=config, local_dir=tree.controldir, create_dist=create_dist, - version_kind=("snapshot" if snapshot else "release") + version_kind=version_kind ) except InvalidHttpResponse as e: raise UpstreamBranchUnavailable(upstream_branch_location, str(e)) @@ -566,10 +574,10 @@ config=config, local_dir=tree.controldir, create_dist=create_dist, - version_kind=("snapshot" if snapshot else "release") + version_kind=version_kind ) else: - if snapshot: + if version_kind == "snapshot": if upstream_branch_source is None: raise UpstreamBranchUnknown() primary_upstream_source = upstream_branch_source @@ -615,7 +623,7 @@ if old_upstream_version == new_upstream_version: raise UpstreamAlreadyImported(new_upstream_version) if old_upstream_version > new_upstream_version: - if not snapshot and matches_release( + if version_kind == "release" and matches_release( str(old_upstream_version), str(new_upstream_version) ): raise UpstreamAlreadyImported(new_upstream_version) @@ -632,7 +640,7 @@ if include_upstream_history is None and upstream_branch_source is not None: include_upstream_history = detect_include_upstream_history( - tree, upstream_branch_source, package, old_upstream_version + tree.branch, upstream_branch_source, package, old_upstream_version ) if include_upstream_history is False: @@ -688,7 +696,7 @@ def import_upstream( tree: Tree, - snapshot: bool = False, + version_kind: str = "release", location: Optional[str] = None, new_upstream_version: Optional[Union[Version, str]] = None, force: bool = False, @@ -768,7 +776,7 @@ old_upstream_version=old_upstream_version, new_upstream_version=new_upstream_version, trust_package=trust_package, - snapshot=snapshot, + version_kind=version_kind, allow_ignore_upstream_branch=allow_ignore_upstream_branch, top_level=top_level, include_upstream_history=include_upstream_history, @@ -878,7 +886,7 @@ def merge_upstream( # noqa: C901 tree: Tree, - snapshot: bool = False, + version_kind: str = "release", location: Optional[str] = None, new_upstream_version: Optional[str] = None, force: bool = False, @@ -962,7 +970,7 @@ old_upstream_version=old_upstream_version, new_upstream_version=new_upstream_version, trust_package=trust_package, - snapshot=snapshot, + version_kind=version_kind, allow_ignore_upstream_branch=allow_ignore_upstream_branch, top_level=top_level, include_upstream_history=include_upstream_history, @@ -1140,8 +1148,8 @@ def update_packaging( - tree: Tree, old_tree: Tree, subpath: str = "", - committer: Optional[str] = None) -> List[str]: + tree: Tree, old_tree: Tree, subpath: str = "", + committer: Optional[str] = None) -> List[str]: """Update packaging to take in changes between upstream trees. Args: @@ -1161,7 +1169,7 @@ continue if not path.startswith(subpath): continue - path = path[len(subpath) :] + path = path[len(subpath):] if path == "autogen.sh": if override_dh_autoreconf_add_arguments(tree.basedir, [b"./autogen.sh"]): logging.info( @@ -1169,7 +1177,9 @@ ) with ChangelogEditor( tree.abspath(os.path.join(subpath, 'debian/changelog'))) as cl: - cl.add_entry(["Invoke autogen.sh from dh_autoreconf."], maintainer=maintainer) + cl.add_entry( + ["Invoke autogen.sh from dh_autoreconf."], + maintainer=maintainer) debcommit( tree, committer=committer, @@ -1177,11 +1187,14 @@ paths=["debian/changelog", "debian/rules"], ) elif path.startswith("LICENSE") or path.startswith("COPYING"): - notes.append("License file %s has changed." % os.path.join(subpath, path)) + notes.append( + "License file %s has changed." % os.path.join(subpath, path)) return notes -def report_fatal(code, description, upstream_version=None, conflicts=None): +def report_fatal( + code: str, description: str, upstream_version: Optional[str] = None, + conflicts=None, hint: Optional[str] = None): if os.environ.get('SVP_API') == '1': context = {} if upstream_version is not None: @@ -1191,9 +1204,12 @@ with open(os.environ['SVP_RESULT'], 'w') as f: json.dump({ 'result_code': code, + 'hint': hint, 'description': description, 'context': context}, f) logging.fatal('%s', description) + if hint: + logging.info('%s', hint) async def main(): @@ -1298,12 +1314,17 @@ elif os.environ.get('DEB_UPDATE_CHANGELOG') == 'update': update_changelog = True + if args.snapshot: + version_kind = "snapshot" + else: + version_kind = "release" + try: if not args.import_only: try: result = merge_upstream( tree=local_tree, - snapshot=args.snapshot, + version_kind=version_kind, trust_package=args.trust_package, update_changelog=update_changelog, subpath=subpath, @@ -1328,7 +1349,7 @@ else: result = import_upstream( tree=local_tree, - snapshot=args.snapshot, + version_kind=version_kind, trust_package=args.trust_package, subpath=subpath, committer=committer, @@ -1340,7 +1361,7 @@ report_fatal("memory-error", str(e)) return 1 except UpstreamAlreadyImported as e: - if args.snapshot: + if version_kind == "snapshot": report_fatal( "nothing-to-do", "Last upstream version %s already imported." % e.version, @@ -1349,9 +1370,9 @@ else: report_fatal( "nothing-to-do", - "Last upstream version %s already imported. " - "Import a snapshot by specifying --snapshot." % e.version, - upstream_version=e.version + "Last upstream version %s already imported. " % e.version, + upstream_version=e.version, + hint="Import a snapshot by specifying --snapshot." ) return 1 except UpstreamBranchLocationInvalid as e: @@ -1430,11 +1451,11 @@ error_code = "upstream-unsupported-vcs" report_fatal(error_code, error_description) return 1 - except UpstreamBranchUnknown as e: + except UpstreamBranchUnknown: report_fatal( "upstream-branch-unknown", - "Upstream branch location unknown. " - "Set 'Repository' field in debian/upstream/metadata?", + "Upstream branch location unknown.", + hint="Set 'Repository' field in debian/upstream/metadata?", ) return 1 except UpstreamMergeConflicted as e: @@ -1580,6 +1601,7 @@ if os.environ.get('SVP_API') == '1': with open(os.environ['SVP_RESULT'], 'w') as f: json.dump({ + 'value': VALUE_IMPORT[version_kind], 'description': "Imported new upstream version %s" % ( result.new_upstream_version), 'context': svp_context, @@ -1637,6 +1659,7 @@ if os.environ.get('SVP_API') == '1': with open(os.environ['SVP_RESULT'], 'w') as f: json.dump({ + 'value': VALUE_MERGE[version_kind], 'description': "Merged new upstream version %s" % ( result.new_upstream_version), 'commit-message': proposed_commit_message, diff -Nru breezy-debian-2.8.65/source_distiller.py breezy-debian-2.8.67/source_distiller.py --- breezy-debian-2.8.65/source_distiller.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/source_distiller.py 2022-04-20 22:15:53.000000000 +0000 @@ -26,12 +26,10 @@ import tempfile from ... import errors as bzr_errors -from ...export import ( - export, - ) from ...trace import note from .util import ( + export_with_nested, extract_orig_tarballs, get_parent_dir, recursive_copy, @@ -90,7 +88,7 @@ if not self.use_existing: if os.path.exists(target): raise bzr_errors.FileExists(target) - export(self.tree, target, subdir=self.subpath) + export_with_nested(self.tree, target, subdir=self.subpath) class FullSourceDistiller(SourceDistiller): @@ -122,7 +120,7 @@ raise bzr_errors.FileExists(target) parent_dir = get_parent_dir(target) self.upstream_provider.provide(parent_dir) - export(self.tree, target, subdir=self.subpath) + export_with_nested(self.tree, target, subdir=self.subpath) # TODO(jelmer): Unapply patches, if they're applied. @@ -180,7 +178,7 @@ export_dir = os.path.join(tempdir, 'debian') else: export_dir = tempdir - export(self.tree, export_dir, subdir=self.subpath) + export_with_nested(self.tree, export_dir, subdir=self.subpath) # Remove any upstream debian dir, or from previous export with # use_existing if os.path.exists(os.path.join(target, 'debian')): diff -Nru breezy-debian-2.8.65/tests/test_config.py breezy-debian-2.8.67/tests/test_config.py --- breezy-debian-2.8.65/tests/test_config.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/tests/test_config.py 2022-04-20 22:15:53.000000000 +0000 @@ -98,6 +98,28 @@ self.assertEquals( "tag:exampl-$UPSTREAM_VERSION", cfg.export_upstream_revision) + def test_upstream_metadata_multidoc(self): + cfg = DebBuildConfig([], tree=self.branch.basis_tree()) + self.assertIs(None, cfg.upstream_branch) + + self.build_tree_contents([ + ('debian/',), + ('debian/upstream/',), + ('debian/upstream/metadata', + b'---\n' + b'---\n' + b'Name: example\n' + b'Repository: http://example.com/foo\n' + b'Repository-Tag-Prefix: exampl-\n' + )]) + self.tree.add( + ['debian', 'debian/upstream', 'debian/upstream/metadata']) + + cfg = DebBuildConfig([], tree=self.tree) + self.assertEquals("http://example.com/foo", cfg.upstream_branch) + self.assertEquals( + "tag:exampl-$UPSTREAM_VERSION", cfg.export_upstream_revision) + def test_invalid_upstream_metadata(self): cfg = DebBuildConfig([], tree=self.branch.basis_tree()) self.assertIs(None, cfg.upstream_branch) diff -Nru breezy-debian-2.8.65/upstream/branch.py breezy-debian-2.8.67/upstream/branch.py --- breezy-debian-2.8.65/upstream/branch.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/upstream/branch.py 2022-04-20 22:15:53.000000000 +0000 @@ -19,17 +19,19 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from contextlib import ExitStack -from debian.changelog import Version +from datetime import date import os import re import subprocess import tempfile from typing import Optional, Tuple, Iterable +from debian.changelog import Version from debmutate.versions import ( git_snapshot_data_from_version, get_snapshot_revision as _get_snapshot_revision, debianize_upstream_version, + upstream_version_add_revision as _upstream_version_add_revision, ) from .... import osutils @@ -60,14 +62,12 @@ MultipleUpstreamTarballsNotSupported, ) from .. import gettext +from ..util import export_with_nested from . import ( UpstreamSource, PackageVersionNotPresent, new_tarball_name, ) -from ....export import ( - export, - ) from ....workingtree import ( WorkingTree, ) @@ -223,7 +223,6 @@ return svn_revno -# TODO(jelmer): Rely on version from debmutate def upstream_version_add_revision( upstream_branch, version_string, revid, sep='+'): """Update the revision in a upstream version string. @@ -236,52 +235,24 @@ try: revno = upstream_branch.revision_id_to_dotted_revno(revid) except GhostRevisionsHaveNoRevno: - pass + bzr_revno = None else: - revno_str = '.'.join(map(str, revno)) - - m = re.match(r"^(.*)([\+~])bzr(\d+)$", version_string) - if m: - return "%s%sbzr%s" % (m.group(1), m.group(2), revno_str) + bzr_revno = '.'.join(map(str, revno)) rev = upstream_branch.repository.get_revision(revid) gitid = extract_gitid(rev) if gitid: - gitid = gitid[:7].decode('ascii') - gitdate = osutils.format_date( - rev.timestamp, rev.timezone, date_fmt='%Y%m%d', show_offset=False) - - m = re.match(r"^(.*)([\+~-])git(\d{8})\.([a-f0-9]{7})$", version_string) - if m and gitid: - return "%s%sgit%s.%s" % (m.group(1), m.group(2), gitdate, gitid) - - m = re.match(r"^(.*)([\+~-])git(\d{8})\.(\d+)\.([a-f0-9]{7})$", - version_string) - if m and gitid: - if gitdate == m.group(3): - snapshot = int(m.group(4)) + 1 - else: - snapshot = 0 - return "%s%sgit%s.%d.%s" % ( - m.group(1), m.group(2), gitdate, snapshot, gitid) - - m = re.match(r"^(.*)([\+~-])git(\d{8})$", version_string) - if m and gitid: - return "%s%sgit%s" % (m.group(1), m.group(2), gitdate) + gitdate = date.fromisoformat(osutils.format_date( + rev.timestamp, rev.timezone, date_fmt='%Y-%m-%d', + show_offset=False)) + else: + gitdate = None svn_revno = extract_svn_revno(rev) - m = re.match(r"^(.*)([\+~])svn(\d+)$", version_string) - # FIXME: Raise error if +svn/~svn is present and svn_revno is not set? - if m and svn_revno: - return "%s%ssvn%d" % (m.group(1), m.group(2), svn_revno) - - if svn_revno: - return "%s%ssvn%d" % (version_string, sep, svn_revno) - elif gitid: - return "%s%sgit%s.1.%s" % (version_string, sep, gitdate, gitid) - else: - return "%s%sbzr%s" % (version_string, sep, revno_str) + return _upstream_version_add_revision( + version_string, gitid=gitid, gitdate=gitdate, bzr_revno=bzr_revno, + svn_revno=svn_revno) def get_snapshot_revision(upstream_version): @@ -396,6 +367,8 @@ """Guess revspecs matching an upstream version string.""" if version.endswith('+ds'): version = str(version)[:-len('+ds')] + if version.endswith('~ds'): + version = str(version)[:-len('~ds')] if version.endswith('+dfsg'): version = str(version)[:-len('+dfsg')] if version.endswith('+repack'): @@ -609,7 +582,8 @@ target_filename = self._tarball_path( package, version, None, target_dir) try: - export(rev_tree, target_filename, 'tgz', tarball_base) + export_with_nested( + rev_tree, target_filename, format='tgz', root=tarball_base) except UnsupportedOperation as e: note('Not exporting revision from upstream branch: %s', e) raise PackageVersionNotPresent(package, version, self) @@ -718,7 +692,7 @@ if include_controldir: _dupe_vcs_tree(rev_tree, package_dir) else: - export(rev_tree, package_dir, 'dir') + export_with_nested(rev_tree, package_dir, format='dir') existing_files = os.listdir(package_dir) try: _run_and_interpret(dist_command, env, package_dir) diff -Nru breezy-debian-2.8.65/upstream/__init__.py breezy-debian-2.8.67/upstream/__init__.py --- breezy-debian-2.8.65/upstream/__init__.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/upstream/__init__.py 2022-04-20 22:15:53.000000000 +0000 @@ -32,7 +32,6 @@ from ....errors import BzrError, DependencyNotPresent, NoSuchFile from .... import osutils -from ....export import export from ....trace import ( note, warning, @@ -44,6 +43,7 @@ ) from ..util import ( component_from_orig_tarball, + export_with_nested, tarball_name, ) @@ -209,7 +209,7 @@ prefix="builddeb-get-orig-source-") as tmpdir: export_dir = os.path.join( tmpdir, "%s-%s" % (package, upstream_version)) - export(self.tree, export_dir, format="dir") + export_with_nested(self.tree, export_dir, format="dir") shutil.rmtree(os.path.join(export_dir, "debian")) with tarfile.open(target_filename, "w:gz") as tar: tar.add(export_dir, "%s-%s" % (package, upstream_version)) diff -Nru breezy-debian-2.8.65/upstream/pristinetar.py breezy-debian-2.8.67/upstream/pristinetar.py --- breezy-debian-2.8.65/upstream/pristinetar.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/upstream/pristinetar.py 2022-04-20 22:15:53.000000000 +0000 @@ -40,8 +40,8 @@ PackageVersionNotPresent, UpstreamSource, ) -from ....export import export from ..util import ( + export_with_nested, subprocess_setup, ) @@ -229,7 +229,7 @@ with tempfile.TemporaryDirectory(prefix="builddeb-pristine-") as tmpdir: dest = os.path.join(tmpdir, "orig") with tree.lock_read(): - export(tree, dest, format='dir', subdir=subdir) + export_with_nested(tree, dest, format='dir', subdir=subdir) try: return make_pristine_tar_delta(dest, tarball_path) except PristineTarDeltaTooLarge: @@ -328,13 +328,13 @@ return ret def has_version( - self, package: Optional[str], version: Version, tarballs=None): + self, package: Optional[str], version: Version, tarballs=None, try_hard=True): if tarballs is None: - return self.has_version_component(package, version, component=None) + return self.has_version_component(package, version, component=None, try_hard=try_hard) else: for (tarball, component, md5) in tarballs: if not self.has_version_component( - package, version, component, md5): + package, version, component, md5, try_hard=try_hard): return False return True @@ -389,9 +389,9 @@ def has_version_component( self, package: Optional[str], version: Version, component, - md5=None): + md5=None, try_hard=True): for tag_name in self.possible_tag_names( - package, version, component=component): + package, version, component=component, try_hard=try_hard): try: revid = self.branch.tags.lookup_tag(tag_name) except NoSuchTag: @@ -547,8 +547,9 @@ def possible_tag_names( self, package: Optional[str], version: Version, - component: Optional[str]): - return possible_upstream_tag_names(package, version, component) + component: Optional[str], + try_hard: bool = True): + return possible_upstream_tag_names(package, version, component, try_hard=try_hard) def get_pristine_tar_delta(self, package, version, dest_filename, revid=None): @@ -564,11 +565,11 @@ delta = self.get_pristine_tar_delta( package, version, dest_filename, revid) except PristineTarDeltaAbsent: - export(tree, dest_filename, per_file_timestamps=True) + export_with_nested(tree, dest_filename, per_file_timestamps=True) else: with tempfile.TemporaryDirectory(prefix="bd-pristine-") as tmpdir: dest = os.path.join(tmpdir, "orig") - export(tree, dest, format='dir') + export_with_nested(tree, dest, format='dir') reconstruct_pristine_tar(dest, delta, dest_filename) def _has_revision(self, revid, md5=None): @@ -881,12 +882,12 @@ return False return True - def possible_tag_names(self, package: Optional[str], version: Version, component: Optional[str]): + def possible_tag_names(self, package: Optional[str], version: Version, component: Optional[str], try_hard: bool = True): tags = [] if self.gbp_tag_format: tags.append(gbp_expand_tag_name(self.gbp_tag_format, mangle_version_for_git(version))) - tags.extend(possible_upstream_tag_names(package, version, component)) + tags.extend(possible_upstream_tag_names(package, version, component, try_hard=try_hard)) return tags @@ -925,7 +926,7 @@ tree = self.branch.repository.revision_tree(revid) dest_filename = self._tarball_path( package, version, component, target_dir, format='gz') - export(tree, dest_filename, per_file_timestamps=True) + export_with_nested(tree, dest_filename, per_file_timestamps=True) return dest_filename else: dest_filename = os.path.join(target_dir, dest_filename) diff -Nru breezy-debian-2.8.65/upstream/tags.py breezy-debian-2.8.67/upstream/tags.py --- breezy-debian-2.8.65/upstream/tags.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/upstream/tags.py 2022-04-20 22:15:53.000000000 +0000 @@ -32,7 +32,7 @@ from debmutate.versions import mangle_version_for_git -def possible_upstream_tag_names(package: Optional[str], version: Version, component: Optional[str] = None): +def possible_upstream_tag_names(package: Optional[str], version: Version, component: Optional[str] = None, try_hard=True): tags = [] if component is None: # compatibility with git-buildpackage @@ -44,16 +44,17 @@ # compatibility with svn-buildpackage tags.append("upstream_%s" % version) - # common upstream names - tags.append("%s" % version) - tags.append("v%s" % version) - if '~' not in str(version) and '+' not in str(version): - tags.append("release-%s" % version) - tags.append("v%s-release" % version) - if package: - tags.append("%s-%s" % (package, version)) - tags.append("v/%s" % version) - tags.append("v.%s" % version) + if try_hard: + # common upstream names + tags.append("%s" % version) + tags.append("v%s" % version) + if '~' not in str(version) and '+' not in str(version): + tags.append("release-%s" % version) + tags.append("v%s-release" % version) + if package: + tags.append("%s-%s" % (package, version)) + tags.append("v/%s" % version) + tags.append("v.%s" % version) else: tags.append('upstream-%s/%s' % (version, component)) tags.append('upstream/%s/%s' % (mangle_version_for_git(version), component)) diff -Nru breezy-debian-2.8.65/upstream/uscan.py breezy-debian-2.8.67/upstream/uscan.py --- breezy-debian-2.8.65/upstream/uscan.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/upstream/uscan.py 2022-04-20 22:15:53.000000000 +0000 @@ -29,9 +29,9 @@ from ....errors import BzrError, NoSuchFile from .... import osutils -from ....export import export from ....trace import note, warning from . import UpstreamSource, PackageVersionNotPresent +from ..util import export_with_nested class UScanError(BzrError): @@ -173,8 +173,9 @@ if self.subpath: subdir = osutils.pathjoin(self.subpath, subdir) # Just export all of debian/, since e.g. uupdate needs more of it. - export(self.tree, os.path.join(container, 'debian'), format='dir', - subdir=subdir) + export_with_nested( + self.tree, os.path.join(container, 'debian'), format='dir', + subdir=subdir) if self.auto_fix: self._do_auto_fix(os.path.join(container, 'debian', 'watch')) args = ["--force-download", "--rename", diff -Nru breezy-debian-2.8.65/util.py breezy-debian-2.8.67/util.py --- breezy-debian-2.8.65/util.py 2021-12-29 19:37:42.000000000 +0000 +++ breezy-debian-2.8.67/util.py 2022-04-20 22:15:53.000000000 +0000 @@ -46,6 +46,7 @@ osutils, urlutils, ) +from ...export import export from ...trace import ( mutter, note, @@ -884,3 +885,18 @@ if snapshot_info is None: return 'release' return 'snapshot' + + +def export_with_nested(tree, dest, **kwargs): + with tree.lock_read(): + try: + try: + return export(tree, dest, recurse_nested=True, **kwargs) + except TypeError: # brz < 3.3 + if any(tree.iter_references()): + raise NotImplementedError('unable to export tree references') + return export(tree, dest, **kwargs) + except BaseException: + if os.path.isfile(dest): + os.unlink(dest) + raise