You are not logged in.
What is the best practice to detect when the name of an AUR package changes names? I just got caught with something I had not expected.
I have a Saleae logic analyzer that I use several times a year. I have been using saleae-logic-alpha to drive it, but had failed to notice that updates to it had stopped. Not unexpected, it is a pretty stable product that I don't use everyday.
I use auracle sync to watch for changes, and when something changes I do a git pull and a makepkg -si. While perusing pacman -Qm today, I saw saleae-logic-alpha and realized I had not seen an upgrade for some time. When I checked the AUR, it is gone. Oh good! Did it move to community? No. Damn.
A little poking around showed that it is now called saleae-logic2, so I built it and removed the former.
In what way should I have detected that change when it happened?
Last edited by ewaller (2021-08-28 16:25:34)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
No idea what's the best way, but I use notifications for that.
Aur has 3 types of notifications : comments, package updates and ownership changes .
I think package deletions are treated as ownership changes .
Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.
(A works at time B) && (time C > time B ) ≠ (A works at time C)
Offline
If you reframe the problem from detecting name changes, to simply detecting local (i.e., -Qm) packages that are not available on the AUR, the problem becomes pretty trivial. Here's one way to do that:
#!/bin/python
from subprocess import check_output
from urllib.request import urlopen
from json import loads
aur='https://aur.archlinux.org/rpc/?v=5&'
pkgs = check_output(['pacman', '-Qmq']).decode().splitlines()
params = '&arg[]=' + '&arg[]='.join(pkgs)
with urlopen(aur + 'type=info' + params) as url:
onaur = [ x['Name'] for x in loads(url.read().decode())['results'] ]
for missing in set(pkgs) - set(onaur):
print(missing)
You can then investigate any results of this to see if they exist under a new name, or were just removed. By writing this, I actually just learned a font I used from the AUR is no longer available ... interesting.
The above was exapted from my aur script, but for these purposes, python isn't really necessary. The following works just as well:
#!/bin/sh
args=$(printf '&arg[]=%s' $(pacman -Qmq | tee /tmp/local.pkg))
url="https://aur.archlinux.org/rpc/?v=5&type=info$args"
curl -s $url \
| tr , \\n \
| sed -n '/^"Name":/{s/"Name":"//;s/"//p}' \
| comm -23 /tmp/local.pkg -
Last edited by Trilby (2021-08-28 13:01:11)
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
Trilby: That is a nice way to refactor the problem into a differnet space. I also like the Python solution with sets. I'll use this model as my solution
I note you reach for Python nowadays where you might have used awk in the past.
Lone_wolf: That would work well also, but I think I prefer a pull solution rather than a push solution. IOW, when I am in the mood to do maintenance, I'll do it. Notifications are kind of being nagged.
I also feel a little better -- I am getting the impression this is a corner case and I did not miss something obvious.
Edit: Tagged as solved, because I have a working solution. I do not assert this is the "best practice"
Last edited by ewaller (2021-08-28 16:27:29)
Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way
Offline
I note you reach for Python nowadays where you might have used awk in the past.
Nah, I just have a more complete "aur helper" in python because python was the right tool for *that* job, and my first pass at the above just pulled out a chunk of that code with a little revision. But I've never been much of an awk'er, I always expect JWR to come out with the awk solution; sed on the other hand is often one of my favored tools.
"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" - Richard Stallman
Offline
In what way should I have detected that change when it happened?
I simply check pkgbrowser from time to time (in online mode), looking for any foreign installed packages from the "local" repository (using column sort). That covers AUR packages that have been removed or renamed.
Offline
#!/bin/sh args=$(printf '&arg[]=%s' $(pacman -Qmq | tee /tmp/local.pkg)) url="https://aur.archlinux.org/rpc/?v=5&type=info$args" curl -s $url \ | tr , \\n \ | sed -n '/^"Name":/{s/"Name":"//;s/"//p}' \ | comm -23 /tmp/local.pkg -
Trilby,
I believe I learned how to use the (json aur web interface?) in my shell scripts from your example.
Been thinking about this for some time now.
I'm more into awk, so replaced the sed and...
Ran some time tests compared to using https://aur.archlinux.org/packages.gz.
The aur web would be much faster for checking a few packages. The later may be better for numerous ongoing checks...
Thanks!
Offline