dep3 parser/generator for git-buildpackage
John Wright
jsw at debian.org
Sat Feb 2 09:52:18 UTC 2013
On Mon, Jan 21, 2013 at 12:01:36PM +0100, Thomas Koch wrote:
> Hi,
>
> I wrote a dep3 parser / generator to enhance the patch queue handling of git-
> buildpackage. The module (and a test module) currently lives here:
>
> https://github.com/thkoch2001/python-
> debian/blob/thkoch/dep3_patch/lib/debian/dep3_patch.py
>
> I intend to prepare some commits to git-buildpackage including the module
> there first to let it mature and later include it in python-debian. In git-
> buildpackage I'd rewrite / delete some code related to git-pq to let it use
> the new module.
>
> My motivation for writing this was that the git-buildpackage version in
> unstable did not preserve the dep3 header fields during an import-export
> cycle.
>
> The dep3 module does not intend to retain a patch header verbatim. It would be
> a huge effort to do so with little benefit. After a parse-format cycle the
> following will have changed:
I haven't read the dep3_patch module, but it's worth noting that the
main motivation for deb822 was to maintain case and order of fields...
> - The formatter outputs the fields in a fixed order regardless of the original
> order.
> - The formatter outputs the description fields always as continuation fields
> with one space indentation. It does parse but not generate unindented
> description lines.
> - The formatter outputs field names in lowercase regardless of the original
> case.
I appreciate the idea of case normalization, but I think it would be
best if it normalized like the examples in DEP3, e.g. 'Description',
'Reviewed-By', etc.
> The module does not support dpatch, only quilt.
> I'm aware of the deb822 module in python-debian but it is rather hard to
> understand, provides more than needed and might fail to parse unindented
> description lines.
It's actually pretty easy to use, but it certainly could use better
documentation. Basically you want
d = deb822.Deb822(lines)
d['Some-Field'] = 'value'
# ...
with open(filename, 'w') as f:
d.dump(fd=f)
All that said, you're right about it failing to parse free-form
unindented description lines.
> I intend that gbp-pq would create commit messages that conform to the dep3
> specification i.e. I can use the parser to parse the patch header as well as
> the commit message.
Can you help me understand what gbp-pq does with the headers? Does it
need to twiddle them after having parsed them?
> Is this OK with you, Guido, Markus? I'm relatively new to python and
> appreciate any review.
I'll try to take a closer look in the next few days.
--
John Wright <jsw at debian.org>
More information about the pkg-python-debian-discuss
mailing list