You are not logged in.

#1 2022-04-02 22:46:05

purpleleaf
Member
Registered: 2022-04-02
Posts: 21

pkgver mismatch cause package to be ever updatable

Please forgive my english and my inexperience, this is my first AUR package release.

I released this package (only PKGBUILD and .SRCINFO):

https://aur.archlinux.org/packages/jgmenu-git

The package installs without problem, but it is reinstalled at every update.

The only strange things are these strings after compilation:

<command-line>: warning: "VERSION" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "VERSION" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "VERSION" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "VERSION" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "VERSION" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "VERSION" redefined
<command-line>: note: this is the location of the previous definition
<command-line>: warning: "VERSION" redefined
<command-line>: note: this is the location of the previous definition

As suggested by wiki i used this function:

pkgver() {
  cd "$pkgname"
  printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

but online code during installation show this output:
r1483.c258a6c-1

the original git and the package downloaded form AUR instead show this:
r4.b375817

Tx for any suggestions

Offline

#2 2022-04-02 22:56:29

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: pkgver mismatch cause package to be ever updatable

You didn't properly regenerate the .SRCINFO before uploading to the AUR.  The .SRCINFO file has the version as 4.4.0 while the PKGBUILD static value is v4.4.0, and then the pkgver function generates a value starting witht the letter r which will always be less than both the 4.4.0 and the v4.4.0.  You need to chose a versioning scheme and use it consistently.  What you have in the pkgver function looks good.  If you run makepkg once on that PKGBUILD the static value in the PKGBUILD will be properly replaced, then manually set the pkgrel back to 1, then regenerate the .SRCINFO file, and then commit both files to the AUR.


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2022-04-03 16:00:11

yochananmarqos
Member
Registered: 2020-02-05
Posts: 217

Re: pkgver mismatch cause package to be ever updatable

See VCS package guidelines:

If tag contains a prefix, like v or project name then it should be cut off:

pkgver() {
  cd "$pkgname"
  # cutting off 'foo-' prefix that presents in the git tag
  git describe --long | sed 's/^foo-//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
6.1.r3.gd77e105

Last edited by yochananmarqos (2022-04-06 18:02:39)

Offline

#4 2022-04-04 18:15:07

purpleleaf
Member
Registered: 2022-04-02
Posts: 21

Re: pkgver mismatch cause package to be ever updatable

Thanks for all suggestions.
Now the package does not require to be ever  updated .
The warning about " version redefined" during installation still persist.
Searching google for this  message using quotes around it point only to this forum thread.

Offline

#5 2022-04-04 18:49:12

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: pkgver mismatch cause package to be ever updatable

Trilby wrote:

If you run makepkg once on that PKGBUILD the static value in the PKGBUILD will be properly replaced, then manually set the pkgrel back to 1, then regenerate the .SRCINFO file, and then commit both files to the AUR.

You seem to have skipped most of this.  You manually put something in the pkgver field of the PKGBUILD that even includes the pkgname.  Really, start by running makepkg once, that will fix the pkgver in the PKGBUILD.  Then regenerate the .SRCINFO file, then commit and push to the AUR.

EDIT: Also you changed your pkgver function, but it still doesn't match any of the recommended approaches.  Please follow the examples in the wiki.  This should be your pkgver function:

pkgver() {
  cd "${srcdir}/${_pkgname}"
  git describe --long | sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}

Last edited by Trilby (2022-04-04 18:55:28)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2022-04-06 17:51:22

purpleleaf
Member
Registered: 2022-04-02
Posts: 21

Re: pkgver mismatch cause package to be ever updatable

Trilby wrote:

You seem to have skipped most of this.  You manually put something in the pkgver field of the PKGBUILD that even includes the pkgname.  Really, start by running makepkg once, that will fix the pkgver in the PKGBUILD.  Then regenerate the .SRCINFO file, then commit and push to the AUR.

EDIT: Also you changed your pkgver function, but it still doesn't match any of the recommended approaches.

I was  running the functions in the package dir, not in the $srcdir, obtaining obviously a different value from the one required by AUR
So i copied another function from AUR that provide the right version code.
I understood my error but i haven't enough time to correct the PKGBUILD until now. I will change it as soon as i will send this post smile .
My git does not have tag so i prefer this code

printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"

It is not necessary run makepkg every time the git code change, it is sufficient to run the code above in the source dir to obtain the correct value that can be  pasted in PKGBUILD.

Offline

#7 2022-04-06 19:12:46

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,456
Website

Re: pkgver mismatch cause package to be ever updatable

purpleleaf wrote:

My git does not have tag

There are tags in the source repo listed in the PKGBUILD.

purpleleaf wrote:

It is not necessary run makepkg every time the git code change, it is sufficient to run the code above in the source dir to obtain the correct value that can be  pasted in PKGBUILD.

NO.  Do not manually run this code; do not manually paste anything into the pkgver value in the PKGBUILD.  Use makepkg, it will adjust the pkgver value for you.

But you are correct that you do not do this every time the git code changes.  You do this once to get a valid PKGBUILD and .SRCINFO, then upload them to the AUR.  After that a VCS PKGBUILD might never need to be updated again (the package can be updated, but the PKGBUILD in the AUR remains the same).

Last edited by Trilby (2022-04-06 19:13:00)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#8 2022-04-06 22:11:51

purpleleaf
Member
Registered: 2022-04-02
Posts: 21

Re: pkgver mismatch cause package to be ever updatable

Trilby wrote:

But you are correct that you do not do this every time the git code changes.  You do this once to get a valid PKGBUILD and .SRCINFO, then upload them to the AUR.  After that a VCS PKGBUILD might never need to be updated again (the package can be updated, but the PKGBUILD in the AUR remains the same).

Thanks Tribly, for sure i must study more deeply the AUR documentation in the wiki.
And thanks also for your willingness.

Offline

Board footer

Powered by FluxBB