You are not logged in.

#1 2008-09-20 18:14:10

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Specify a depending package when using --asdeps

Hi,

I've thought about this for some time... When one uses the --asdeps option, the package gets the installation reason that it has been installed as a dependency - but it can potentially be "Required By" None, specifically it will not be Required By the package one intended it to be a dependency for. This really makes no sense - IMO one should be able to specify a depending package, so that when one does a pacman -Rs the --asdeps package(s) will be removed as well.

Has this been discussed? Is it something to report as an FR or bug?

Offline

#2 2008-09-20 19:00:58

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

Re: Specify a depending package when using --asdeps

I disagree.

I think it makes sense that a package that you installed separately should not be removed with another program. You can remove all packages that are installed with --asdeps that aren't required by any other package using

pacman -Rsn $(pacman -Qqdt)

It's definitely not a bug because pacman has no idea for what you considered the package to be a dependency. If you want that behavior, you could  modify the PKGBUILD and rebuild it yourself, or you could tweak files in the local pacman database to specify that as a dependency.


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

Offline

#3 2008-09-20 19:05:35

fwojciec
Member
Registered: 2007-05-20
Posts: 1,411

Re: Specify a depending package when using --asdeps

It does make sense, because pacman checks this from two sides -- it checks what the dependencies for various packages are and it checks the reason for installation.  So if you installed package "x" with --asdeps and no package has "x" as a dependency "x" will be technically an orphan (i.e. you will be able to list it with "pacman -Qdt").  If later you install package "y" that does have "x" as a dependency, "x" will be no longer an orphan and "pacman -Qdt" will not list it -- in addition, if you then choose to remove package "y" with "pacman -Rs y", package "x" will be removed along with "y".

Offline

#4 2008-09-22 11:11:26

jacko
Member
Registered: 2007-11-23
Posts: 840

Re: Specify a depending package when using --asdeps

doesn't paman now tell you when a package is orphaned and is not being used by any installed program? or is that just yaourt feature?

Offline

#5 2008-09-22 12:03:01

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Specify a depending package when using --asdeps

jacko wrote:

doesn't paman now tell you when a package is orphaned and is not being used by any installed program? or is that just yaourt feature?

Well, yes, with -Qdt or whatever it was, but my problem is that when I use --asdeps, I want to bind a program to another, so that the --asdeps-installed program is removed when I remove the "predator" - I don't _want_ it to show up among the orphaned packages.

Okay, now I remember what made me post my first post tongue It wasn't very well thought through - dependencies should of course be stated by each package. So, when I install an optional dependency for a package, the optional dependency will not be removed with pacman -Rs, right? When I install an optional dependency I will usually want to use the --asdeps option because I'm not interested in the program on its own. But, it will be listed as an orphan with pacman -Qdt, since I've faked the installation reason, and then I have to _remember_ that I've installed it as an optional dependency, which I really don't want to (remember stuff, that is).

Aha, I just read in the PKGBUILD man page that

optdepends are currently for informational purposes only and are not utilized by pacman during dependency resolution.

I've bolded the "currently"... Maybe something is planned for the optional dependency case?

Offline

#6 2008-09-22 17:47:13

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

Re: Specify a depending package when using --asdeps

Ah.

For optional dependencies, I agree that it would be nice to let the target package "adopt" them. Perhaps you should file a feature request to expand package "install reasons". Alternatively, maybe you could expand on my idea here: http://bugs.archlinux.org/task/11337

Dependencies have a "required by" field... perhaps it would be possible to add a dynamic "optionally required by" field to which packages could be appended.
Maybe something like

pacman -S <parent pkg> --adopt <child pkg>
pacman -S <parent pkg> --disown <child pkg>

(just an example)

EDIT:
Better yet, add a new operation, "--alter" or "-A" that would let you alter packages without re-installing them, e.g.

pacman -A --asdeps <pkg>
pacman -A --asexplicit <pkg>
pacman -A <parent pkg> --adopt <child pkg>

*goes to file feature request*
http://bugs.archlinux.org/task/11557

Last edited by Xyne (2008-09-22 17:54:22)


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

Offline

#7 2008-09-23 12:38:09

ngaba
Pacman Developer
Registered: 2008-05-13
Posts: 16

Re: Specify a depending package when using --asdeps

Bebo, you misinterpret --asdeps. That sets the _install reason_ (--asexplicit sets the other possible reason).

"Installed as dependency" means that the package was installed by pacman _automatically_ (via -S), so this package is "not important" to you, only a requirement for other package. So pacman will automatically remove it, if no longer needed (if you use -Rs always).
"Explicitly installed" means that _you_ installed the package (you mentioned it in the command line). For example you might have installed gtk2, because you develop programs that use that library. [Ovbiously gtk2 can be a dependency of other packages (firefox, x-chat ...).] In this case the package is "important" to you, so pacman won't remove it even if it is no longer needed by other packages. (However, you can skip this reason checking step with -Rss, in this case pacman will remove _all_ no longer needed packages, including explicitly installed ones.)

Requiredby field is not stored at all. It is calculated from "depends" fields of other packages.

Offline

#8 2008-09-23 14:36:29

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Specify a depending package when using --asdeps

Yes, ngaba, I kn(o|e)w all this (except for the -Rss possibility).

In my first post I half forgot what I had in mind, so I guess it sounded a bit strange. But you are right, I may have missed the intention with the --asdeps option*. I hope my second post makes more sense.


_______________
* In hindsight I think I was/am looking for a possibility to "inject" dependencies in installed packages (without changing PKGBUILDs and/or filing bug reports smile).

Offline

#9 2008-09-23 14:44:27

Bebo
Member
From: Göteborg, Sweden
Registered: 2006-06-07
Posts: 207

Re: Specify a depending package when using --asdeps

@Xyne, your FRs look interesting. The optdepends implementation seems a bit unfinished, so hopefully your first FR results in something. Your second FR sounds like a way to do this "dependency injection" that I would like to be able to do. Not sure how well it is received though smile

Offline

Board footer

Powered by FluxBB