Commit d4f830d7 authored by Ralf Jung's avatar Ralf Jung

improve 'package already pinned' check

parent 1763e08e
Pipeline #4732 failed with stage
in 2 minutes and 31 seconds
......@@ -51,10 +51,11 @@ while (( "$#" )); do # while there are arguments left
VERSION="$1" ; shift
# Check if the pin is already set
if opam pin list | fgrep "$PACKAGE.$VERSION " > /dev/null; then
echo "[opam-ci] $PACKAGE already pinned to $VERSION"
PIN=$(opam pin list | egrep "^$PACKAGE\.")
if [[ "$(echo "$PIN" | cut -d ' ' -f 2)" == "$KIND" && "$(echo "$PIN" | cut -d ' ' -f 3)" == "$VERSION" ]]; then
echo "[opam-ci] $PACKAGE already $KIND-pinned to $VERSION"
else
echo "[opam-ci] Pinning $PACKAGE to $VERSION"
echo "[opam-ci] $KIND-pinning $PACKAGE to $VERSION"
run_and_print opam pin add -y -k "$KIND" "$PACKAGE" "$VERSION"
fi
done
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment