File: sort-by-deps.sh

package info (click to toggle)
coq 8.16.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 40,596 kB
  • sloc: ml: 219,376; sh: 3,545; python: 3,231; ansic: 2,529; makefile: 767; lisp: 279; javascript: 63; xml: 24; sed: 2
file content (15 lines) | stat: -rwxr-xr-x 625 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#!/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"