Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

opam recompiles unchanged package on upgrade #5814

Open
Khady opened this issue Jan 31, 2024 · 6 comments · May be fixed by #5907
Open

opam recompiles unchanged package on upgrade #5814

Khady opened this issue Jan 31, 2024 · 6 comments · May be fixed by #5907

Comments

@Khady
Copy link
Contributor

Khady commented Jan 31, 2024

We have been seeing a weird behavior of opam, both in CI and on dev machines, where a package that hasn't seen a change in months gets recompiled once in a while by opam. It is hard to investigate, we don't see much in opam logs, even when increasing the verbosity. And we can't systematically reproduce.

The message we get looks like this. Here it is on opam upgrade --fixup but I believe that it happens on basic opam upgrade too.

[06:14:31 #] opam upgrade --fixup
The following actions will be performed:
  ↻ recompile ocurl                           20231103+git
          [upstream or system changes]

The package definition is like this

opam-version: "2.0"
name: "ocurl"
maintainer: "ygrek@autistici.org"
homepage: "https://ygrek.org/p/ocurl"
license: "MIT"
authors: [ "Lars Nilsson" "ygrek" ]
dev-repo: "git+https://github.com/ygrek/ocurl.git"
bug-reports: "https://github.com/ygrek/ocurl/issues"
build: [
]
depends: [
  "curl" {= version}
]
synopsis: "Transitional dummy package: ocurl -> curl"
description: "Use `opam install curl`"

Our repository is a local repo (with the file:/// prefix).

It happens at least with opam 2.2.0~alpha3 and 2.1.2.

This is one of the reasons behind our request for #5776.

@kit-ty-kate
Copy link
Member

How often does this happen? Is it linked to a call to opam update?

@Khady
Copy link
Contributor Author

Khady commented Jan 31, 2024

We see it every day. But we runs thousands of builds per day. So it might be something uncommon which appears at scale. I don’t have the exact frequency at which it is triggered.

yes we always run opam update before to run those opam upgrade. I’m not aware of opam upgrade having this behaviour without an update before hand. That could be the case, but it’s not something that we do.

@kit-ty-kate
Copy link
Member

and on dev machines

Is this on a bare metal file system or in docker? There is a known issue with timestamps in docker and it might be that

@Khady
Copy link
Contributor Author

Khady commented Feb 5, 2024

Bare file system.

@ygrek might have a reproduction. There is a suspicion that it happens because of the absence of a build section.

@kit-ty-kate
Copy link
Member

We managed to debug this. The culprit was the name field which is not defined in the <switch>/.opam-switch/packages/ocurl.20231103+git but is defined in the original opam file, thus the OpamFile.OPAM.effectively_equal function detects it is different.

I'll have a look at fixing that soon.

@kit-ty-kate kit-ty-kate linked a pull request Apr 5, 2024 that will close this issue
2 tasks
@kit-ty-kate
Copy link
Member

kit-ty-kate commented Apr 5, 2024

I opened #5907 which should fix this issue for good.

In the meantime the easy fix on your side is to simply remove the name and version fields from the opam files in your repository

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants