Something went wrong. Try again.
Odoc docs forked from jon.recoil.org/odd
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283Dependency ordering is computed from the opam files of installed packages,under <prefix>/.opam-switch/packages/<name>.<version>/opam.
$ mkpkg() { mkdir -p "prefix/.opam-switch/packages/$1.$2"; cat > "prefix/.opam-switch/packages/$1.$2/opam"; } $ mkpkg a 1 <<EOF > opam-version: "2.0" > EOF $ mkpkg b 1 <<EOF > opam-version: "2.0" > depends: [ "a" {>= "1"} ] > EOF $ mkpkg c 2 <<EOF > opam-version: "2.0" > depends: [ "b" "a" ] > EOF
Dependencies come before dependents, whatever order the names are given in:
$ odd order --prefix prefix c b a a b c $ odd order --prefix prefix a c a c
With no arguments, every installed package is ordered:
$ odd order --prefix prefix a b c
Names that are not installed are ignored, as sync ignores them (they areremovals, not builds):
$ odd order --prefix prefix c nosuchpkg a a c
Dependencies marked {post} are excluded: they may legitimately be circularand do not constrain build order. Here x depends on y, and y post-dependson x; without the exclusion this would be a cycle.
$ mkpkg x 1 <<EOF > opam-version: "2.0" > depends: [ "y" ] > EOF $ mkpkg y 1 <<EOF > opam-version: "2.0" > depends: [ "x" {post} ] > EOF $ odd order --prefix prefix x y y x
Optional dependencies (depopts) are included — an installed depoptinfluenced the build, hence the docs. z has no hard deps but depopts on c:
$ mkpkg z 1 <<EOF > opam-version: "2.0" > depopts: [ "c" ] > EOF $ odd order --prefix prefix z c b b c z
A genuine dependency cycle is reported and broken rather than fatal:
$ mkpkg p 1 <<EOF > opam-version: "2.0" > depends: [ "q" ] > EOF $ mkpkg q 1 <<EOF > opam-version: "2.0" > depends: [ "p" ] > EOF $ odd order --prefix prefix p q q p warning: dependency cycle through p; breaking it