specfile icon indicating copy to clipboard operation
specfile copied to clipboard

`add_changelog_entry` does not add the `-` prefix

Open LecrisUT opened this issue 3 months ago • 5 comments

What happened? What is the problem?

I guess it is in the documentation that it doesn't introduce the - but I missed it. Is there any reason why not to always add it?

What did you expect to happen?

No response

Example URL(s)

No response

Steps to reproduce

1.
2.
3.

Workaround

  • [x] There is an existing workaround that can be used until this issue is fixed.

Participation

  • [ ] I am willing to submit a pull request for this issue. (Packit team is happy to help!)

LecrisUT avatar Nov 12 '25 16:11 LecrisUT

This is not a bug, it's on purpose.

Is there any reason why not to always add it?

What if you want to add multiple lines, some prefixed with - and some not? Other distributions (than Fedora/RHEL) can have different conventions and use a different character (or none at all).

nforro avatar Nov 13 '25 09:11 nforro

I think it would be a list of comments?

Other distributions (than Fedora/RHEL) can have different conventions and use a different character (or none at all).

Doesn't rpmlint/rpminspect and maybe other tools complain if you have the changelog missformatted?

LecrisUT avatar Nov 13 '25 09:11 LecrisUT

I think it would be a list of comments?

But how do you differentiate between single and multi-line items in a list? For example:

* Thu Nov 05 2020 Nikola Forró <[email protected]> - 1.5.4-1
- New upstream release 1.5.4
- Increase test timeout, 300 seconds is not always enough
  for test_logpdf_overflow on s390x

I think this is a common practice.

Doesn't rpmlint/rpminspect and maybe other tools complain if you have the changelog missformatted?

Do they complain about the above? (it's from https://src.fedoraproject.org/rpms/scipy/blob/rawhide/f/scipy.spec)

nforro avatar Nov 13 '25 10:11 nforro

But how do you differentiate between single and multi-line items in a list?

I suppose you could pass a list with (some) items containing \n, but I'm not sure I like that.

nforro avatar Nov 13 '25 10:11 nforro

But how do you differentiate between single and multi-line items in a list?

I've used context managers to handle that and the indenting for my work on a sphinx autodoc, basically ux wise it is:

with contents.new_changelog_entry():
    contents.write("first line")
    contents.write("continue on second line")
    contents.new_item()
    contents.write("new item now")
"""
* <date> <author> - <maybe_release>
- first line
  continue on second line
- new item now
"""

(internally I just keep a flag in the context item if I need either a new-item symbol or an indent and the indent level)

And at the very least it wouldn't break compatibility. Sphinx/docutils is very peculiar in how it interacts with contents, but I think here you could have a more user-friendly interface

LecrisUT avatar Nov 13 '25 10:11 LecrisUT