Skip to content

git-bloom-release error if HEAD revision is detached #320

@meyerj

Description

@meyerj

I am testing local releases of the orocos_toolchain repo with git-bloom-release from a tarball in an up-to-date Ubuntu Trusty. The first run with debian increment 0 was successful, but after I updated the tarball and rerun git-bloom-release indigo I got the following error message:

/opt/orocos/indigo/release$ git-bloom-release indigo
+++ Cloning working copy for safety
Processing release track settings for 'indigo'
What version are you releasing (version should normally be MAJOR.MINOR.PATCH)? 2.7.9

Executing release track 'indigo'
Explicitly skipping bloom-export-upstream for tar.
==> git-bloom-import-upstream /opt/orocos/indigo/release/orocos_toolchain.tar.gz  --release-version 2.7.9 --replace
The latest upstream tag in the release repository is 'upstream/2.7.9'.
Removing tag: 'upstream/2.7.9'
Removing tag: 'orocos_toolchain/2.7.9'
Importing archive into upstream branch...
Creating tag: 'upstream/2.7.9'
Creating tag: 'orocos_toolchain/2.7.9'
I'm happy.  You should be too.

==> git-bloom-generate -y rosrelease indigo --source upstream -i 1
Releasing packages: ['ocl', 'orocos_toolchain', 'typelib', 'utilrb', 'rtt', 'utilmm', 'orogen', 'log4cpp', 'rtt_typelib']
Releasing package 'ocl' for 'indigo' to: 'release/indigo/ocl'
Releasing package 'orocos_toolchain' for 'indigo' to: 'release/indigo/orocos_toolchain'



Releasing package 'typelib' for 'indigo' to: 'release/indigo/typelib'
Releasing package 'utilrb' for 'indigo' to: 'release/indigo/utilrb'
Releasing package 'rtt' for 'indigo' to: 'release/indigo/rtt'
Releasing package 'utilmm' for 'indigo' to: 'release/indigo/utilmm'
Releasing package 'orogen' for 'indigo' to: 'release/indigo/orogen'
Releasing package 'log4cpp' for 'indigo' to: 'release/indigo/log4cpp'
Releasing package 'rtt_typelib' for 'indigo' to: 'release/indigo/rtt_typelib'

==> git-bloom-generate -y rosdebian --prefix release/indigo indigo -i 1
Generating source debs for the packages: ['utilmm', 'rtt', 'log4cpp', 'orocos_toolchain', 'orogen', 'rtt_typelib', 'utilrb', 'ocl', 'typelib']
Debian Incremental Version: 1
Debian Distributions: ['saucy', 'trusty']
Releasing for rosdistro: indigo

Pre-verifying Debian dependency keys...
Running 'rosdep update'...
All keys are OK

Placing debian template files into 'debian/indigo/utilmm' branch.
Overwriting Debian directory: debian
==> Placing templates files in the 'debian' folder.

...and after some Generating 'x' debian/heisenbug RPM for package 'x' at version '2.7.9-1' steps...

<== Command successful, committing changes to working copy
/bin/sh: 1: Syntax error: "(" unexpected
Traceback (most recent call last):
  File "/usr/bin/git-bloom-release", line 9, in <module>
    load_entry_point('bloom==0.5.12', 'console_scripts', 'git-bloom-release')()
  File "/usr/lib/pymodules/python2.7/bloom/commands/git/release.py", line 358, in main
    git_clone.commit()
  File "/usr/lib/pymodules/python2.7/bloom/git.py", line 123, in commit
    with inbranch(get_commit_hash(get_current_branch())):
  File "/usr/lib/pymodules/python2.7/bloom/git.py", line 379, in get_commit_hash
    out = check_output(cmd, shell=True, cwd=directory)
  File "/usr/lib/pymodules/python2.7/bloom/util.py", line 348, in check_output
    raise CalledProcessError(p.returncode, cmd)
CalledProcessError: Command 'git show-branch --sha1-name (detached from debian/ros-indigo-typelib_2.7.9-0_trusty)' returned non-zero exit status 2

It looks like get_current_branch() in git.py:120 does not return None as git branch returns (detached from debian/ros-indigo-typelib_2.7.9-0_trusty) instead of (no branch). Before the new release I did a git checkout debian/ros-indigo-typelib_2.7.9-0_trusty of the typelib release tag in order to build that package. After a git checkout master the second release with the same command was successful.

Note that git symbolic-ref --short HEAD shows the current branch name and git show-ref --head -s HEAD the SHA1 hash of the current HEAD. These two commands are probably more reliable than parsing the output of git branch.

The (no branch) output assumption is also used in git.py:524.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions