Skip to content

Commit

Permalink
Generate <pkg>.install in project and warn if it exists in tarball
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris00 committed May 3, 2016
1 parent 15fa9dd commit 8c1ab0e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
File renamed without changes.
13 changes: 7 additions & 6 deletions src/Install.ml
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,12 @@ let write_datas ppf datas =
let with_install t ?warn:(want_warn=true) ~local f =
let pkg = Tarball.oasis t in
let fname = pkg.name ^ ".install" in
let dir = Filename.concat (Tarball.pkg_opam_dir t) "files" in
let full_fname = Filename.concat dir fname in
if local then (
(* In local mode, the goal is to generate the opam files in
the repository itself. *)
if Sys.file_exists full_fname then
warn(sprintf "A file %S was found. Please remove it." full_fname);
(* In local mode, generate the opam files in the repository itself. *)
info(sprintf "Create %S." fname);
let fh = open_out fname in
let ppf = Format.formatter_of_out_channel fh in
Expand All @@ -160,8 +163,6 @@ let with_install t ?warn:(want_warn=true) ~local f =
content differs from the generated one. Make sure \
it is compatible with:\n%s" fname contents)
| None ->
let dir = Filename.concat (Tarball.pkg_opam_dir t) "files" in
let full_fname = Filename.concat dir fname in
if want_warn then
warn(sprintf "No %s file was found at the root of the tarball, \
so creating %s. Its is recommended to add \
Expand Down Expand Up @@ -206,8 +207,8 @@ let remove_script = "_oasis_remove_.ml"
(** Write an .install file to save oasis setup.* in order to be able
to also use oasis for removal. Never put these files in the
repository itself because they are a hack. *)
let oasis t =
with_install t ~local:false ~warn:false
let oasis t ~local =
with_install t ~local ~warn:true
(fun ppf ->
fprintf ppf "@[<2>etc: [@\n\
\"setup.ml\"@\n\
Expand Down
2 changes: 1 addition & 1 deletion src/oasis2opam.ml
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ let () =
opam_opam t flags opam_file_version ~local:!local ~remove_with_oasis;
opam_findlib t flags;
if remove_with_oasis then
Install.oasis t
Install.oasis t ~local:!local
else
Install.opam t flags ~local:!local;
info (sprintf "OPAM directory %S created." dir)

0 comments on commit 8c1ab0e

Please sign in to comment.