#218 missing changelog entry behavior
Closed: Invalid by nphilipp. Opened by carlwgeorge.

Several people including myself have stumbled across the issue where they try to make other changes such as a new version in the same commit that adds the %autorelease and %autochangelog macros. This was recently called out in the docs as something to avoid. However, that conflicts with the behavior for new packages, where the initial commit contains both a new version and the macros. The only difference is the flawed conversion commit contains a changelog file. Would it be possible to make this behavior consistent? Currently if you commit the macros and the changelog file in the same commit as a new version, you are missing a changelog entry. Scenario 2 below is a simple reproducer of this, with scenario 1 for contrast.

Scenario 1: importing a new package

[carl@teal:~]$ mkdir foo
[carl@teal:~]$ cd foo
[carl@teal:~/foo]$ git init
Initialized empty Git repository in /home/carl/foo/.git/
[carl@teal:~/foo:main]$ cat > foo.spec << EOF
> Name: foo
> Summary: Foo
> Version: 1
> Release: %autorelease
> License: FOO
> 
> %description
> %{summary}.
> 
> %changelog
> %autochangelog
> EOF
[carl@teal:~/foo:main]$ git add foo.spec
[carl@teal:~/foo:main]$ git commit -m 'Version 1'
[main (root-commit) db03723] Version 1
 1 file changed, 11 insertions(+)
 create mode 100644 foo.spec
[carl@teal:~/foo:main]$ rpmautospec generate-changelog
* Thu Aug 12 2021 Carl George <carl@george.computer> 1-1
- Version 1

In this scenario, the commit that contains the %autorelease and %autochangelog macros also contains the initial version. The generated changelog is correct.

Scenario 2: converting an existing package

[carl@teal:~]$ mkdir bar
[carl@teal:~]$ cd bar
[carl@teal:~/bar]$ git init
Initialized empty Git repository in /home/carl/bar/.git/
[carl@teal:~/bar:main]$ cat > bar.spec << EOF
> Name: bar
> Summary: Bar
> Version: 1
> Release: 1%{?dist}
> License: BAR
> 
> %description
> %{summary}.
> 
> %changelog
> * Wed Aug 12 2021 Carl George <carl@george.computer> 1-1
> - Version 1
> EOF
[carl@teal:~/bar:main]$ git add bar.spec
[carl@teal:~/bar:main]$ git commit -m 'Version 1'
[main (root-commit) 2e7418a] Version 1
 1 file changed, 12 insertions(+)
 create mode 100644 bar.spec
[carl@teal:~/bar:main]$ sed -e '/Version:/s/1/2/' -e '/Release:/s/1%{?dist}/%autorelease/' -i bar.spec
[carl@teal:~/bar:main]$ tail -2 bar.spec > changelog
[carl@teal:~/bar:main]$ head -n -2 bar.spec > bar.spec.new
[carl@teal:~/bar:main]$ mv bar.spec.new bar.spec
[carl@teal:~/bar:main]$ echo %autochangelog >> bar.spec
[carl@teal:~/bar:main]$ git add bar.spec changelog
[carl@teal:~/bar:main]$ git commit -m 'Version 2'
[main 2cd409a] Version 2
 2 files changed, 5 insertions(+), 4 deletions(-)
 create mode 100644 changelog
[carl@teal:~/bar:main]$ rpmautospec generate-changelog
* Wed Aug 12 2021 Carl George <carl@george.computer> 1-1
- Version 1

In this scenario, the commit that contains the %autorelease/%autochangelog macros also contains a new version, but it is not reflected in the generated changelog.


I think this is essentially an operator error. The documentation is pretty clear: if the changelog file is touched in a commit, it must also include the final changelog entry for that commit, if desired. But the whole scenario makes very little sense: if you want to use %autochangelog for a new package, just do that. Using manually-formatted changelog entries just for the review process is a waste of time. Also, we shouldn't require packagers to do something so different during the review process; the package being reviewed should be as close as possible to the final package. (Personally, I nowadays start with a git repo and do normal commits during package review and/or updates before the package is accepted, and then do fedpkg request-repo --no-initial-commit and import any useful history into dist-git. But that's because I like git. I think it's totally fine to skip changelog entries from before the review process.)

I'd just close this.

Agreed, closing.

Metadata Update from @nphilipp:
- Issue close_status updated to: Invalid
- Issue status updated to: Closed (was: Open)

Metadata