unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nils Gillmann <ng0@n0.is>
To: "Björn Höfling" <bjoern.hoefling@bjoernhoefling.de>
Cc: guix-devel <guix-devel@gnu.org>
Subject: Re: Extracting a reachability path out of a (package) DAG
Date: Tue, 17 Jul 2018 08:24:24 +0000	[thread overview]
Message-ID: <20180717082424.qbvf4cv7omirkp2r@abyayala> (raw)
In-Reply-To: <20180717101033.113807d5@alma-ubu>

Björn Höfling transcribed 74K bytes:
> Hi Guix,
> 
> we have this nice `guix graph` tool which outputs DAGs of the packages
> (or even derivations,bags, ...). This is cool if you look at simple
> packages like the "hello" package with little to no dependencies. If
> you look at "real" packages like qt or maven the information is just
> overwhelming and you are scrolling around the image for just getting a
> headache. 
> 
> Often the only think I want to know is something like: Why is "goodbye"
> a dependency of "hello"?
> 
> To answer this, I want to extract from hello's package graph the path
> (more precisely: the sub-DAG) leading from the root "hello" to the
> target node (or even nodes) "goodbye".
> 
> After several attempts and failures, I wrote a script for gvpr from
> the GraphViz suite that does the job.
> 
> Example 1: In bug #30710 Hartmut Goebel asked why qt depends on two
> different autoconf-wrapper packages. To answer that, you can find out
> the two node names from the .dot file and then call:
> 
> gvpr -f markpath.g -a "ex 64168128 64167936" < qt-thing/qt.package.dot
> >qt-acw.dot
> 
> This extracts (ex) the path (sub-DAG) to the two seed nodes and outputs
> it in a new graph. This result is quite compact with only 12 nodes (attached).
> 
> Example 2: How/Why is glib a dependency of maven? The extracted graph
> has about 50 nodes, so I don't attach it here. You will see that
> java-logback-classic depends on a groovy-cluster that finally mounts
> into antlr. That depends on a gtk/pango/cairo-cluster that finally
> sinks into glib.
> 
> Hope that is useful to someone else,
> 
> Björn
> 
> 

To add to this idea:
abyayala$ nix why-depends --help
Usage: nix why-depends <FLAGS>... <PACKAGE> <DEPENDENCY>

Summary: show why a package has another package in its closure.

Flags:
  -a, --all                     show all edges in the dependency graph leading from 'package' to 'dependency', rather than just a shortest path
  --arg <NAME> <EXPR>       argument to be passed to Nix functions
  --argstr <NAME> <STRING>  string-valued argument to be passed to Nix functions
  -f, --file <FILE>             evaluate FILE rather than the default
  -I, --include <PATH>          add a path to the list of locations used to look up <...> file names

Examples:

  To show one path through the dependency graph leading from Hello to Glibc:
    $ nix why-depends nixpkgs.hello nixpkgs.glibc

  To show all files and paths in the dependency graph leading from Thunderbird to libX11:
    $ nix why-depends --all nixpkgs.thunderbird nixpkgs.xorg.libX11

  To show why Glibc depends on itself:
    $ nix why-depends nixpkgs.glibc nixpkgs.glibc

Note: this program is EXPERIMENTAL and subject to change.



Would it be useful to have a guix package subcommand which replicates this?

  parent reply	other threads:[~2018-07-17  8:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-17  8:10 Extracting a reachability path out of a (package) DAG Björn Höfling
2018-07-17  8:22 ` Pierre Neidhardt
2018-07-17 10:29   ` Björn Höfling
2018-07-17  8:24 ` Nils Gillmann [this message]
2018-07-17 10:32   ` Björn Höfling
2018-07-17 15:09     ` Gábor Boskovits
2018-07-21 21:55       ` Pierre Neidhardt
2018-07-22 18:53         ` Alex Kost
2018-07-22 18:59           ` Pierre Neidhardt
2018-07-22 19:18             ` Björn Höfling
2018-07-23 13:09 ` Ludovic Courtès
2018-08-04  3:54 ` Chris Marusich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180717082424.qbvf4cv7omirkp2r@abyayala \
    --to=ng0@n0.is \
    --cc=bjoern.hoefling@bjoernhoefling.de \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).