You are not logged in.

#1 2025-02-12 19:28:08

NuSkool
Member
Registered: 2015-03-23
Posts: 266

[SOLVED] Convert list /w '*.so' names and '*>=4.10' to repo pkg names

I have an nspawn container that I'd like to keep maintained with a particular set of packages including base, base-devel, and an AUR.
It has various uses mostly around building packages.

I have a bash script to clean it that removes all packages not in a 'list'.
This works well except over time, base and base-devel change the pkgs they install.

To work around this, I have a second bash script that creates a fresh 'list' as if I had just recreated the container.

Now onto the issue... The script used to calculate the fresh 'list' is a 70+ line embarrasing mess.

Part of the issue is converting the '*.so' names and '*>=4.10' versions into package names.
Is there a clean way to do this conversion or is this an 'A B' problem?


Here's part of the script:

	pactree -slu       base | sort -u				>  /tmp/acpl/acpl
	pactree -slu base-devel | sort -u				>> /tmp/acpl/acpl
	pactree -lu    aurutils | sort -u				>> /tmp/acpl/acpl

	sort -u /tmp/acpl/acpl  | awk -F'>|=|<' '{print $1}'		>  /tmp/acpl/acpl-pre

	awk -F"=" '/\.so/ {print $1}' /tmp/acpl/acpl-pre  		>  /tmp/acpl/so

	grep -v '\.so' /tmp/acpl/acpl-pre | xargs -n1 pacman -Qq	>  /tmp/acpl/acpl-pre1

	while read -r line
	do
		pacman -Fq "${line}" | head -n1 | awk -F"/" '{print $2}' 	>> /tmp/acpl/acpl-pre1

	done < /tmp/acpl/so

	sort -u /tmp/acpl/acpl-pre1 | nl | sudo tee $(pwd)/.#orig-pkgs.log-$(date '+%Y-%m-%d')-NEW

Last edited by NuSkool (2025-02-12 22:58:19)


Scripts I Use                                                 :  https://github.com/Cody-Learner
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 7 8745HS w/ Radeon 780M Graphics
grep -m1 'model name' /proc/cpuinfo    : Intel(R) N95
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics

Offline

#2 2025-02-12 19:39:06

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,702

Re: [SOLVED] Convert list /w '*.so' names and '*>=4.10' to repo pkg names

Uninstall all orphaned deps, uninstall all explicitly installed packages not names base, base-devel, or aurutils. Done.

Offline

#3 2025-02-12 19:51:52

NuSkool
Member
Registered: 2015-03-23
Posts: 266

Re: [SOLVED] Convert list /w '*.so' names and '*>=4.10' to repo pkg names

Thanks Scimmia.

Trying to get my thick head around your reply....

So 'pacman -Qdtq' fed to pacman remove covers 'orphaned deps'.

uninstall all explicitly installed packages not names base, base-devel, or aurutils

Are you saying don't remove the pkg names, 'base', 'base-devel', 'aurutils'?

So 'pacman -Qqe'  minus the package names 'base, base-devel, aurutils' fed to pacman remove?

That would remove all the packages base and base-devel install.

I have a bash script to clean it that removes all packages not in a 'list'.


EDIT: Maybe this would help clarify my question....

Is there a simple way to convert the following list into package names?
I realize pacman would install the packages revealing their names, but I don't want install.
I'm currently converting these into package names with my script, but looking for a cleaner, more accurate method.

ca-certificates-utils>=20181109-3
glibc>=2.27
libcrypt.so=2-64
libisl.so=23-64
libp11-kit=0.25.5-1
libxtables.so=12-64
linux-api-headers>=4.10

And the total list:

$ sort -u acpl
acl
archlinux-keyring
attr
audit
aurutils
autoconf
automake
base
base-devel
bash
binutils
bison
brotli
bzip2
ca-certificates
ca-certificates-mozilla
ca-certificates-utils>=20181109-3
coreutils
cryptsetup
curl
db5.3
dbus
dbus-broker
dbus-broker-units
dbus-units
debugedit
device-mapper
diffutils
e2fsprogs
expat
fakeroot
file
filesystem
findutils
flex
gawk
gc
gcc
gcc-libs
gdbm
gettext
git
glib2
glibc
glibc>=2.27
gmp
gnulib-l10n
gnupg
gnutls
gpgme
grep
groff
guile
gzip
hwdata
iana-etc
icu
iproute2
iputils
jansson
json-c
kbd
keyutils
kmod
krb5
leancrypto
libarchive
libassuan
libbpf
libcap
libcap-ng
libcrypt.so=2-64
libelf
libevent
libffi
libgcrypt
libgpg-error
libidn2
libisl.so=23-64
libksba
libldap
libmnl
libmpc
libnetfilter_conntrack
libnfnetlink
libnftnl
libnghttp2
libnghttp3
libnl
libnsl
libp11-kit=0.25.5-1
libpcap
libpsl
libsasl
libseccomp
libsecret
libssh2
libsysprof-capture
libtasn1
libtirpc
libtool
libunistring
libusb
libverto-module-base
libxml2
libxtables.so=12-64
licenses
linux-api-headers>=4.10
lmdb
lz4
m4
make
mpfr
ncurses
nettle
npth
openssl
p11-kit
pacman
pacman-mirrorlist
pacutils
pam
pambase
patch
pciutils
pcre2
perl
perl-common-sense
perl-error
perl-json-xs
perl-mailtools
perl-timedate
perl-types-serialiser
pinentry
pkgconf
popt
procps-ng
psmisc
readline
sed
shadow
sqlite
sudo
systemd
systemd-libs
systemd-sysvcompat
tar
texinfo
tpm2-tss
tzdata
util-linux
util-linux-libs
which
xxhash
xz
zlib
zstd

Last edited by NuSkool (2025-02-12 20:45:07)


Scripts I Use                                                 :  https://github.com/Cody-Learner
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 7 8745HS w/ Radeon 780M Graphics
grep -m1 'model name' /proc/cpuinfo    : Intel(R) N95
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics

Offline

#4 2025-02-12 21:25:05

Scimmia
Fellow
Registered: 2012-09-01
Posts: 12,702

Re: [SOLVED] Convert list /w '*.so' names and '*>=4.10' to repo pkg names

NuSkool wrote:

So 'pacman -Qqe'  minus the package names 'base, base-devel, aurutils' fed to pacman remove?

That would remove all the packages base and base-devel install.

No, it wouldn't. They're metapackages, everything they depend on stays.

Edit: and yes, I understood your question, my point is that that's a terrible and needlessly complicated way to do it. This is very simple.

Last edited by Scimmia (2025-02-12 21:27:50)

Offline

#5 2025-02-12 22:52:11

NuSkool
Member
Registered: 2015-03-23
Posts: 266

Re: [SOLVED] Convert list /w '*.so' names and '*>=4.10' to repo pkg names

.... No, it wouldn't ....
.... that's a terrible and needlessly complicated way to do it ....

I was a little apprehensive to post the script, because I was SO FOCUSED ON there would be a much cleaner way to filter the list.
Well worth feeling a bit embarrassed to get rid of that whole script though, and to be replaced with just a few commands.
Not to mention get straightened out on some basic pacman usage.

pacman -Qdtq | pacman -Rns -
pacman -Qqe | grep -Ev 'base|base-devel|aurutils' | pacman -Rns -

I obviously never gave the pacman commands enough thought which caused a bad case of, "can't see the forest for the trees".

Thanks again and also for being persistent Scimmia!

EDIT:  corrected the commands

Last edited by NuSkool (2025-02-12 23:03:20)


Scripts I Use                                                 :  https://github.com/Cody-Learner
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 7 8745HS w/ Radeon 780M Graphics
grep -m1 'model name' /proc/cpuinfo    : Intel(R) N95
grep -m1 'model name' /proc/cpuinfo    : AMD Ryzen 5 PRO 2400GE w/ Radeon Vega Graphics

Offline

#6 2025-02-13 19:57:24

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 24,431

Re: [SOLVED] Convert list /w '*.so' names and '*>=4.10' to repo pkg names

Moving to Pacman issues by request.

By the way, you can use the built-in "Report" button on your own OP to request a move, in order to send a notification to all mods, so you don't have to rely on me checking my mail to see a request.

Offline

Board footer

Powered by FluxBB