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

Remove dealing with descr and url files #6253

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

hannesm
Copy link
Member

@hannesm hannesm commented Oct 21, 2024

They have been deprecated since quite some time. I suspect this PR could go further, and remove the OpamFile.DescrIO module - but I failed to understand what to replace it with.

Please let me know whether this direction is the right one. I'm especially unsure whether there need to be more guards checking that url / descr do not exist.

OpamAdminRepoUpgrade: deal locally with descr/url files

OpamAdminCommand: adapt checks whether url is present, and whether the opam file version is good
Copy link
Member

@kit-ty-kate kit-ty-kate left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a couple of suggestions for the code first.
I'll do a proper review later.

src/client/opamAdminRepoUpgrade.ml Outdated Show resolved Hide resolved
src/client/opamAdminCommand.ml Outdated Show resolved Hide resolved
@hannesm
Copy link
Member Author

hannesm commented Oct 21, 2024

there's quite some tests that fail now... I'm not sure whether this is related (likely it is) -- but also not sure whether updating the tests is preferred, or whether some bits of the code should be re-instantiated?

@rjbou rjbou self-requested a review October 28, 2024 14:06
@rjbou rjbou added this to the 2.4.0~alpha1 milestone Oct 28, 2024
Comment on lines -44 to -50
(** Return the description file for a given package:
{i $repo/packages/XXX/$NAME.VERSION/descr} *)
val descr: dirname -> string option -> package -> OpamFile.Descr.t OpamFile.t

(** urls {i $repo/package/XXX/$NAME.$VERSION/url} *)
val url: dirname -> string option -> package -> OpamFile.URL.t OpamFile.t

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still need them for upgrade functions. We can mark them as deprecated for use in external libraries, but opam lib need to keep for backward compatibility ftm.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if we simply stopped supporting opam 1.x instead? 6 and a half years seems like a reasonable time for people to upgrade from a deprecated format

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, we should remove all 1.2 upgrade code, not only a part.
6 years to upgrade is a reasonable time indeed, but if the code do not require maintenance, why do we need to remove it?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it does not require maintenance per say but it holds us back from doing this type of change for example, which we could also call as some kind of maintenance burden

Comment on lines -334 to -339
List.iter OpamFilename.remove
OpamPath.Switch.Overlay.([
OpamFile.filename opam_file;
OpamFile.filename (url root st.switch name);
OpamFile.filename (descr root st.switch name);
]);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to myself:

  • check that it is handled in switch upgrade function

Comment on lines -1300 to -1305
let (url_file: OpamFile.URL.t OpamFile.t) =
OpamFile.make (dir // "url")
in
let (descr_file: OpamFile.Descr.t OpamFile.t) =
OpamFile.make (dir // "descr")
in
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

descr & url reading & handling should be moved to OpamFormatUpgrade.opam_file or OpamFormatUpgrade.opam_file_from_1_2_to_2_0

Comment on lines -365 to -371
(** URL overlay: {i
$meta/overlay/$name.$version/url} *)
val url: t -> switch -> name -> OpamFile.URL.t OpamFile.t

(** Descr orverlay *)
val descr: t -> switch -> name -> OpamFile.Descr.t OpamFile.t

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we still need them for upgrade functions. We can mark them as deprecated for use in external libraries, but opam lib need to keep for backward compatibility ftm.


let internal = "descr"
let format_version = OpamVersion.of_string "0"
module Descr = struct
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The module can be moved in the bottom of the section; It also need a comment that it is deprecated and used only for compat.

@@ -298,12 +298,11 @@ end
(** Package descriptions: [$opam/descr/] *)
module Descr: sig

include IO_FILE
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IO_FILE functions are still used, why remove the module inclusion?

(OpamRepositoryPath.url repo_root prefix nv));
true)
else has_error
check_opam_file_version_url has_error repo_root prefix nv opam
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this command supposed to work only on 2.0 repos ? if yes, there is no need to handle url files. It is sufficient to have a check at the beginning and fail with a hint to opam admin upgrade.

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

Successfully merging this pull request may close these issues.

3 participants