-
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?
Changes from all commits
612ff8c
b43c23e
fc6454e
adb134e
9805cd4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,10 +186,7 @@ end | |
content. Formerly, (<repo>/packages/.../descr, | ||
<repo>/compilers/.../<v>.descr) *) | ||
|
||
module DescrIO = struct | ||
|
||
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 commentThe 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. |
||
|
||
type t = string * string | ||
|
||
|
@@ -203,39 +200,13 @@ module DescrIO = struct | |
| "" -> x ^ "\n" | ||
| y -> String.concat "" [x; "\n\n"; y; "\n"] | ||
|
||
let of_channel _ ic = | ||
let x = | ||
try OpamStd.String.strip (input_line ic) | ||
with End_of_file | Sys_error _ -> "" in | ||
let y = | ||
try OpamStd.String.strip (OpamSystem.string_of_channel ic) | ||
with End_of_file | Sys_error _ -> "" | ||
in | ||
x, y | ||
|
||
let to_channel _ oc (x,y) = | ||
output_string oc x; | ||
output_char oc '\n'; | ||
if y <> "" then | ||
(output_char oc '\n'; | ||
output_string oc y; | ||
output_char oc '\n') | ||
|
||
let create str = | ||
let head, tail = | ||
match OpamStd.String.cut_at str '\n' with | ||
| None -> str, "" | ||
| Some (h,t) -> h, t in | ||
OpamStd.String.strip head, OpamStd.String.strip tail | ||
|
||
let of_string _ = create | ||
|
||
let to_string _ = full | ||
|
||
end | ||
module Descr = struct | ||
include DescrIO | ||
include MakeIO(DescrIO) | ||
end | ||
|
||
(* module Comp_descr = Descr *) | ||
|
@@ -3182,7 +3153,7 @@ module OPAMSyntax = struct | |
Pp.V.os_constraint; | ||
"descr", no_cleanup Pp.ppacc_opt with_descr OpamStd.Option.none | ||
(Pp.V.string_tr -| | ||
Pp.of_pair "descr" Descr.(of_string (), to_string ())); | ||
Pp.of_pair "descr" Descr.(create, full)); | ||
"extra-sources", no_cleanup Pp.ppacc_opt | ||
with_extra_sources OpamStd.Option.none | ||
(Pp.V.map_list ~depth:2 @@ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
type t | ||
|
||
val create: string -> t | ||
val empty : t | ||
|
||
(** Create an abstract description file from a string *) | ||
val of_string: t typed_file -> string -> t | ||
val create: string -> t | ||
|
||
(** Return the first line *) | ||
val synopsis: t -> string | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -362,13 +362,6 @@ module Switch: sig | |
$meta/overlay/$name.$version/opam_} *) | ||
val tmp_opam: t -> switch -> name -> OpamFile.OPAM.t OpamFile.t | ||
|
||
(** 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 | ||
|
||
Comment on lines
-365
to
-371
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
(** Files overlay *) | ||
val files: t -> switch -> name -> dirname | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,13 +41,6 @@ val packages: dirname -> string option -> package -> dirname | |
{i $repo/packages/XXX/$NAME.$VERSION/opam} *) | ||
val opam: dirname -> string option -> package -> OpamFile.OPAM.t OpamFile.t | ||
|
||
(** 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 | ||
|
||
Comment on lines
-44
to
-50
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 commentThe 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 commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 |
||
(** files {i $repo/packages/XXX/$NAME.$VERSION/files} *) | ||
val files: dirname -> string option -> package -> dirname | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1297,44 +1297,9 @@ let add_aux_files ?dir ?(files_subdir_hashes=false) opam = | |
match dir with | ||
| None -> opam | ||
| Some dir -> | ||
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 | ||
Comment on lines
-1300
to
-1305
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. descr & url reading & handling should be moved to |
||
let files_dir = | ||
OpamFilename.Op.(dir / "files") | ||
in | ||
let opam = | ||
match OpamFile.OPAM.url opam, try_read OpamFile.URL.read_opt url_file with | ||
| None, (Some url, None) -> OpamFile.OPAM.with_url url opam | ||
| Some opam_url, (Some url, errs) -> | ||
if url = opam_url && errs = None then | ||
log "Duplicate definition of url in '%s' and opam file" | ||
(OpamFile.to_string url_file) | ||
else | ||
OpamConsole.warning | ||
"File '%s' ignored (conflicting url already specified in the \ | ||
'opam' file)" | ||
(OpamFile.to_string url_file); | ||
opam | ||
| _, (_, Some err) -> | ||
OpamFile.OPAM.with_format_errors (err :: opam.format_errors) opam | ||
| _, (None, None) -> opam | ||
in | ||
let opam = | ||
match OpamFile.OPAM.descr opam, | ||
try_read OpamFile.Descr.read_opt descr_file with | ||
| None, (Some descr, None) -> OpamFile.OPAM.with_descr descr opam | ||
| Some _, (Some _, _) -> | ||
log "Duplicate descr in '%s' and opam file" | ||
(OpamFile.to_string descr_file); | ||
opam | ||
| _, (_, Some err) -> | ||
OpamFile.OPAM.with_format_errors (err :: opam.format_errors) opam | ||
| _, (None, None) -> opam | ||
in | ||
let opam = | ||
let extra_files = | ||
OpamFilename.opt_dir files_dir >>| fun dir -> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -331,12 +331,7 @@ let pinned_package st ?version ?(autolock=false) ?(working_dir=false) name = | |
let save_overlay opam = | ||
OpamFilename.mkdir overlay_dir; | ||
let opam_file = OpamPath.Switch.Overlay.opam root st.switch name in | ||
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); | ||
]); | ||
Comment on lines
-334
to
-339
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Note to myself:
|
||
OpamFilename.remove (OpamFile.filename opam_file); | ||
let files_dir = OpamPath.Switch.Overlay.files root st.switch name in | ||
OpamFilename.rmdir files_dir; | ||
let 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
.