You are not logged in.
Hi all.
Sometimes I don't want to just pacman -Syu. There are many packages that are big but introduce only minor bugfixes (usually libreoffice packages* are the culprits), so I don't want to have to install those.
This is something I cooked up a while ago to show version difference of currently installed packages with the latest packages in repository.
It's in python3, and uses python-termcolor.
It outputs something like this:
acl : 2.2.52-1 --> 2.2.52-2
archlinux-keyring : 20130926-1 --> 20131027-1
bison : 3.0-1 --> 3.0.1-1
cracklib : 2.9.0-1 --> 2.9.0-2
Here is the script:
#!/usr/bin/python3
from subprocess import check_output
from termcolor import colored
pacman_out=check_output(["pacman","-Sl"], universal_newlines=True).split("\n")
outlist = []
len_pkgname = 0
len_majver = 0
len_newver = 0
len_oldver = 0
for pkgs in pacman_out:
if not "[installed" in pkgs:
continue
if "[installed]" in pkgs:
continue
pkg_split = pkgs.split(" ")
newver = pkg_split[2]
oldver = pkg_split[4].rstrip("]")
for i in range(min(len(newver),len(oldver))):
if newver[i] != oldver[i]:
break
pkgname = pkg_split[1]
majver = newver[:i]
oldver = oldver[i:]
newver = newver[i:]
outlist.append((pkgname, majver, newver, oldver))
len_pkgname = max(len_pkgname, len(pkgname))
len_majver = max(len_majver, len(majver))
len_newver = max(len_newver, len(newver))
len_oldver = max(len_oldver, len(oldver))
for (pkgname, majver, newver, oldver) in outlist:
print("{}: {}{} --> {}{}".format(
pkgname.ljust(len_pkgname),
colored(majver.rjust(len_majver),"cyan"),
colored(oldver.ljust(len_oldver),"cyan",attrs=["bold"]),
colored(majver.rjust(len_majver),"magenta"),
colored(newver.ljust(len_newver),"magenta",attrs=["bold"])))
I hope pkgbrowser will include something like this in the future.
P/S: * these packages will break anyway in the event the dependencies has had some ABI changes.
EDIT: swapped new and old version columns. Thanks, karol!
Last edited by syockit (2013-12-04 17:55:42)
Offline
Cool. Moving to Programming and Scripting...
Offline
Ah, sorry then. Because the subtitle for pacman's subforum has "Also the place for discussion about pacman in general.", I thought this would be appropriate there.
Offline
It's nothing to apologize for: it is just more likely to attract the interest of people who are more oriented towards actually programming for Arch here.
Offline
I think the columns with version numbers should be switched around. I update from 0.1 to 0.2 i.e. 0.1 -> 0.2.
Arch doesn't support partial upgrades ;P
Offline
I just found out there's a grand thread that has tons of self-baked scripts Maybe I need to lurk bbs more often.
Offline
I hope pkgbrowser will include something like this in the future.
Why not suggest adding this feature?
Currently it shows only the version that is going to be installed https://bbs.archlinux.org/viewtopic.php … 3#p1316573
I've mated pacman's checkupdates with my old script https://bbs.archlinux.org/viewtopic.php … 80#p829780
$ diff -Naur /usr/bin/checkupdates ch
--- /usr/bin/checkupdates 2013-10-21 14:04:37.000000000 +0000
+++ ch 2013-12-04 18:46:52.792101792 +0000
@@ -37,7 +37,11 @@
mkdir -p "$CHECKUPDATES_DB"
ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null
fakeroot pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null
-pacman -Qqu --dbpath "$CHECKUPDATES_DB" 2> /dev/null
+
+conf=${TMPDIR:-/tmp}/checkup-db-${USER}/pacman.conf
+grep -v "^Ignore" /etc/pacman.conf > $conf
+
+/usr/bin/paste -d " " <(/usr/bin/printf "%-20.20s %-12s => \n" $(/usr/bin/pacman -Qu)) <(/usr/bin/pacman -Sdp --config $conf --print-format "%v" $(/usr/bin/pacman -Qqu --dbpath "$CHECKUPDATES_DB" 2> /dev/null))
exit 0
$ ./ch
libpipeline 1.2.4-1 => 1.2.5-1
No colors though.
Last edited by karol (2013-12-04 18:55:03)
Offline