debian: Attribute all maintainers in changlog

Message ID 20210613161625.20616-1-valter.jansons@gmail.com
State Accepted
Headers
Series debian: Attribute all maintainers in changlog |

Commit Message

Valters Jansons June 13, 2021, 4:16 p.m. UTC
  This commit further builds on historical changelog modifications,
to properly attribute all authors of the commits.

An additional d/genchangelog.sh script has been added. This allows
generation of changelog entries, internally using `debchange` (`dch`).
The script accepts an argument, which is the commit range to generate
entries for. Each commit's subject line (first line of body) is used,
along with author name and email. This information is added to the
changelog. Automatic detection (via `debchange` built-in functionality)
is used to determine whether these entries should be added to an
existing version number. If there is no UNRELEASED version, then a new
version is automatically tagged.

The new version tag will usually need to be modified, for example,
replacing an automatically generated 0.9.6-2 with 0.9.7-1.

The final release change (s/UNRELEASED/unstable/) needs to be done
manually as well, when the Git tag is actually being tagged.
`dch -r` can be useful for this particular purpose.

Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
---
 debian/changelog       | 15 +++++++++------
 debian/genchangelog.sh | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 45 insertions(+), 6 deletions(-)
 create mode 100755 debian/genchangelog.sh
  

Comments

Michael Tremer June 14, 2021, 9:36 a.m. UTC | #1
Hello Valters,

Thank you very much for this patch. I have a general question regarding this:

Since we have a number of packages that we package for Debian, is it a good strategy to add so many scripts and replicate them across the different repositories? It seems that this will get complicated in the future where improvements might not be copied to all repositories, etc.

How can we combat that?

-Michael

> On 13 Jun 2021, at 17:16, Valters Jansons <valter.jansons@gmail.com> wrote:
> 
> This commit further builds on historical changelog modifications,
> to properly attribute all authors of the commits.
> 
> An additional d/genchangelog.sh script has been added. This allows
> generation of changelog entries, internally using `debchange` (`dch`).
> The script accepts an argument, which is the commit range to generate
> entries for. Each commit's subject line (first line of body) is used,
> along with author name and email. This information is added to the
> changelog. Automatic detection (via `debchange` built-in functionality)
> is used to determine whether these entries should be added to an
> existing version number. If there is no UNRELEASED version, then a new
> version is automatically tagged.
> 
> The new version tag will usually need to be modified, for example,
> replacing an automatically generated 0.9.6-2 with 0.9.7-1.
> 
> The final release change (s/UNRELEASED/unstable/) needs to be done
> manually as well, when the Git tag is actually being tagged.
> `dch -r` can be useful for this particular purpose.
> 
> Signed-off-by: Valters Jansons <valter.jansons@gmail.com>
> ---
> debian/changelog       | 15 +++++++++------
> debian/genchangelog.sh | 36 ++++++++++++++++++++++++++++++++++++
> 2 files changed, 45 insertions(+), 6 deletions(-)
> create mode 100755 debian/genchangelog.sh
> 
> diff --git a/debian/changelog b/debian/changelog
> index e58c0ca..6817fb3 100644
> --- a/debian/changelog
> +++ b/debian/changelog
> @@ -1,13 +1,16 @@
> libloc (0.9.6-1) unstable; urgency=medium
> 
> -  * location-importer.in: skip networks with unknown country codes
> -  * location-importer.in: process unaligned IP ranges in RIR data files
> -    correctly
> +  [ Michael Tremer ]
> +  * location: Fix list-networks-by-as
>   * database: Free mmapped countries section
> -  * location-importer.in: reduce log noise for unusable networks
> -  * location-importer.in: delete 6to4 IPv6 space as well
> +
> +  [ Peter Müller ]
>   * location-importer.in: fix typo
> -  * location: Fix list-networks-by-as
> +  * location-importer.in: delete 6to4 IPv6 space as well
> +  * location-importer.in: reduce log noise for unusable networks
> +  * location-importer.in: process unaligned IP ranges in RIR data files
> +    correctly
> +  * location-importer.in: skip networks with unknown country codes
> 
>  -- Michael Tremer <michael.tremer@ipfire.org>  Wed, 31 Mar 2021 14:06:00 +0100
> 
> diff --git a/debian/genchangelog.sh b/debian/genchangelog.sh
> new file mode 100755
> index 0000000..85d3922
> --- /dev/null
> +++ b/debian/genchangelog.sh
> @@ -0,0 +1,36 @@
> +#!/bin/bash -e
> +gitshow () {
> +  local format=$1
> +  local commit=$2
> +
> +  git show --no-patch --format=format:"$format" "$commit"
> +}
> +
> +main () {
> +  if [ $# -lt 1 ]; then
> +    local bn="$(basename $0)"
> +    echo "Usage:    $bn  <commit range>" >&2
> +    echo "Example:  $bn  0.9.7..HEAD" >&2
> +    echo "Example:  $bn  0.9.5..0.9.6^" >&2
> +    return 1
> +  fi
> +
> +  local commitrange=$1
> +
> +  local commit
> +  for commit in $(git rev-list --reverse "$commitrange"); do
> +    # Skip commits with diffs that only have Makefile.am or d/ changes.
> +    if [ "$(git diff --name-only "${commit}^..${commit}" -- . ':^Makefile.am' ':^debian/' | wc -l)" == 0 ]; then
> +      continue
> +    fi
> +
> +    local author_name="$(gitshow %an "$commit")"
> +    local author_email="$(gitshow %ae "$commit")"
> +    local subject="$(gitshow %s "$commit")"
> +
> +    echo "$author_name <$author_email>  $subject"
> +    DEBFULLNAME="$author_name" DEBEMAIL="$author_email" debchange --upstream --multimaint-merge "$subject"
> +  done
> +}
> +
> +main "$@" || exit $?
> -- 
> 2.32.0
>
  
Valters Jansons July 11, 2021, 4:53 p.m. UTC | #2
On Mon, Jun 14, 2021 at 12:36 PM Michael Tremer
<michael.tremer@ipfire.org> wrote:
> Since we have a number of packages that we package for Debian, is it a good strategy to add so many scripts and replicate them across the different repositories? It seems that this will get complicated in the future where improvements might not be copied to all repositories, etc.
>
> How can we combat that?

Hard question to answer directly, as I am not 100% sure about the
other projects you are dealing with. However, I would as a general
suggestion propose a common repository with dev/build-scripts.

This shifts all scripts to an external repository, outside of the
project-specific one. Of course, care has to be taken, to make the
actual scripts project-insensitive, to run in any project.

--Valters
  
Michael Tremer July 14, 2021, 4:34 p.m. UTC | #3
Hello,

> On 11 Jul 2021, at 17:53, Valters Jansons <valter.jansons@gmail.com> wrote:
> 
> On Mon, Jun 14, 2021 at 12:36 PM Michael Tremer
> <michael.tremer@ipfire.org> wrote:
>> Since we have a number of packages that we package for Debian, is it a good strategy to add so many scripts and replicate them across the different repositories? It seems that this will get complicated in the future where improvements might not be copied to all repositories, etc.
>> 
>> How can we combat that?
> 
> Hard question to answer directly, as I am not 100% sure about the
> other projects you are dealing with. However, I would as a general
> suggestion propose a common repository with dev/build-scripts.

And then? Copy and paste or do this “git submodule” theatre?

Both don’t feel like a very good solution. I am very close to require packaging pakfire and it probably wouldn’t be a bad idea if you had a look at fireperf: 

* https://git.ipfire.org/?p=pakfire.git;a=summary
* https://git.ipfire.org/?p=fireperf.git;a=summary

> This shifts all scripts to an external repository, outside of the
> project-specific one. Of course, care has to be taken, to make the
> actual scripts project-insensitive, to run in any project.
> 
> --Valters

-Michael
  

Patch

diff --git a/debian/changelog b/debian/changelog
index e58c0ca..6817fb3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,13 +1,16 @@ 
 libloc (0.9.6-1) unstable; urgency=medium
 
-  * location-importer.in: skip networks with unknown country codes
-  * location-importer.in: process unaligned IP ranges in RIR data files
-    correctly
+  [ Michael Tremer ]
+  * location: Fix list-networks-by-as
   * database: Free mmapped countries section
-  * location-importer.in: reduce log noise for unusable networks
-  * location-importer.in: delete 6to4 IPv6 space as well
+
+  [ Peter Müller ]
   * location-importer.in: fix typo
-  * location: Fix list-networks-by-as
+  * location-importer.in: delete 6to4 IPv6 space as well
+  * location-importer.in: reduce log noise for unusable networks
+  * location-importer.in: process unaligned IP ranges in RIR data files
+    correctly
+  * location-importer.in: skip networks with unknown country codes
 
  -- Michael Tremer <michael.tremer@ipfire.org>  Wed, 31 Mar 2021 14:06:00 +0100
 
diff --git a/debian/genchangelog.sh b/debian/genchangelog.sh
new file mode 100755
index 0000000..85d3922
--- /dev/null
+++ b/debian/genchangelog.sh
@@ -0,0 +1,36 @@ 
+#!/bin/bash -e
+gitshow () {
+  local format=$1
+  local commit=$2
+
+  git show --no-patch --format=format:"$format" "$commit"
+}
+
+main () {
+  if [ $# -lt 1 ]; then
+    local bn="$(basename $0)"
+    echo "Usage:    $bn  <commit range>" >&2
+    echo "Example:  $bn  0.9.7..HEAD" >&2
+    echo "Example:  $bn  0.9.5..0.9.6^" >&2
+    return 1
+  fi
+
+  local commitrange=$1
+
+  local commit
+  for commit in $(git rev-list --reverse "$commitrange"); do
+    # Skip commits with diffs that only have Makefile.am or d/ changes.
+    if [ "$(git diff --name-only "${commit}^..${commit}" -- . ':^Makefile.am' ':^debian/' | wc -l)" == 0 ]; then
+      continue
+    fi
+
+    local author_name="$(gitshow %an "$commit")"
+    local author_email="$(gitshow %ae "$commit")"
+    local subject="$(gitshow %s "$commit")"
+
+    echo "$author_name <$author_email>  $subject"
+    DEBFULLNAME="$author_name" DEBEMAIL="$author_email" debchange --upstream --multimaint-merge "$subject"
+  done
+}
+
+main "$@" || exit $?