PBR

Error in retrieval of commit data and most recent tag

Bug #1467440 reported by Florian Wilhelm
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
PBR
Fix Released
Undecided
Florian Wilhelm

Bug Description

git._iter_log_online() returns None in some cases for instance when SKIP_WRITE_GIT_CHANGELOG is set to true. This needs to be handled in packaging._get_revno_and_last_tag().

Revision history for this message
Robert Collins (lifeless) wrote :

There isn't enough information here to reproduce. Please include reproduction instructions.

Changed in pbr:
status: New → Incomplete
Revision history for this message
Florian Wilhelm (florian-wilhelm-gmail) wrote :

It's actually quite obvious. In packaging._get_revno_and_last_tag we have following code:

changelog = git._iter_log_oneline(git_dir=git_dir)
row_count = 0
for row_count, (ignored, tag_set, ignored) in enumerate(changelog):

If git._iter_log_online returns None what it sometimes does, we get "TypeError: 'NoneType' object is not iterable".
You can also achieve this by setting os.environ['SKIP_WRITE_GIT_CHANGELOG'] = '1' in your setup.py.
I'll attach a small sample project that does exactly this.
The fix is just to add the line changelog = changelog if changelog else [] after changelog = git._iter_log_oneline(git_dir=git_dir). I have a PR ready. Just let me know.

Revision history for this message
Florian Wilhelm (florian-wilhelm-gmail) wrote :
Changed in pbr:
assignee: nobody → Florian Wilhelm (florian-wilhelm-gmail)
status: Incomplete → In Progress
Revision history for this message
Florian Wilhelm (florian-wilhelm-gmail) wrote :
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on pbr (master)

Change abandoned by Florian Wilhelm (<email address hidden>) on branch: master
Review: https://review.openstack.org/197508
Reason: This was just a duplicate of https://review.openstack.org/#/c/194954/

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to pbr (master)

Reviewed: https://review.openstack.org/194954
Committed: https://git.openstack.org/cgit/openstack-dev/pbr/commit/?id=c3fc63c64f9db3b98d16fa77a8021b3f5d5b34a4
Submitter: Jenkins
Branch: master

commit c3fc63c64f9db3b98d16fa77a8021b3f5d5b34a4
Author: Florian Wilhelm <email address hidden>
Date: Fri Jun 19 12:01:12 2015 +0200

    Fix retrieval of commit data and most recent tag.

    git._iter_log_online() returns None in some cases for instance
    when SKIP_WRITE_GIT_CHANGELOG is set to true. This is fixed by
    returning an empty list in _iter_log_online.

    Also the check if a changelog based on git should be written
    was moved from git._iter_log_online to git.write_git_changelog
    which makes more sense since some functions were calling
    git._iter_log_online to get the changelog for other reasons than
    writing it.

    Additionally a unittest was added to check that setting the
    environment variable SKIP_WRITE_GIT_CHANGELOG to true does not
    break anything when retrieving the git version.

    Change-Id: Ib12df23ab25b290dd394f9cb1456b8d5da57306a
    Closes-Bug: 1467440

Changed in pbr:
status: In Progress → Fix Committed
Changed in pbr:
milestone: none → 1.6.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.