[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: finding a dependency chain



On Thu, 4 Sep 2014, davidson@ling.ohio-state.edu wrote:

On Wed, 3 Sep 2014, Rob Owens wrote:

----- Original Message -----
From: "Kelly Clowers" <kelly.clowers@gmail.com>

On Tue, Sep 2, 2014 at 1:44 PM, Rob Owens <rowens@ptd.net> wrote:
I'm trying to figure out, for example, what causes brasero to
ultimately depend on systemd.  I found a utility called debtree,
but it produces too much output to be of use to me -- it shows all
dependency chains starting at brasero, but I am only interested in
the one that ends at systemd.

Can anybody suggest another utility, or maybe the proper syntax to
make debtree do what I want?

Thanks

-Rob

I just used vim to search through debtree's .dot output (for such a
complex thing, way easier than trying to look at the image file),
and then followed up by looking around in aptitude interactive
mode.
Thanks.  That is much easier than looking at the image file!

I'd still like to find a method to specify the start point and end
point, and get output of a single dependency chain.  If anybody
knows a way, please post it.

seems like this pipeline

$ apt-cache --recurse -i depends brasero |tac

yields the elements in question, and in a convenient order (children
before parents), but with a whole bunch of irrelevance interleaved.

piping it to something like the following clears away the irrelevant
parts:

note the careful choice of words above: "*something like*"


$ cat above_kludge
#!/bin/bash

pattrn=$1

while read line
do if [[ $line =~ ^${pattrn}$ ]]                  # Found node C.
    then echo $line                               # Admit node C to output.
        pattrn=$line                              # Ground the pattern.
    else if [[ $line =~ [[:blank:]]${pattrn}$ ]]  # Found node C listed
                                                  # above its parent.
    then pattrn='[[:alnum:][:punct:]]*'           # Seek the parent.
    fi
    fi
done

did some more tests this morning.  ouch.  above kludge has problems.

version below works better:

  #!/bin/bash

  seek_parent=1
  pattrn=$1

  while IFS='' read line
  do
      if [[ $seek_parent -eq 1 ]] && [[ $line =~ ^${pattrn}$ ]]
      then
          echo "$line"
          pattrn=$line
          seek_parent=0
      elif [[ $seek_parent -eq 0 ]] && [[ $line =~ [[:space:]]${pattrn}$ ]]
      then
          pattrn=[[:alnum:][:punct:]]+
          seek_parent=1
      fi
  done

so, like this:

$ apt-cache --recurse -i depends brasero |tac |above_kludge '.*systemd.*'

er, no.  that won't work in general.  for better results, replace '.'
on the line above with '[[:alnum:][:punct:]]'.

so, more like this:

  $ apt-cache --recurse -i depends brasero |tac |\
    above_kludge '[[:alnum:][:punct:]]*systemd[[:alnum:][:punct:]]*'

-wes

libsystemd-login0
dbus
udisks
libgdu0
gvfs-daemons
gvfs
brasero

while in general there might be multiple paths, above kludge will find
just one of them.

-wes





Reply to: