You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cc @mseri I think there is definitively a feature that would save some time to users:
the ability to search automatically for the lower (or upper) bound version constraint of a given dependency of a given package.
I.e. in my current opam switch (i.e. for some fixed OCaml version), I might want to know the version constraints of one (or maybe all) of the dependencies of a given package (which might be pinned to its development version).
I think being able to search automatically for the lower bound might be useful for opam package maintainers.
Maybe, for several dependencies of one package, the search can be done in parallel.
Regards,
F.
The text was updated successfully, but these errors were encountered:
It's possibly doable with some existing commands, e.g. opam list dependency --coinstallable-with package.version --all-versions will give the list all versions of dependency of package.version which can be installed and the bounds could be extracted from that (and then repeat over the existing dependencies).
It's not (yet) totally clear what the feature looks like - is there some more context we could see?
#!/bin/bash
set -e
result=()
add() {
local i=0
local isset=false
for line in "${result[@]}" ; do
local name=$(echo "$line" | cut '-d ' -f1)
if test "$name" = "$1" ; then
result[$i]="$line $2"
isset=true
fi
i=$(($i + 1))
done
if test "$isset" = "false" ; then
result+=("$1 $2")
fi
}
deps=$(opam list --required-by "$1" --all-versions -s)
last=
lastv=
for pkg in $deps ; do
name=$(echo "$pkg" | cut -d. -f1)
version=$(echo "$pkg" | cut -d. -f2-)
if test "$name" != "$last" ; then
if test "$last" != "" ; then
add "$last" "$lastv"
fi
add "$name" "$version"
fi
last=$name
lastv=$version
done
if test "$last" != "" ; then
add "$last" "$lastv"
fi
for line in "${result[@]}" ; do
name=$(echo "$line" | cut '-d ' -f1)
lower=$(echo "$line" | cut '-d ' -f2)
upper=$(echo "$line" | cut '-d ' -f3)
if test "$lower" = "$upper" ; then
constraint="{= \"$lower\"}"
else
constraint="{>= \"$lower\" & <= \"$upper\"}"
fi
echo "\"$name\" $constraint"
done
@dra27 the context is just you want to add a new version (or a new opam package) in opam-repository.
To do so nowadays, you need to specify at least a lower-bound version for all (or at least several) of those dependencies. @kate I will give it a try. Maybe such script should be hosted somewhere under version control.
Hello,
Cc @mseri I think there is definitively a feature that would save some time to users:
I.e. in my current opam switch (i.e. for some fixed OCaml version), I might want to know the version constraints of one (or maybe all) of the dependencies of a given package (which might be pinned to its development version).
I think being able to search automatically for the lower bound might be useful for opam package maintainers.
Maybe, for several dependencies of one package, the search can be done in parallel.
Regards,
F.
The text was updated successfully, but these errors were encountered: