You are not logged in.

#1 2025-05-29 01:32:46

Snv0
Member
Registered: 2025-05-29
Posts: 6

How to add changelog to package?

There is a changelog.txt file in the source tree. I try to add it to the package. I write

changelog="$srcdir"/far2l/changelog.txt

to the PKGBUILD file. Then I run makepkg. But it returns an error:

==> ERROR: changelog file (/far2l/changelog.txt) does not exist or is not a regular file.

How to add changelog to package?

Last edited by Snv0 (2025-05-29 01:34:18)

Offline

#2 2025-05-29 06:27:04

seth
Member
Registered: 2012-09-03
Posts: 63,955

Re: How to add changelog to package?

https://man.archlinux.org/man/core/pacman/PKGBUILD.5.en

changelog
Specifies a changelog file that is to be included in the package. The changelog file should end in a single newline. This file should reside in the same directory as the PKGBUILD and will be copied into the package by makepkg. It does not need to be included in the source array (e.g., changelog=$pkgname.changelog).

Example:
https://gitlab.archlinux.org/archlinux/ … =heads#L15
https://gitlab.archlinux.org/archlinux/ … s/powertop

Offline

#3 2025-05-29 06:51:27

Snv0
Member
Registered: 2025-05-29
Posts: 6

Re: How to add changelog to package?

How to automate copying changelog.txt file from source tree?

Offline

#4 2025-05-29 07:53:47

seth
Member
Registered: 2012-09-03
Posts: 63,955

Re: How to add changelog to package?

Hardcode the path relative to the PKGBUILD location or copy it there w/ the prepare function.

Offline

#5 2025-05-29 09:18:56

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,531
Website

Re: How to add changelog to package?

seth wrote:

Hardcode the path relative to the PKGBUILD location or copy it there w/ the prepare function.

I'm fairly sure both these will not work.

The changelog functionality is designed to track changes to the packaging of software.  I.e. the changes made to the PKGBUILD.  It is not designed to pull the upstream changelog into the package.  If you want to do that, install it to /usr/share/doc/$pkgname/changelog (or something like that).

Offline

#6 2025-05-29 15:49:17

seth
Member
Registered: 2012-09-03
Posts: 63,955

Re: How to add changelog to package?

Not really - I tried.
The changelog happens before obtaining the sources or the prepare function, so the file *has* to be there from the get-go.

Impractical/nonsensical scenarios are
1. if the PKGBUILD is actually part of the sources (which is akin to just having the file placed next to the PKGBUILD) and
2. rebuilds w/ existing src paths (but then of course the file from the *old* build is used as changelog and also you're not getting an old source w/o manually putting a changelog file into src/ or running a build w/ changelog commented)

For "normal" package distribution and notably the AUR this won't apply.

Offline

#7 2025-05-29 22:05:31

Snv0
Member
Registered: 2025-05-29
Posts: 6

Re: How to add changelog to package?

Using the changelog file from the source code:

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,6 +7,7 @@ pkgdesc='Linux port of FAR v2'
 url='https://github.com/elfmz/far2l'
 arch=('i686' 'x86_64')
 license=('GPL2')
+changelog=src/far2l/changelog.md
 source=('git+https://github.com/elfmz/far2l')
 sha256sums=('SKIP')
 makedepends=('git' 'cmake')

Returns an error:

[user@linuxbox far2l-git]$ makepkg
==> ERROR: changelog file (src/far2l/changelog.md) does not exist or is not a regular file.
[user@linuxbox far2l-git]$

Using the prepare() function:

--- a/PKGBUILD
+++ b/PKGBUILD
@@ -7,6 +7,7 @@ pkgdesc='Linux port of FAR v2'
 url='https://github.com/elfmz/far2l'
 arch=('i686' 'x86_64')
 license=('GPL2')
+changelog=changelog.md
 source=('git+https://github.com/elfmz/far2l')
 sha256sums=('SKIP')
 makedepends=('git' 'cmake')
@@ -22,6 +23,10 @@ optdepends=(
   'libarchive: more archive type support in multiarc'
 )
 
+prepare() {
+  cp "$srcdir"/far2l/changelog.md .
+}
+
 pkgver() {
   cd "$srcdir"/far2l
   printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

Returns an error:

[user@linuxbox far2l-git]$ makepkg
==> ERROR: changelog file (changelog.md) does not exist or is not a regular file.
[user@linuxbox far2l-git]$ 

Conclusion: There is no way to automate adding a changelog file from the source tree.

Offline

#8 2025-05-29 22:32:26

seth
Member
Registered: 2012-09-03
Posts: 63,955

Re: How to add changelog to package?

Which in the specific case would be wrong anyway, that's an upstream changelog and belongs (iff at all) into /usr/share/… or you could post it with a post_upgrade script?

Offline

#9 2025-05-29 22:56:51

Snv0
Member
Registered: 2025-05-29
Posts: 6

Re: How to add changelog to package?

The changelog variable in the PKGBUILD file adds a .CHANGELOG file to the package.

The "pacman -Qc" command shows the .CHANGELOG before upgrading the package.

The /usr/share/doc/<package>/CHENGES file is only available after upgrading the package.

Offline

#10 Yesterday 00:00:36

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,531
Website

Re: How to add changelog to package?

Snv0 wrote:

The "pacman -Qc" command shows the .CHANGELOG before upgrading the package.

It does not.  It shows the changelog for the installed package.   Not the future update.

Offline

#11 Yesterday 00:11:37

Snv0
Member
Registered: 2025-05-29
Posts: 6

Re: How to add changelog to package?

Allan wrote:

It shows the changelog for the installed package.

It does not.

"pacman -Qc" shows changelog for downloaded packages:

Download but do not install packages:
sudo pacman -Syuw

Read changelog:
pacman -Qc

Upgrade packages:
sudo pacman -Su

Last edited by Snv0 (Yesterday 00:32:00)

Offline

#12 Yesterday 02:44:11

Allan
Pacman
From: Brisbane, AU
Registered: 2007-06-09
Posts: 11,531
Website

Re: How to add changelog to package?

I wrote the changelog support.    It just prints the changelog file from the local pacman database - i.e. the package must be installed before -Qc will print it.

Offline

#13 Yesterday 06:11:00

seth
Member
Registered: 2012-09-03
Posts: 63,955

Re: How to add changelog to package?

@Snv0 show the trick for a package not listed by "pacman -Q" - also how is that related to the original topic or the fact that in the given example you don't want to add /that/ changelog /this/ way anyway?

Offline

Board footer

Powered by FluxBB