You are not logged in.
I have a script to just update and install AUR packages. It is simple and just working for me.
I check the version number from the output of $ pacman -Qm against the version number from the output of
https://aur.archlinux.org/rpc/v5/info?arg[]=package
.
But sometime, some package show different version numbers against each other while they are at the same version.
for example, @ 2024-01-27, AUR package eww-wayland is showing the different versions. So, every time I run my script to update AUR packages, eww-wayland is getting updating but some version.
while
~]$ pacman -Qm | grep eww-wayland
eww-wayland 0.4.0-1
The version from AURweb RPC Interface
https://aur.archlinux.org/rpc/v5/info?arg[]=eww-wayland
shows
Version: 0.4.0-5
What is the best way to check AUR package version in my script?
Thanks in advance.
Last edited by duyinthee (2024-01-28 05:46:28)
Offline
What is the best way to check AUR package version in my script
Why don't you share the script so we can have a look? Why not just use an established AUR helper? Bear in mind that AUR helpers or scripts are a little frowned upon here.
The best way to check the version is of course reading the PKGBUILD's and the recommended way of installing is via makepkg.
Offline
pacman -Qi eww-wayland
Either the package gets ignored by your script or fails to build or doesn't rebuild but installs a present dated version of the package.
Online
Let me paste a snippet of my script here.
# update aur packages
updateaur_func () {
for INSTNAME in $(pacman -Qmq); do
local INSTVER=$(pacman -Q $INSTNAME | cut -d ' ' -f 2)
local CURRVER=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]=$INSTNAME" | \
jq -r '.results[] | .Version')
if [ -z "$CURRVER" ]; then
echo "Oop! "$INSTNAME", AUR Package does not exist. continue @ updateaur_func"
continue
fi
if [ "$INSTVER" = "$CURRVER" ]; then
echo " $INSTNAME ---------> up to date."
continue
fi
aurdownload_func $INSTNAME
installaur_func
done
}
Then in aurdownload_func I check if the package exists and download snapshot using wget.
AURPKG=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]="$1"" | jq -r '.results[] | .Name')
if [ -z "$AURPKG" ]; then
echo "Oop! AUR Package does not exist."
return 3
fi
...
wget https://aur.archlinux.org/cgit/aur.git/snapshot/"$AURPKG".tar.gz
tar -xzf "$PWD"/"$AURPKG".tar.gz
...
In case of eww-wayland package name, my script gets the snapshot this
wget https://aur.archlinux.org/cgit/aur.git/snapshot/eww-wayland.tar.gz
But, at this link https://aur.archlinux.org/packages/eww-wayland, if I download snapshot from the link inside the right side box called Package Actions, I get the following,
https://aur.archlinux.org/cgit/aur.git/snapshot/eww.tar.gz
So, the snapshots are different, eww-wayland.tar.gz and eww.tar.gz.
PKGBUILD in the eww-wayland.tar.gz shows
...
pkgver=0.4.0
pkgrel=1
...
But PKGBUILD in the eww.tar.gz shows
...
pkgver=0.4.0
pkgrel=5
...
Therefore, every time I run my script, eww-wayland is getting update because of pkgrel=1 in PKGBUILD.
Last edited by duyinthee (2024-01-28 02:33:18)
Offline
It's a split package, the pkgbase is eww. When you're grabbing eww-wayland.tar.gz, you're grabbing an old, deleted pkgbase
Offline
The solution:
- AURPKG=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]="$1"" | jq -r '.results[] | .Name')
+ AURPKG=$(curl -s "https://aur.archlinux.org/rpc/?v=5&type=info&arg[]="$1"" | jq -r '.results[] | .PackageBase')
Also, while not related to the current error, I'd strongly suggest replacing this:
if [ "$INSTVER" = "$CURRVER" ]; then
and use `vercmp` instead.
EDIT: I suppose if you're checking strictly for equality it should not matter. But still switching to vercmp now could prevent a future headache if you ever change that part of the script to handle any other comparisons.
Last edited by Trilby (2024-01-28 03:43:51)
"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman
Offline
and use `vercmp` instead.
EDIT: I suppose if you're checking strictly for equality it should not matter. But still switching to vercmp now could prevent a future headache if you ever change that part of the script to handle any other comparisons.
Thanks for helpful suggestion.
Offline