You are not logged in.

#1 2011-07-09 02:14:15

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

viewing dependency tree for non-installed packages [SOLVED]

Pactree only seems to work for installed packages so I was wondering if there was any alternative that could work with any package (installed or not).

Last edited by anonymous_user (2011-07-09 14:46:05)

Offline

#2 2011-07-09 08:49:19

Lars Stokholm
Member
From: Denmark
Registered: 2009-03-17
Posts: 223

Re: viewing dependency tree for non-installed packages [SOLVED]

Well it's not as fast as pactree but I hacked this together for you:

#!/bin/bash

pactree () {
  echo "$2|--$1" | cut -c4-
  for dep in $(pacman -Si $1 2>/dev/null | awk -F':' '/Depends On/ { print $2 }')
  do
    dep=$(echo $dep | egrep -o "^[a-z0-9._-]+")
    [[ -n $dep ]] && pactree $dep "$2|  "
  done
}

pactree $1 ""

Perhaps you should replace the occurences of "pactree" with something else. smile

Edit: Prettier output.

Last edited by Lars Stokholm (2011-07-09 09:22:52)

Offline

#3 2011-07-09 08:51:26

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

Re: viewing dependency tree for non-installed packages [SOLVED]

https://bbs.archlinux.org/viewtopic.php … 67#p904267
God, I need some coffee. This finds the reverse dependencies.

You need to change %N to %E like so

for pkg in $(expac -S '%E' $1); do

to find dependencies.

Last edited by karol (2011-07-09 09:10:20)

Offline

#4 2011-07-09 14:45:51

anonymous_user
Member
Registered: 2009-08-28
Posts: 3,059

Re: viewing dependency tree for non-installed packages [SOLVED]

Thank you both smile

Offline

Board footer

Powered by FluxBB