Artix Linux Forum

Artix Linux => Package management => Topic started by: onekk on 08 August 2023, 18:48:31

Title: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 08 August 2023, 18:48:31
Hello, I have a problem, sometimes package broke, as some of my packages were installed from Arch Linux repo.

There is a way to find from where an installed package come from?

or better there is way to list packages installed from a specific repo? In this case arch linux ones.


EDIT: found:

Code: [Select]
paclist world
paclist extra
paclist community

will do the job, now the problem is how to substitute packages installed from these repo or better find what package will make artix linux load them from arch linux repo

Regards

Carlo D.
Title: Re: Check what package are installed from arch linux repositories
Post by: SGOrava on 08 August 2023, 19:25:05
Hello,

I think this is not possible with pacman alone.

But where is the will, there is a way.
You can list the packages from the remote repositories (e,g. arch/extra) and check which packages are installed.
Than check the package info (pacman -Qi <my-package>) and check for "Packager" field e.g.
Packager        : Artix Build Bot <jenkins < aa tt > artixlinux.org>

This can work because Artix packages are built on a server and Arch ones are on the machines of packagers (I guess here). Anyway Arch packages have wide variety of "Packager"s.

When you combine it in some script (or you can try to oneline it somehow...) you should be able to get the results you seek.

PS: there might be a better interface to pacman database (libalpm). You may try to check some GUI like Octopi, Pamac or the console tools in "pacutils" or "pacman-contrib" or  "expac" package
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 08 August 2023, 19:32:09


Thanks partially solved.

I've modified title of my first post, to better reflect the problem:


How to substitue packages installed from arch linu repo with those supplied by artix.

This implies to find if there are some packages that block the update.

As example I have found that zathura is supplied by artix, but it seems that zathura-pdf-poppler is not.


Regards

Carlo D.

Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: SGOrava on 08 August 2023, 19:39:15
In the migration guide, we went with brute force approach and made it reinstall everything.
https://wiki.artixlinux.org/Main/Migration#ReInstall_packages_from_Artix_repositories
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 08 August 2023, 19:46:48
In the migration guide, we went with brute force approach and made it reinstall everything.
https://wiki.artixlinux.org/Main/Migration#ReInstall_packages_from_Artix_repositories


Under: ReInstall packages from Artix repositories

Code: [Select]
 pacman -Sl system | grep installed | cut -d" " -f2 | pacman -S -
 pacman -Sl world | grep installed | cut -d" " -f2 | pacman -S -
 pacman -Sl galaxy | grep installed | cut -d" " -f2 | pacman -S -

but these lines seems to be not correct.

world is an artixlinux package, and even galaxy, according to:

https://wiki.artixlinux.org/Main/Repositories

so probably:

Code: [Select]
pacman -Sl extra | grep installed | cut -d" " -f2 | pacman -S -

seems a more correct solution

Regards

Carlo D.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: SGOrava on 08 August 2023, 19:49:46
The wiki is correct since we can only reinstall packages for which we have a replacement in Artix repositories.
It is useless to reinstall packages FROM Arch repos by packages FROM Arch repos again.

You might need to combine it in some script.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 08 August 2023, 20:17:24
Ok I have found  a way to grep what is installed in extra:

Code: [Select]
pacman -Sl extra | grep installed  | cut -d" " -f2   >> installed-extra.txt


this is giving  me a list:


Code: [Select]
a52dec
aalib
abseil-cpp
....

and then process this list to find out what could be supplied by world and what not:

I have this file, do you have some hints, to find out what is supplied and what is not present in world?

Regards

Carlo D.

Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: SGOrava on 08 August 2023, 20:21:24
like compare 2 lists and select the matching lines?
Maybe by using uniq tool ?
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 08 August 2023, 20:23:06
how to obtain the list of packages supplied by "world" regardless if they are installed or not?

Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: SGOrava on 08 August 2023, 20:28:50
pacman -Sl world
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 08 August 2023, 20:36:18


Update:


I have made this script that probably is doing what I want.

Code: [Select]
#!/bin/bash


sudo LC_ALL=C | pacman -Sl extra | grep installed | cut -d" " -f2 >> installed-extra.txt

#sudo LC_ALL=C | pacman -Sl world | grep installed | cut -d" " -f2 >> installed-world.txt

sudo LC_ALL=C | pacman -Sl world | cut -d" " -f2 >> world-allpkgs.txt

awk 'NR==FNR{arr[$0];next} $0 in arr' installed-extra.txt world-allpkgs.txt  >> tobe-installed.txt

awk '{print "world/" $0}' tobe-installed.txt >> pacman-list.txt


It will produce "pacman-list"  with packages installed in extra that are present in world, prefixed with "world/" as follow:


Code: [Select]
world/a52dec
world/aalib
world/abseil-cpp


I have to feed to to pacman this list to be installed, but I have to specify that they have to be reinstalled


I have found this command on Arch Linux Wiki:

Code: [Select]
pacman -S --needed - < pkglist.txt

Will it perform the desired action? Ie it will install packages from world reinstalling them on top of  the extra one?

or I have to add some other options?

TIA and Regards


Carlo D.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: nous on 09 August 2023, 10:23:03
Code: [Select]
pacman -S --needed - < pkglist.txt
Will it perform the desired action? Ie it will install packages from world reinstalling them on top of  the extra one?
The '--needed' option won't re-install already installed packages, no matter which repo they were taken from. You need to omit it. Also, that command will explicitly re-install the packages listed, which is not what you want; most are installed as dependencies.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 09 August 2023, 11:11:53
The '--needed' option won't re-install already installed packages, no matter which repo they were taken from. You need to omit it. Also, that command will explicitly re-install the packages listed, which is not what you want; most are installed as dependencies.

Thanks for answering.

I have to delete the --needed and what else?

My goal is to get rid of things installed from Arch Linux extra (and other repository" and to find what packages are lacking from my current installation of Artix.

In the time I have installed some development libraries so it is difficult to track what is needed and what is not.

My fault, but if I could amend my current installation using packages from Artix, I will try to see what is left from Arch Linux and search in a more restricted list of packages.

Regards

Carlo D.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: nous on 09 August 2023, 22:31:06
Let's say you want to install pkg1: pacman -S pkg1
This may pull 3 dependencies of pkg1: dep1, dep2, dep3. The latter will be marked as dependencies ("Install Reason" in pacman -Qi), while the former as "explicitly installed". This may seem trivial, but when try to uninstall pkg1, you can instruct pacman to also uninstall its dependencies to save space. If you re-install all packages listed in pkglist without --asdeps, this information will be lost and you won't be able to uninstall unneeded packages in one go, i.e. you'll have to find the deps yourself which is very time-consuming.
So, you must split your package list into 2: pkglist-explicit and pkglist-deps and install the second with --asdeps.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 10 August 2023, 09:16:21

So there is not a viable way to substitute packages pulled from "Arch extra" with packages pulled from "Artix world"?


You speak about of creating two lists, there is an automated way to do so?

TIA and Regards

Carlo D.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: nous on 10 August 2023, 09:48:42
Of course there is. First read this (https://wiki.archlinux.org/title/Pacman#Installation_reason), then the pacman manpage on the -Q (query) operation. Finally, 'pacman -Qh' will show you how to list explicitly installed / as dependencies packages separately.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 10 August 2023, 11:26:46
...
 Finally, 'pacman -Qh' will show you how to list explicitly installed / as dependencies packages separately.


ok misunderstood the command it is "pacman -Qd "

Regards

Carlo D.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 15 August 2023, 11:12:08
Hello, after some studying I'm returning on this topic.

I've created this script, that will try to create  a tbi-ad-list.txt hopefully ready to be installed substituing packages in extra with those in world.


I have made some intermediate lists, to check better the workflow.


Code: [Select]
#!/bin/bash

sudo LC_ALL=C | pacman -Qd | cut -d" " -f1 >> asdeps-list.txt

sudo LC_ALL=C | pacman -Sl extra | grep installed | cut -d" " -f2 >> extra-inst.txt

sudo LC_ALL=C | pacman -Sl world | grep installed | cut -d" " -f2 >> world-inst.txt

sudo LC_ALL=C | pacman -Sl world | cut -d" " -f2 >> world-allpkgs.txt

awk 'NR==FNR{arr[$0];next} $0 in arr' asdeps-list.txt extra-inst.txt >> tobe-inst-asdeps.txt

awk '{print "world/" $0}' tobe-inst-asdeps.txt >> tbi-ad-list.txt


Now the problem is how to make things happens.

First of all is this correct?

or first I have to create and install a list of the other packages (those non installed as deps) or doing what?


TIA and Regards.

Carlo D.


Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: nous on 18 August 2023, 00:10:08
Use 'export LC_ALL=C' once; use -Qq to suppress version info and drop cut(1); pacman query operations don't need sudo(1).
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: onekk on 19 August 2023, 16:14:50
Use 'export LC_ALL=C' once; use -Qq to suppress version info and drop cut(1); pacman query operations don't need sudo(1).

Some modifications done to the script according to your post.

Code: [Select]
#!/bin/bash

export LC_ALL=C

mkdir ./workfiles

pacman -Qq >> ./workfiles/asdeps-list.txt

pacman -Sl extra | grep installed | cut -d" " -f2 >> ./workfiles/extra-inst.txt

pacman -Sl world | grep installed | cut -d" " -f2 >> ./workfiles/world-inst.txt

pacman -Sl world | cut -d" " -f2 >> ./workfiles/world-allpkgs.txt

awk 'NR==FNR{arr[$0];next} $0 in arr' ./workfiles/asdeps-list.txt ./workfiles/extra-inst.txt >> ./workfiles/tobe-inst-asdeps.txt

awk '{print "world/" $0}' ./workfiles/tobe-inst-asdeps.txt >> pacman-list.txt




Now the problem are:

- How to obtain the list of packages installed not "asdeps"
- How are the correct commands to use pacman-list.txt (that is created as list of world/xxxx ) to substitute packages installed from extra
- What is the correct order to avoid problems, fisrt the asdeps-list and then the other list or...

TIA and Regards

Carlo D.
Title: Re: Substitute packages installed from arch repositories with artix ones.
Post by: nous on 20 August 2023, 21:26:16
- How to obtain the list of packages installed not "asdeps"
'grep -v installed'
- What is the correct order to avoid problems, fisrt the asdeps-list and then the other list or...
Irrelevant.