You are not logged in.

#1 2010-05-21 19:10:20

silenc3r
Member
From: Poland
Registered: 2009-08-29
Posts: 149

[SOLVED] pacman show dependency list

How can I make pacman show all dependencies of some package?

Last edited by silenc3r (2010-05-21 20:00:12)

Offline

#2 2010-05-21 19:14:29

hokasch
Member
Registered: 2007-09-23
Posts: 1,461

Re: [SOLVED] pacman show dependency list

By checking man pacman.

Offline

#3 2010-05-21 19:17:07

hidefromkgb
Member
Registered: 2009-08-03
Posts: 146

Re: [SOLVED] pacman show dependency list

Or finding "show dependencies" here.

Offline

#4 2010-05-21 19:29:48

silenc3r
Member
From: Poland
Registered: 2009-08-29
Posts: 149

Re: [SOLVED] pacman show dependency list

I know about pacman -Qi/Si but I was wondering if there's some way to show only simple list of dependencies not whole package info.

Offline

#5 2010-05-21 19:40:41

hidefromkgb
Member
Registered: 2009-08-03
Posts: 146

Re: [SOLVED] pacman show dependency list

Maybe not a very graceful solution, but still working smile

pacman -Qi pidgin|grep <STRING_THAT_MEANS_"DEPENDS_ON"_IN_YOUR_NATIVE_LANGUAGE>|cut -d: -f2

Offline

#6 2010-05-21 19:54:29

silenc3r
Member
From: Poland
Registered: 2009-08-29
Posts: 149

Re: [SOLVED] pacman show dependency list

thanks a lot hidefromkgb, that is exactly what I was looking for smile

Offline

#7 2010-05-21 20:12:20

tesjo
Member
Registered: 2007-11-30
Posts: 164

Re: [SOLVED] pacman show dependency list

Careful, that fails for when depends extend to multiple lines.

This will do it but it a sloppy way I think

pacman -Si pidgin|sed -n '/Depends\ On/,/:/p'|sed '$d'|cut -d: -f2

Last edited by tesjo (2010-05-21 20:33:14)

Offline

#8 2010-05-21 20:40:22

harryNID
Member
From: P3X-1971
Registered: 2009-06-12
Posts: 117

Re: [SOLVED] pacman show dependency list

Here is a little command I wrote a while back while I was learning sed. It gives a bulk output of all your programs, their dependencies and optional dependencies. I ran into the "fails for when depends extend to multiple lines" issue and this should fix that. I haven't tested it very much so you be the judge.

 pacman -Qi | sed '/^Depends On/,/^Required By/{ s/^Required By.*$//; H; d }; /^Name/!d; /^Name/{ n;x;}'| sed '/^$/s//==================================================================================/'

Small Example Output: (looks much cleaner in the Terminal)

==================================================================================
Name           : xorg-server-utils
Version        : 1.7.6-3
Depends On     : hal>=0.5.14  libgl  libxfont>=1.4.1  openssl>=1.0.0 
                 libpciaccess>=0.10.9  libxv>=1.0.5  pixman>=0.16.6 
                 xcursor-themes>=1.0.2  xkeyboard-config>=1.8 
                 xorg-server-utils  xorg-fonts-misc  xbitmaps  diffutils 
                 xf86-input-evdev>=2.2.5  inputproto>=2.0 
Optional Deps  : None
==================================================================================
Name           : xorg-util-macros
Version        : 7.5-3
Depends On     : libxfontcache>=1.0.5  libxi>=1.3  libxaw>=1.0.6 
                 libxxf86misc>=1.0.2  libxrandr>=1.3.0  libxxf86vm>=1.1.0 
                 mcpp>=2.7.2 
Optional Deps  : None
==================================================================================
Name           : xorg-utils
Version        : 1.7.0-1
Depends On     : None
Optional Deps  : None
==================================================================================

I added the equal signs for looks and to fit my default Terminal window. Just add or subtract them in the command to fit yours or to get rid of them just drop off the last section of the pipe.

Good Luck!:D


In solving a problem of this sort, the grand thing is to be able to reason backward. That is a very useful accomplishment, and a very easy one, but people do not practice it much. In the everyday affairs of life it is more useful to reason forward, and so the other comes to be neglected. There are fifty who can reason synthetically for one who can reason analytically.  --Sherlock Holmes

Offline

#9 2012-12-01 15:28:48

Stack
Member
Registered: 2012-04-22
Posts: 13

Re: [SOLVED] pacman show dependency list

There are yet another two ways. Awk dependent, and Bash only.

Awk dependent:

#!/bin/bash
packageName="gstreamer0.10-bad-plugins"
depsList="$( pacman -Si "${packageName}" 2>/dev/null )"
depsList="$( \
        awk \
            -F ": " \
            -v searchToken="Depends On     " \
            ' \
               $0 ~ searchToken \
                { \
                    gsub(/[>=<]*[0-9.\-]* /," ",$2) ; \
                    gsub(/ +/,"\n",$2) ; \
                    print $2 ; \
                } \
            ' <<< "${depsList}" \
    )" 
echo "====  ${packageName}" | sort -u
echo "${depsList}"
unset depsList

Bash only:

#/bin/bash
packageName="gstreamer0.10-bad-plugins"
searchToken="Depends On     : "
depsList="$( pacman -Si "${packageName}" 2>/dev/null )"
shopt -s extglob
depsList="${depsList/*${searchToken}/}"
depsList="${depsList/$'\n'*/}"
depsList="${depsList//+([>=<])+([0-9.\-])*([[:space:]])/ }"
depsList="${depsList/#+([[:space:]])/}"
depsList="${depsList/%+([[:space:]])/}"
depsList="${depsList//+([[:space:]])/$'\n'}"
echo "====  ${packageName}"
echo "${depsList}" | sort -u
unset depsList

Save them it files s1 and s2, try

time ./s1 1>/dev/null ; time ./s2 1>/dev/null

3x difference in time consumption. Regular expressions is a hard weight.

See: https://wiki.archlinux.org/index.php/Pacman_Tips

Offline

#10 2013-03-18 17:20:51

Götz
Member
Registered: 2009-02-16
Posts: 30

Re: [SOLVED] pacman show dependency list

With pactree it is possible to search recursively for ALL the dependencies of a package:

pactree -u PACKAGE

To search for reverse dependencies:

pactree -r PACKAGE

What I hear, I forget. What I say, I remember. What I do, I understand.  –Tao Te Ching/Laozi

Offline

#11 2014-11-27 15:44:10

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 671
Website

Re: [SOLVED] pacman show dependency list

Someone willing to help a noob using harryNID's pacman|sed commandline with an example?
Or Stack's small regex script. As it returns just the package name in this location :}

Note: When I get it works, it'd be cool with added prompt/input, eg:

#!/bin/bash                                                                        
read -p "Package Name please : " PACKAGE
packageName="$PACKAGE"
depsList="$( pacman -Si "${packageName}" 2>/dev/null )"
depsList="$( \
        awk \
            -F ": " \
            -v searchToken="Depends On     " \
            ' \
               $0 ~ searchToken \
                { \
                    gsub(/[>=<]*[0-9.\-]* /," ",$2) ; \
                    gsub(/ +/,"\n",$2) ; \
                    print $2 ; \
                } \
            ' <<< "${depsList}" \
    )"
echo "====  ${packageName}" | sort -u
echo "${depsList}"
unset depsList

PS This is the most recent post on the subject I found. Sorry if duplicating.
@hidefromkgb: Pacman_Rosetta is something smile


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

#12 2014-11-27 16:26:23

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

Re: [SOLVED] pacman show dependency list

This post is old. Real old. These days, there's expac.

$ expac -S '%r/%n: %D' pacman
falconindy/pacman: bash>=4.2.042-2  glibc>=2.17-2  libarchive>=3.1.2  curl>=7.19.4  gpgme  pacman-mirrorlist  archlinux-keyring
core/pacman: bash>=4.2.042-2  glibc>=2.17-2  libarchive>=3.1.2  curl>=7.19.4  gpgme  pacman-mirrorlist  archlinux-keyring

Offline

#13 2014-11-27 19:55:51

kozaki
Member
From: London >. < Paris
Registered: 2005-06-13
Posts: 671
Website

Re: [SOLVED] pacman show dependency list

Thank you for the update falconindy
Now I can use expac in case of conflicting update.
pacman -Qii shines in this field, though tongue


Seeded last month: Arch 50 gig, derivatives 1 gig
Desktop @3.3GHz 8 gig RAM, linux-ck
laptop #1 Atom 2 gig RAM, Arch linux stock i686 (6H w/ 6yrs old battery smile) #2: ARM Tegra K1, 4 gig RAM, ChrOS
Atom Z520 2 gig RAM, OMV (Debian 7) kernel 3.16 bpo on SDHC | PGP Key: 0xFF0157D9

Offline

#14 2014-11-27 20:50:32

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

Re: [SOLVED] pacman show dependency list

kozaki wrote:

pacman -Qii shines in this field, though tongue

I don't know what you mean by this, but I suspect you'd benefit from sklimming expac's manpage.

Offline

#15 2015-08-10 22:53:18

CentaurFire
Member
Registered: 2015-08-10
Posts: 2

Re: [SOLVED] pacman show dependency list

pacman -Qii app_name

This will list Optional dependencies (along with other information but it's easy enough to scroll through)

Offline

#16 2015-08-10 23:13:49

jasonwryan
Anarchist
From: .nz
Registered: 2009-05-09
Posts: 30,424
Website

Re: [SOLVED] pacman show dependency list

Please don't necrobump; especially solved threads: https://wiki.archlinux.org/index.php/Fo … bumping.22


Closing


Arch + dwm   •   Mercurial repos  •   Surfraw

Registered Linux User #482438

Offline

Board footer

Powered by FluxBB