#210 RPMAUTOSPEC: changelog file removed
Closed: Fixed a year ago by nphilipp. Opened 2 years ago by churchyard.

My plan for adapting our packages to rpmautospec was like this:

  1. move present %changelog to a file called changelog
  2. Use %autochangelog from now on
  3. Wait many months
  4. Eventually remove the old changelog file

But when I commit the removal of changelog, I get:

$ rpmautospec generate-changelog .
* Wed Jul 21 2021 Miro Hrončok <miro@hroncok.cz> 3.1.2-4
- RPMAUTOSPEC: changelog file removed

Instead of the chagelog from git.

Once we have the changelog file, we can never ever remove it? Could this please be allowed somehow?

Isn't this just a matter of being able to skip autogenerated changelog for the removal commit? I.e. truncate (not remove) the file and commit with "Remove changelog\n(changelog skip)" or whatever the syntax will be?

Technically, this could work, yes.

I'm a bit confused. Am I right that removing changelog truncates the generated changelog to all younger commits instead of the error message? Let's ignore hypothetical means to ignore individual commit logs for this.

Am I right that removing changelog truncates the generated changelog to all younger commits instead of the error message?

Yes. You only get one changelog entry (the one for the removal commit), presumably because rpmautospec notices that changelog was touched by the commit.

$ git rm changelog
$ git commit -m 'Drop changelog file'
$ rpmautospec generate-changelog     
* Tue Nov 09 2021 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> 1.0.1-4
- RPMAUTOSPEC: changelog file removed

Metadata Update from @nphilipp:
- Issue assigned to nphilipp

a year ago

Hah, I hoped nobody had seen this one, because it'll be hard to implement than I thought. 🙈 Not sure how I can resurrect it though…

In order to achieve that removing changelog in a newer commit causes its contents to be disregarded in the older, we have to take care of it in the first stage of processing commits, i.e. the one that goes from latest/newest to earliest/oldest, and have that inform how the changelog is built in the second stage, i.e. to ignore the changelog contents in the commit that adds/changes changelog.

There is changelog_visitor that checks if changelog blob was changed. The case we're talking about here is when the parent blob is not None, and current blob is None. That should be easy to add to the conditionals there.

It's more than that. Detecting that the file is removed is easy enough, but previously there was no mechanism to pass this information on to when the changelog visitor processes the parent commit which adds changelog or changes it – it has to disregard the file contents in this case and simply start with an empty changelog.

Metadata Update from @nphilipp:
- Issue set to the milestone: So you call this production ready?

a year ago

Commit 4f5ba21 relates to this ticket

Login to comment on this ticket.