Title: Handling of changelog bug closures in Debian derived distros
Status: Draft
Author: Guillem Jover <guillem@debian.org>
Thread: https://lists.debian.org/debian-project/2006/11/msg00100.html
Last-Change: 2006-11-14


Right now there's no clean way for a Debian derivative to close bugs
specific to their distro in a changelog entry and then distinguish
those from Debian bugs.

I'd like that developers from derivatives would get involved in this
discussion so that we can get a general solution for everyone, as I
think Debian should be responsible for providing the infrastructure
to do that.


As an example, say package foo_1.0-2 is in Debian, then distro Naibed
takes it and modifies some stuff and gets versions foo_1.0-2naibed1
and foo_1.0-2naibed2. If this distro wants to automatically parse
the changelog for version tracking or when including a mix of changelog
entries from Debian and Naibed at upload time, then it needs a way to
distinguish the bugs from versions <= 1.0-2 (Debian specific) to the
ones from versions >= 1.0-2naibed1 (Naibed specific). We cannot assume
that Naibed will not use 'unstable' as the target suite, though.

Currently we have in place the Origin and Bugs fields[0] for the
debian/control file, but those only allow overriding the entire origin
or bts for a package, and not for a specific version. The current
workarounds I've seen to this problem have been:

 * Prepending an "Origin" code into each bug number. (Example: Maemo
   prepends NB to the bug number, like "Fixes: NB#12345" [1]).

 * Appending an "Origin" code into each bug number. (Eample: a different
   practice in Maemo, appending @Nokia, like "Closes: #12345@Nokia" [2]).

 * Using an URL to qualify the bug number. (Example: I think I've seen
   that in some Ubuntu changelogs, but cannot find any example now).

 * Using a different "Closes:" name, which just sidetracks the issue
   if every derivative have to use a different name, this does not
   scale. (Example: Maemo uses "Fixes:" instead of "Closes:" [1],
   and there's a proposal in Ubuntu to do something similar with
   a different name[3]).

 * Appending the "Origin" to the "Closes". (Example: "Closes Ubuntu: #123"
   and "Closes: Malone #123").

which are wrong, ugly or may need a central registration place to avoid
collision either in the mnemonic or the "alternative" closure syntax.
Probably the cleanest one is the "Closes Ubuntu:" approach.


So I'd propose to extend the changelog format to add an optional origin
field in the header, then that information will be preserved after the
upload. Something like this:

foo (1.0-2naibed2) quux; urgency=low, origin=naibed

  * Fixed c. (Closes: #322)

 -- Naibed Devel <nd@naibed.org>  Tue,  3 Oct 2006 05:15:10 +0300

foo (1.0-2naibed1) quux; urgency=low, origin=naibed

  * Fixed b. (Closes: #321)

 -- Naibed Devel <nd@naibed.org>  Tue, 02 May 2006 03:11:39 +0300

foo (1.0-2) unstable; urgency=high

  * Fixed a. (Closes: #12345)

 -- Debian Devel <dd@debian.org>  Thu, 27 Oct 2005 07:12:47 +0300


That origin could be matched against /etc/dpkg/origins. I'm attaching a
PoC patch with those change to dpkg. Probably we'd not want to output
the Origin field in the default mode, instead of the current
implementation which outputs "Origin: debian". So comments welcome!


[0] https://lists.debian.org/debian-policy/2000/07/msg00074.html
    https://lists.debian.org/debian-policy/2000/11/msg00183.html [4]
[1] https://stage.maemo.org/svn/maemo/projects/haf/trunk/gtk+/debian/changelog
[2] https://stage.maemo.org/svn/maemo/projects/haf/trunk/maemo-launcher/debian/changelog
[3] https://wiki.ubuntu.com/ClosingBugsFromChangelog
    https://features.launchpad.net/distros/ubuntu/+spec/changelog-closes-bugs
[4] It was curious to see the different PoV related to derived distros at
    that time.
