File: sort-by-deps.sh

package info (click to toggle)
coq 9.1.0%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 35,968 kB
  • sloc: ml: 239,908; sh: 4,355; python: 2,985; ansic: 2,644; makefile: 874; lisp: 171; javascript: 63; xml: 24; sed: 2
file content (15 lines) | stat: -rwxr-xr-x 629 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/usr/bin/bash

program_name="$0"
program_path=$(readlink -f "${program_name%/*}")

# We add || true (which may not be needed without set -e) to be
# explicit about the fact that this script does not fail even if `opam
# install --show-actions` does, e.g., because of a non-existent
# package
#
# TODO: Figure out how to use the OPAM API
# (https://opam.ocaml.org/doc/api/) to call this from OCaml.
for i in "$@"; do
    echo -n "$i:"; ((echo -n "$(opam install --show-actions "$i" | grep -o '∗\s*install\s*[^ ]*' | sed 's/∗\s*install\s*//g')" | tr '\n' ',') || true); echo
done | xargs ocaml "${program_path}/sort-by-deps"