Hi Brian, On Mon, Nov 02, 2020 at 07:48:41PM +0000, Murrell, Brian wrote: > Since this looks like a mailing-list, please CC me directly on any > replies as I am not a list member. I hope I don't have to subscribe > first as I just followed a mailto: link in the documentation to start > this e-mail. > > Anyway, looking at > > https://salsa.debian.org/python-debian-team/python-debian/-/blob/master/lib/debian/changelog.py#L20-26 > > it looks like I have to supply an amount of information (package, > version, etc.) that debian.changelog could conceivably already know > about by having opened the existing changelog with: > > debian.changelog.Changelog(open("debian/changelog")) > > I wonder why, if one does something like: > > ch = debian.changelog.Changelog(open("debian/changelog")) > ch.new_block(version="1.2.3) > > one gets an exception: > > debian.changelog.ChangelogCreateError: Package not specified > > Surely, the package name is known already in the Changelog object and > new_block() can just use that, yes? > > Basically just an implied: > > ch = debian.changelog.Changelog(open("debian/changelog")) > ch.new_block(package=ch.get_package(), > version=1.2.3", > distributions=ch.distributions, > author="%s <%s>" % debian.changelog.get_maintainer(), > date=email.utils.formatdate(None, True)) > > Given the above, the only field that seems like it really needs to be > mandatory and not have a reasonable default is the version field.
I agree it would make sense to have *a* way of creating a new changelog entry as if the current user was running "dch". In that case, distributions would be set to UNRELEASED per convention rather than to the previous distributions. Whether that should be the default Changelog.new_block() command is a different question - Changelog is a fairly low-level interface. If it defaulted to calling .get_maintainer() but then in some situations it raised an exception because get_maintainer() didn't see the right environment variables, I think that would be worse and more surprising than the current situation where you need to be explicit but have consistent behaviour regardless of the environment. Perhaps we could add a DWIM-style function for adding changelog entries? Cheers, Jelmer -- Jelmer Vernooij <[email protected]> PGP Key: https://www.jelmer.uk/D729A457.asc
signature.asc
Description: PGP signature
-- https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/pkg-python-debian-maint
