You are not logged in.

#1 2014-03-04 21:22:32

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Allow only one of a category of packages

I'd like to create an open-ended list of packages, of which only one may be installed at any time.

Think of it as some kind of system service that listens on port 1234 (I made that up, for this example). There might be three implementations from me, all of which support the 1234-port protocol, and the user may install one of them at a time, but no more than one. But then there might also be implementations from other people who I don't know about it. I'd like pacman to say something like:

> pacman -S third-party-1234-package
Sorry, you already have installed the wonderful-1234-package, which you will need to uninstall before you can install this one.

How would I get makepkg/pacman to do that? (Yes, I understand that in this scenario, I could install but not run several implementations. But my question is about how I prevent the installation of another packages in the same category, not how to prevent that more than one runs.)

Offline

#2 2014-03-04 21:48:44

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

Re: Allow only one of a category of packages

Take a look at the PKGBUILD provides and conflicts fields.

Last edited by Slithery (2014-03-05 10:00:42)


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 2014-03-05 00:15:10

drcouzelis
Member
From: Connecticut, USA
Registered: 2009-11-09
Posts: 4,092
Website

Re: Allow only one of a category of packages

This sounds like a really strange situation... It might help us help you if you tell us the problem you are working on instead of what you think is the solution. smile

Offline

#4 2014-03-05 00:41:49

karol
Archivist
Registered: 2009-05-06
Posts: 25,440

Re: Allow only one of a category of packages

mesa-libgl, nvidia-libgl and nvidia-304xx-utils provide libgl:

$ pacman -Qqs libgl
mesa
mesa-libgl
$ sudo pacman -S nvidia-libgl
resolving dependencies...
looking for inter-conflicts...
:: nvidia-libgl and mesa-libgl are in conflict (libgl). Remove mesa-libgl? [y/N]

Offline

#5 2014-03-05 04:26:33

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Re: Allow only one of a category of packages

@karol: great example! Poking around the PKGBUILD files, it seems that both say:

conflicts=('libgl')
provides=('libgl')

and that produces the behavior. So if I said in all of my packages

conflicts=('any-1234-package')
provides=('any-1234-package')

(but didn't provide a package called 'any-1234-package' directly), I should get the desired behavior?

Offline

#6 2014-03-05 12:33:53

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,868

Re: Allow only one of a category of packages

jernst, that is the idea.

'any-1234-package' would be what's called a 'virtual package' .
Some other examples of existing 'virtual packages' : java-runtime , java-environment , cron, libgl


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

#7 2014-03-05 17:31:30

jernst
Member
From: Silicon Valley
Registered: 2014-03-04
Posts: 290
Website

Re: Allow only one of a category of packages

Thanks, everybody, this was very quick, the the point, and just what I needed to know. #greatcommunity

Offline

Board footer

Powered by FluxBB