1

I am trying to build Cozy Audiobook in launchpad.

I have the imported the source branch (master) from GitHub, and a there is a different branch (deb-packaging-juno) containing the debian/ directory. The master branch does not have a debian directory. I want to copy the debian/ directory from the deb-packaging-juno branch into the master branch during building.

I went through the Launchpad help page for recipes, and also this answer.

I created the following packaging recipe.

# git-build-recipe format 0.4 deb-version {debupstream}-0~{revtime}
lp:cozy master
nest-part deb-packaging-juno lp:cozy debian debian master

But the package fails to build in Launchpad, with the following build error. Here is the full buildlog.

Traceback (most recent call last):
  File "/usr/bin/git-build-recipe", line 11, in <module>
    load_entry_point('git-build-recipe==0.1', 'console_scripts', 'git-build-recipe')()
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/main.py", line 110, in main
    build_tree(base_branch, working_directory)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/recipe.py", line 489, in build_tree
    _build_inner_tree(base_branch, target_path)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/recipe.py", line 413, in _build_inner_tree
    instruction.apply(target_path)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/recipe.py", line 567, in apply
    target_subdir=self.target_subdir)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/recipe.py", line 400, in nest_part_branch
    child_branch.commit + ":" + subpath)
  File "/usr/lib/python3/dist-packages/gitbuildrecipe/recipe.py", line 662, in git_call
    **kwargs)
  File "/usr/lib/python3.6/subprocess.py", line 356, in check_output
    **kwargs).stdout
  File "/usr/lib/python3.6/subprocess.py", line 438, in run
    output=stdout, stderr=stderr)
subprocess.CalledProcessError: Command '['git', '-C', '/home/buildd/build-RECIPEBRANCHBUILD-2811196/chroot-autobuild/home/buildd/work/tree/recipe', 'read-tree', '--prefix', 'debian', '-u', '574660454b66b1c1fd22e72c0ac2d1041e0a4b4d:debian']' returned non-zero exit status 128.
RUN: /usr/share/launchpad-buildd/bin/in-target scan-for-processes --backend=chroot --series=hirsute --arch=amd64 RECIPEBRANCHBUILD-2811196
Scanning for processes to kill in build RECIPEBRANCHBUILD-2811196

What was the error with my packaging recipe and how to fix it?

2 Answers 2

1

The error is that you used the wrong branch name in the nest-part line. (The first argument to nest-part is a name that can be used to refer to that part of the recipe in substitution variables, not a Git branch name.) While the error message isn't the clearest thing ever, you can spot it by looking at this line in the build log:

fatal: Not a valid object name 574660454b66b1c1fd22e72c0ac2d1041e0a4b4d:debian

574660454b66b1c1fd22e72c0ac2d1041e0a4b4d is the current commit on the master branch, and that error message is saying, accurately, that there's no debian directory in the tree referenced by that commit.

You should have written the following instead, which seems to work as desired when I test it locally:

# git-build-recipe format 0.4 deb-version {debupstream}-1~{revtime}
lp:cozy master
nest-part deb-packaging-juno lp:cozy debian debian deb-packaging-juno

Or perhaps you might want to use a different name for the first argument to nest-part to reduce confusion:

# git-build-recipe format 0.4 deb-version {debupstream}-1~{revtime}
lp:cozy master
nest-part packaging lp:cozy debian debian deb-packaging-juno
2
  • It works. Thank you. It may be helpful if it is clearly written in the help page that the first argument in the nest-part line is the destination branch, and the last argument is the source branch. Jun 6, 2021 at 12:12
  • 1
    The first argument is a short name used in substitution variables, not the destination branch. I've had a go at clarifying the help page. Jun 7, 2021 at 13:42
1

While I could not copy the debian directory this way, I found an alternative, to merge the branch into master.

The current deb-packaging-juno directory cannot be merged into master because they were from the same base, and there were merge conflicts (However, this is probably not related to the failure in copying the directory, as mentioned in the question).

I created a new orphan branch (so that there would be no common history) named deb-dir containing the debian directory, and I am able to copy it into master with the following recipe.

# git-build-recipe format 0.4 deb-version {debupstream}-0~{revtime}
lp:cozy master
merge deb-dir lp:cozy deb-dir

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .