Skip to content

opam install . --deps-only does nothing when a package of the same name and version is already installed but not pinned #6501

@kit-ty-kate

Description

@kit-ty-kate

This is yet another bug similar to #5567 and all the similar issues, and was supposed to be fixed by #6209 as part of 2.4.0~alpha1:
However it seems that there are still some edge-cases and we forgot to test for them:

$ opam install -t --deps .
$ cat *.opam
opam-version: "2.0"
version: "3.0.0~alpha1"
maintainer: "Hannes Mehnert <hannes@mehnert.org>"
authors: [
  "Hannes Mehnert <hannes@mehnert.org>"
  "Kate <kit-ty-kate@outlook.com>"
]
homepage: "https://github.com/hannesm/patch"
doc: "https://hannesm.github.io/patch/"
dev-repo: "git+https://github.com/hannesm/patch.git"
bug-reports: "https://github.com/hannesm/patch/issues"
license: "ISC"

depends: [
  "ocaml" {>= "4.08"}
  "dune" {>= "3.0"}
  "alcotest" {with-test & >= "1.7.0"}
  "crowbar" {with-test}
]
build: [
  ["dune" "subst"] {dev}
  ["dune" "build" "-p" name "-j" jobs]
  ["dune" "runtest" "-p" name "-j" jobs] {with-test}
]
synopsis: "Patch library purely in OCaml"
description: """
This is a library which parses unified diff and git diff output, and can
apply a patch in memory.
"""
x-maintenance-intent: [ "(latest)" ]
$ opam install alcotest
The following actions will be performed:
=== recompile 2 packages
  ↻ lambda-term        3.3.2  [uses logs]
  ↻ logs               0.8.0  [uses fmt]
=== install 4 packages
  ∗ alcotest           1.9.0
  ∗ astring            0.8.5  [required by alcotest]
  ∗ fmt                0.10.0 [required by alcotest]
  ∗ ocaml-syntax-shims 1.0.0  [required by alcotest]

Proceed with ↻ 2 recompilations and ∗ 4 installations? [Y/n] n
$ opam list | grep patch
patch                3.0.0~alpha1 Patch library purely in OCaml
$ vim patch.opam
$ opam install -t --deps .
The following actions will be performed:
=== remove 1 package
  ⊘ patch              3.0.0~alpha1 [no longer available]
=== recompile 2 packages
  ↻ lambda-term        3.3.2        [uses logs]
  ↻ logs               0.8.0        [uses fmt]
=== install 6 packages
  ∗ afl-persistent     1.4          [required by crowbar]
  ∗ alcotest           1.9.0        [required by patch]
  ∗ astring            0.8.5        [required by alcotest]
  ∗ crowbar            0.2.1        [required by patch]
  ∗ fmt                0.10.0       [required by alcotest]
  ∗ ocaml-syntax-shims 1.0.0        [required by alcotest]

Proceed with ⊘ 1 removal, ↻ 2 recompilations and ∗ 6 installations? [Y/n] n
$ opam pin | grep patch
$ opam show -fversion .
3.0.0~alpha2

In this example, the package patch is already installed (from opam-repository) and opam install --deps-only -t . seems to try and fetch patch.3.0.0~alpha1, realize it's already installed and doesn't do anything like if opam install patch.3.0.0~alpha1 --deps -t was called (although i would argue that this command should do something given the --deps at the very least, if not for the -t but that's related to #4514)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions