#313 Unretired packages loose changelog between initial rpmautospec conversion and retirement
Opened a year ago by churchyard. Modified a year ago

Consider this scenario involving a Fedora package:

  1. the package exists in dist-git with classic changelog in spec
  2. the package is converted to rpmautospec, a changelog file is created
  3. new commits happen, new automatic changelog entries
  4. the package is retired, and the changelog file is deleted
  5. the package is unretired, and the changelog file is restored

Now, the entire changelog from 3 is gone.

To reproduce, I chose the python-nbconvert package.

First, I ensured I was on a custom branch set to track my fork, to avoid actual retirement.

[python-nbconvert (rawhide)]$ fedpkg fork
[python-nbconvert (rawhide)]$ git switch -c nope
[python-nbconvert (nope)]$ git push -u churchyard nope
...
branch 'nope' set up to track 'churchyard/nope'.

Observe the changelog file:

$ head changelog 
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Jan 12 2022 Miro Hrončok <mhroncok@redhat.com> - 6.4.0-2
- Drop outdated unused BuildRequires of python3-mock
...

And the actual changelog:

$ rpmautospec generate-changelog | head
* Fri Jul 21 2023 Fedora Release Engineering <releng@fedoraproject.org> - 7.2.5-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

* Mon Jul 10 2023 Python Maint <python-maint@redhat.com> - 7.2.5-7
- Rebuilt for Python 3.12
...

Notice they are a year and a half apart.

Now retire the package (safe to ^C after the commit is created):

[python-nbconvert (nope)]$ fedpkg retire "test retirement on custom branch"
rm '.gitignore'
rm 'changelog'
rm 'python-nbconvert.spec'
rm 'sources'
[nope 1157014] test retirement on custom branch
 5 files changed, 1 insertion(+), 291 deletions(-)
 delete mode 100644 .gitignore
 delete mode 100644 changelog
 create mode 100644 dead.package
 delete mode 100644 python-nbconvert.spec
 delete mode 100644 sources
Enumerating objects: 4, done.
Counting objects: 100% (4/4), done.
Delta compression using up to 8 threads
Compressing objects: 100% (1/1), done.
Writing objects: 100% (3/3), 297 bytes | 297.00 KiB/s, done.
^C

And unretire it as would releng:

[python-nbconvert (nope)]$ git revert HEAD
[nope 4f4377a] Revert "test retirement on custom branch"
 5 files changed, 291 insertions(+), 1 deletion(-)
 create mode 100644 .gitignore
 create mode 100644 changelog
 delete mode 100644 dead.package
 create mode 100644 python-nbconvert.spec
 create mode 100644 sources

Observe the git log:

[python-nbconvert (nope)]$ git log
commit 4f4377aed58641a3ee67a1606e681a1714706687 (HEAD -> nope)
Author: Miro Hrončok <miro@hroncok.cz>
Date:   Tue Oct 10 12:27:54 2023 +0200

    Revert "test retirement on custom branch"

    This reverts commit 115701493506ff5ff0fb2611b4f3279b79cce3d4.

commit 115701493506ff5ff0fb2611b4f3279b79cce3d4
Author: Miro Hrončok <miro@hroncok.cz>
Date:   Tue Oct 10 12:27:24 2023 +0200

    test retirement on custom branch

commit 02e04a536142a8d49155a82e29b50c400a7d8937 (origin/f39, churchyard/nope, rawhide)
Author: Fedora Release Engineering <releng@fedoraproject.org>
Date:   Fri Jul 21 11:37:43 2023 +0000

    Rebuilt for https://fedoraproject.org/wiki/Fedora_39_Mass_Rebuild

    Signed-off-by: Fedora Release Engineering <releng@fedoraproject.org>

commit 98bca7dc814b353938ae42d5118386e542e5ef81
Author: Python Maint <python-maint@redhat.com>
Date:   Tue Jul 11 00:47:02 2023 +0200

    Rebuilt for Python 3.12
...

And the changelog:

[python-nbconvert (nope)]$ rpmautospec generate-changelog | head
* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild

* Wed Jan 12 2022 Miro Hrončok <mhroncok@redhat.com> - 6.4.0-2
- Drop outdated unused BuildRequires of python3-mock
...

Notice how the last entry is from Jan 2022? It's the changelog file that has been just created by the unretirement.

Now commits won't restore anything:

[python-nbconvert (nope)]$ git commit --allow-empty -m "test"
[nope bf8a6e9] test
[python-nbconvert (nope)]$ rpmautospec generate-changelog | head
* Tue Oct 10 2023 Miro Hrončok <miro@hroncok.cz> - 7.2.5-10
- test

* Fri Jan 21 2022 Fedora Release Engineering <releng@fedoraproject.org> - 6.4.0-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_36_Mass_Rebuild
...

Right, because rpmautospec does not read commits past the last one that modified the changelog file.
That is the unretirement commit in this case.
I think the fix should go to rpkg retire command.
It the specfile uses rpmautospec,
it could fill the changelog file with all the commit messages first,
then do the actual retirement.

Log in to comment on this ticket.

Metadata