You are not logged in.

#1 2019-04-25 16:53:55

blochl
Member
Registered: 2018-08-31
Posts: 44

Remove conflicting packages automatically

Hi,

I need to install a custom package which has dependencies that conflict with some packages that are already on the system (and I get the system as an image, so I can't uninstall them beforehand).

I must install this package automatically (it happens on a CI system).

The problem:

* If I do `pacman -U --nocofirm package.pkg.tar.xz`, the installation fails, as the default option is to keep the conflicting packages installed.
* If I do `yes | pacman -U package.pkg.tar.xz`, the installation fails, as some of the dependencies can be provided by several sources, and a number needs to be specified instead of y/n.

What can be done in such a case?

Offline

#2 2019-04-25 17:00:24

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 3,295

Re: Remove conflicting packages automatically

Install the correct dependencies first before installing your custom package?


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#3 2019-04-25 17:29:07

Stefan Husmann
Member
From: Germany
Registered: 2007-08-07
Posts: 1,073

Re: Remove conflicting packages automatically

Try this:

yes 2|pacman -U package.pkg.tar.xz

The 2 is to be read as an example.

Offline

#4 2019-04-25 17:47:54

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

Re: Remove conflicting packages automatically

Possibly implementing the -d or "twice" option? For either prior removal or installation.

Preemptively advising for regular use: "Don't do this"

EDIT :

I must install this package automatically (it happens on a CI system).

I initially read this as you want to do this in a script, although the "it happens on a CI system" seems like you may be doing it manually on the cl.

If scripted, might consider the -d options. If manually on the cl, definitely go with Slithery's advice, "Install the correct dependencies first".

Last edited by NuSkool (2019-04-25 18:10:22)

Offline

#5 2019-04-25 18:12:07

blochl
Member
Registered: 2018-08-31
Posts: 44

Re: Remove conflicting packages automatically

Thanks for your help!!

Slithery wrote:

Install the correct dependencies first before installing your custom package?

That would be awesome, but it all needs to be automatic.

Stefan Husmann wrote:

Try this:

yes 2|pacman -U package.pkg.tar.xz

The 2 is to be read as an example.

This will just repeat the number. I need it to return the number "1" (1 is always the default, right?) each time it asks for a number, and "y" each time it asks for [y/N] or [Y/n]...
Hmmm... maybe something with `expect`... I just thought about it now - will look into it.

NuSkool wrote:

Possibly implementing the -d or "twice" option? For either prior removal or installation.

But I actually want to remove the conflicting packages, not to ignore them. smile

Offline

#6 2019-04-25 18:20:28

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

Re: Remove conflicting packages automatically

it all needs to be automatic

Are you scripting this? What is "needs to be automatic"?


-R <conflicting>, then -U <package> .

If pacman won't remove conflicting packages because of dependencies, and removing them won't kill your system, consider the -d options.

Last edited by NuSkool (2019-04-25 18:26:02)

Offline

#7 2019-04-25 18:27:00

Slithery
Forum Moderator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 3,295

Re: Remove conflicting packages automatically

blochl wrote:

Thanks for your help!!

Slithery wrote:

Install the correct dependencies first before installing your custom package?

That would be awesome, but it all needs to be automatic.

I didn't mean to do it manually, just fire off the correct pacman command from whichever script then goes on to install the package.


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#8 2019-04-25 18:51:01

loqs
Member
Registered: 2014-03-06
Posts: 7,653

Re: Remove conflicting packages automatically

Can you not provide an example of the actual command used and the output it generates?  Also is the arch install on the image base plus base-devel?

Offline

#9 2019-04-26 00:15:41

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 21,399
Website

Re: Remove conflicting packages automatically

loqs, the OP is installing a custom package, not building it - so base-devel is not necessary.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#10 2019-04-26 22:11:34

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 6,872

Re: Remove conflicting packages automatically

Biochi, you could ABUSE the conflicts+replaces arrays to achieve automatic removal.

Keep in mind that this is completely unsupported and may cause severe breakage.


Multi-init booting with apg Openrc and systemd coexisting
Automounting : not needed, i prefer pmount
Aur helpers : makepkg + my own local repo === rarely need them

Offline

Board footer

Powered by FluxBB