-
Notifications
You must be signed in to change notification settings - Fork 371
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
base: master
Are you sure you want to change the base?
Conversation
OpamAdminRepoUpgrade: deal locally with descr/url files OpamAdminCommand: adapt checks whether url is present, and whether the opam file version is good
There was a problem hiding this 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.
Co-authored-by: Kate <[email protected]>
d304842
to
fc6454e
Compare
6d2e879
to
abe2fc4
Compare
abe2fc4
to
adb134e
Compare
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? |
(** 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 | ||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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); | ||
]); |
There was a problem hiding this comment.
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
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 |
There was a problem hiding this comment.
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
(** 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 | ||
|
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
.
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.