git ubuntu import: leverage raise ... from ... syntax
This provides a bit of a cleaner stacktrace output on errors when we are
propogating/transforming exceptions. Per PEP 3134, this is present in
python 3.0+.
git ubuntu build: correct search for matching upstream version
The loop only makes sense if the publishing records are in version
order. That is not the case before this change, as they are in published
order and leads to false output (e.g., for sssd).
Fix the recursion to recurse only down real directories, not symlinks.
A symlink to a directory that has under the target directory an empty
directory fails the assertion in _create_replacement_tree_builder
because the provided entry is not a tree (a symlink entry is a blob).
This is non-sensical; we don't want to follow symlinks while traversing
for empty directories anyway.
Nish discovered this when importing websockify 0.5.1+dfsg1-1.
I had assumed that os.path.isdir() would not match on symlinks to
directories, but it does. Instead, use os.lstat() to check st_mode
directly.
git ubuntu build: handle building a new upstream version
We need two changes to correctly build:
- do not attempt to find the orig tarball in Debian or Ubuntu
- do not attempt to symlink the orig tarball, because we are not
caching it from another upload
If debian/changelog does not exist (e.g., on an orphan branch), the
parsing function(s) incorrectly return 'HEAD:debian/changelog missing'
directly from `git cat-file`. Instead, check for this case of not
finding the debian/changelog file and raising a GitUbuntuChangelogError.