You are not logged in.

#1 2011-03-15 22:11:17

Boobek
Member
Registered: 2011-03-15
Posts: 7

Exist a simple way to find dependencies recursivly with pacman?

Hi,
I'm a newbie Arch user with  little english language skills.. Sorry for this.

Today I try to install some components of xfce (4.8) and I see... pacman want to install these packages: gnome-keyring, hal.
(Hal is probably a dependency of an old (4.6) component's of xfce.)
I don't want to install hal and gnome-keyring so I need to know what packages depends on those.

I don't find relevant informations on the net (but I'm possible blind smile )

Anyone know a simple solution for this problem?
I wrote a bash script today to teach myself to programming in bash but this script is probably not the simplest way. ( http://paste.ubuntu.com/580804/ )

Balazs

Offline

#2 2011-03-15 22:24:00

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

Re: Exist a simple way to find dependencies recursivly with pacman?

If you want to know all the packages from the official repos that depend on hal: http://www.archlinux.org/packages/extra/i686/hal/
Seems like thunar-vfs needs it. It's *not* a recursive solution.

Once you have certain packages installed, you can use e.g. pactree from pacman-contrib package.
I don't know which way is simpler: clicking through the web page or installing a bunch of packages and uninstalling them later.

Last edited by karol (2011-03-15 22:31:25)

Offline

#3 2011-03-15 22:44:19

Boobek
Member
Registered: 2011-03-15
Posts: 7

Re: Exist a simple way to find dependencies recursivly with pacman?

karol wrote:

If you want to know all the packages from the official repos that depend on hal: http://www.archlinux.org/packages/extra/i686/hal/
Seems like thunar-vfs needs it. It's *not* a recursive solution.

Once you have certain packages installed, you can use e.g. pactree from pacman-contrib package.
I don't know which way is simpler: clicking through the web page or installing a bunch of packages and uninstalling them later.

The webpage can't become a complete solution.
Second way: .. I don't want to install theese components.. smile


Thanks for your fast reply,
Balazs

Offline

#4 2011-03-15 22:54:07

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

Re: Exist a simple way to find dependencies recursivly with pacman?

You can use expac in your script.

foo () { xargs expac -l '\n' "%N" -S | tee -a asdfghtest1; }
expac -l '\n' "%N" -S $1 | tee -a asdfghtest1 | foo | foo | foo | foo | foo | foo | foo | foo | foo | foo | foo | foo && sort asdfghtest1 | uniq

Bruteforce FTW ;P


Edited, because falconindy bit me and now I can't write too ;P

Last edited by karol (2011-03-16 15:05:06)

Offline

#5 2011-03-16 10:30:54

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: Exist a simple way to find dependencies recursivly with pacman?

pactree


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#6 2011-03-16 10:34:16

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

Re: Exist a simple way to find dependencies recursivly with pacman?

Mr.Elendig wrote:

pactree

[karol@black ~]$ pactree -h
This program generates the dependency tree of an installed package

<SNIP>

[karol@black ~]$ pactree -u hal
[karol@black ~]$ pactree -r hal
Boobek wrote:

I don't want to install theese components..

Offline

#7 2011-03-16 10:42:15

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: Exist a simple way to find dependencies recursivly with pacman?

Fairly easy to get it to work on the sync db instead of the local db.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#8 2011-03-16 13:16:51

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Exist a simple way to find dependencies recursivly with pacman?

Mr.Elendig wrote:

Fairly easy to get it to work on the sync db instead of the local db.

Would take some refactoring, but definitely possible. Maybe for 3.6 I'll work on this...

In the meantime, I agree. expac is awesome. Note that I may or may not be biased. The following should properly walk the repos and find you dependencies

#!/bin/bash

: ${maxdepth:=0}

declare -A walked
declare -i depth=0

walkdeps() {
  for pkg in $(expac -S '%N' -l '\n' $1); do
    printf '%s\n' "$pkg"
    if [[ -z ${walked[$pkg]} ]] && (( maxdepth == 0 || depth <= maxdepth )); then
      walked["$pkg"]=1
      (( ++depth ));
      walkdeps $pkg;
    fi
  done
}

walkdeps $1 | sort -u

Being bash, its not the speediest. By default, it'll recurse until it hits the end, but it'll honor the 'maxdepth' environment variable to limit that, e.g.

$ maxdepth=2 ./depwalk hal
e-modules-extra-svn
eiciel
flumotion
gnome-commander
gnome-device-manager
gnome-vfs
gnome-vfs-perl
gnome-vfsmm
gobby
libgda3
libgnome
podsleuth
python2-gnomevfs
synce-libsynce
synce-odccm
thoggen
thunar-vfs

updated: because i can't read or write

Last edited by falconindy (2011-03-16 13:42:24)

Offline

#9 2011-03-16 13:22:37

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

Re: Exist a simple way to find dependencies recursivly with pacman?

@falconindy
I think your script shows the packages e.g. hal depends on and their recursive dependencies while OP wanted to know what packages depend on hal:

Boobek wrote:

I don't want to install hal and gnome-keyring so I need to know what packages depends on those.

Offline

#10 2011-03-16 13:27:15

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Exist a simple way to find dependencies recursivly with pacman?

oh. reverse deps... just change the %E to an %N. fixed my earlier post (and updated with bash4!)

Last edited by falconindy (2011-03-16 13:42:46)

Offline

#11 2011-03-16 14:55:12

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

Re: Exist a simple way to find dependencies recursivly with pacman?

falconindy wrote:

oh. reverse deps... just change the %E to an %N.)

Me smart, me figured that out. But my script runs in <10 secs, while yours in >2mins.
I'm not sure if my script is correct, I've tested it on one package only (hal) and both scripts returned the same results and you can control the depth by reducing the number of foos :-)

Getting rid of asdfghtest1 file and having a way of setting the depth in a less awkward way would be nice, but I really don't have time to do it atm (and I suppose I lack the knowledge too).


Edit: I fixed the obvious mistake I had in my script: ... not printing the package dependencies, but printing its dependencies' dependencies.
If I missed something else, let me know. I'll try to test it some more in a couple hours.

Last edited by karol (2011-03-16 15:17:12)

Offline

#12 2011-03-16 15:19:18

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Exist a simple way to find dependencies recursivly with pacman?

I've spoiled myself being on pacman-git for so long. My depwalk runs in 23s on my work VM, and a little less than half that on my desktop back at home.

Offline

#13 2011-03-16 15:23:56

ngoonee
Forum Fellow
From: Between Thailand and Singapore
Registered: 2009-03-17
Posts: 7,356

Re: Exist a simple way to find dependencies recursivly with pacman?

falconindy wrote:

I've spoiled myself being on pacman-git for so long. My depwalk runs in 23s on my work VM, and a little less than half that on my desktop back at home.

Ah, pacman 3.5. Here's hoping we see it sooner rather than later smile


Allan-Volunteer on the (topic being discussed) mailn lists. You never get the people who matters attention on the forums.
jasonwryan-Installing Arch is a measure of your literacy. Maintaining Arch is a measure of your diligence. Contributing to Arch is a measure of your competence.
Griemak-Bleeding edge, not bleeding flat. Edge denotes falls will occur from time to time. Bring your own parachute.

Offline

#14 2011-03-16 15:35:26

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

Re: Exist a simple way to find dependencies recursivly with pacman?

Another thing: your 'maxdepth=2 ./depwalk hal' lists gobby but not xfburn.
When I run it, I get a shorter list (even though I have some unofficial repos enabled - arista is one such package, picasa-beta is another). Where's e.g. gnome-vfsmm? What am I missing?

[karol@black ~]$ maxdepth=2 ./depwalk hal
arista
e-modules-extra-svn
gnome-device-manager
gnome-vfs
picasa-beta
podsleuth
synce-libsynce
synce-odccm
thoggen
thunar-vfs

Offline

#15 2011-03-16 19:17:21

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: Exist a simple way to find dependencies recursivly with pacman?

Look, I already admitted that I can't read or write. Now you're going to take the last of my pride and make me admit that I can't count either...

#!/bin/bash

: ${maxdepth:=0}

declare -A walked
declare -i depth=0

walkdeps() {
  for pkg in $(expac -S '%N' $1); do
    printf '%s\n' "$pkg"
    if [[ -z ${walked[$pkg]} ]] && (( maxdepth == 0 || depth <= maxdepth )); then
      walked["$pkg"]=1
      (( ++depth ))
      walkdeps $pkg
      (( depth-- ))
    fi  
  done
}

walkdeps $1 | sort -u

That should fix it...

Offline

#16 2011-03-16 21:54:02

Boobek
Member
Registered: 2011-03-15
Posts: 7

Re: Exist a simple way to find dependencies recursivly with pacman?

Thanks for answers.

ps.: @falconindy:
Your script is excellent, but it's works too much.. smile
In this problem we have the list of packages what we need to parse.

Last edited by Boobek (2011-03-16 21:55:01)

Offline

#17 2011-03-16 22:11:21

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

Re: Exist a simple way to find dependencies recursivly with pacman?

Boobek wrote:

Thanks for answers.

ps.: @falconindy:
Your script is excellent, but it's works too much.. smile
In this problem we have the list of packages what we need to parse.

I don't think I understand. If the list is too long, you can remove the packages you already have and check if you need any of the rest.

falconindy wrote:

Look, I already admitted that I can't read or write. Now you're going to take the last of my pride and make me admit that I can't count either...

LOL
I needed that after a hard hard day :-)

Yeah, the results are identical this time, so your script is OK (or we're both wrong).

As for the execution speed, I have a 7yo computer. Intel Core i7 980x EE v. P4 @2GHz <sigh>

Offline

Board footer

Powered by FluxBB