Open RalfJung opened 4 years ago
Hm, it's weird, for any pinned package opam is supposed to have a cache of its latest sources at $OPAM_SWITCH_PREFIX/.opam-switch/sources/$PKGNAME
; these sources are indeed updated from upstream before install/reinstall/upgrade actions when the package is listed on the command-line, unless you specified --skip-update
.
For removals, however, these updates are never necessary, so indeed the option shouldn't do anything.
I only tested on 2.1.0~beta2, but here is what I get after removing a pinned package's upstream:
$ opam upgrade ocp-index
<><> Synchronising pinned packages ><><><><><><><><><><><><><><><><><><><><><><>
[ERROR] Could not synchronize $OPAM_SWITCH_PREFIX/.opam-switch/sources/ocp-index from "git+file:///tmp/ocp-index.x#master":
"/usr/bin/git fetch -q" exited with code 128
[ocp-index.1.2.1] fetching sources failed: git+file:///tmp/ocp-index.x#master
Already up-to-date.
Nothing to do.
$ opam upgrade ocp-index --skip
Already up-to-date.
Nothing to do.
$ opam remove ocp-index
The following actions will be performed:
⊘ remove ocp-browser 1.2.1* [uses ocp-index]
⊘ remove ocp-index 1.2.1*
===== ⊘ 2 =====
Do you want to continue? [Y/n] y
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
⊘ removed ocp-browser.1.2.1
⊘ removed ocp-index.1.2.1
Done.
So there is no issue with either upgrade --skip-updates
or remove
; with just upgrade
, the download fails, but the command can still continue (useful for reinstall
, for example). Of course, in your case it hangs rather than failing, which is more annoying...
NB: have you tried <enter>
or ctrl-d
when the downloading hangs ? We've had cases of downloads hanging that were actually silently waiting for input.
To conclude, at this point I don't know yet if this is fixed in 2.1 or if I just couldn't reproduce.
I have since worked around it by killing the hanging git-fetch-pack
(or so) process. Then opam just continued, warning me that deinstallation might use outdated information because the update failed.
Note that the deinstallation did update many things because this is a system switch and the system compiler changed, so any command will rebuild all the things. (I always struggle hard to make it only rebuild the parts I intend to keep, but found it very hard to combine "rebuild" and "upgrade" and "remove stuff I do not need any more" in a single command so usually I just give up on the "upgrade" part.) Maybe that is related?
Ah, it might be related, indeed... I'll see if I can reproduce with that extra information.
I always struggle hard to make it only rebuild the parts I intend to keep, but found it very hard to combine "rebuild" and "upgrade" and "remove stuff I do not need any more" in a single command so usually I just give up on the "upgrade" part.
Indeed, I don't think I have an easy solution at the moment, there is no compound install/remove or upgrade/remove command. We have been discussing a more generic install
command where you could specify a formula and conflicts, but nothing is planned at the moment.
Upgrading or not can be triggered using the solver criteria, though, maybe you could find a workaround with something like opam remove -a --criteria="-removed,-count[hidden-version,changed],-count[version-lag,solution],-count[missing-depexts,changed],-new"
("upgrade criteria" as extracted from `opam config report, they will differ for 2.0.7).
Maybe the most useful solution would be to add a flag that does something similar to remove -a
, but could be applied to install/reinstall/upgrade commands? opam upgrade --autoremove
?
Also note that you can do opam reinstall --forget-pending
, but then it will be you responsibility to reinstall everything properly, so hardly a manageable solution.
Maybe the most useful solution would be to add a flag that does something similar to remove -a, but could be applied to install/reinstall/upgrade commands? opam upgrade --autoremove ?
These are not usually autoinstalled packages that I want to get rid of.
What usually happens is that I want to update some library, and then realize the system switch needs rebuilding. (All my switches are system switches. Maybe that is the mistake.^^ But it keeps them smaller.) If I now just opam upgrade
it'll rebuild the old version of that library (the library in question is pinned as it is the build-dependency of what I use the switch for); if I just update the pin it'll rebuild some other library that I do not even need any more. These all take a few minutes each to build so that's quite annoying. So I want to uninstall all libraries, upgrade, and rely on the build-dependency-installation to pull them in any more. But I cannot upgrade and uninstall in one step so there are still pointless rebuilds...
Maybe the most useful solution would be to add a flag that does something similar to remove -a, but could be applied to install/reinstall/upgrade commands? opam upgrade --autoremove ?
These are not usually autoinstalled packages that I want to get rid of.
Ah, actually the opposite could do the trick then ? opam remove PKGS --upgrade-the-rest
That would be a shortcut for opam remove PKGS --criteria=<upgrade-criteria>
, where <upgrade-criteria>
can be extracted from opam config report
. Can you check if that works for you ?
opam remove PKGS --upgrade-the-rest
Yeah, something like that... though then I still need two transactions if I also want to install something.
aptitude install
also supports mixing in deinstallation with aptitude install package1+ package2-
(installs package1 and uninstalls package2). If opam install
and opam upgrade
supported something similar, that would be great:
opam upgrade -a package1+ package2-
.
I recommend reading man aptitude
for some further inspiration for useful flags to be used with install
.
That would be a shortcut for opam remove PKGS --criteria=
, where can be extracted from opam config report. Can you check if that works for you ?
I will try to remember looking this up the next time the problem comes up (aka the next time debian upgrades its ocaml). Thanks!
I have an opam package installed whose git URL is now dead.
opam uninstall coq-tlc
hangs forever, trying to download the latest sources:So I tried to add
--skip-updates
, but that does not help either, it still updates the package! Looks like it is impossible to uninstall or update this package, so I will have to delete the switch and start over again?