You are not logged in.

#1 2009-08-28 14:00:16

benkay
Member
Registered: 2009-08-28
Posts: 6

install package as dependency of another package

Suppose you want to install Package X, which depends on Package Y. You also want to install Package Z, which augments Package X, but is not a dependency of Package X. You run:
pacman -S X Z
Now suppose that you no longer want Package X on your system. You run:
pacman -R X
Package X is removed. Now you can run:
pacman -Qdt
To clean up packages orphaned by Package X. Provided nothing else depends on Package Y, Package Y will be removed.

All is well and good, except Package Z was not orphaned by Package X. Even though Package Z is (in this hypothetical example) useless without Package X, it won't be removed automatically because it was installed with pacman -S.

So... is there a way to install Package Z as a dependency of Package X such that, when Package X is removed, Package Z will be orphaned if no other packages depend on it?

Offline

#2 2009-08-28 14:04:33

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: install package as dependency of another package

there is an --asdeps option to pacman, however i don't believe there's anything like --asdepof which would be needed to take advantage of the cleanup orphans shortcut, though i could be overlooking something.

i was thinking about this yesterday when i noticed openERP from AUR brought in like 27 python25-* deps that won't get picked up as orphans if i later remove openERP.  maybe a feature request?

Last edited by brisbin33 (2009-08-28 14:04:48)

Offline

#3 2009-08-28 14:16:30

benkay
Member
Registered: 2009-08-28
Posts: 6

Re: install package as dependency of another package

Indeed, the --asdeps option will cause Package Z to become orphaned immediately. pacman -Qdt will flag Package Z for removal even if Package X has not been removed.

Does anyone know of a hack with the effect of --asdepof? Or should I go ahead and submit a feature request?

Offline

#4 2009-08-28 14:36:54

Garns
Member
Registered: 2008-05-28
Posts: 239

Re: install package as dependency of another package

I don't know any wrappers or hacks dealing with this.

Regarding a feature request, there is already some stuff floating around:

http://www.archlinux.org/pipermail/pacm … 08382.html

IIRC there was something in the bugtracker as well.

Offline

#5 2009-08-28 15:51:25

venky80
Member
Registered: 2007-05-13
Posts: 1,002

Re: install package as dependency of another package

I am wondering ..can someone provide an example as to how to use --asdeps...i have been trying unsuccessfully..


Acer Aspire V5-573P Antergos KDE

Offline

#6 2009-08-28 17:08:51

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: install package as dependency of another package

nothing special about how to use --asdeps. what are you trying?
also define unsuccessfully


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#7 2009-08-28 18:56:25

benkay
Member
Registered: 2009-08-28
Posts: 6

Re: install package as dependency of another package

Garns, it looks like the discussion you linked to died back in March 2009. If anyone knows whether or not an effort to implement this feature is ongoing, please speak up. Otherwise, I'll submit a feature request once bugs.archlinux.org is back up.

Offline

#8 2009-08-29 12:36:18

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: install package as dependency of another package

You can probably manually make y depend on x by editing var/lib/pacman/local/y/depends, or
by editing the 'depends' line in a PKGBUILD file before building a package. But a --asdepsof <pckname> option would be nice to have, and less chance to mess up the pacman database.

Last edited by rwd (2009-08-29 13:08:00)

Offline

#9 2009-08-29 13:29:51

benkay
Member
Registered: 2009-08-28
Posts: 6

Re: install package as dependency of another package

Thank you, rwd, that does the trick. Editing the PKGBUILD is quite reasonable when Package X is in AUR, and for official packages, editing /var/lib/pacman/local/X/depends (not Z/depends) works. The downside is that I have to remember that I want Package Z to behave as a dependency of Package X and tweak Package X every time it is updated. So yes, an --asdepof option would be really swell.

For venky80 and anyone else who may be interested in this, here's a real-world example. Suppose you want to install loudmouth for use with amarok. If you later decide to uninstall amarok, you would like for loudmouth to be automatically uninstalled as well (unless some other package depends on it). loudmouth is not a depedency of amarok (incidentally it is an optional dependency, but this will work with any package that is not a dependency).

1. Install amarok
$ pacman -S amarok
2. Install loudmouth with --asdeps
$ pacman -S --asdeps loudmouth
3. Edit amarok's depends file to make it depend on loudmouth
3a. Open the file in a text editor
$ nano /var/lib/pacman/local/amarok*/depends
3b. Add "loudmouth" under the DEPENDS section; e.g.
%DEPENDS%
loudmouth
mysql>=5.1.34
kdebase-runtime>=4.2
taglib
...
3c. If loudmouth is an optional dependency of amarok (and it is), remove it from the OPTDEPENDS section.
3d. Save and close the depends file.
4. Test to see if it worked
$ pacman -Qtd
$ # loudmouth should not be listed
$ pacman -Rs amarok
$ # loudmouth should be listed

Offline

#10 2009-08-29 14:56:32

rwd
Member
Registered: 2009-02-08
Posts: 664

Re: install package as dependency of another package

I guess such a  '--asdepof' option would  require some kind of parallel database of 'forced' dependencies to overrule the ones stated in the packages so that they survive each update.

Last edited by rwd (2009-08-29 14:57:50)

Offline

#11 2009-08-29 15:01:20

benkay
Member
Registered: 2009-08-28
Posts: 6

Re: install package as dependency of another package

True, I suppose, but that need not be complicated. For instance, one could simply create a %USERDEPENDS% section in the local depends file, preserve the section across updates, and patch pacman to treat packages listed therein as normal dependencies.

Offline

#12 2009-08-30 09:09:14

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: install package as dependency of another package

benkay wrote:

True, I suppose, but that need not be complicated. For instance, one could simply create a %USERDEPENDS% section in the local depends file, preserve the section across updates, and patch pacman to treat packages listed therein as normal dependencies.

to be honest, it is much easier to implement the 4 points there :
http://wiki.archlinux.org/index.php/Use … OptDepends

what's your problems with them? why wouldn't these optdepends improvements solve your "problem" ?
As far as I can tell, the two in the middle should make you happy :
* optdepends are not orphans unless a flag is specified
* optdepends can be removed with -Rs


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#13 2009-09-01 12:54:07

benkay
Member
Registered: 2009-08-28
Posts: 6

Re: install package as dependency of another package

My "problem" is more general as it does not require Package Z to be an optional dependency of Package X. I agree, though, that it would also be nice if pacman were able to do something with optional dependencies besides just listing them.

Offline

#14 2009-09-01 13:01:52

shining
Pacman Developer
Registered: 2006-05-10
Posts: 2,043

Re: install package as dependency of another package

benkay wrote:

You also want to install Package Z, which augments Package X

this is exactly why optdepends were introduced ...


pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))

Offline

#15 2009-09-01 13:08:31

baghera
Member
Registered: 2007-08-26
Posts: 19

Re: install package as dependency of another package

benkay wrote:

My "problem" is more general as it does not require Package Z to be an optional dependency of Package X. I agree, though, that it would also be nice if pacman were able to do something with optional dependencies besides just listing them.

How often do you face up this situation? If it occurs just for a few packages, you could file a bug report to ask the mantainer to add the optdeps. Then improvements described in the wiki page will do the rest.

Offline

#16 2017-01-18 19:47:15

Cirelli94
Member
Registered: 2016-12-13
Posts: 37

Re: install package as dependency of another package

Any update about this problem?
Thanks in advance

Offline

#17 2017-01-18 21:00:01

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: install package as dependency of another package

Cirelli94 wrote:

Any update about this problem?
Thanks in advance

This thread is over 7 years old. It's better to start a new thread if you want to bring it up again. Check the progress of related bug reports too.

I will also shameless mention that makedep can be used as a stopgap solution until Pacman gets proper support for this.

Closing.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

Board footer

Powered by FluxBB