This is an automated email from the git hooks/post-receive script. infinity0 pushed a commit to branch master in repository findlib.
commit 6e0167f9fb5d8270dfdc5f7791c1bd06e284a362 Author: Ximin Luo <infini...@debian.org> Date: Thu Jul 6 22:08:55 2017 +0200 New upstream version 1.7.3 --- Makefile | 4 +- configure | 26 +++++- doc/README | 10 +++ doc/README.xml | 17 ++++ src/findlib/META.in | 27 ++++-- src/findlib/Makefile | 12 +-- src/findlib/frontend.ml | 217 ++++++++++++++++++++++++++++-------------------- 7 files changed, 209 insertions(+), 104 deletions(-) diff --git a/Makefile b/Makefile index e2b46c2..221af08 100644 --- a/Makefile +++ b/Makefile @@ -22,7 +22,7 @@ install: $(MAKE) install-config for p in $(PARTS); do ( cd src/$$p; $(MAKE) install ); done $(MAKE) install-meta - cd src/findlib; $(MAKE) install-num-top + test -z "$(NUMTOP)" || { cd src/findlib; $(MAKE) install-num-top; } if [ $(INSTALL_CAMLP4) -eq 1 ]; then \ cp tools/safe_camlp4 "$(prefix)$(OCAMLFIND_BIN)"; \ fi @@ -55,7 +55,7 @@ findlib.conf: findlib.conf.in USE_CYGPATH="$(USE_CYGPATH)"; \ export USE_CYGPATH; \ cat findlib.conf.in | \ - tools/patch '@SITELIB@' '$(OCAML_SITELIB)' >findlib.conf + $(SH) tools/patch '@SITELIB@' '$(OCAML_SITELIB)' >findlib.conf if ./tools/cmd_from_same_dir ocamlc; then \ echo 'ocamlc="ocamlc.opt"' >>findlib.conf; \ fi diff --git a/configure b/configure index c43f584..6a4a558 100755 --- a/configure +++ b/configure @@ -7,7 +7,7 @@ #set -x -version="1.7.1" +version="1.7.3" # Remember the old IFS value: oldifs="$IFS" @@ -119,6 +119,7 @@ with_topfind=1 with_camlp4=1 custom=-custom system="" +sh="" while [ "$#" != "0" ]; do case "$1" in @@ -246,6 +247,13 @@ case "$system" in esac ###################################################################### +# check for presence of /bin/sh + +if [ ! -f /bin/sh ]; then + sh=sh +fi + +###################################################################### # Find out standard library location ocaml_core_stdlib=`get_stdlib` @@ -514,6 +522,18 @@ else ldbm="" fi +# num? + +if [ -f "${ocaml_core_stdlib}/num.cmi" ]; then + echo "num: found" + lnum="num num-top" + numtop="num-top" +else + echo "num: not present (normal since OCaml-4.06)" + lnum="" + numtop="" +fi + # bytes? if [ -f "${ocaml_core_stdlib}/bytes.cmi" ]; then @@ -539,7 +559,7 @@ fi # Generate the META files now. -l="$ldbm dynlink graphics num num-top str threads unix stdlib bigarray ocamldoc $llabltk $lcamlp4 $lobuild $lcomplibs $lbytes $lspacetime" +l="$ldbm dynlink graphics $lnum str threads unix stdlib bigarray ocamldoc $llabltk $lcamlp4 $lobuild $lcomplibs $lbytes $lspacetime" for dir in site-lib-src/*; do # We do not really know if $dir is a directory. @@ -623,6 +643,8 @@ echo "HAVE_NATDYNLINK=${have_natdynlink}" >>Makefile.config echo "VERSION=${version}" >>Makefile.config echo "ENABLE_TOPFIND_PPXOPT=${enable_topfind_ppxopt}" >>Makefile.config echo "SYSTEM=${system}" >>Makefile.config +echo "NUMTOP=${numtop}" >>Makefile.config +echo "SH=${sh}" >>Makefile.config if [ "$mingw_lib" != "" ]; then echo "OCAMLC_FLAGS=-I \"${mingw_lib}\"" >>Makefile.config echo "OCAMLOPT_FLAGS=-I \"${mingw_lib}\"" >>Makefile.config diff --git a/doc/README b/doc/README index 6e3b0ae..2ad42d6 100644 --- a/doc/README +++ b/doc/README @@ -85,6 +85,16 @@ of questions. List of Changes ============================================================================== +- 1.7.3: Fix regarding num-top: this library is now also optional, as num. + +- 1.7.2: Trying to protect against failures when several package installs are + done in parallel. + New subpackage "findlib.top" for the toploop (Jeremie Dimino). + The "num" library is now optional. + Shell scripts are started via "sh" command when there is no /bin/sh (ygrek) + +- 1.7.1: added missing file to tarball + - 1.7.0: New command "ocamlfind printppx" that outputs how the ppx preprocessor would be called (Hendrik Tews). Support for the raw_spacetime library that comes with OCaml 4.04 (Gerd diff --git a/doc/README.xml b/doc/README.xml index 5c6b019..248483e 100644 --- a/doc/README.xml +++ b/doc/README.xml @@ -110,6 +110,23 @@ configuration files, and library routines in detail.</p> <ul> <li> + <p><em>1.7.3:</em> Fix regarding num-top: this library is now also + optional, as num.</p> + </li> + + <li> + <p><em>1.7.2:</em> Trying to protect against failures when + several package installs are done in parallel.</p> + + <p>New subpackage "findlib.top" for the toploop (Jeremie Dimino).</p> + + <p>The "num" library is now optional.</p> + + <p>Shell scripts are started via "sh" command when there is no + /bin/sh (ygrek)</p> + </li> + + <li> <p><em>1.7.1:</em> added missing file to tarball</p> </li> diff --git a/src/findlib/META.in b/src/findlib/META.in index ec57230..df850fb 100644 --- a/src/findlib/META.in +++ b/src/findlib/META.in @@ -1,13 +1,19 @@ # specifications for "findlib": description = "Package manager" -requires = "" +requires = "findlib.internal" +requires(toploop) += "findlib.top" +requires(create_toploop) += "findlib.top" version = "@VERSION@" -archive(byte) = "findlib.cma" -archive(byte,toploop) = "findlib.cma findlib_top.cma" -archive(byte,create_toploop) = "findlib.cma findlib_top.cma" -archive(native) = "findlib.cmxa" -plugin(byte) = "findlib.cma" -plugin(native) = "findlib.cmxs" + +package "internal" ( + version = "@VERSION@" + description = "Package manager" + requires = "" + archive(byte) = "findlib.cma" + archive(native) = "findlib.cmxa" + plugin(byte) = "findlib.cma" + plugin(native) = "findlib.cmxs" +) package "dynload" ( version = "@VERSION@" @@ -20,3 +26,10 @@ package "dynload" ( plugin(native) = "findlib_dynload.cmxs" linkopts = "-linkall" ) + +package "top" ( + version = "@VERSION@" + description = "Package manager toplevel support" + requires = "findlib.internal" + archive(byte) = "findlib_top.cma" +) diff --git a/src/findlib/Makefile b/src/findlib/Makefile index 1385a6a..981760f 100644 --- a/src/findlib/Makefile +++ b/src/findlib/Makefile @@ -38,12 +38,14 @@ DYNLOAD_OBJECTS = fl_dynload.cmo DYNLOAD_XOBJECTS = $(DYNLOAD_OBJECTS:.cmo=.cmx) -all: ocamlfind$(EXEC_SUFFIX) findlib.cma findlib_top.cma topfind num_top.cma \ +all: ocamlfind$(EXEC_SUFFIX) findlib.cma findlib_top.cma topfind $(NUMTOP) \ findlib_dynload.cma opt: ocamlfind_opt$(EXEC_SUFFIX) findlib.cmxa findlib_top.cmxa topfind \ findlib_dynload.cmxa +num-top: num_top.cma + ocamlfind$(EXEC_SUFFIX): findlib.cma $(OCAMLFIND_OBJECTS) $(OCAMLC) $(CUSTOM) -o ocamlfind$(EXEC_SUFFIX) -g findlib.cma unix.cma \ $(OCAMLC_FLAGS) $(OCAMLFIND_OBJECTS) @@ -86,8 +88,8 @@ findlib_config.ml: findlib_config.mlp $(TOP)/Makefile.config USE_CYGPATH="$(USE_CYGPATH)"; \ export USE_CYGPATH; \ cat findlib_config.mlp | \ - $(TOP)/tools/patch '@CONFIGFILE@' '$(OCAMLFIND_CONF)' | \ - $(TOP)/tools/patch '@STDLIB@' '$(OCAML_CORE_STDLIB)' | \ + $(SH) $(TOP)/tools/patch '@CONFIGFILE@' '$(OCAMLFIND_CONF)' | \ + $(SH) $(TOP)/tools/patch '@STDLIB@' '$(OCAML_CORE_STDLIB)' | \ sed -e 's;@AUTOLINK@;$(OCAML_AUTOLINK);g' \ -e 's;@SYSTEM@;$(SYSTEM);g' \ >findlib_config.ml @@ -107,7 +109,7 @@ topfind: topfind_rd$(OCAML_REMOVE_DIRECTORY).p USE_CYGPATH="$(USE_CYGPATH)"; \ export USE_CYGPATH; \ cat topfind_rd$(OCAML_REMOVE_DIRECTORY).p | \ - $(TOP)/tools/patch '@SITELIB@' '$(OCAML_SITELIB)' \ + $(SH) $(TOP)/tools/patch '@SITELIB@' '$(OCAML_SITELIB)' \ >topfind num_top.cma: $(NUMTOP_OBJECTS) @@ -122,7 +124,7 @@ install: all mkdir -p "$(prefix)$(OCAML_SITELIB)/$(NAME)" mkdir -p "$(prefix)$(OCAMLFIND_BIN)" test $(INSTALL_TOPFIND) -eq 0 || cp topfind "$(prefix)$(OCAML_CORE_STDLIB)" - files=`$(TOP)/tools/collect_files $(TOP)/Makefile.config findlib.cmi findlib.mli findlib.cma findlib.cmxa findlib.a findlib.cmxs topfind.cmi topfind.mli fl_package_base.mli fl_package_base.cmi fl_metascanner.mli fl_metascanner.cmi fl_metatoken.cmi findlib_top.cma findlib_top.cmxa findlib_top.a findlib_top.cmxs findlib_dynload.cma findlib_dynload.cmxa findlib_dynload.a findlib_dynload.cmxs fl_dynload.mli fl_dynload.cmi META` && \ + files=`$(SH) $(TOP)/tools/collect_files $(TOP)/Makefile.config findlib.cmi findlib.mli findlib.cma findlib.cmxa findlib.a findlib.cmxs topfind.cmi topfind.mli fl_package_base.mli fl_package_base.cmi fl_metascanner.mli fl_metascanner.cmi fl_metatoken.cmi findlib_top.cma findlib_top.cmxa findlib_top.a findlib_top.cmxs findlib_dynload.cma findlib_dynload.cmxa findlib_dynload.a findlib_dynload.cmxs fl_dynload.mli fl_dynload.cmi META` && \ cp $$files "$(prefix)$(OCAML_SITELIB)/$(NAME)" f="ocamlfind$(EXEC_SUFFIX)"; { test -f ocamlfind_opt$(EXEC_SUFFIX) && f="ocamlfind_opt$(EXEC_SUFFIX)"; }; \ cp $$f "$(prefix)$(OCAMLFIND_BIN)/ocamlfind$(EXEC_SUFFIX)" diff --git a/src/findlib/frontend.ml b/src/findlib/frontend.ml index 01c67d4..f399d7d 100644 --- a/src/findlib/frontend.ml +++ b/src/findlib/frontend.ml @@ -25,6 +25,11 @@ and modifier = | Plus ;; +let sys_error code arg = + if arg = "" then + Sys_error (Unix.error_message code) + else + Sys_error (arg ^ ": " ^ Unix.error_message code) let slashify s = @@ -1859,14 +1864,27 @@ let find_owned_files pkg dir = else file ^ ".owner" in (List.mem owner_file files) && ( - let f = open_in (Filename.concat dir owner_file) in - try - let line = input_line f in - let is_my_file = (line = pkg) in - close_in f; - is_my_file - with - exc -> close_in f; raise exc + try + let fd = + Unix.openfile (Filename.concat dir owner_file) [Unix.O_RDONLY] 0 in + let f = + Unix.in_channel_of_descr fd in + try + let line = input_line f in + let is_my_file = (line = pkg) in + close_in f; + is_my_file + with + | End_of_file -> close_in f; false + | exc -> close_in f; raise exc + with + | Unix.Unix_error(Unix.ENOENT,_,_) -> + (* the owner file might have been removed by a package + removal that is being done in parallel + *) + false + | Unix.Unix_error(code, _, arg) -> + raise(sys_error code arg) ) ) files @@ -2118,7 +2136,7 @@ let install_package () = (* Create the package directory: *) install_create_directory !pkgname pkgdir; - (* Now copy the files into the package directory: *) + (* Now copy the files into the package directory (except META): *) List.iter (fun p -> try @@ -2135,38 +2153,6 @@ let install_package () = ) pkgdir_list; - (* Now write the META file: *) - let write_meta append_directory dir name = - (* If there are patches, write the patched META, else copy the file: *) - if !patches = [] then - copy_file - ~rename:(fun _ -> name) - ?append:(if append_directory then - Some("\ndirectory=\"" ^ pkgdir ^ - "\" # auto-added by ocamlfind\n") - else - None) - meta_name - dir - else ( - let p = Filename.concat dir name in - let patched_pkg = patch_pkg pkgdir meta_pkg !patches in - let out = open_out p in - Fl_metascanner.print out patched_pkg; - if append_directory then - output_string out ("\ndirectory=\"" ^ pkgdir ^ - "\" # auto-added by ocamlfind\n"); - close_out out; - prerr_endline ("Installed " ^ p); - ) - in - if not !add_files then ( - if has_metadir then - write_meta true !metadir meta_dot_pkg - else - write_meta false pkgdir "META"; - ); - (* Copy the DLLs into the libexec directory if necessary *) if have_libexec then begin List.iter @@ -2209,6 +2195,38 @@ let install_package () = prerr_endline("ocamlfind: [WARNING] You have installed DLLs but the directory " ^ dlldir_norm ^ " is not mentioned in ld.conf"); end; + (* Finally, write the META file: *) + let write_meta append_directory dir name = + (* If there are patches, write the patched META, else copy the file: *) + if !patches = [] then + copy_file + ~rename:(fun _ -> name) + ?append:(if append_directory then + Some("\ndirectory=\"" ^ pkgdir ^ + "\" # auto-added by ocamlfind\n") + else + None) + meta_name + dir + else ( + let p = Filename.concat dir name in + let patched_pkg = patch_pkg pkgdir meta_pkg !patches in + let out = open_out p in + Fl_metascanner.print out patched_pkg; + if append_directory then + output_string out ("\ndirectory=\"" ^ pkgdir ^ + "\" # auto-added by ocamlfind\n"); + close_out out; + prerr_endline ("Installed " ^ p); + ) + in + if not !add_files then ( + if has_metadir then + write_meta true !metadir meta_dot_pkg + else + write_meta false pkgdir "META"; + ); + (* Check if there is a postinstall script: *) let postinstall = Filename.concat !destdir "postinstall" in if Sys.file_exists postinstall then @@ -2277,57 +2295,80 @@ let remove_package () = Unix.Unix_error(_,_,_) -> () (* ignore, it's only a warning *) end; + (* First remove the META file. If it is already gone, assume that a + parallel running removal removed it already. + *) + (* If there is a metadir, remove the META file from it: *) - if has_metadir then begin - let f = Filename.concat !metadir meta_dot_pkg in - if Sys.file_exists f then begin - Sys.remove f; - prerr_endline ("Removed " ^ f); - end - else - prerr_endline ("ocamlfind: [WARNING] No such file: " ^ f) - end; + let meta_removal_ok = + if has_metadir then ( + let f = Filename.concat !metadir meta_dot_pkg in + try + Unix.unlink f; + prerr_endline ("Removed " ^ f); + true + with + | Unix.Unix_error(Unix.ENOENT,_,_) -> + prerr_endline ("ocamlfind: [WARNING] No such file: " ^ f); + false + | Unix.Unix_error(code, _, arg) -> + raise(sys_error code arg) + ) else + let f = Filename.concat pkgdir "META" in + try + Unix.unlink f; + prerr_endline ("Removed " ^ f); + true + with + | Unix.Unix_error(Unix.ENOENT,_,_) -> + prerr_endline ("ocamlfind: [WARNING] No such file: " ^ f); + false + | Unix.Unix_error(code, _, arg) -> + raise(sys_error code arg) in - (* Remove files from libexec directory: *) - if have_libexec then begin - let dll_files = find_owned_files !pkgname dlldir in - List.iter - (fun file -> - let absfile = Filename.concat dlldir file in - Sys.remove absfile; - prerr_endline ("Removed " ^ absfile) - ) - dll_files - end; + if meta_removal_ok then ( - (* Remove the files from the package directory: *) - if Sys.file_exists pkgdir then begin - let files = Sys.readdir pkgdir in - Array.iter (fun f -> Sys.remove (Filename.concat pkgdir f)) files; - Unix.rmdir pkgdir; - prerr_endline ("Removed " ^ pkgdir) - end - else - prerr_endline("ocamlfind: [WARNING] No such directory: " ^ pkgdir); + (* Remove files from libexec directory: *) + if have_libexec then begin + let dll_files = find_owned_files !pkgname dlldir in + List.iter + (fun file -> + let absfile = Filename.concat dlldir file in + Sys.remove absfile; + prerr_endline ("Removed " ^ absfile) + ) + dll_files + end; - (* Modify ld.conf *) - if !ldconf <> "ignore" then begin - if Sys.file_exists !ldconf then - begin - let lines = read_ldconf !ldconf in - let d = Fl_split.norm_dir pkgdir in - let exists = List.exists (fun p -> Fl_split.norm_dir p = d) lines in - if exists then begin - let lines' = List.filter (fun p -> Fl_split.norm_dir p <> d) lines in - write_ldconf !ldconf lines' [] - end - end - end; + (* Remove the files from the package directory: *) + if Sys.file_exists pkgdir then begin + let files = Sys.readdir pkgdir in + Array.iter (fun f -> Sys.remove (Filename.concat pkgdir f)) files; + Unix.rmdir pkgdir; + prerr_endline ("Removed " ^ pkgdir) + end + else + prerr_endline("ocamlfind: [WARNING] No such directory: " ^ pkgdir); + + (* Modify ld.conf *) + if !ldconf <> "ignore" then begin + if Sys.file_exists !ldconf then + begin + let lines = read_ldconf !ldconf in + let d = Fl_split.norm_dir pkgdir in + let exists = List.exists (fun p -> Fl_split.norm_dir p = d) lines in + if exists then begin + let lines' = List.filter (fun p -> Fl_split.norm_dir p <> d) lines in + write_ldconf !ldconf lines' [] + end + end + end; - (* Check if there is a postremove script: *) - let postremove = Filename.concat !destdir "postremove" in - if Sys.file_exists postremove then - run_command Verbose postremove [ slashify !destdir; !pkgname ] + (* Check if there is a postremove script: *) + let postremove = Filename.concat !destdir "postremove" in + if Sys.file_exists postremove then + run_command Verbose postremove [ slashify !destdir; !pkgname ] + ) ;; @@ -2445,7 +2486,7 @@ let lint () = (fun s -> if Sys.file_exists s then Queue.add s meta_files else raise(Arg.Bad (Printf.sprintf "%s: file doesn't exists" s))) - "usage: ocamlfind ocamldoc <options> <files>..."; + "usage: ocamlfind lint <options> <files>..."; let error = Queue.fold (fun error file -> -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-ocaml-maint/packages/findlib.git _______________________________________________ Pkg-ocaml-maint-commits mailing list Pkg-ocaml-maint-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-ocaml-maint-commits