← Back to team overview

ubuntu-packaging-guide-team team mailing list archive

[Bug 1954595] Re: bzr dh-make crash - no attribute 'initialize_on_transport'

 

Submitted a Merge Request [1] with updates to the Ubuntu Packaging Guide
for Ubuntu Focal.

[1] https://code.launchpad.net/~mfo/ubuntu-packaging-guide/ubuntu-
packaging-guide/+merge/423560

** Branch linked: lp:~mfo/ubuntu-packaging-guide/ubuntu-packaging-guide

** Changed in: ubuntu-packaging-guide
       Status: Confirmed => In Progress

** Changed in: ubuntu-packaging-guide
   Importance: Undecided => Medium

** Changed in: ubuntu-packaging-guide
     Assignee: (unassigned) => Mauricio Faria de Oliveira (mfo)

-- 
You received this bug notification because you are a member of Ubuntu
Packaging Guide Team, which is subscribed to Ubuntu Packaging Guide.
https://bugs.launchpad.net/bugs/1954595

Title:
  bzr dh-make crash - no attribute 'initialize_on_transport'

Status in Ubuntu Packaging Guide:
  In Progress
Status in breezy-debian package in Ubuntu:
  Invalid
Status in breezy-debian source package in Bionic:
  Fix Committed
Status in breezy-debian source package in Focal:
  Fix Committed

Bug description:
  [Impact]

   * The `bzr dh-make` step in the Ubuntu Packaging Guide [1]
     fails in Focal.

   * The alternative `brz dh-make` (BReeZy instead of BaZaaR)
     fails in Focal and Bionic.

   * The `dh-make` subcommand is not available in Impish/later.
     The Guide should be updated and ideally use another tool.

  [Test Plan]

   * Prepare:
     $ sudo apt-get install dh-make bzr-builddeb brz-debian
     $ bzr whoami "Your Name <name@xxxxxxxxxxx>"
     $ wget -O hello-2.10.tar.gz "http://ftp.gnu.org/gnu/hello/hello-2.10.tar.gz";

   * Test bazaar:
     $ bzr dh-make hello 2.10 hello-2.10.tar.gz

   * Test breezy:
     $ brz dh-make hello 2.10 hello-2.10.tar.gz

   * Between tests, remove the generated dir/file:
     $ rm -rf hello hello_2.10.orig.tar.gz

  [Where problems could occur]

   * The changes are restricted to the `dh-make` command
     in bazaar/breezy, which is broken, so it should not
     make things worse.

     But, theoretically, `bzr/brz dh-make` is the impact
     surface for other issues/regressions from previous/
     working releases.

  [Links]

   * [1] https://packaging.ubuntu.com/html/packaging-new-
  software.html#starting-a-package

  [Other Info]

   * Bionic is not affected in `bzr`, but just in `brz`,
     due to being from 2 source packages: `bzr-builddeb`
     and `breezy-debian`.

   * Focal is affected in both `bzr/brz` per transition
     from `bzr-builddeb` to `breezy-debian` (1 src pkg).

   * Impish+ are not "affected" as `dh-make` was dropped
     by debian-breezy upstream.

   * The root cause of the regression is a dropped python
    `import` in breezy-debian following changes in breezy.

     The `bzrdir` import sets ControlDir's default format:
     `controldir.ControlDirFormat._default_format = BzrDirMetaFormat1()`

     Once debian-breezy.git's dh_make.py:_get_tree() moved
     from BzrDir. to ControlDir.create_branch_convenience()
     and dropped the bzrlib import, that is not set anymore.

     Now, create_branch_convenience() calls create(), calls
     initialize_on_transport() on the default format (None).

   commit 08fcab340a2cd4f6bf0f5aec65c304a88023a4f8
   Author: Jelmer Vernooij <jelmer@xxxxxxxxx>
   Date:   Sat Jun 17 14:10:12 2017 +0000

       Update for breezy, drop support for older versions of bazaar and
  for debian_bundle.

   ...
   diff --git a/dh_make.py b/dh_make.py
   ...
    from ... import (
   -    bzrdir,
   +    controldir,
   ...
   @@ -34,22 +34,22 @@ def _get_tree(package_name):
   ...
   -            create_branch = bzrdir.BzrDir.create_branch_convenience
   ...
   +            create_branch = controldir.ControlDir.create_branch_convenience
   ...

   * Focal needs another patch to fix this in `bzr`:

   $ bzr dh-make hello 2.10 hello-2.10.tar.gz
   Fetching tarball
   Looking for a way to retrieve the upstream tarball
   Upstream tarball already exists in build directory, using that
   brz: ERROR: TypeError: can only concatenate str (not "bytes") to str

   * Synthetic test cases for this are provided in comment #1.

  [Original Bug Description]

  I am following official Ubuntu Packaging Guide:
  https://packaging.ubuntu.com/html/packaging-new-software.html

  When I come to the following part, the command crashes:

  $ bzr dh-make hello 2.10 hello-2.10.tar.gz
  brz: ERROR: AttributeError: 'NoneType' object has no attribute 'initialize_on_transport'
  (trackback bellow)

  My system:

  Description:	Ubuntu 20.04.3 LTS
  Release:	20.04
  dh-make:
    Installed: 2.201903
    Candidate: 2.201903
    Version table:
   *** 2.201903 500
          500 http://cz.archive.ubuntu.com/ubuntu focal/main amd64 Packages
          500 http://cz.archive.ubuntu.com/ubuntu focal/main i386 Packages
          100 /var/lib/dpkg/status

  $ bzr dh-make hello 2.10 hello-2.10.tar.gz
  brz: ERROR: AttributeError: 'NoneType' object has no attribute 'initialize_on_transport'

  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/breezy/plugins/debian/dh_make.py", line 26, in _get_tree
      tree = workingtree.WorkingTree.open(".")
    File "/usr/lib/python3/dist-packages/breezy/workingtree.py", line 201, in open
      control = controldir.ControlDir.open(path, _unsupported=_unsupported)
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 706, in open
      return klass.open_from_transport(t, probers=probers,
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 736, in open_from_transport
      transport, format = _mod_transport.do_catching_redirections(
    File "/usr/lib/python3/dist-packages/breezy/transport/__init__.py", line 1613, in do_catching_redirections
      return action(transport)
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 724, in find_format
      return transport, ControlDirFormat.find_format(transport,
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 1166, in find_format
      raise errors.NotBranchError(path=transport.base)
  breezy.errors.NotBranchError: Not a branch: "/home/jkalina/packaging/".

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/breezy/plugins/debian/dh_make.py", line 37, in _get_tree
      a_controldir = controldir.ControlDir.open_from_transport(
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 736, in open_from_transport
      transport, format = _mod_transport.do_catching_redirections(
    File "/usr/lib/python3/dist-packages/breezy/transport/__init__.py", line 1613, in do_catching_redirections
      return action(transport)
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 724, in find_format
      return transport, ControlDirFormat.find_format(transport,
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 1166, in find_format
      raise errors.NotBranchError(path=transport.base)
  breezy.errors.NotBranchError: Not a branch: "/home/jkalina/packaging/hello/".

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1016, in exception_to_return_code
      return the_callable(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/breezy/commands.py", line 1202, in run_bzr
      ret = run(*run_argv)
    File "/usr/lib/python3/dist-packages/breezy/commands.py", line 759, in run_argv_aliases
      return self.run(**all_cmd_args)
    File "/usr/lib/python3/dist-packages/breezy/commands.py", line 784, in run
      return self._operation.run_simple(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/breezy/cleanup.py", line 136, in run_simple
      return _do_with_cleanups(
    File "/usr/lib/python3/dist-packages/breezy/cleanup.py", line 166, in _do_with_cleanups
      result = func(*args, **kwargs)
    File "/usr/lib/python3/dist-packages/breezy/plugins/debian/cmds.py", line 1385, in run
      tree = dh_make.import_upstream(
    File "/usr/lib/python3/dist-packages/breezy/plugins/debian/dh_make.py", line 83, in import_upstream
      tree = _get_tree(package_name)
    File "/usr/lib/python3/dist-packages/breezy/plugins/debian/dh_make.py", line 42, in _get_tree
      branch = create_branch(to_transport.base,
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 660, in create_branch_convenience
      controldir = klass.create(base, format, possible_transports)
    File "/usr/lib/python3/dist-packages/breezy/controldir.py", line 859, in create
      return format.initialize_on_transport(t)
  AttributeError: 'NoneType' object has no attribute 'initialize_on_transport'

  You can report this problem to Bazaar's developers by running
      apport-bug /var/crash/brz.1000.2021-12-12T15:32.crash
  if a bug-reporting window does not automatically appear.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu-packaging-guide/+bug/1954595/+subscriptions