← Back to team overview

ubuntu-packaging-guide-team team mailing list archive

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

 

Dear all, not sure if this bug fix is just about dh_make or the full
process to make a package for Launchpad that is documented on the Ubuntu
documentation.

The former now works, the latter still fails further down the process.

Here is what now works:

$ bzr dh-make 1fichierfs 1.9.2~Focal /tmp/1fichierfs.tar
Fetching tarball                                                                                                                                                                                                  
Looking for a way to retrieve the upstream tarball
Upstream tarball already exists in build directory, using that
Type of package: (single, indep, library, python)
[s/i/l/p]?
Maintainer Name     : ....
Email-Address       : ....@....fr
Date                : Thu, 26 May 2022 13:50:43 +0200
Package Name        : 1fichierfs
Version             : 1.9.2~Focal
License             : blank
Package Type        : single
Are the details correct? [Y/n/q]
Skipping creating ../1fichierfs_1.9.2~Focal.orig.tar.gz because it already exists
Currently there is not top level Makefile. This may require additional tuning
Done. Please edit the files in the debian/ subdirectory now.

Package prepared in /tmp/build/1fichierfs


That's fine.

Then further down the process we have

$ bzr commit -m "This is a test"
Committing to: /tmp/build/1fichierfs/                                                                                                                                                                             
added debian
added debian/1fichierfs-docs.docs
missing debian/README.Debian
missing debian/README.source
added debian/changelog
added debian/control
added debian/copyright
added debian/rules
added debian/source
added debian/source/format
Committed revision 2.


(Note the "missing" warning is not an issue, that is because I purposefully removed these files that I didn't fill with useful information so far)
You can notice here that there is no "compat" file although I provided one in the debian directory.

echo 10 >debian/compat

Then further it seems to complain for compatibility level:

$ bzr builddeb -- -us -uc
Building using working tree
Building package in merge mode
Looking for a way to retrieve the upstream tarball
Using the upstream tarball that is present in /tmp/build
Building the package in /tmp/build/build-area/1fichierfs-1.9.2~Focal, using debuild -us -uc
 dpkg-buildpackage -us -uc -ui
dpkg-buildpackage: info: paquet source 1fichierfs
dpkg-buildpackage: info: version source 1.9.2~Focal-1
dpkg-buildpackage: info: distribution source focal
dpkg-buildpackage: info: source changé par .... <...@...fr>
 dpkg-source --before-build .
dpkg-buildpackage: info: architecture hôte amd64
 fakeroot debian/rules clean
dh clean
dh: error: Please specify the compatibility level in debian/compat
make: *** [debian/rules:18 : clean] Error 25
dpkg-buildpackage: error: fakeroot debian/rules clean subprocess returned exit status 2
debuild: fatal error at line 1182:
dpkg-buildpackage -us -uc -ui failed
brz: ERROR: The build failed.


This was working as of 16.04, although it seemed to use compatibility
level 9, and nowadays this seems obsolete.


What am I doing wrong (which is then probably missing in the documentation)?

Or is there something broken elsewhere with "compat" not being committed
although it is present?

-- 
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:
  Confirmed
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