Giter Club home page Giter Club logo

Comments (6)

Anachron avatar Anachron commented on August 16, 2024

Comment:
This is to be used in combination with xbps-query --fulldeptree -Rx <pkgname>.

Now, you don't need to wonder any longer what the dependency chain is! ;-)

from xtools.

leahneukirchen avatar leahneukirchen commented on August 16, 2024

I think the tool is useful, not sure about the implementation however.

Perhaps the output of xbps-dgraph -f is more suitable to work on, perhaps even with gvpr(1).

from xtools.

Anachron avatar Anachron commented on August 16, 2024

Happy to hear!

This is an improved version by feranur:

#!/bin/sh
set -eu

tmp="`mktemp -d`"
trap 'rm -rf "$tmp"' EXIT
trap 'exit 98' INT TERM HUP ALRM PIPE QUIT # ensure the EXIT trap is triggered on signals

tree="${tmp}/tree"
store="${tmp}/store"

test $# -ge 1
mkdir "${tree}" "${store}"
cd "${tree}"

handle() {
    deps=$(xbps-query -Rx "${1}")
    for d in ${deps:-} ; do
        d=$(xbps-uhelper getpkgdepname "${d}" || xbps-uhelper getpkgname "$d")
        test -n "${d:-}" || exit 99
        if ! test -e "${store}/${d}"; then
            mkdir "${d}"
            ln -s "${PWD}/${d}" "${store}/${d}"
            ( cd "${d}"; handle "${d}"; )
        else
            ln -s "${store}/${d}" "${d}"
        fi
    done
}

handle "${1}"
if test -n "${2:-}" ; then
    find . -name "${2}" -printf '%d %P\n' | sort -n | sed -E 's/^[0-9]+ //'
else
    find . -mindepth 1 -printf '%P\n' | sort
fi

from xtools.

leahneukirchen avatar leahneukirchen commented on August 16, 2024

prototype:

xbps-dgraph mesa -f | gvpr '
  BEGIN {
    node_t stack[int];
    int depth = 0;

    void traverse(node_t n, edge_t e) {
      stack[depth++] = n;

      if (n.label == "ncurses-libs-6.4_2") {
        int i;
        for (i = 0; i < depth; i++) {
          printf("%s", stack[i].label);
          if (i < depth-1)
            printf(" -> ");
        }
        printf("\n");
      }

      e = fstout(n);
      while (e != NULL) {
        traverse(e.head, NULL);
        if (e == NULL)
          break;
        e = nxtout(e);
      }

      depth--;
    }
  }
  BEG_G {
    traverse(node($,"31"), NULL);
  }
'

from xtools.

Anachron avatar Anachron commented on August 16, 2024

Nice, that one is quite fast.

If you could now manage to show all dependencies in a tree I guess we can use that one instead of mine.

from xtools.

leahneukirchen avatar leahneukirchen commented on August 16, 2024

Here is one with one or two arguments: https://l2.re/gmGaDF

from xtools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.