Skip to content
Newer
Older
100644 128 lines (101 sloc) 3.3 KB
bad6023 @samoht Add GPL headers
samoht authored Mar 22, 2012
1 (***********************************************************************)
2 (* *)
3 (* Copyright 2012 OCamlPro *)
4 (* Copyright 2012 INRIA *)
5 (* *)
6 (* All rights reserved. This file is distributed under the terms of *)
7 (* the GNU Public License version 3.0. *)
8 (* *)
e4fe517 Display an error on "opam install|remove" if no package is specified.…
Vincent Bernardoff authored Sep 10, 2012
9 (* OPAM is distributed in the hope that it will be useful, *)
bad6023 @samoht Add GPL headers
samoht authored Mar 22, 2012
10 (* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
11 (* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
12 (* GNU General Public License for more details. *)
13 (* *)
14 (***********************************************************************)
15
5f94ccf @samoht Add some way to activate --debug via an env variable
samoht authored Mar 30, 2012
16 let debug = ref (
3dd8be7 @samoht OPAMDEBUG=1 means verbose mode / OPAMDEBUG=2 (or more) means debug (+…
samoht authored Jul 5, 2012
17 try int_of_string (Sys.getenv "OPAMDEBUG") >= 2
5f94ccf @samoht Add some way to activate --debug via an env variable
samoht authored Mar 29, 2012
18 with _ -> false
19 )
3d75c58 @samoht More clean-ups.
samoht authored Mar 7, 2012
20
3dd8be7 @samoht OPAMDEBUG=1 means verbose mode / OPAMDEBUG=2 (or more) means debug (+…
samoht authored Jul 5, 2012
21 let verbose = ref (
22 try int_of_string (Sys.getenv "OPAMDEBUG") >= 1
23 with _ -> false
24 )
3409973 @samoht Display stderr/stdout messages when using --verbose
samoht authored Jun 10, 2012
25
640a3ba @samoht Add an option to not install the base packages on init
samoht authored Jul 5, 2012
26 let base_packages = ref true
4f14bbc @samoht Add a --no-checksums option to disable checksum checks
samoht authored Sep 10, 2012
27 let verify_checksums = ref true
76b6c57 @samoht Add a --yes option to always answer yes to OPAM questions
samoht authored May 22, 2012
28 let yes = ref false
29
334250b @samoht [build] simplified autoconf scripts
samoht authored Sep 9, 2012
30 let version = "@PACKAGE_VERSION@"
b582d5e @samoht Bits of refactoring
samoht authored Mar 7, 2012
31
ac99a15 @samoht More WIP ...
samoht authored May 2, 2012
32 let default_repository_name = "default"
33 let default_repository_address = "http://opam.ocamlpro.com"
b097165 @samoht [curl] Add a new repository backend, based on curl/wget, as rsync-ing…
samoht authored Jun 24, 2012
34 let default_repository_kind = "curl"
b582d5e @samoht Bits of refactoring
samoht authored Mar 6, 2012
35
39771d6 @samoht Init / Update / Upload works
samoht authored May 9, 2012
36 let default_build_command = [ [ "./build.sh" ] ]
37
a97b6ff @samoht [config] opam config -var VAR works
samoht authored May 11, 2012
38 let default_package = "conf-ocaml"
39
aa67aa9 @samoht Big refactoring work.
samoht authored Oct 4, 2012
40 let default_alias = "system"
46c067d @samoht Install a default "system" compiler description on init.
samoht authored Jul 4, 2012
41
f3683b7 @samoht Spring clean-ups before the first release
samoht authored Apr 30, 2012
42 let opam_version = "1"
b582d5e @samoht Bits of refactoring
samoht authored Mar 6, 2012
43
f8dc221 @samoht Add --root to ocp-get and ocp-get-server to change the default root p…
samoht authored Mar 8, 2012
44 let home = Unix.getenv "HOME"
aa67aa9 @samoht Big refactoring work.
samoht authored Oct 4, 2012
45 let default_opam_dir = Filename.concat home ".opam"
f8dc221 @samoht Add --root to ocp-get and ocp-get-server to change the default root p…
samoht authored Mar 8, 2012
46
aa67aa9 @samoht Big refactoring work.
samoht authored Oct 4, 2012
47 let root_dir = ref default_opam_dir
e951116 @samoht Fix ocp-get init
samoht authored Mar 7, 2012
48
49 let log section fmt =
e4fe517 Display an error on "opam install|remove" if no package is specified.…
Vincent Bernardoff authored Sep 10, 2012
50 Printf.ksprintf (fun str ->
e951116 @samoht Fix ocp-get init
samoht authored Mar 7, 2012
51 if !debug then
d72de1d @samoht More cleanups
samoht authored May 7, 2012
52 Printf.eprintf "[%d] %-20s %s\n%!" (Unix.getpid ()) section str
e951116 @samoht Fix ocp-get init
samoht authored Mar 7, 2012
53 ) fmt
fa0d4b3 @samoht Various fixes to the server logics
samoht authored Mar 7, 2012
54
55 let error fmt =
e4fe517 Display an error on "opam install|remove" if no package is specified.…
Vincent Bernardoff authored Sep 10, 2012
56 Printf.ksprintf (fun str ->
a895849 @samoht Better error messages
samoht authored Sep 10, 2012
57 Printf.eprintf "%s\n%!" str
fa0d4b3 @samoht Various fixes to the server logics
samoht authored Mar 7, 2012
58 ) fmt
8550872 @samoht More clean-ups.
samoht authored Mar 8, 2012
59
8b10261 @samoht Towards a support for multiple version of OCaml
samoht authored Mar 28, 2012
60 let warning fmt =
e4fe517 Display an error on "opam install|remove" if no package is specified.…
Vincent Bernardoff authored Sep 10, 2012
61 Printf.ksprintf (fun str ->
a895849 @samoht Better error messages
samoht authored Sep 10, 2012
62 Printf.eprintf "[WARNING] %s\n%!" str
8b10261 @samoht Towards a support for multiple version of OCaml
samoht authored Mar 28, 2012
63 ) fmt
bf5ff98 @samoht [scripts] Fix creation scripts
samoht authored May 21, 2012
64
27c2549 @samoht don't use 'exit' command in the middle of the code, as it is not hand…
samoht authored May 25, 2012
65 exception Exit of int
59a5c07 @samoht Add the os string in the main configuration file.
samoht authored Sep 20, 2012
66
8550872 @samoht More clean-ups.
samoht authored Mar 8, 2012
67 let error_and_exit fmt =
e4fe517 Display an error on "opam install|remove" if no package is specified.…
Vincent Bernardoff authored Sep 10, 2012
68 Printf.ksprintf (fun str ->
8550872 @samoht More clean-ups.
samoht authored Mar 8, 2012
69 error "%s" str;
27c2549 @samoht don't use 'exit' command in the middle of the code, as it is not hand…
samoht authored May 25, 2012
70 raise (Exit 66)
8550872 @samoht More clean-ups.
samoht authored Mar 8, 2012
71 ) fmt
f8dc221 @samoht Add --root to ocp-get and ocp-get-server to change the default root p…
samoht authored Mar 8, 2012
72
fec13a5 @samoht Fix stdout/stderr flushing bugs
samoht authored Mar 17, 2012
73 let msg fmt =
e4fe517 Display an error on "opam install|remove" if no package is specified.…
Vincent Bernardoff authored Sep 10, 2012
74 Printf.ksprintf (fun str ->
fec13a5 @samoht Fix stdout/stderr flushing bugs
samoht authored Mar 17, 2012
75 Printf.printf "%s%!" str
76 ) fmt
77
59a5c07 @samoht Add the os string in the main configuration file.
samoht authored Sep 20, 2012
78 type os =
8afaa59 @samoht Cool new features
samoht authored Mar 23, 2012
79 | Darwin
80 | Linux
81 | FreeBSD
f4d3aa8 @avsm detect OpenBSD
avsm authored Jul 8, 2012
82 | OpenBSD
8afaa59 @samoht Cool new features
samoht authored Mar 22, 2012
83 | Cygwin
84 | Win32
85 | Unix
59a5c07 @samoht Add the os string in the main configuration file.
samoht authored Sep 20, 2012
86 | Other of string
8afaa59 @samoht Cool new features
samoht authored Mar 22, 2012
87
ba39c27 @samoht More WIP.
samoht authored May 4, 2012
88 let os = match Sys.os_type with
8afaa59 @samoht Cool new features
samoht authored Mar 22, 2012
89 | "Unix" -> begin
90 match input_line (Unix.open_process_in "uname -s") with
91 | "Darwin" -> Darwin
92 | "Linux" -> Linux
93 | "FreeBSD" -> FreeBSD
f4d3aa8 @avsm detect OpenBSD
avsm authored Jul 8, 2012
94 | "OpenBSD" -> OpenBSD
8afaa59 @samoht Cool new features
samoht authored Mar 22, 2012
95 | _ -> Unix
96 end
97 | "Win32" -> Win32
98 | "Cygwin" -> Cygwin
59a5c07 @samoht Add the os string in the main configuration file.
samoht authored Sep 20, 2012
99 | s -> Other s
100
101 let os_string = match os with
102 | Darwin -> "darwin"
103 | Linux -> "linux"
104 | FreeBSD
105 | OpenBSD -> "bsd"
106 | Cygwin -> "cygwin"
107 | Win32 -> "win32"
108 | Unix -> "unix"
109 | Other x -> x
ba39c27 @samoht More WIP.
samoht authored May 3, 2012
110
c340757 @tuong [variable .opam] add the variable "make" for opam-repository
tuong authored Sep 10, 2012
111 let makecmd = ref (match os with FreeBSD | OpenBSD -> "gmake" | _ -> "make") (* WARNING check the result of "which gmake", "which make", ... *)
112
98403ff @samoht Set the default number of cores to 1
samoht authored Jun 23, 2012
113 let default_cores = 1
4ac99d5 @samoht Normalize the version string for all installed executables
samoht authored Sep 21, 2012
114
6e54186 @samoht Be more robust on repository format changes (#166)
samoht authored Oct 3, 2012
115 let version_msg () =
4ac99d5 @samoht Normalize the version string for all installed executables
samoht authored Sep 21, 2012
116 Printf.printf "\
117 %s version %s
118
119 Copyright (C) 2012 OCamlPro - INRIA
120
121 This is free software; see the source for copying conditions. There is NO
122 warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
123 Sys.argv.(0) version;
124 exit 0
125
126 let exit i =
127 raise (Exit i)
Something went wrong with that request. Please try again.