Skip to content

Commit

Permalink
Merge pull request #2676 from OCamlPro/fix-release
Browse files Browse the repository at this point in the history
Better `opam-admin --mirror`, fixed Makefile
  • Loading branch information
AltGr authored Sep 16, 2016
2 parents 01ab839 + 861728a commit 4403812
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 19 deletions.
24 changes: 12 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,20 @@ opam-%.install:
$(MAKE) -C src ../opam-$*.install

opam.install:
echo 'bin: [' >$@
echo ' "src/opam"' >>$@
echo ' "src/opam-admin"' >>$@
echo ' "src/opam-installer"' >>$@
echo ']' >>$@
echo 'man: [' >>$@
$(patsubst %,echo ' "'%'"' >>$@;,$(wildcard doc/man/*.1))
echo ']' >>$@
echo 'doc: [' >>$@
$(foreach x,$(wildcard doc/man-html/*.html),\
@echo 'bin: [' >$@
@echo ' "src/opam"' >>$@
@echo ' "src/opam-admin"' >>$@
@echo ' "src/opam-installer"' >>$@
@echo ']' >>$@
@echo 'man: [' >>$@
@$(patsubst %,echo ' "'%'"' >>$@;,$(wildcard doc/man/*.1))
@echo ']' >>$@
@echo 'doc: [' >>$@
@$(foreach x,$(wildcard doc/man-html/*.html),\
echo ' "$x" {"man/$(notdir $x)"}' >>$@;)
$(foreach x,$(wildcard doc/pages/*.html),\
@$(foreach x,$(wildcard doc/pages/*.html),\
echo ' "$x" {"$(notdir $x)"}' >>$@;)
echo ']' >>$@
@echo ']' >>$@

opam-devel.install:
@echo 'libexec: [' >$@
Expand Down
6 changes: 3 additions & 3 deletions src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ endef
export PROJ_state

# -- opam-client -- #
opam-client.cma: opam-core.cma opam-format.cma opam-solver.cma opam-repository.cma opam-state.cma ALWAYS
opam-client.cmxa: opam-core.cmxa opam-format.cmxa opam-solver.cmxa opam-repository.cmxa opam-state.cmxa ALWAYS
opam-client.cma: client/opamGitVersion.ml opam-core.cma opam-format.cma opam-solver.cma opam-repository.cma opam-state.cma ALWAYS
opam-client.cmxa: client/opamGitVersion.ml opam-core.cmxa opam-format.cmxa opam-solver.cmxa opam-repository.cmxa opam-state.cmxa ALWAYS

SRC_client = \
opamClientConfig.ml \
Expand Down Expand Up @@ -242,7 +242,7 @@ client/opamGitVersion.ml: ALWAYS
cd .. && ocaml shell/get-git-id.ml src/$@
touch $@

opam: $(addsuffix $(LIBEXT),$(OPAMLIB)) client/opamGitVersion.ml ALWAYS
opam: $(addsuffix $(LIBEXT),$(OPAMLIB)) ALWAYS
$(MAKE) -f $(OCAMLMAKEFILE) subprojs SUBPROJS=opam SUBTARGET=$(BINTARGET)

define PROJ_opam
Expand Down
7 changes: 5 additions & 2 deletions src/core/opamSystem.ml
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,11 @@ let copy_file src dst =
let copy_dir src dst =
if Sys.file_exists dst then
if Sys.is_directory dst then
command ~verbose:(verbose_for_base_commands ())
([ "cp"; "-PR" ] @ ls src @ [ dst ])
match ls src with
| [] -> ()
| srcfiles ->
command ~verbose:(verbose_for_base_commands ())
([ "cp"; "-PR" ] @ srcfiles @ [ dst ])
else internal_error "Can not copy dir %s to %s, which is not a directory"
src dst
else
Expand Down
6 changes: 5 additions & 1 deletion src/tools/opam_format_upgrade.ml
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ let process args =
OpamFilename.with_tmp_dir @@ fun tmp_mirror_dir ->
OpamFilename.copy_dir ~src:(OpamFilename.cwd ()) ~dst:tmp_mirror_dir;
OpamFilename.rmdir OpamFilename.Op.(tmp_mirror_dir / "2.0");
OpamFilename.rmdir OpamFilename.Op.(tmp_mirror_dir / ".git");
OpamFilename.in_dir tmp_mirror_dir do_upgrade;
let repo_file = OpamFile.make (OpamFilename.of_string "repo") in
let repo0 = OpamFile.Repo.safe_read repo_file in
Expand Down Expand Up @@ -446,4 +447,7 @@ let process args =
repo_20;
let dir20 = OpamFilename.Dir.of_string "2.0" in
OpamFilename.rmdir dir20;
OpamFilename.move_dir ~src:tmp_mirror_dir ~dst:dir20
OpamFilename.move_dir ~src:tmp_mirror_dir ~dst:dir20;
if OpamFilename.exists (OpamFilename.of_string "urls.txt") then
OpamConsole.note
"Indexes need updating: remember to re-run `opam-admin make`"
12 changes: 11 additions & 1 deletion src/tools/opam_mk_repo.ml
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ let resolve_deps args index names =
(OpamFormula.string_of_atom atom))
cs)

let process
let rec process
({index; gener_digest; dryrun; recurse;
names; debug; resolve; dev;_} as args) =
OpamStd.Config.init
Expand Down Expand Up @@ -410,4 +410,14 @@ let process
OpamConsole.error "Got some errors while processing: %s"
(OpamStd.List.concat_map ", " OpamPackage.to_string all_errors);
List.iter display_error !errors
);
let subdir = OpamFilename.Dir.of_string "2.0" in
if OpamFilename.exists (subdir // "repo") then (
OpamConsole.header_msg "Now processing within subdir 2.0/";
let archives = OpamFilename.Dir.of_string "archives" in
if OpamFilename.exists_dir archives then
OpamFilename.copy_dir
~src:archives
~dst:(subdir / "archives");
OpamFilename.in_dir subdir (fun () -> process args)
)

0 comments on commit 4403812

Please sign in to comment.