launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #21761
[Merge] lp:~cjwatson/launchpad-buildd/bzr-command-line into lp:launchpad-buildd
Colin Watson has proposed merging lp:~cjwatson/launchpad-buildd/bzr-command-line into lp:launchpad-buildd.
Commit message:
Use bzr's command-line interface rather than bzrlib, to ease porting to
Python 3.
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~cjwatson/launchpad-buildd/bzr-command-line/+merge/328177
--
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~cjwatson/launchpad-buildd/bzr-command-line into lp:launchpad-buildd.
=== modified file 'debian/changelog'
--- debian/changelog 2017-07-27 15:38:53 +0000
+++ debian/changelog 2017-07-27 16:13:37 +0000
@@ -5,6 +5,8 @@
* Run tests at build time, now that python-txfixtures is in
ppa:launchpad/ubuntu/ppa (and >= zesty).
* Add missing dependency on intltool.
+ * Use bzr's command-line interface rather than bzrlib, to ease porting to
+ Python 3.
-- Colin Watson <cjwatson@xxxxxxxxxx> Tue, 25 Jul 2017 23:07:58 +0100
=== modified file 'lpbuildd/pottery/generate_translation_templates.py'
--- lpbuildd/pottery/generate_translation_templates.py 2016-12-09 18:04:00 +0000
+++ lpbuildd/pottery/generate_translation_templates.py 2017-07-27 16:13:37 +0000
@@ -1,5 +1,5 @@
#! /usr/bin/python
-# Copyright 2010 Canonical Ltd. This software is licensed under the
+# Copyright 2010-2017 Canonical Ltd. This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).
from __future__ import print_function
@@ -7,14 +7,12 @@
__metaclass__ = type
import os.path
+import subprocess
import sys
import tarfile
import logging
-from bzrlib.branch import Branch
-from bzrlib.export import export
-
from lpbuildd.pottery import intltool
@@ -68,12 +66,10 @@
The branch is checked out to the location specified by
`self.branch_dir`.
"""
- self.logger.info("Opening branch %s..." % branch_url)
- branch = Branch.open(branch_url)
- self.logger.info("Getting branch revision tree...")
- rev_tree = branch.basis_tree()
- self.logger.info("Exporting branch to %s..." % self.branch_dir)
- export(rev_tree, self.branch_dir)
+ self.logger.info(
+ "Exporting branch %s to %s..." % (branch_url, self.branch_dir))
+ subprocess.check_call(
+ ["bzr", "export", "-q", "-d", branch_url, self.branch_dir])
self.logger.info("Exporting branch done.")
def _makeTarball(self, files):
=== modified file 'lpbuildd/pottery/tests/test_generate_translation_templates.py'
--- lpbuildd/pottery/tests/test_generate_translation_templates.py 2017-05-10 11:26:30 +0000
+++ lpbuildd/pottery/tests/test_generate_translation_templates.py 2017-07-27 16:13:37 +0000
@@ -9,15 +9,6 @@
import sys
import tarfile
-from bzrlib.bzrdir import BzrDir
-from bzrlib.generate_ids import (
- gen_file_id,
- gen_root_id,
- )
-from bzrlib.transform import (
- ROOT_PARENT,
- TransformPreview,
- )
from fixtures import (
EnvironmentVariable,
TempDir,
@@ -76,34 +67,25 @@
written to the branch. Currently only supports writing files at
the root directory of the branch.
- :return: a tuple of a fresh bzr branch and its URL.
+ :return: the URL of a fresh bzr branch.
"""
- branch_url = 'file://' + self.useFixture(TempDir()).path
- branch = BzrDir.create_branch_convenience(branch_url)
+ branch_path = self.useFixture(TempDir()).path
+ branch_url = 'file://' + branch_path
+ subprocess.check_call(['bzr', 'init', '-q'], cwd=branch_path)
if content_map is not None:
- branch.lock_write()
- try:
- revision_tree = branch.basis_tree()
- transform_preview = TransformPreview(revision_tree)
- try:
- root_id = transform_preview.new_directory(
- '', ROOT_PARENT, gen_root_id())
- for name, contents in content_map.iteritems():
- file_id = gen_file_id(name)
- transform_preview.new_file(
- name, root_id, [contents], file_id=file_id)
- committer_id = 'Committer <committer@xxxxxxxxxxx>'
- with EnvironmentVariable('BZR_EMAIL', committer_id):
- transform_preview.commit(
- branch, 'Populating branch.',
- committer=committer_id)
- finally:
- transform_preview.finalize()
- finally:
- branch.unlock()
+ for name, contents in content_map.iteritems():
+ with open(os.path.join(branch_path, name), 'wb') as f:
+ f.write(contents)
+ subprocess.check_call(
+ ['bzr', 'add', '-q'] + list(content_map), cwd=branch_path)
+ committer_id = 'Committer <committer@xxxxxxxxxxx>'
+ with EnvironmentVariable('BZR_EMAIL', committer_id):
+ subprocess.check_call(
+ ['bzr', 'commit', '-q', '-m', 'Populating branch.'],
+ cwd=branch_path)
- return branch, branch_url
+ return branch_url
def test_getBranch_bzr(self):
# _getBranch can retrieve branch contents from a branch URL.
@@ -113,7 +95,7 @@
self.useFixture(EnvironmentVariable('EMAIL'))
marker_text = "Ceci n'est pas cet branch."
- branch, branch_url = self._createBranch({'marker.txt': marker_text})
+ branch_url = self._createBranch({'marker.txt': marker_text})
generator = GenerateTranslationTemplates(
branch_url, self.result_name, self.useFixture(TempDir()).path,
=== modified file 'setup.py'
--- setup.py 2015-11-11 08:57:21 +0000
+++ setup.py 2017-07-27 16:13:37 +0000
@@ -58,7 +58,6 @@
maintainer_email='launchpad-dev@xxxxxxxxxxxxxxxxxxx',
license='Affero GPL v3',
install_requires=[
- 'bzr',
# XXX cjwatson 2015-11-04: This does in fact require python-apt, but
# that's normally shipped as a system package and specifying it here
# causes problems for Launchpad's build system.
Follow ups