You are not logged in.

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

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

[Solved] 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?

Last edited by blochl (2019-05-29 11:08:46)

Offline

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

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [Solved] 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,391

Re: [Solved] 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: 141

Re: [Solved] 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: 77

Re: [Solved] 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: 141

Re: [Solved] 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
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: [Solved] 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: 17,195

Re: [Solved] 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: 29,444
Website

Re: [Solved] 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: 11,868

Re: [Solved] 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.


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

#11 2019-05-29 11:08:28

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

Re: [Solved] Remove conflicting packages automatically

Sorry for abandoning this - I followed here for the first week or so, trying to apply your suggestions, but nothing worked like I wanted, then I found a solution which worked for me, and while testing it (few more days), I forgot about this thread somehow. sad

So the solution I came up with is removing the `conflicts` from the problematic dependency, and after installing my custom package, just removing the conflicting package in the same script. As easy as that. The dependency is modified by me as well, so it's not a problem to edit its PKGBUILD.

This worked for this particular case, as this dependency could actually be installed alongside the package it conflicts with, so removing the conflicting package after the installation worked fine.

Marking as solved. smile

Offline

Board footer

Powered by FluxBB