You are not logged in.
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
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
How to automate copying changelog.txt file from source tree?
Offline
Hardcode the path relative to the PKGBUILD location or copy it there w/ the prepare function.
Offline
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
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
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
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
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
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
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
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
@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