| •1 |
#!/usr/bin/bashscip-shell filesystem . . `/usr/bin/bash`. |
| 2 |
|
| 3 |
program_name="$0" |
| 4 |
program_path=$(readlinkscip-shell system . . readlink. -f "${program_name%/*}") |
| 5 |
|
| 6 |
# We add || true (which may not be needed without set -e) to be |
| 7 |
# explicit about the fact that this script does not fail even if `opam |
| 8 |
# install --show-actions` does, e.g., because of a non-existent |
| 9 |
# package |
| 10 |
# |
| 11 |
# TODO: Figure out how to use the OPAM API |
| 12 |
# (https://opam.ocaml.org/doc/api/) to call this from OCaml. |
| 13 |
for i in "$@"; do |
| 14 |
echoscip-shell system . . echo. -n "$i:"; ((echoscip-shell system . . echo. -n "$(opam install --show-actions "$i" | grepscip-shell system . . grep. -o '∗\s*install\s*[^ ]*' | sedscip-shell system . . sed. 's/∗\s*install\s*//g')" | trscip-shell system . . tr. '\n' ',') || truescip-shell system . . true.); echoscip-shell system . . echo. |
| 15 |
done | xargsscip-shell system . . xargs. ocaml "${program_path}/sort-by-deps" |