Skip to content

Remove dealing with descr and url files - #6253

Draft
hannesm wants to merge 5 commits into
ocaml:masterfrom
hannesm:remove-descr-url
Draft

Remove dealing with descr and url files#6253
hannesm wants to merge 5 commits into
ocaml:masterfrom
hannesm:remove-descr-url

Conversation

@hannesm

@hannesm hannesm commented Oct 21, 2024

Copy link
Copy Markdown
Member

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.

Fixes #5086
Queued on #6827

OpamAdminRepoUpgrade: deal locally with descr/url files

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

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

Copy link
Copy Markdown
Member

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.

Comment thread src/client/opamAdminRepoUpgrade.ml Outdated
Comment thread src/client/opamAdminCommand.ml Outdated
Co-authored-by: Kate <kit-ty-kate@outlook.com>
@hannesm

hannesm commented Oct 21, 2024

Copy link
Copy Markdown
Member Author

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 thread src/state/opamUpdate.ml
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
Copy Markdown
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
Copy Markdown
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 thread src/format/opamPath.mli
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
Copy Markdown
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.

Comment thread src/format/opamFile.ml

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

Copy link
Copy Markdown
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.

Comment thread src/format/opamFile.mli
(** Package descriptions: [$opam/descr/] *)
module Descr: sig

include IO_FILE

Copy link
Copy Markdown
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
Copy Markdown
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.

@kit-ty-kate

Copy link
Copy Markdown
Member

ref #6827

@kit-ty-kate kit-ty-kate added the PR: QUEUED Pending pull request, waiting for other work to be merged or closed label Dec 8, 2025
@kit-ty-kate
kit-ty-kate marked this pull request as draft December 8, 2025 16:33
@kit-ty-kate kit-ty-kate modified the milestones: 2.6.0~alpha1, 2.7.0~alpha1 Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AREA: API AREA: FORMAT PR: QUEUED Pending pull request, waiting for other work to be merged or closed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecated descr file handling

3 participants