You are not logged in.
Pages: 1
Topic closed
How can I make pacman show all dependencies of some package?
Last edited by silenc3r (2010-05-21 20:00:12)
Offline
By checking man pacman.
Offline
Or finding "show dependencies" here.
Offline
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
Maybe not a very graceful solution, but still working
pacman -Qi pidgin|grep <STRING_THAT_MEANS_"DEPENDS_ON"_IN_YOUR_NATIVE_LANGUAGE>|cut -d: -f2
Offline
thanks a lot hidefromkgb, that is exactly what I was looking for
Offline
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
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
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.
Offline
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
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
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 ) #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
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
Thank you for the update falconindy
Now I can use expac in case of conflicting update.
pacman -Qii shines in this field, though
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 ) #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
pacman -Qii app_name
This will list Optional dependencies (along with other information but it's easy enough to scroll through)
Offline
Please don't necrobump; especially solved threads: https://wiki.archlinux.org/index.php/Fo … bumping.22
Closing
Offline
Pages: 1
Topic closed