addfile ./OMakefile hunk ./OMakefile 1 +.PHONY: all install clean + +# .SUBDIRS: + +USE_OCAMLFIND = true +OCAMLPACKS[] = + xml-light + unix + +# OCAMLINCLUDES += + +NATIVE_ENABLED = $(OCAMLOPT_EXISTS) +#BYTE_ENABLED = $(not $(OCAMLOPT_EXISTS)) +BYTE_ENABLED = true + +# OCAMLFLAGS += +# OCAMLCFLAGS += +# OCAMLOPTFLAGS += +# OCAML_LINK_FLAGS += +# OCAML_BYTE_LINK_FLAGS += +# OCAML_NATIVE_LINK_FLAGS += + +FILES[] = + localpkg + log + utils + conf + +PROGRAM = localpkg +# OCAML_LIBS += +# OCAML_CLIBS += +# OCAML_OTHER_LIBS += +# OCAML_LIB_FLAGS += +# + +clean: + rm $(filter-proper-targets $(ls R, .)) + +.DEFAULT: $(OCamlProgram $(PROGRAM), $(FILES)) addfile ./OMakeroot hunk ./OMakeroot 1 +######################################################################## +# Permission is hereby granted, free of charge, to any person +# obtaining a copy of this file, to deal in the File without +# restriction, including without limitation the rights to use, +# copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the File, and to permit persons to whom the +# File is furnished to do so, subject to the following condition: +# +# THE FILE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE FILE OR +# THE USE OR OTHER DEALINGS IN THE FILE. + +######################################################################## +# The standard OMakeroot file. +# You will not normally need to modify this file. +# By default, your changes should be placed in the +# OMakefile in this directory. +# +# If you decide to modify this file, note that it uses exactly +# the same syntax as the OMakefile. +# + +# +# Include the standard installed configuration files. +# Any of these can be deleted if you are not using them, +# but you probably want to keep the Common file. +# +open build/C +open build/OCaml +open build/LaTeX + +# +# The command-line variables are defined *after* the +# standard configuration has been loaded. +# +DefineCommandVars() + +# +# Include the OMakefile in this directory. +# +.SUBDIRS: . addfile ./conf.ml hunk ./conf.ml 1 +type conf_option = + | Env of string * string + | Arg of string + +let join_args l0 = + let rec aux l acc = + match l with + | [] -> acc + | x::q -> + match x with + | Arg s -> aux q (acc^" "^s) + | Env (s, v) -> Unix.putenv s v; aux q acc + in + aux l0 " " + +let prefix_of_arg a path= + match a with + | Env (s, _) -> Unix.putenv s path; "" + | Arg s -> s^" "^path^" " + addfile ./localpkg.ml hunk ./localpkg.ml 1 +open Printf +open Filename + +open Utils +open Conf + +let prefix_path = "/home/olivier/tmp/test" + +exception Invalid_digest + +type version = Minmax of string * string | List of string list + +type dependency = { + dep_name: string; + dep_version: version; + yes_imply: conf_option list; + no_imply: conf_option list; +} + +type package = { + pkg_name : string; + pkg_version: string; + pkg_url: string; + pkg_directory: string; + pkg_fetch_cmd: string; + pkg_digest: string option; + pkg_depends: dependency list; + pkg_conf: conf_option list; + pkg_conf_cmd: string; + pkg_prefix: conf_option; + pkg_build_cmd: string; + pkg_install_cmd: string; +} + +let mutt = { + pkg_name = "mutt"; + pkg_version = "1.5.18"; + pkg_url = "ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz"; + pkg_directory = "mutt-1.5.18"; + pkg_fetch_cmd = "wget"; + pkg_digest = Some "27c30037120189b9f9c0d3e76361b8f8"; + pkg_depends = []; + pkg_conf = [ + Arg "--enable-compressed"; + Arg "--enable-debug"; + Arg "--enable-fcntl"; + Arg "--enable-hcache"; + Arg "--enable-imap"; + Arg "--enable-smtp"; + Arg "--enable-inodesort"; + Arg "--enable-pop"; + Arg "--with-curses"; + Arg "--with-gnutls"; + Arg "--with-idn"; + Arg "--with-mixmaster"; +(* Arg "--with-sasl"; *) + Arg "--without-qdbm"; + Arg "--without-bdb"; + ]; + pkg_conf_cmd = "./configure"; + pkg_prefix = Arg "--prefix"; + pkg_build_cmd = "make"; + pkg_install_cmd = "make install"; +} + +let prepare temp name version cmd url = + let target = temp in + (try mkdir target with + | _ -> () + ); + Sys.chdir target; + target^"/" + +let fetch cmd url = + run_cmd (cmd^" "^url) + +let check target url digest file = + match digest with + | None -> true + | Some d -> + let fresh_digest = Digest.to_hex (Digest.file (target^file)) in + if d = fresh_digest then + true + else + raise Invalid_digest + +let extract directory file = + let st = (Sys.command ("aunpack "^file)) = 0 in + chdir directory; + st + +let configure conf_cmd conf prefix_path prefix = + let prefix_string = prefix_of_arg prefix prefix_path in + let conf_line = join_args conf in + run_cmd (conf_cmd^" "^prefix_string^conf_line) + +let build build_cmd = + run_cmd build_cmd + +let install install_cmd = + run_cmd install_cmd + +let compile pkg = + (* let temp = Filename.temp_dir_name *) + let temp = "/home/olivier/tmp/local" in + + let name = pkg.pkg_name in + let version = pkg.pkg_version in + let fetch_cmd = pkg.pkg_fetch_cmd in + let url = pkg.pkg_url in + let digest = pkg.pkg_digest in + let conf = pkg.pkg_conf in + let prefix = pkg.pkg_prefix in + let conf_cmd = pkg.pkg_conf_cmd in + let build_cmd = pkg.pkg_build_cmd in + let install_cmd = pkg.pkg_install_cmd in + let directory = pkg.pkg_directory in + + let file = basename url in + let target = prepare temp name version fetch_cmd url in + Log.task_begin ("Fetching "^url); + Log.status (fetch fetch_cmd url); + + Log.task_begin ("Verifying digest "^file); + Log.status (check target url digest file); + + Log.task_begin ("Extracting "^file); + Log.status (extract directory file); + + Log.task_begin ("Configuring "^name); + Log.status (configure conf_cmd conf prefix_path prefix); + + Log.task_begin ("Building "^name); + Log.status (build build_cmd); + + Log.task_begin ("Installing "^name); + Log.status (install install_cmd); + + () + +let _ = + compile mutt + addfile ./log.ml hunk ./log.ml 1 +open Printf + +let task_begin name = + printf "* %s. \n%!" name + +let task_end () = + printf "Done.\n" + +let task_failure () = + printf "Failure !!! Ouch...\n" + +let status st = + if st then + task_end () + else + task_failure () addfile ./utils.ml hunk ./utils.ml 1 +let mkdir d = + Unix.mkdir d 0o755 + +let run_cmd cmd = + (Sys.command cmd) = 0 + +let chdir = Sys.chdir + hunk ./conf.ml 16 -let prefix_of_arg a path= - match a with - | Env (s, _) -> Unix.putenv s path; "" - | Arg s -> s^" "^path^" " +let build_prefix a path name version = + let prefix = path^"/"^name^"/"^version in + match a with + | Env (s, _) -> Unix.putenv s path; "" + | Arg s -> s^" "^prefix^" " hunk ./localpkg.ml 139 +(* Log.task_begin ("Registering "^name); *) +(* Log.status (register ()); *) + hunk ./localpkg.ml 10 +exception Patch_error of string hunk ./localpkg.ml 28 + pkg_patches: string list; hunk ./localpkg.ml 44 + pkg_patches = [ + "http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz"; + "http://chadok.info/~oschwand/mutt/patch-1.5.4.vk.pgp_verbose_mime"; + "http://chadok.info/~oschwand/mutt/xtitles"; + ]; hunk ./localpkg.ml 57 - Arg "--enable-inodesort"; + (* Arg "--enable-inodesort"; *) hunk ./localpkg.ml 78 + (try mkdir (prefix_path^"/"^name) with + | _ -> () + ); + (try mkdir (prefix_path^"/"^name^"/"^version) with + | _ -> () + ); hunk ./localpkg.ml 105 -let configure conf_cmd conf prefix_path prefix = - let prefix_string = prefix_of_arg prefix prefix_path in +let patch patch_list = + let rec apply url = + let file = basename url in + if fetch "wget" url then + () + else + raise (Patch_error url); + let file = + if check_suffix file ".gz" then ( + if run_cmd ("gunzip "^file) then + () + else + raise (Patch_error url); + chop_extension file + ) + else + file + in + printf "Applying %s\n%!" file; + if run_cmd ("patch -p1 <"^file) then + () + else + raise (Patch_error url); + in + try (List.iter apply patch_list; true) with _ -> false + +let configure conf_cmd conf prefix_path prefix name version = + let prefix_string = build_prefix prefix prefix_path name version in hunk ./localpkg.ml 151 + let patches = pkg.pkg_patches in hunk ./localpkg.ml 170 + Log.task_begin ("Patching "^name); + Log.status (patch patches); + hunk ./localpkg.ml 16 + dep_altnames: (string * string) list; hunk ./localpkg.ml 25 + pkg_licence: string; + pkg_maintainer: string; + pkg_maintainer_email: string; hunk ./localpkg.ml 44 + pkg_licence = "GPL"; + pkg_maintainer = "Olivier Schwander"; + pkg_maintainer_email = "olivier.schwander@ens-lyon.org"; addfile ./mutt.xml hunk ./mutt.xml 1 + + Mutt + 1.5.18 + GPL + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz + mutt-1.5.18 + 27c30037120189b9f9c0d3e76361b8f8 + + http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz + http://chadok.info/~oschwand/mutt/patch-1.5.4.vk.pgp_verbose_mime + http://chadok.info/~oschwand/mutt/xtitles + + + + + ./configure + + --prefix + + + --enable-compressed + --enable-debug + --enable-fcntl + --enable-hcache + --enable-imap + --enable-smtp + + --enable-pop + --with-curses + --with-gnutls + --with-idn + --with-mixmaster + + --without-qdbm + --without-bdb + + + + + make + + + make install + + hunk ./localpkg.ml 12 -type version = Minmax of string * string | List of string list +type version = + | Exact of string + | Minmax of string * string + | List of string list hunk ./localpkg.ml 184 - Log.status (configure conf_cmd conf prefix_path prefix); + Log.status (configure conf_cmd conf prefix_path prefix name version); move ./conf.ml ./parameter.ml hunk ./localpkg.ml 21 - yes_imply: conf_option list; - no_imply: conf_option list; + yes_imply: parameter list; + no_imply: parameter list; hunk ./localpkg.ml 37 - pkg_conf: conf_option list; + pkg_conf: parameter list; hunk ./localpkg.ml 39 - pkg_prefix: conf_option; + pkg_prefix: parameter; hunk ./localpkg.ml 143 - let conf_line = join_args conf in + let conf_line = build_args conf in hunk ./parameter.ml 1 -type conf_option = +type parameter = hunk ./parameter.ml 5 -let join_args l0 = +let build_args l0 = hunk ./OMakefile 27 - conf + parameter hunk ./localpkg.ml 5 -open Conf +open Parameter move ./localpkg.ml ./lack.ml hunk ./OMakefile 24 - localpkg + lack hunk ./OMakefile 29 -PROGRAM = localpkg +PROGRAM = lack hunk ./lack.ml 7 -let prefix_path = "/home/olivier/tmp/test" + +let prefix_path = "/home/olivier/tmp/lack/test" hunk ./lack.ml 155 - let temp = "/home/olivier/tmp/local" in + let temp = "/home/olivier/tmp/lack/local" in hunk ./OMakefile 28 + package + defaults addfile ./defaults.ml hunk ./defaults.ml 1 +let def = Hashtbl.create 17 + +let _ = + Hashtbl.add def "fetch_cmd" "wget"; + Hashtbl.add def "extract_cmd" "aunpack"; + Hashtbl.add def "prefix" "--prefix"; + () + +let give s = + Hashtbl.find def s + hunk ./lack.ml 6 +open Package hunk ./lack.ml 8 - -let prefix_path = "/home/olivier/tmp/lack/test" +let prefix_path = "/home/olivier/tmp/lack/local" hunk ./lack.ml 13 -type version = - | Exact of string - | Minmax of string * string - | List of string list - -type dependency = { - dep_name: string; - dep_altnames: (string * string) list; - dep_version: version; - yes_imply: parameter list; - no_imply: parameter list; -} - -type package = { - pkg_name : string; - pkg_version: string; - pkg_licence: string; - pkg_maintainer: string; - pkg_maintainer_email: string; - pkg_url: string; - pkg_directory: string; - pkg_fetch_cmd: string; - pkg_digest: string option; - pkg_patches: string list; - pkg_depends: dependency list; - pkg_conf: parameter list; - pkg_conf_cmd: string; - pkg_prefix: parameter; - pkg_build_cmd: string; - pkg_install_cmd: string; -} - -let mutt = { - pkg_name = "mutt"; - pkg_version = "1.5.18"; - pkg_licence = "GPL"; - pkg_maintainer = "Olivier Schwander"; - pkg_maintainer_email = "olivier.schwander@ens-lyon.org"; - pkg_url = "ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz"; - pkg_directory = "mutt-1.5.18"; - pkg_fetch_cmd = "wget"; - pkg_digest = Some "27c30037120189b9f9c0d3e76361b8f8"; - pkg_patches = [ - "http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz"; - "http://chadok.info/~oschwand/mutt/patch-1.5.4.vk.pgp_verbose_mime"; - "http://chadok.info/~oschwand/mutt/xtitles"; - ]; - pkg_depends = []; - pkg_conf = [ - Arg "--enable-compressed"; - Arg "--enable-debug"; - Arg "--enable-fcntl"; - Arg "--enable-hcache"; - Arg "--enable-imap"; - Arg "--enable-smtp"; - (* Arg "--enable-inodesort"; *) - Arg "--enable-pop"; - Arg "--with-curses"; - Arg "--with-gnutls"; - Arg "--with-idn"; - Arg "--with-mixmaster"; -(* Arg "--with-sasl"; *) - Arg "--without-qdbm"; - Arg "--without-bdb"; - ]; - pkg_conf_cmd = "./configure"; - pkg_prefix = Arg "--prefix"; - pkg_build_cmd = "make"; - pkg_install_cmd = "make install"; -} - hunk ./lack.ml 34 + print_endline d; hunk ./lack.ml 72 -let configure conf_cmd conf prefix_path prefix name version = +let run_step cmd options prefix prefix_path name version = hunk ./lack.ml 74 - let conf_line = build_args conf in - run_cmd (conf_cmd^" "^prefix_string^conf_line) + let arg_line = build_args options in + run_cmd (cmd^" "^prefix_string^arg_line) hunk ./lack.ml 77 -let build build_cmd = - run_cmd build_cmd - -let install install_cmd = - run_cmd install_cmd - -let compile pkg = +let install pkg = hunk ./lack.ml 79 - let temp = "/home/olivier/tmp/lack/local" in + let temp = "/home/olivier/tmp/lack/src" in hunk ./lack.ml 83 - let fetch_cmd = pkg.pkg_fetch_cmd in + hunk ./lack.ml 85 + let directory = pkg.pkg_directory in + let fetch_cmd = pkg.pkg_fetch_cmd in hunk ./lack.ml 88 + hunk ./lack.ml 90 - let conf = pkg.pkg_conf in - let prefix = pkg.pkg_prefix in + + let conf_options = pkg.pkg_conf_options in + let conf_prefix = pkg.pkg_conf_prefix in hunk ./lack.ml 94 + + let build_options = pkg.pkg_build_options in + let build_prefix = pkg.pkg_build_prefix in hunk ./lack.ml 98 + + let install_options = pkg.pkg_install_options in + let install_prefix = pkg.pkg_install_prefix in hunk ./lack.ml 102 - let directory = pkg.pkg_directory in hunk ./lack.ml 105 + hunk ./lack.ml 119 - Log.status (configure conf_cmd conf prefix_path prefix name version); + Log.status (run_step conf_cmd conf_options conf_prefix prefix_path name version); hunk ./lack.ml 122 - Log.status (build build_cmd); + Log.status (run_step build_cmd build_options build_prefix prefix_path name version); hunk ./lack.ml 125 - Log.status (install install_cmd); + Log.status (run_step install_cmd install_options install_prefix prefix_path name version); hunk ./lack.ml 133 - compile mutt + let pkg = parse "mutt.xml" in + install pkg hunk ./log.ml 10 - printf "Failure !!! Ouch...\n" + printf "Failure !!! Ouch...\n"; + raise Exit hunk ./mutt.xml 9 - ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz + ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz hunk ./mutt.xml 21 - - --prefix - hunk ./mutt.xml 28 - + hunk ./mutt.xml 34 - + hunk ./mutt.xml 43 - - make install hunk ./mutt.xml 44 + make install + hunk ./mutt.xml 48 + addfile ./package.ml hunk ./package.ml 1 +open Parameter + +exception Invalid_file of string +exception File_not_found of string +exception Invalid_url +exception Missing of string + +type version = + | Exact of string + | Minmax of string * string + | List of string list + +type dep_dsc = { + dep_name: string; + dep_altnames: (string * string) list; + dep_version: version; + dep_mandatory: bool; + yes_imply: parameter list; + no_imply: parameter list; + required_paramaters: parameter list; +} + +type dependency = + | Pkg of dep_dsc + | Or of dependency list + +type package = { + pkg_name : string; + pkg_version: string; + pkg_licence: string option; + pkg_maintainer: string option; + pkg_maintainer_email: string option; + pkg_url: string; + pkg_directory: string; + (* essayer avec + "als -q mutt-1.5.18.tar.gz 2>/dev/null | head -n1" + *) + pkg_fetch_cmd: string; + pkg_extract_cmd: string; + pkg_digest: string option; + pkg_patches: string list; + pkg_depends: dependency list; + + pkg_conf_options: parameter list; + pkg_conf_cmd: string; + pkg_conf_prefix: parameter option; + + pkg_build_options: parameter list; + pkg_build_cmd: string; + pkg_build_prefix: parameter option; + + pkg_install_options: parameter list; + pkg_install_cmd: string; + pkg_install_prefix: parameter option; +} + +let rec find_node l tag = + match l with + | [] -> raise Not_found + | x::q -> + match x with + | Xml.Element(s, _, _) when s = tag -> x + | _ -> find_node q tag + +let rec find_value l tag = + match l with + | [] -> "" + | x::q -> + match x with + | Xml.Element(s, _, + [Xml.PCData(value)]) when s = tag -> value + | _ -> find_value q tag + +let rec get_maintainer l = + match l with + | [] -> "", "" + | x::q -> + match x with + | Xml.Element("maintainer", _, l) -> + find_value l "name", find_value l "email" + | _ -> get_maintainer q + +let get_patches l = + let p = find_node l "patches" in + let f acc x = + match x with + | Xml.Element("url", _, [Xml.PCData(url)]) -> + url::acc + | _ -> acc + in + List.rev (Xml.fold f [] p) + +let get_url l = + let url = find_node l "url" in + let value = + match url with + | Xml.Element("url", _, [Xml.PCData(value)]) -> value + | _ -> raise Invalid_url + in + let defaults s = try Xml.attrib url s with + | Xml.No_attribute _ -> Defaults.give s in + let fetch_cmd = defaults "fetch_cmd" in + let extract_cmd = defaults "extract_cmd" in + value, fetch_cmd, extract_cmd + +let get_instr step l = + let conf = find_node l step in + let command = find_value (Xml.children conf) "command" in + let options = + try + let opts = find_node (Xml.children conf) "options" in + let f acc x = + match x with + | Xml.Element("arg", _, [Xml.PCData(s)]) -> + (Arg s)::acc + | Xml.Element("env", _, [Xml.PCData(s)]) -> + let name = Xml.attrib x "name" in + (Env (name,s))::acc + | _ -> acc + in + List.rev (Xml.fold f [] opts) + with + Not_found -> [] + in + let prefix = + try + let node = find_node l "prefix" in + match node with + | Xml.Element("arg", _, [Xml.PCData(s)]) -> Some (Arg s) + | Xml.Element("env", _, [Xml.PCData(s)]) -> + let name = Xml.attrib node "name" in + Some (Env (name,s)) + | _ -> raise (Invalid_argument "Missing parameter for prefix") + with + | Not_found -> + if step = "configuration" then + Some (Arg (Defaults.give "prefix")) + else + None + in + command, options, prefix + +let none_if_empty s = + if s = "" then + None + else + Some s + +let default_if_empty s = + if s = "" then + Defaults.give s + else + s + +let non_empty name value = + if value = "" then + raise (Missing name) + else + value + +let parse file = + let x = try Xml.parse_file file with + | Xml.File_not_found _ -> raise (File_not_found file) in + match x with + | Xml.Element("package", _, l) -> + let name = find_value l "name" in + let version = find_value l "version" in + let licence = find_value l "licence" in + let maintainer = get_maintainer l in + let url, fetch, extract = get_url l in + let directory = find_value l "directory" in + let digest = find_value l "digest" in + let patches = get_patches l in + let conf_cmd, conf_options, conf_prefix = get_instr "configuration" l in + let build_cmd, build_options, build_prefix = get_instr "build" l in + let install_cmd, install_options, install_prefix = get_instr "install" l in + { + pkg_name = non_empty "name" name; + pkg_version = non_empty "version" version; + pkg_licence = none_if_empty licence; + + pkg_maintainer = none_if_empty (fst maintainer); + pkg_maintainer_email = none_if_empty (snd maintainer); + + pkg_url = non_empty "url" url; + pkg_directory = non_empty "directory" directory; + pkg_fetch_cmd = fetch; + pkg_extract_cmd = extract; + + pkg_digest = none_if_empty digest; + + pkg_patches = patches; + + pkg_depends = []; + + pkg_conf_options = conf_options; + pkg_conf_cmd = conf_cmd; + pkg_conf_prefix = conf_prefix; + + pkg_build_options = build_options; + pkg_build_cmd = build_cmd; + pkg_build_prefix = build_prefix; + + pkg_install_options = install_options; + pkg_install_cmd = install_cmd; + pkg_install_prefix = install_prefix; + } + | _ -> raise (Invalid_file file) + + +let mutt = { + pkg_name = "mutt"; + pkg_version = "1.5.18"; + pkg_licence = Some "GPL"; + pkg_maintainer = Some "Olivier Schwander"; + pkg_maintainer_email = Some "olivier.schwander@ens-lyon.org"; + pkg_url = "ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz"; + pkg_directory = "mutt-1.5.18"; + pkg_fetch_cmd = "wget"; + pkg_extract_cmd = "wget"; + pkg_digest = Some "27c30037120189b9f9c0d3e76361b8f8"; + pkg_patches = [ + "http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz"; + "http://chadok.info/~oschwand/mutt/patch-1.5.4.vk.pgp_verbose_mime"; + "http://chadok.info/~oschwand/mutt/xtitles"; + ]; + pkg_depends = []; + pkg_conf_options = [ + Arg "--enable-compressed"; + Arg "--enable-debug"; + Arg "--enable-fcntl"; + Arg "--enable-hcache"; + Arg "--enable-imap"; + Arg "--enable-smtp"; + (* Arg "--enable-inodesort"; *) + Arg "--enable-pop"; + Arg "--with-curses"; + Arg "--with-gnutls"; + Arg "--with-idn"; + Arg "--with-mixmaster"; +(* Arg "--with-sasl"; *) + Arg "--without-qdbm"; + Arg "--without-bdb"; + ]; + pkg_conf_cmd = "./configure"; + pkg_conf_prefix = Some (Arg "--prefix"); + pkg_build_cmd = "make"; + pkg_build_options = []; + pkg_build_prefix = None; + pkg_install_cmd = "make install"; + pkg_install_options = []; + pkg_install_prefix = None; +} + addfile ./package.mli hunk ./package.mli 1 +open Parameter + +exception Invalid_file of string +exception File_not_found of string +exception Invalid_url +exception Missing of string + +type version = + | Exact of string + | Minmax of string * string + | List of string list + +type dep_dsc = { + dep_name: string; + dep_altnames: (string * string) list; + dep_version: version; + dep_mandatory: bool; + yes_imply: parameter list; + no_imply: parameter list; + required_paramaters: parameter list; +} + +type dependency = + | Pkg of dep_dsc + + | Or of dependency list + +type package = { + pkg_name : string; + pkg_version: string; + + pkg_licence: string option; + pkg_maintainer: string option; + pkg_maintainer_email: string option; + + pkg_url: string; + pkg_directory: string; + pkg_fetch_cmd: string; + pkg_extract_cmd: string; + pkg_digest: string option; + + pkg_patches: string list; + + pkg_depends: dependency list; + + pkg_conf_options: parameter list; + pkg_conf_cmd: string; + pkg_conf_prefix: parameter option; + + pkg_build_options: parameter list; + pkg_build_cmd: string; + pkg_build_prefix: parameter option; + + pkg_install_options: parameter list; + pkg_install_cmd: string; + pkg_install_prefix: parameter option; +} + +val parse : string -> package + +val mutt : package + hunk ./parameter.ml 16 -let build_prefix a path name version = +let build_prefix param_opt path name version = hunk ./parameter.ml 18 - match a with - | Env (s, _) -> Unix.putenv s path; "" - | Arg s -> s^" "^prefix^" " + match param_opt with + | None -> "" + | Some param -> + match param with + | Env (s, _) -> Unix.putenv s path; "" + | Arg s -> s^" "^prefix^" " hunk ./utils.ml 8 + +let some a = + match a with + | None -> raise Not_found + | Some a -> a hunk ./mutt.xml 5 + http://www.mutt.org hunk ./package.ml 30 + pkg_homepage: string option; hunk ./package.ml 170 + let homepage = find_value l "homepage" in hunk ./package.ml 182 - pkg_licence = none_if_empty licence; hunk ./package.ml 183 + pkg_licence = none_if_empty licence; + pkg_homepage = none_if_empty homepage; hunk ./package.ml 218 + pkg_homepage = Some "http://www.mutt.org"; hunk ./package.mli 32 + pkg_homepage: string option; hunk ./lack.ml 118 +(* Log.task_begin ("Managing dependencies "^name); *) +(* Log.status (dependencies ()); *) + hunk ./lack.ml 133 +(* Log.task_begin ("Cleaning build directory for "^name); *) +(* Log.status (clean ()); *) + hunk ./package.ml 58 +(* return the first node with the given tag *) hunk ./package.ml 67 +(* return the content of the first pcdata of the first node with the + given tag or empty string if it is missing *) hunk ./package.ml 78 +(* return a tuple with the maintainer name and email or empty strings if + it is missing *) hunk ./package.ml 89 +(* return the list of patches url *) hunk ./package.ml 100 +(* return the url of the sources, maybe with specific values for + fetching and extracting or default values *) hunk ./package.ml 109 + (* search for an attribute, or take the default value *) hunk ./lack.ml 34 - print_endline d; hunk ./package.ml 59 -let rec find_node l tag = +let rec find_node l tag = hunk ./package.ml 122 - let f acc x = + let f acc x = hunk ./package.ml 152 - + hunk ./OMakefile 30 + steps hunk ./lack.ml 4 -open Utils -open Parameter +(* open Parameter *) hunk ./lack.ml 9 -exception Invalid_digest -exception Patch_error of string - -let prepare temp name version cmd url = - let target = temp in - (try mkdir target with - | _ -> () - ); - (try mkdir (prefix_path^"/"^name) with - | _ -> () - ); - (try mkdir (prefix_path^"/"^name^"/"^version) with - | _ -> () - ); - Sys.chdir target; - target^"/" - -let fetch cmd url = - run_cmd (cmd^" "^url) - -let check target url digest file = - match digest with - | None -> true - | Some d -> - let fresh_digest = Digest.to_hex (Digest.file (target^file)) in - if d = fresh_digest then - true - else - raise Invalid_digest - -let extract directory file = - let st = (Sys.command ("aunpack "^file)) = 0 in - chdir directory; - st - -let patch patch_list = - let rec apply url = - let file = basename url in - if fetch "wget" url then - () - else - raise (Patch_error url); - let file = - if check_suffix file ".gz" then ( - if run_cmd ("gunzip "^file) then - () - else - raise (Patch_error url); - chop_extension file - ) - else - file - in - printf "Applying %s\n%!" file; - if run_cmd ("patch -p1 <"^file) then - () - else - raise (Patch_error url); - in - try (List.iter apply patch_list; true) with _ -> false - -let run_step cmd options prefix prefix_path name version = - let prefix_string = build_prefix prefix prefix_path name version in - let arg_line = build_args options in - run_cmd (cmd^" "^prefix_string^arg_line) - hunk ./lack.ml 36 - let target = prepare temp name version fetch_cmd url in + let target = Steps.prepare temp prefix_path name version fetch_cmd url in hunk ./lack.ml 39 - Log.status (fetch fetch_cmd url); + Log.status (Steps.fetch fetch_cmd url); hunk ./lack.ml 42 - Log.status (check target url digest file); + Log.status (Steps.check target url digest file); hunk ./lack.ml 45 - Log.status (extract directory file); + Log.status (Steps.extract directory file); hunk ./lack.ml 48 - Log.status (patch patches); + Log.status (Steps.patch patches); hunk ./lack.ml 51 -(* Log.status (dependencies ()); *) +(* Log.status (Steps.dependencies ()); *) hunk ./lack.ml 54 - Log.status (run_step conf_cmd conf_options conf_prefix prefix_path name version); + Log.status (Steps.run_step conf_cmd conf_options conf_prefix prefix_path name version); hunk ./lack.ml 57 - Log.status (run_step build_cmd build_options build_prefix prefix_path name version); + Log.status (Steps.run_step build_cmd build_options build_prefix prefix_path name version); hunk ./lack.ml 60 - Log.status (run_step install_cmd install_options install_prefix prefix_path name version); + Log.status (Steps.run_step install_cmd install_options install_prefix prefix_path name version); hunk ./lack.ml 63 -(* Log.status (register ()); *) +(* Log.status (Steps.register ()); *) hunk ./lack.ml 66 -(* Log.status (clean ()); *) +(* Log.status (Steps.clean ()); *) hunk ./lack.ml 71 - let pkg = parse "mutt.xml" in + let pkg = parse Sys.argv.(1) in hunk ./package.ml 116 +(* used for the three main steps: configure, build, install. Get the + command name, its parameters and a possible prefix field *) hunk ./package.ml 121 + (* get all the parameters *) hunk ./package.ml 138 + (* get the prefix *) hunk ./package.ml 149 + (* a prefix is mandatory for the configuation step, so use the + default value if there is nothing in the package description *) hunk ./package.ml 159 +(* convert an empty string to None *) hunk ./package.ml 166 +(* change an empty string to a default value *) hunk ./package.ml 173 +(* failure if a mandatory value is missing *) addfile ./packages.xml hunk ./packages.xml 1 + + + + + + + + + + + + + + + + + addfile ./steps.ml hunk ./steps.ml 1 +open Printf +open Filename + +open Parameter +open Utils + +exception Invalid_digest +exception Patch_error of string + +let prepare temp prefix_path name version cmd url = + let target = temp in + (try mkdir target with + | _ -> () + ); + (try mkdir (prefix_path^"/"^name) with + | _ -> () + ); + (try mkdir (prefix_path^"/"^name^"/"^version) with + | _ -> () + ); + Sys.chdir target; + target^"/" + +let fetch cmd url = + run_cmd (cmd^" "^url) + +let check target url digest file = + match digest with + | None -> true + | Some d -> + let fresh_digest = Digest.to_hex (Digest.file (target^file)) in + if d = fresh_digest then + true + else + raise Invalid_digest + +let extract directory file = + let st = (Sys.command ("aunpack "^file)) = 0 in + chdir directory; + st + +let patch patch_list = + let rec apply url = + let file = basename url in + if fetch "wget" url then + () + else + raise (Patch_error url); + let file = + if check_suffix file ".gz" then ( + if run_cmd ("gunzip "^file) then + () + else + raise (Patch_error url); + chop_extension file + ) + else + file + in + printf "Applying %s\n%!" file; + if run_cmd ("patch -p1 <"^file) then + () + else + raise (Patch_error url); + in + try (List.iter apply patch_list; true) with _ -> false + +let run_step cmd options prefix prefix_path name version = + let prefix_string = build_prefix prefix prefix_path name version in + let arg_line = build_args options in + run_cmd (cmd^" "^prefix_string^arg_line) + addfile ./gdbm.xml hunk ./gdbm.xml 1 + + Gdbm + 1.8.3 + GPL + + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://ftp.gnu.org/pub/gnu/gdbm/gdbm-1.8.3.tar.gz + gdbm-1.8.3 + 1d1b1d5c0245b1c00aff92da751e9aa1 + + + + + + ./configure + + + make + + + make install + + BINOWN=olivier + BINGRP=olivier + + + + hunk ./mutt.xml 23 - --enable-compressed hunk ./mutt.xml 28 - hunk ./mutt.xml 33 - hunk ./mutt.xml 35 - + --without-homespool adddir ./packages move ./gdbm.xml ./packages/gdbm.xml move ./mutt.xml ./packages/mutt.xml addfile ./packages/msmtp.xml hunk ./packages/msmtp.xml 1 + + Msmtp + 1.4.15 + GPL + http://msmtp.sourceforge.net + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://downloads.sourceforge.net/msmtp/msmtp-1.4.15.tar.bz2 + msmtp-1.4.15 + 52dfb3039f4253581292eba8285379c1 + + + + + + ./configure + + + make + + + make install + + + addfile ./packages/ncurses.xml hunk ./packages/ncurses.xml 1 + + Ncursesw + 5.6 + GPL + ftp://ftp.gnu.org/gnu/ncurses/ + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.6.tar.gz + ncurses-5.6 + b6593abe1089d6aab1551c105c9300e3 + + + + + + ./configure + + + make + + + make install + + + addfile ./packages/ncursesw.xml hunk ./packages/ncursesw.xml 1 + + Ncursesw + 5.6 + GPL + ftp://ftp.gnu.org/gnu/ncurses/ + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.6.tar.gz + ncurses-5.6 + b6593abe1089d6aab1551c105c9300e3 + + + + + + ./configure + + --enable-widec + + + + make + + + make install + + + addfile ./packages/vim.xml hunk ./packages/vim.xml 1 + + Vim + 7.1 + GPL + http://www.vim.org + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2 + vim71 + 44c6b4914f38d6f9aa959640b89da329 + + + + + + ./configure + + + make + + + make install + + + addfile ./packages/ghc.xml hunk ./packages/ghc.xml 1 + + Ghc + 6.8.2 + GPL + http://haskell.org/ghc + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://haskell.org/ghc/dist/6.8.2/ghc-6.8.2-i386-unknown-linux.tar.bz2 + ghc-6.8.2 + fb48153f70a7ee3718619a5f05c5fd64 + + + + + + ./configure + + + + + make install + + + addfile ./packages/autoconf.xml hunk ./packages/autoconf.xml 1 + + Autoconf + 2.62 + GPL + http://www.gnu.org/software/autoconf/ + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.bz2 + autoconf-2.62 + e1fb8fe0b22e651240afdfa2be537a3c + + + + + + ./configure + + + make + + + make install + + + addfile ./packages/darcs.xml hunk ./packages/darcs.xml 1 + + Darcs + 2.0.0 + GPL + http://darcs.net + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://darcs.net/darcs-2.0.0.tar.gz + darcs-2.0.0 + 89e48c2fb388692b78b3cceeb86a95a7 + + + + + + autoconf; ./configure + + + make + + + make install + + + addfile ./packages/ghc-x11.xml hunk ./packages/ghc-x11.xml 1 + + Ghc-x11 + darcs + GPL + http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11 + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://darcs.haskell.org/X11 + X11 + + + + + + autoreconf; runhaskell Setup.hs configure --user + + + runhaskell Setup.hs build + + + runhaskell Setup.hs install + + + hunk ./packages/ghc.xml 10 - http://haskell.org/ghc/dist/6.8.2/ghc-6.8.2-i386-unknown-linux.tar.bz2 + http://www.haskell.org/ghc/dist/6.8.2/maeder/ghc-6.8.2-i386-unknown-linux.tar.bz2 hunk ./packages/ghc.xml 12 - fb48153f70a7ee3718619a5f05c5fd64 + bd8c115e027dd74daf96681880dfb9fd addfile ./packages/gmp.xml hunk ./packages/gmp.xml 1 + + Gmp + 2.62 + GPL + http://gmplib.org + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://ftp.gnu.org/gnu/gmp/gmp-4.2.2.tar.bz2 + gmp-4.2.2 + 7ce52531644e6d12f16911b7e3151f3f + + + + + + ./configure + + + make + + + make install + + + addfile ./packages/m4.xml hunk ./packages/m4.xml 1 + + M4 + 1.4.11 + GPL + http://www.gnu.org/software/m4/ + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://ftp.gnu.org/gnu/m4/m4-1.4.11.tar.bz2 + m4-1.4.11 + 96ec473c2a6f203976c028e896a01b28 + + + + + + ./configure + + + make + + + make install + + + addfile ./packages/xmonad-contrib.xml hunk ./packages/xmonad-contrib.xml 1 + + Xmonad-contrib + darcs + GPL + http://xmonad.org + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://code.haskell.org/XMonadContrib + XMonadContrib + + + + + + runhaskell Setup.lhs configure --user + + + runhaskell Setup.lhs -v build + + + runhaskell Setup.lhs install + + + addfile ./packages/xmonad.xml hunk ./packages/xmonad.xml 1 + + Xmonad + darcs + GPL + http://xmonad.org + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://code.haskell.org/xmonad + xmonad + + + + + + runhaskell Setup.lhs configure --user + + + runhaskell Setup.lhs build + + + runhaskell Setup.lhs install + + + hunk ./defaults.ml 4 - Hashtbl.add def "fetch_cmd" "wget"; - Hashtbl.add def "extract_cmd" "aunpack"; + Hashtbl.add def "fetch" "wget"; + Hashtbl.add def "extract" "aunpack"; hunk ./lack.ml 19 + let extract_cmd = pkg.pkg_extract_cmd in hunk ./lack.ml 46 - Log.status (Steps.extract directory file); + Log.status (Steps.extract extract_cmd directory file); hunk ./package.ml 36 - (* essayer avec - "als -q mutt-1.5.18.tar.gz 2>/dev/null | head -n1" - *) + hunk ./package.ml 110 - let fetch_cmd = defaults "fetch_cmd" in - let extract_cmd = defaults "extract_cmd" in + let fetch_cmd = defaults "fetch" in + let extract_cmd = defaults "extract" in hunk ./steps.ml 37 -let extract directory file = - let st = (Sys.command ("aunpack "^file)) = 0 in +let extract extract directory file = + let st = (Sys.command (extract^" "^file)) = 0 in hunk ./lack.ml 4 -(* open Parameter *) hunk ./lack.ml 5 +open Utils hunk ./lack.ml 7 -let prefix_path = "/home/olivier/tmp/lack/local" +let prefix_path = Sys.getenv "LACK" +let temp = temp_dir () +(* let temp = "/home/olivier/tmp/lack/src" *) hunk ./lack.ml 12 - (* let temp = Filename.temp_dir_name *) - let temp = "/home/olivier/tmp/lack/src" in - hunk ./lack.ml 65 -(* Log.task_begin ("Cleaning build directory for "^name); *) -(* Log.status (Steps.clean ()); *) + Log.task_begin ("Cleaning build directory for "^name); + Log.status (Steps.clean temp); hunk ./lack.ml 72 - install pkg + try + install pkg + with + _ -> printf "Failure !!! Ouch in %s\n" temp; hunk ./log.ml 3 +exception Failure + hunk ./log.ml 12 - printf "Failure !!! Ouch...\n"; - raise Exit + raise Failure hunk ./steps.ml 72 + +let clean dir = + run_cmd ("rm -fr "^dir); hunk ./utils.ml 13 + +let temp_dir () = + let tmp = Filename.temp_file "lack_" "" in + Sys.remove tmp; + mkdir tmp; + tmp hunk ./lack.ml 7 +let usage = "" + hunk ./lack.ml 11 -(* let temp = "/home/olivier/tmp/lack/src" *) hunk ./lack.ml 12 -let install pkg = +let install quiet verbose pkg = hunk ./lack.ml 37 - let target = Steps.prepare temp prefix_path name version fetch_cmd url in + let target = Steps.prepare verbose temp prefix_path name version fetch_cmd url in hunk ./lack.ml 39 - Log.task_begin ("Fetching "^url); - Log.status (Steps.fetch fetch_cmd url); + let n = 10 in + Log.task_begin quiet 1 n ("Fetching "^url^"..."); + Log.status quiet (Steps.fetch verbose fetch_cmd url); hunk ./lack.ml 43 - Log.task_begin ("Verifying digest "^file); - Log.status (Steps.check target url digest file); + Log.task_begin quiet 2 n "Verifying digest..."; + Log.status quiet (Steps.check verbose target url digest file); hunk ./lack.ml 46 - Log.task_begin ("Extracting "^file); - Log.status (Steps.extract extract_cmd directory file); + Log.task_begin quiet 3 n "Extracting..."; + Log.status quiet (Steps.extract verbose extract_cmd directory file); hunk ./lack.ml 49 - Log.task_begin ("Patching "^name); - Log.status (Steps.patch patches); + Log.task_begin quiet 4 n "Patching..."; + Log.status quiet (Steps.patch verbose patches); hunk ./lack.ml 52 -(* Log.task_begin ("Managing dependencies "^name); *) -(* Log.status (Steps.dependencies ()); *) +(* Log.task_begin quiet 5 n "Managing dependencies..."; *) +(* Log.status quiet (Steps.dependencies verbose ()); *) hunk ./lack.ml 55 - Log.task_begin ("Configuring "^name); - Log.status (Steps.run_step conf_cmd conf_options conf_prefix prefix_path name version); + Log.task_begin quiet 6 n "Configuring..."; + Log.status quiet (Steps.run_step verbose conf_cmd conf_options conf_prefix prefix_path name version); hunk ./lack.ml 58 - Log.task_begin ("Building "^name); - Log.status (Steps.run_step build_cmd build_options build_prefix prefix_path name version); + Log.task_begin quiet 7 n "Building..."; + Log.status quiet (Steps.run_step verbose build_cmd build_options build_prefix prefix_path name version); hunk ./lack.ml 61 - Log.task_begin ("Installing "^name); - Log.status (Steps.run_step install_cmd install_options install_prefix prefix_path name version); + Log.task_begin quiet 8 n "Installing..."; + Log.status quiet (Steps.run_step verbose install_cmd install_options install_prefix prefix_path name version); hunk ./lack.ml 64 -(* Log.task_begin ("Registering "^name); *) -(* Log.status (Steps.register ()); *) +(* Log.task_begin quiet 9 n "Registering..."; *) +(* Log.status quiet (Steps.register verbose ()); *) hunk ./lack.ml 67 - Log.task_begin ("Cleaning build directory for "^name); - Log.status (Steps.clean temp); + Log.task_begin quiet 10 n "Cleaning build directory..."; + Log.status quiet (Steps.clean verbose temp); hunk ./lack.ml 73 - let pkg = parse Sys.argv.(1) in - try - install pkg - with - _ -> printf "Failure !!! Ouch in %s\n" temp; + let verbose = ref false in + let quiet = ref false in + let xml = ref "" in + let file = ref "" in + Arg.parse (Arg.align [ + "--verbose", Arg.Set verbose , " Display output of commands"; + "--quiet" , Arg.Set quiet , " Don't display progression information"; + "--file" , Arg.Set_string file, " Don't download the sources, instead, use the file provided"; + ]) + (fun x -> xml := x) + usage; + let quiet = not !verbose && !quiet in + let pkg = parse !xml in + try + install quiet !verbose pkg + with + _ -> printf "Failure !!! Ouch in %s\n" temp; hunk ./log.ml 5 -let task_begin name = - printf "* %s. \n%!" name +let task_begin quiet i n name = + if not quiet then + printf "%i/%i - %s \n%!" i n name hunk ./log.ml 9 -let task_end () = - printf "Done.\n" +let task_end quiet = + if not quiet then + printf "Done.\n" hunk ./log.ml 16 -let status st = +let status quiet st = hunk ./log.ml 18 - task_end () + task_end quiet hunk ./log.ml 22 + hunk ./steps.ml 10 -let prepare temp prefix_path name version cmd url = +let prepare verbose temp prefix_path name version cmd url = hunk ./steps.ml 24 -let fetch cmd url = - run_cmd (cmd^" "^url) +let fetch verbose cmd url = + command verbose (cmd^" "^url) hunk ./steps.ml 27 -let check target url digest file = +let check verbose target url digest file = hunk ./steps.ml 37 -let extract extract directory file = - let st = (Sys.command (extract^" "^file)) = 0 in +let extract verbose extract directory file = + let st = command verbose (extract^" "^file) in hunk ./steps.ml 42 -let patch patch_list = +let patch verbose patch_list = hunk ./steps.ml 45 - if fetch "wget" url then + if fetch verbose "wget" url then hunk ./steps.ml 51 - if run_cmd ("gunzip "^file) then + if command verbose ("gunzip "^file) then hunk ./steps.ml 60 - printf "Applying %s\n%!" file; - if run_cmd ("patch -p1 <"^file) then + if verbose then + printf "Applying %s\n%!" file; + if command verbose ("patch -p1 <"^file) then hunk ./steps.ml 69 -let run_step cmd options prefix prefix_path name version = +let run_step verbose cmd options prefix prefix_path name version = hunk ./steps.ml 72 - run_cmd (cmd^" "^prefix_string^arg_line) + command verbose (cmd^" "^prefix_string^arg_line) hunk ./steps.ml 74 -let clean dir = - run_cmd ("rm -fr "^dir); +let clean verbose dir = + command verbose ("rm -fr "^dir); hunk ./utils.ml 4 -let run_cmd cmd = - (Sys.command cmd) = 0 +let command verbose cmd = + let cmd = if verbose then cmd else cmd^" 1>/dev/null 2>&1" in + (Sys.command cmd) = 0 addfile ./packages/luit.xml hunk ./packages/luit.xml 1 + + Luit + 1.0.2 + GPL + http://packages.ubuntu.com/gutsy/luit + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://archive.ubuntu.com/ubuntu/pool/universe/l/luit/luit_1.0.2.orig.tar.gz + luit-1.0.2 + 1acd244a489bae605a03a84d0754fb00 + + + + + + ./configure + + + make + + + make install + + + addfile ./packages/zsh.xml hunk ./packages/zsh.xml 1 + + Zsh + 4.2.3 + GPL + http://www.zsh.org/ + + Olivier Schwander + olivier.schwander@ens-lyon.org + + ftp://nephtys.lip6.fr/pub/unix/shells/zsh/zsh-4.2.3.tar.bz2 + zsh-4.2.3 + ae19a74ae7e84cf4dbd8e35f52c8ec74 + + + + + + ./configure + + + make + + + make install + + + hunk ./lack.ml 7 -let usage = "" +let version = "0.1" +let usage = sprintf "Lack %s, a package manager for all it lacks on your computer" version hunk ./lack.ml 78 - Arg.parse (Arg.align [ - "--verbose", Arg.Set verbose , " Display output of commands"; - "--quiet" , Arg.Set quiet , " Don't display progression information"; - "--file" , Arg.Set_string file, " Don't download the sources, instead, use the file provided"; - ]) - (fun x -> xml := x) - usage; + let arguments = (Arg.align [ + "--verbose", Arg.Set verbose , " Display output of commands"; + "--quiet" , Arg.Set quiet , " Don't display progression information"; + "--file" , Arg.Set_string file, " Don't download the sources, instead, use the file provided"; + ]) + in + Arg.parse arguments (fun x -> xml := x) usage; hunk ./lack.ml 86 - let pkg = parse !xml in - try - install quiet !verbose pkg - with - _ -> printf "Failure !!! Ouch in %s\n" temp; + if !xml = "" then + Arg.usage arguments usage + else + try + let pkg = parse !xml in + install quiet !verbose pkg + with + | Package.File_not_found s -> printf "Unable to find the package file %s\n" s + | _ -> printf "Failure !!! Ouch in %s\n" temp; hunk ./OMakefile 31 + find hunk ./lack.ml 13 -let install quiet verbose pkg = +let install quiet verbose pkg source = hunk ./lack.ml 41 + hunk ./lack.ml 66 -(* Log.task_begin quiet 9 n "Registering..."; *) -(* Log.status quiet (Steps.register verbose ()); *) + Log.task_begin quiet 9 n "Registering..."; + Log.status quiet (Steps.register verbose prefix_path name version source); hunk ./lack.ml 92 - install quiet !verbose pkg + install quiet !verbose pkg !xml hunk ./packages.xml 1 - - - - - - - - - - - - - - - - - hunk ./steps.ml 73 + +let register verbose prefix name version source = + let to_xmlnode name = fun value -> Xml.Element(name, [], [Xml.PCData value]) in + let find = Find.find (prefix^"/"^name^"/"^version) in + let build var dir = + let l = find dir in + List.map (to_xmlnode var) l + in + try + let children = List.flatten [ + build "PATH" "bin" ; + build "LD_LIBRARY_PATH" "lib" ; + build "LIBRARY_PATH" "lib" ; + build "C_INCLUDE_PATH" "include" ; + build "CPP_INCLUDE_PATH" "include" ; + build "PKG_CONFIG_PATH" "lib/pkgconfig"; + build "MANPATH" "man" ; + build "INFOPATH" "info" ; + ] + in + let meta = Xml.Element("meta", [], [ + to_xmlnode "name" name; + to_xmlnode "version" version; + to_xmlnode "source" source; + Xml.Element("paths", [], children) + ]) + in + let file = open_out (prefix^"/"^name^"/"^version^"/meta.xml") in + output_string file ((Xml.to_string_fmt meta)^"\n"); + close_out file; + true + with + _ -> false hunk ./OMakefile 23 -FILES[] = +LACK_FILES[] = hunk ./OMakefile 32 + parse + version hunk ./OMakefile 35 -PROGRAM = lack +LACK_PROGRAM = lack hunk ./OMakefile 40 -# + +OCamlProgram($(LACK_PROGRAM), $(LACK_FILES)) + +LACKINIT_FILES[] = + lack-init + meta + find + parse + defaults + version + utils + +LACKINIT_PROGRAM = lack-init + +OCamlProgram($(LACKINIT_PROGRAM), $(LACKINIT_FILES)) hunk ./OMakefile 59 -.DEFAULT: $(OCamlProgram $(PROGRAM), $(FILES)) +all: $(LACK_PROGRAM) $(LACKINIT_PROGRAM) + +.DEFAULT: all hunk ./defaults.ml 7 + Hashtbl.add def "base" ((Sys.getenv "HOME")^"/local/lack"); addfile ./find.ml hunk ./find.ml 1 +open Printf + +let find base tag = + let cmd = sprintf "find %s -type d -wholename */%s" base tag in + let inchan = Unix.open_process_in cmd in + let rec aux l = + try + let line = input_line inchan in + aux (line::l) + with + End_of_file -> ignore (Unix.close_process_in inchan); l + in + aux [] + +let find_meta base = + let cmd = sprintf "find %s -type f -name meta.xml" base in + let inchan = Unix.open_process_in cmd in + let rec aux l = + try + let line = input_line inchan in + aux (line::l) + with + End_of_file -> ignore (Unix.close_process_in inchan); l + in + aux [] + + addfile ./lack-init.ml hunk ./lack-init.ml 1 +open Printf +open Utils + +let usage = sprintf "Lack %s, a package manager for all it lacks on your computer\nRun this program to initializate the lack envirronement" Version.version + +let to_shell env = + let env_to_string (var, value) = + sprintf "%s=%s:$%s" var value var + in + List.map env_to_string env + +let join l s = + let f a acc = + acc^s^a + in + List.fold_left f "" l + +let expose prefix = + let packages = Find.find_meta prefix in + let metas = List.map Meta.parse packages in + let envs = List.map Meta.env metas in + let shells = List.map to_shell envs in + let lines = List.flatten shells in + let names = fst (List.split (List.flatten envs)) in + printf "LACK=%s\nexport LACK\n" prefix; + List.iter print_endline lines; + printf "export %s\n" (join names " "); + () + +let _ = + let prepare = ref false in + let base = ref (Defaults.give "base") in + let arguments = (Arg.align [ + "--init" , Arg.Set prepare, (" Create the lack directory (defaults to "^ !base ^")"); + "--prefix" , Arg.Set_string base, (" Path to lack files (defaults to "^ !base ^")"); + ]) + in + Arg.parse arguments (fun x -> ()) usage; + if !prepare then + ignore (command false ("mkdir -p "^ !base)) + else + expose !base; + hunk ./lack.ml 7 -let version = "0.1" -let usage = sprintf "Lack %s, a package manager for all it lacks on your computer" version +let usage = sprintf "Lack %s, a package manager for all it lacks on your computer" Version.version addfile ./meta.ml hunk ./meta.ml 1 +open Parse + +exception InvalidMeta of string + +type meta = { + meta_name : string; + meta_version : string; + meta_source : string; + meta_env : (string * string) list; +} + +let parse meta_file = + let x = Xml.parse_file meta_file in + match x with + | Xml.Element("meta", _, l) -> + let name = find_value l "name" in + let version = find_value l "version" in + let source = find_value l "source" in + let paths = Xml.children (find_node l "paths") in + let g = function + | Xml.Element(var, [], [Xml.PCData value]) -> (var, value) + | _ -> raise (InvalidMeta meta_file) + in + let env = List.map g paths in + { + meta_name = name; + meta_version = version; + meta_source = source; + meta_env = env; + } + | _ -> raise (InvalidMeta meta_file) + +let env meta = meta.meta_env + hunk ./package.ml 1 +open Parse hunk ./package.ml 57 -(* return the first node with the given tag *) -let rec find_node l tag = - match l with - | [] -> raise Not_found - | x::q -> - match x with - | Xml.Element(s, _, _) when s = tag -> x - | _ -> find_node q tag - -(* return the content of the first pcdata of the first node with the - given tag or empty string if it is missing *) -let rec find_value l tag = - match l with - | [] -> "" - | x::q -> - match x with - | Xml.Element(s, _, - [Xml.PCData(value)]) when s = tag -> value - | _ -> find_value q tag - addfile ./parse.ml hunk ./parse.ml 1 +(* return the first node with the given tag *) +let rec find_node l tag = + match l with + | [] -> raise Not_found + | x::q -> + match x with + | Xml.Element(s, _, _) when s = tag -> x + | _ -> find_node q tag + +(* return the content of the first pcdata of the first node with the + given tag or empty string if it is missing *) +let rec find_value l tag = + match l with + | [] -> "" + | x::q -> + match x with + | Xml.Element(s, _, + [Xml.PCData(value)]) when s = tag -> value + | _ -> find_value q tag + + addfile ./version.ml hunk ./version.ml 1 +let version = "0.1" + hunk ./OMakefile 34 + init + meta hunk ./OMakefile 53 + init hunk ./find.ml 4 - let cmd = sprintf "find %s -type d -wholename */%s" base tag in + let cmd = sprintf "find %s -wholename */%s/*" base tag in hunk ./find.ml 16 - let cmd = sprintf "find %s -type f -name meta.xml" base in + let cmd = sprintf "find %s -maxdepth 3 -type f -name meta.xml" base in addfile ./init.ml hunk ./init.ml 1 +open Printf +open Utils + +let link base (target,file) = + let cmd = sprintf "ln -s %s %s/_links/%s" file base target in + ignore (command false cmd) + +let clean base = + let cmd = sprintf "rm -f %s/_links/*/*" base in + ignore (command false cmd) + +let expose base = + let to_sring var dir = + sprintf "%s=%s/_links/%s:$%s\nexport %s" var base dir var var + in + let variables = [ + to_sring "PATH" "bin"; + to_sring "LD_LIBRARY_PATH" "lib"; + to_sring "LIBRARY_PATH" "lib"; + to_sring "C_INCLUDE_PATH" "include"; + to_sring "CPP_INCLUDE_PATH" "include"; + to_sring "MANPATH" "man"; + to_sring "INFOPATH" "info"; + ] + in + List.iter print_endline variables; + printf "LACK=%s\nexport LACK\n" base; + () + +let update prefix = + let packages = Find.find_meta prefix in + let metas = List.map Meta.parse packages in + let files = List.flatten (List.map Meta.env metas) in + clean prefix; + List.iter (link prefix) files; + () + +let prepare base = + let dir = !base^"/_links" in + ignore (command false ("mkdir -p "^dir)); + mkdir (dir^"/"^"bin"); + mkdir (dir^"/"^"lib"); + mkdir (dir^"/"^"include"); + mkdir (dir^"/"^"man"); + mkdir (dir^"/"^"info"); + () + hunk ./lack-init.ml 3 +open Init hunk ./lack-init.ml 7 -let to_shell env = - let env_to_string (var, value) = - sprintf "%s=%s:$%s" var value var - in - List.map env_to_string env - -let join l s = - let f a acc = - acc^s^a - in - List.fold_left f "" l - -let expose prefix = - let packages = Find.find_meta prefix in - let metas = List.map Meta.parse packages in - let envs = List.map Meta.env metas in - let shells = List.map to_shell envs in - let lines = List.flatten shells in - let names = fst (List.split (List.flatten envs)) in - printf "LACK=%s\nexport LACK\n" prefix; - List.iter print_endline lines; - printf "export %s\n" (join names " "); - () - hunk ./lack-init.ml 8 - let prepare = ref false in + let is_prepare = ref false in + let is_update = ref false in hunk ./lack-init.ml 12 - "--init" , Arg.Set prepare, (" Create the lack directory (defaults to "^ !base ^")"); - "--prefix" , Arg.Set_string base, (" Path to lack files (defaults to "^ !base ^")"); + "--prepare", Arg.Set is_prepare , (" Create the lack directory (defaults to "^ !base ^")"); + "--update" , Arg.Set is_update , (" Update lack envirronement using $LACK"); + "--prefix" , Arg.Set_string base, (" Path to lack files (defaults to "^ !base ^")"); hunk ./lack-init.ml 18 - if !prepare then - ignore (command false ("mkdir -p "^ !base)) + if !is_prepare then + prepare base hunk ./lack-init.ml 21 - expose !base; + if !is_update then + update (Sys.getenv "LACK") + else ( + expose !base; + ) hunk ./lack.ml 9 -let prefix_path = Sys.getenv "LACK" +let base = Sys.getenv "LACK" hunk ./lack.ml 37 - let target = Steps.prepare verbose temp prefix_path name version fetch_cmd url in + let target = Steps.prepare verbose temp base name version fetch_cmd url in hunk ./lack.ml 57 - Log.status quiet (Steps.run_step verbose conf_cmd conf_options conf_prefix prefix_path name version); + Log.status quiet (Steps.run_step verbose conf_cmd conf_options conf_prefix base name version); hunk ./lack.ml 60 - Log.status quiet (Steps.run_step verbose build_cmd build_options build_prefix prefix_path name version); + Log.status quiet (Steps.run_step verbose build_cmd build_options build_prefix base name version); hunk ./lack.ml 63 - Log.status quiet (Steps.run_step verbose install_cmd install_options install_prefix prefix_path name version); + Log.status quiet (Steps.run_step verbose install_cmd install_options install_prefix base name version); hunk ./lack.ml 66 - Log.status quiet (Steps.register verbose prefix_path name version source); + Log.status quiet (Steps.register verbose base name version source); hunk ./lack.ml 91 - install quiet !verbose pkg !xml + install quiet !verbose pkg !xml; + Sys.chdir base; + Init.update base rmfile ./packages.xml hunk ./steps.ml 77 - let build var dir = + let build dir = hunk ./steps.ml 79 - List.map (to_xmlnode var) l + List.map (to_xmlnode dir) l hunk ./steps.ml 83 - build "PATH" "bin" ; - build "LD_LIBRARY_PATH" "lib" ; - build "LIBRARY_PATH" "lib" ; - build "C_INCLUDE_PATH" "include" ; - build "CPP_INCLUDE_PATH" "include" ; - build "PKG_CONFIG_PATH" "lib/pkgconfig"; - build "MANPATH" "man" ; - build "INFOPATH" "info" ; + build "bin"; + build "lib"; + build "include"; + build "pkgconfig"; + build "man"; + build "info"; hunk ./package.ml 120 - let node = find_node l "prefix" in - match node with + let node = find_node (Xml.children conf) "prefix" in + match List.hd (Xml.children node) with hunk ./lack-init.ml 5 -let usage = sprintf "Lack %s, a package manager for all it lacks on your computer\nRun this program to initializate the lack envirronement" Version.version +let usage = sprintf "Lack %s, a package manager for all it lacks on your computer\nRun this program to initializate the lack environment" Version.version hunk ./steps.ml 72 - command verbose (cmd^" "^prefix_string^arg_line) + if cmd <> "" then + command verbose (cmd^" "^prefix_string^arg_line) + else + true hunk ./utils.ml 6 + if verbose then Printf.printf "$ %s\n" cmd; hunk ./init.ml 24 + to_sring "PYTHONPATH" "python"; hunk ./steps.ml 92 + build "python"; hunk ./packages/mutt.xml 23 + --enable-compressed addfile ./packages/python-progressbar.xml hunk ./packages/python-progressbar.xml 1 + + Python-progressbar + 2.2 + GPL + http://pypi.python.org/pypi/progressbar/ + + Olivier Schwander + olivier.schwander@ens-lyon.org + + http://pypi.python.org/packages/source/p/progressbar/progressbar-2.2.tar.gz + progressbar-2.2/ + + + + + + + + + + + + + python setup.py install + --home + + + hunk ./steps.ml 21 - Sys.chdir target; + chdir target; hunk ./steps.ml 43 - let rec apply url = + let apply url = hunk ./packages/autoconf.xml 1 - - Autoconf - 2.62 - GPL - http://www.gnu.org/software/autoconf/ - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://ftp.gnu.org/gnu/autoconf/autoconf-2.62.tar.bz2 - autoconf-2.62 - e1fb8fe0b22e651240afdfa2be537a3c - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/autoconf.xml hunk ./packages/darcs.xml 1 - - Darcs - 2.0.0 - GPL - http://darcs.net - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://darcs.net/darcs-2.0.0.tar.gz - darcs-2.0.0 - 89e48c2fb388692b78b3cceeb86a95a7 - - - - - - autoconf; ./configure - - - make - - - make install - - - rmfile ./packages/darcs.xml hunk ./packages/gdbm.xml 1 - - Gdbm - 1.8.3 - GPL - - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://ftp.gnu.org/pub/gnu/gdbm/gdbm-1.8.3.tar.gz - gdbm-1.8.3 - 1d1b1d5c0245b1c00aff92da751e9aa1 - - - - - - ./configure - - - make - - - make install - - BINOWN=olivier - BINGRP=olivier - - - - rmfile ./packages/gdbm.xml hunk ./packages/ghc-x11.xml 1 - - Ghc-x11 - darcs - GPL - http://hackage.haskell.org/cgi-bin/hackage-scripts/package/X11 - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://darcs.haskell.org/X11 - X11 - - - - - - autoreconf; runhaskell Setup.hs configure --user - - - runhaskell Setup.hs build - - - runhaskell Setup.hs install - - - rmfile ./packages/ghc-x11.xml hunk ./packages/ghc.xml 1 - - Ghc - 6.8.2 - GPL - http://haskell.org/ghc - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://www.haskell.org/ghc/dist/6.8.2/maeder/ghc-6.8.2-i386-unknown-linux.tar.bz2 - ghc-6.8.2 - bd8c115e027dd74daf96681880dfb9fd - - - - - - ./configure - - - - - make install - - - rmfile ./packages/ghc.xml hunk ./packages/gmp.xml 1 - - Gmp - 2.62 - GPL - http://gmplib.org - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://ftp.gnu.org/gnu/gmp/gmp-4.2.2.tar.bz2 - gmp-4.2.2 - 7ce52531644e6d12f16911b7e3151f3f - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/gmp.xml hunk ./packages/luit.xml 1 - - Luit - 1.0.2 - GPL - http://packages.ubuntu.com/gutsy/luit - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://archive.ubuntu.com/ubuntu/pool/universe/l/luit/luit_1.0.2.orig.tar.gz - luit-1.0.2 - 1acd244a489bae605a03a84d0754fb00 - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/luit.xml hunk ./packages/m4.xml 1 - - M4 - 1.4.11 - GPL - http://www.gnu.org/software/m4/ - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://ftp.gnu.org/gnu/m4/m4-1.4.11.tar.bz2 - m4-1.4.11 - 96ec473c2a6f203976c028e896a01b28 - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/m4.xml hunk ./packages/msmtp.xml 1 - - Msmtp - 1.4.15 - GPL - http://msmtp.sourceforge.net - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://downloads.sourceforge.net/msmtp/msmtp-1.4.15.tar.bz2 - msmtp-1.4.15 - 52dfb3039f4253581292eba8285379c1 - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/msmtp.xml hunk ./packages/mutt.xml 1 - - Mutt - 1.5.18 - GPL - http://www.mutt.org - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz - mutt-1.5.18 - 27c30037120189b9f9c0d3e76361b8f8 - - http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz - http://chadok.info/~oschwand/mutt/patch-1.5.4.vk.pgp_verbose_mime - http://chadok.info/~oschwand/mutt/xtitles - - - - - ./configure - - --enable-compressed - --enable-debug - --enable-fcntl - --enable-hcache - --enable-imap - --enable-smtp - --enable-pop - --with-curses - --with-gnutls - --with-idn - --with-mixmaster - --without-qdbm - --without-bdb - --without-homespool - - - - make - - - make install - - - rmfile ./packages/mutt.xml hunk ./packages/ncurses.xml 1 - - Ncursesw - 5.6 - GPL - ftp://ftp.gnu.org/gnu/ncurses/ - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.6.tar.gz - ncurses-5.6 - b6593abe1089d6aab1551c105c9300e3 - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/ncurses.xml hunk ./packages/ncursesw.xml 1 - - Ncursesw - 5.6 - GPL - ftp://ftp.gnu.org/gnu/ncurses/ - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://ftp.gnu.org/gnu/ncurses/ncurses-5.6.tar.gz - ncurses-5.6 - b6593abe1089d6aab1551c105c9300e3 - - - - - - ./configure - - --enable-widec - - - - make - - - make install - - - rmfile ./packages/ncursesw.xml hunk ./packages/python-progressbar.xml 1 - - Python-progressbar - 2.2 - GPL - http://pypi.python.org/pypi/progressbar/ - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://pypi.python.org/packages/source/p/progressbar/progressbar-2.2.tar.gz - progressbar-2.2/ - - - - - - - - - - - - - python setup.py install - --home - - - rmfile ./packages/python-progressbar.xml hunk ./packages/vim.xml 1 - - Vim - 7.1 - GPL - http://www.vim.org - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://ftp.vim.org/pub/vim/unix/vim-7.1.tar.bz2 - vim71 - 44c6b4914f38d6f9aa959640b89da329 - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/vim.xml hunk ./packages/xmonad-contrib.xml 1 - - Xmonad-contrib - darcs - GPL - http://xmonad.org - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://code.haskell.org/XMonadContrib - XMonadContrib - - - - - - runhaskell Setup.lhs configure --user - - - runhaskell Setup.lhs -v build - - - runhaskell Setup.lhs install - - - rmfile ./packages/xmonad-contrib.xml hunk ./packages/xmonad.xml 1 - - Xmonad - darcs - GPL - http://xmonad.org - - Olivier Schwander - olivier.schwander@ens-lyon.org - - http://code.haskell.org/xmonad - xmonad - - - - - - runhaskell Setup.lhs configure --user - - - runhaskell Setup.lhs build - - - runhaskell Setup.lhs install - - - rmfile ./packages/xmonad.xml hunk ./packages/zsh.xml 1 - - Zsh - 4.2.3 - GPL - http://www.zsh.org/ - - Olivier Schwander - olivier.schwander@ens-lyon.org - - ftp://nephtys.lip6.fr/pub/unix/shells/zsh/zsh-4.2.3.tar.bz2 - zsh-4.2.3 - ae19a74ae7e84cf4dbd8e35f52c8ec74 - - - - - - ./configure - - - make - - - make install - - - rmfile ./packages/zsh.xml rmdir ./packages hunk ./init.ml 21 - to_sring "CPP_INCLUDE_PATH" "include"; + to_sring "CPLUS_INCLUDE_PATH" "include"; addfile ./TODO hunk ./TODO 1 +* TODO afficher une erreur si $LACK est pas défine + hunk ./init.ml 25 + to_string "PKG_CONFIG_PATH" "pkgconfig"; hunk ./init.ml 13 - let to_sring var dir = + let to_string var dir = hunk ./init.ml 17 - to_sring "PATH" "bin"; - to_sring "LD_LIBRARY_PATH" "lib"; - to_sring "LIBRARY_PATH" "lib"; - to_sring "C_INCLUDE_PATH" "include"; - to_sring "CPLUS_INCLUDE_PATH" "include"; - to_sring "MANPATH" "man"; - to_sring "INFOPATH" "info"; - to_sring "PYTHONPATH" "python"; + to_string "PATH" "bin"; + to_string "LD_LIBRARY_PATH" "lib"; + to_string "LIBRARY_PATH" "lib"; + to_string "C_INCLUDE_PATH" "include"; + to_string "CPLUS_INCLUDE_PATH" "include"; + to_string "MANPATH" "man"; + to_string "INFOPATH" "info"; + to_string "PYTHONPATH" "python"; hunk ./init.ml 46 + mkdir (dir^"/"^"pkgconfig"); hunk ./lack.ml 9 -let base = Sys.getenv "LACK" +let base = + try Sys.getenv "LACK" with + Not_found -> (printf "Error: $LACK is not defined\nRun \"eval $(lack-init)\"\n"; exit(1)) hunk ./lack.ml 59 - Log.status quiet (Steps.run_step verbose conf_cmd conf_options conf_prefix base name version); + Log.status quiet (Steps.run verbose conf_cmd conf_options conf_prefix base name version); hunk ./lack.ml 62 - Log.status quiet (Steps.run_step verbose build_cmd build_options build_prefix base name version); + Log.status quiet (Steps.run verbose build_cmd build_options build_prefix base name version); hunk ./lack.ml 65 - Log.status quiet (Steps.run_step verbose install_cmd install_options install_prefix base name version); + Log.status quiet (Steps.run verbose install_cmd install_options install_prefix base name version); hunk ./steps.ml 69 -let run_step verbose cmd options prefix prefix_path name version = +let run verbose cmd options prefix prefix_path name version = hunk ./TODO 1 -* TODO afficher une erreur si $LACK est pas défine +* DONE afficher une erreur si $LACK est pas défine + CLOSED: [2008-10-14 mar 18:02] +* TODO intérpréter $PREFIX dans les commandes +* TOOD gérer les dépendances +* TODO faire marcher scribus +* TODO corriger l'indexation des pages de man hunk ./OMakefile 12 -NATIVE_ENABLED = $(OCAMLOPT_EXISTS) +#NATIVE_ENABLED = $(OCAMLOPT_EXISTS) +NATIVE_ENABLED = false hunk ./OMakefile 15 -BYTE_ENABLED = true +BYTE_ENABLED = $(OCAMLC_EXISTS) hunk ./OMakefile 18 -# OCAMLCFLAGS += +OCAMLCFLAGS += -custom hunk ./OMakefile 39 -# OCAML_LIBS += -# OCAML_CLIBS += -# OCAML_OTHER_LIBS += -# OCAML_LIB_FLAGS += hunk ./lack.ml 14 -let install quiet verbose pkg source = +let install quiet verbose pkg source localfile = hunk ./lack.ml 38 - let file = basename url in + let file = + match localfile with + | None -> basename url + | Some s -> basename s + in hunk ./lack.ml 48 - Log.status quiet (Steps.fetch verbose fetch_cmd url); + Log.status quiet (Steps.fetch verbose fetch_cmd url localfile); hunk ./lack.ml 97 - install quiet !verbose pkg !xml; + if !file = "" then + install quiet !verbose pkg !xml None + else + install quiet !verbose pkg !xml (Some !file); hunk ./steps.ml 24 -let fetch verbose cmd url = - command verbose (cmd^" "^url) +let fetch verbose cmd url file = + match file with + | None -> command verbose (cmd^" "^url) + | Some f -> command verbose ("cp "^f^" .") hunk ./steps.ml 47 - if fetch verbose "wget" url then + if fetch verbose "wget" url None then hunk ./find.ml 5 - let inchan = Unix.open_process_in cmd in + let inchan = print_endline cmd; Unix.open_process_in cmd in hunk ./lack.ml 14 +let date = chomp (slurp "date +%F") + hunk ./lack.ml 18 - let version = pkg.pkg_version in + let version = substitute (total [ ("date", date) ]) pkg.pkg_version in hunk ./utils.ml 22 +let substitute f s = + let b = Buffer.create 0 in + Buffer.add_substitute b f s; + Buffer.contents b + +let total l = + fun x -> + try List.assoc x l with + | Not_found -> "" + +let slurp cmd = + let inchan = Unix.open_process_in cmd in + input_line inchan + +let chomp s = + let n = String.length s in + if s.[n-1] = '\n' then + String.sub s 0 (n-2) + else + s + hunk ./steps.ml 92 - build "man"; + build "man/man1"; + build "man/man2"; + build "man/man3"; + build "man/man4"; + build "man/man5"; + build "man/man6"; + build "man/man7"; + build "man/man8"; + build "man/man9"; hunk ./steps.ml 27 - | Some f -> command verbose ("cp "^f^" .") + | Some f -> command verbose ("cp -r "^f^" .") hunk ./init.ml 42 - ignore (command false ("mkdir -p "^dir)); - mkdir (dir^"/"^"bin"); - mkdir (dir^"/"^"lib"); - mkdir (dir^"/"^"include"); - mkdir (dir^"/"^"pkgconfig"); - mkdir (dir^"/"^"man"); - mkdir (dir^"/"^"info"); - () + ignore (command false ("mkdir -p "^dir)); + List.iter (fun x -> mkdir (dir^"/"^x)) Meta.sources; + () hunk ./meta.ml 35 +let sources = [ + "bin"; + "sbin"; + "lib"; + "include"; + "pkgconfig"; + "man/man1"; + "man/man2"; + "man/man3"; + "man/man4"; + "man/man5"; + "man/man6"; + "man/man7"; + "man/man8"; + "man/man9"; + "info"; + "python"; +] + hunk ./steps.ml 87 - let children = List.flatten [ - build "bin"; - build "lib"; - build "include"; - build "pkgconfig"; - build "man/man1"; - build "man/man2"; - build "man/man3"; - build "man/man4"; - build "man/man5"; - build "man/man6"; - build "man/man7"; - build "man/man8"; - build "man/man9"; - build "info"; - build "python"; - ] - in + let children = List.flatten (List.map build Meta.sources) in hunk ./lack.ml 98 - let pkg = parse !xml in + let pkg = parse !verbose !xml base in hunk ./package.ml 3 +open Utils hunk ./package.ml 160 -let parse file = +let retrieve verbose url base = + let may_http = String.sub url 0 7 in + let may_https = String.sub url 0 8 in + let may_ftp = String.sub url 0 6 in + let filename = Filename.basename url in + chdir base; + (if may_http = "http://" or may_https = "https://" or may_ftp = "ftp://" then + ignore (command verbose ("wget "^url)) + else + ignore (command verbose ("cp "^url^" ."))); + filename + +let parse verbose url base + let file = retrieve verbose url base in hunk ./package.mli 60 -val parse : string -> package +val parse : bool -> string -> string -> package hunk ./package.ml 172 -let parse verbose url base +let parse verbose url base = hunk ./package.ml 172 -let parse verbose url base = +let parse verbose url base hunk ./package.ml 225 -let mutt = { - pkg_name = "mutt"; - pkg_version = "1.5.18"; - pkg_licence = Some "GPL"; - pkg_homepage = Some "http://www.mutt.org"; - pkg_maintainer = Some "Olivier Schwander"; - pkg_maintainer_email = Some "olivier.schwander@ens-lyon.org"; - pkg_url = "ftp://ftp.mutt.org/mutt/devel/mutt-1.5.18.tar.gz"; - pkg_directory = "mutt-1.5.18"; - pkg_fetch_cmd = "wget"; - pkg_extract_cmd = "wget"; - pkg_digest = Some "27c30037120189b9f9c0d3e76361b8f8"; - pkg_patches = [ - "http://www.spinnaker.de/mutt/compressed/patch-1.5.18.rr.compressed.1.gz"; - "http://chadok.info/~oschwand/mutt/patch-1.5.4.vk.pgp_verbose_mime"; - "http://chadok.info/~oschwand/mutt/xtitles"; - ]; - pkg_depends = []; - pkg_conf_options = [ - Arg "--enable-compressed"; - Arg "--enable-debug"; - Arg "--enable-fcntl"; - Arg "--enable-hcache"; - Arg "--enable-imap"; - Arg "--enable-smtp"; - (* Arg "--enable-inodesort"; *) - Arg "--enable-pop"; - Arg "--with-curses"; - Arg "--with-gnutls"; - Arg "--with-idn"; - Arg "--with-mixmaster"; -(* Arg "--with-sasl"; *) - Arg "--without-qdbm"; - Arg "--without-bdb"; - ]; - pkg_conf_cmd = "./configure"; - pkg_conf_prefix = Some (Arg "--prefix"); - pkg_build_cmd = "make"; - pkg_build_options = []; - pkg_build_prefix = None; - pkg_install_cmd = "make install"; - pkg_install_options = []; - pkg_install_prefix = None; -} - - hunk ./package.mli 62 -val mutt : package - hunk ./defaults.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./find.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./init.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./lack-init.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./lack.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./log.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./meta.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./package.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./package.mli 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./parameter.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./parse.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./steps.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./utils.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./version.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + hunk ./package.ml 189 - ignore (command verbose ("wget "^url)) + ignore (command verbose ("wget -N"^url)) hunk ./init.ml 64 - ignore (command false ("mkdir -p "^dir)); + mkdir dir; hunk ./meta.ml 43 - | Xml.Element(var, [], [Xml.PCData value]) -> (var, value) + | Xml.Element("path", attrs, [Xml.PCData value]) -> + let name = List.assoc "name" attrs in + (name, value) hunk ./package.ml 189 - ignore (command verbose ("wget -N"^url)) + ignore (command verbose ("wget -N "^url)) hunk ./steps.ml 102 - let to_xmlnode name = fun value -> Xml.Element(name, [], [Xml.PCData value]) in + let to_xmlnode name = + fun value -> Xml.Element("path", ["name", name], [Xml.PCData value]) + in hunk ./utils.ml 23 -let mkdir d = - Unix.mkdir d 0o755 - hunk ./utils.ml 28 +let mkdir d = + ignore (command false ("mkdir -m 755 -p "^d)) + hunk ./find.ml 25 -let find base tag = - let cmd = sprintf "find %s -wholename */%s/*" base tag in - let inchan = print_endline cmd; Unix.open_process_in cmd in +let find ?(verbose=false) base tag = + let cmd = sprintf "find '%s' -wholename '*/%s/*'" base tag in + let inchan = if verbose then print_endline cmd; Unix.open_process_in cmd in hunk ./package.ml 194 -let parse verbose url base +let parse verbose url base = hunk ./steps.ml 105 - let find = Find.find (prefix^"/"^name^"/"^version) in + let find = Find.find ~verbose:true (prefix^"/"^name^"/"^version) in hunk ./lack.ml 128 - | Package.File_not_found s -> printf "Unable to find the package file %s\n" s - | _ -> printf "Failure !!! Ouch in %s\n" temp; + | Package.File_not_found s -> printf "Unable to find the package file %s\n" s; exit 1 + | _ -> printf "Failure !!! Ouch in %s\n" temp; exit 1 hunk ./version.ml 23 -let version = "0.1" +let version = "0.3.1" hunk ./lack.ml 51 - let conf_prefix = pkg.pkg_conf_prefix in hunk ./lack.ml 54 - let build_prefix = pkg.pkg_build_prefix in hunk ./lack.ml 57 - let install_prefix = pkg.pkg_install_prefix in hunk ./lack.ml 83 + (* We make the difference between configure step and others *) hunk ./lack.ml 85 - Log.status quiet (Steps.run verbose conf_cmd conf_options conf_prefix base name version); + Log.status quiet (Steps.run ~configure:true verbose conf_cmd conf_options base name version); hunk ./lack.ml 88 - Log.status quiet (Steps.run verbose build_cmd build_options build_prefix base name version); + Log.status quiet (Steps.run verbose build_cmd build_options base name version); hunk ./lack.ml 91 - Log.status quiet (Steps.run verbose install_cmd install_options install_prefix base name version); + Log.status quiet (Steps.run verbose install_cmd install_options base name version); hunk ./parameter.ml 27 -let build_args l0 = - let rec aux l acc = - match l with - | [] -> acc - | x::q -> - match x with - | Arg s -> aux q (acc^" "^s) - | Env (s, v) -> Unix.putenv s v; aux q acc - in - aux l0 " " +exception Not_PREFIX hunk ./parameter.ml 29 -let build_prefix param_opt path name version = - let prefix = path^"/"^name^"/"^version in - match param_opt with - | None -> "" - | Some param -> - match param with - | Env (s, _) -> Unix.putenv s path; "" - | Arg s -> s^" "^prefix^" " +(* for compatibility with packages without explicit $PREFIX *) +let prefixed = ref false + +let build_args ?(configure=false) prefix params = + let line = Buffer.create 32 in + let add s = Buffer.add_substitute line + (function "PREFIX" -> prefixed := true; prefix | _ -> raise Not_PREFIX) s in + List.iter (function + | Arg s -> add s + | Env (s, v) -> failwith "Not implemented" (* Unix.putenv s v *) + ) params; + let line = Buffer.contents line in + (* if it is the configure steps, add "--prefix $PREFIX", see prefixed *) + if configure && not !prefixed then + line^" "^(Defaults.give "prefix")^" "^prefix + else + line + +let build_prefix path name version = + path^"/"^name^"/"^version hunk ./steps.ml 93 -let run verbose cmd options prefix prefix_path name version = - let prefix_string = build_prefix prefix prefix_path name version in - let arg_line = build_args options in +let run ?(configure=false) verbose cmd options prefix_path name version = + let prefix = build_prefix prefix_path name version in + let arg_line = build_args ~configure:configure prefix options in hunk ./steps.ml 97 - command verbose (cmd^" "^prefix_string^arg_line) + let cmd = cmd^" "^arg_line in + if verbose then + print_endline cmd; + command verbose cmd hunk ./steps.ml 108 - let find = Find.find ~verbose:true (prefix^"/"^name^"/"^version) in + let find = Find.find ~verbose:verbose (prefix^"/"^name^"/"^version) in hunk ./OMakefile 17 -# OCAMLFLAGS += +OCAMLFLAGS += -warn-error Ax hunk ./package.ml 104 -let get_url l = +let get_url l version = hunk ./package.ml 106 - let value = + let url_value = hunk ./package.ml 114 + let url = substitute (total [ ("version", version) ]) url_value in hunk ./package.ml 117 - value, fetch_cmd, extract_cmd + url, fetch_cmd, extract_cmd hunk ./package.ml 206 - let url, fetch, extract = get_url l in + let url, fetch, extract = get_url l version in hunk ./steps.ml 108 - let find = Find.find ~verbose:verbose (prefix^"/"^name^"/"^version) in + let find = Find.find ~verbose:verbose (prefix^"/"^name^"/current") in hunk ./steps.ml 114 + ignore (command verbose ("ln -s "^prefix^"/"^name^"/"^version^" "^prefix^"/"^name^"/current")); hunk ./lack.ml 43 + let filename = pkg.pkg_file in hunk ./lack.ml 62 - | None -> basename url + | None -> (match filename with + | None -> basename url + | Some s -> s) hunk ./package.ml 59 + pkg_file: string option; hunk ./package.ml 115 - let url = substitute (total [ ("version", version) ]) url_value in + let url_value = substitute (total [ ("version", version) ]) url_value in hunk ./package.ml 118 - url, fetch_cmd, extract_cmd + let file = try Some (Xml.attrib url "filename") with + | Xml.No_attribute _ -> None + in + url_value, fetch_cmd, extract_cmd, file hunk ./package.ml 210 - let url, fetch, extract = get_url l version in + let url, fetch, extract, file = get_url l version in hunk ./package.ml 229 + pkg_file = file; hunk ./package.mli 60 + pkg_file: string option; hunk ./steps.ml 48 - | None -> command verbose (cmd^" "^url) + | None -> command verbose (cmd^" '"^url^"'") hunk ./version.ml 23 -let version = "0.3.1" +let version = "0.4" hunk ./steps.ml 105 - let to_xmlnode name = + let gen_node name = + fun value -> Xml.Element(name, [], [Xml.PCData value]) + in + let gen_path name = hunk ./steps.ml 111 + let path = prefix^"/"^name^"/"^version in hunk ./steps.ml 115 - List.map (to_xmlnode dir) l + List.map (gen_path dir) l hunk ./steps.ml 118 - ignore (command verbose ("ln -s "^prefix^"/"^name^"/"^version^" "^prefix^"/"^name^"/current")); + ignore (command verbose ("ln -s "^path^" "^prefix^"/"^name^"/current")); hunk ./steps.ml 121 - to_xmlnode "name" name; - to_xmlnode "version" version; - to_xmlnode "source" source; + gen_node "name" name; + gen_node "version" version; + gen_node "source" source; hunk ./steps.ml 127 - let file = open_out (prefix^"/"^name^"/"^version^"/meta.xml") in + let file = open_out (path^"/meta.xml") in hunk ./steps.ml 111 - let path = prefix^"/"^name^"/"^version in - let find = Find.find ~verbose:verbose (prefix^"/"^name^"/current") in + let install_path = prefix^"/"^name^"/"^version in + let current_path = prefix^"/"^name^"/"^"/current" in + let find = Find.find ~verbose:verbose current_path in hunk ./steps.ml 119 - ignore (command verbose ("ln -s "^path^" "^prefix^"/"^name^"/current")); + ignore (command verbose ("rm -f "^current_path)); + ignore (command verbose ("ln -s "^install_path^" "^current_path)); hunk ./steps.ml 129 - let file = open_out (path^"/meta.xml") in + let file = open_out (install_path^"/meta.xml") in hunk ./init.ml 60 - () + true hunk ./lack-init.ml 44 - update (Sys.getenv "LACK") - else ( - expose !base; - ) - + ignore (update (Sys.getenv "LACK")) + else + expose !base hunk ./lack.ml 69 - let n = 10 in + let n = 11 in hunk ./lack.ml 102 + Log.task_begin quiet 11 n "Updating packages base..."; + Log.status quiet (Init.update base); + hunk ./lack.ml 130 - Init.update base hunk ./steps.ml 113 - let find = Find.find ~verbose:verbose current_path in + let find = Find.find ~verbose:verbose install_path in hunk ./init.ml 58 + Sys.chdir prefix; hunk ./lack.ml 128 - install quiet !verbose pkg !xml (Some !file); - Sys.chdir base; + install quiet !verbose pkg !xml (Some !file) hunk ./OMakefile 26 + install addfile ./install.ml hunk ./install.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + +open Printf +open Filename + +open Package +open Utils + +let base = + try Sys.getenv "LACK" with + Not_found -> (printf "Error: $LACK is not defined\nRun \"eval $(lack-init)\"\n"; exit(1)) +let temp = temp_dir () + +let date = chomp (slurp "date +%F") + +let install quiet verbose pkg source localfile = + let name = pkg.pkg_name in + let version = substitute (total [ ("date", date) ]) pkg.pkg_version in + + let url = pkg.pkg_url in + let filename = pkg.pkg_file in + let directory = pkg.pkg_directory in + let fetch_cmd = pkg.pkg_fetch_cmd in + let extract_cmd = pkg.pkg_extract_cmd in + let digest = pkg.pkg_digest in + + let patches = pkg.pkg_patches in + + let conf_options = pkg.pkg_conf_options in + let conf_cmd = pkg.pkg_conf_cmd in + + let build_options = pkg.pkg_build_options in + let build_cmd = pkg.pkg_build_cmd in + + let install_options = pkg.pkg_install_options in + let install_cmd = pkg.pkg_install_cmd in + + let file = + match localfile with + | None -> (match filename with + | None -> basename url + | Some s -> s) + | Some s -> basename s + in + let target = Steps.prepare verbose temp base name version fetch_cmd url in + + let n = 11 in + + Log.task_begin quiet 1 n ("Fetching "^url^"..."); + Log.status quiet (Steps.fetch verbose fetch_cmd url localfile); + + Log.task_begin quiet 2 n "Verifying digest..."; + Log.status quiet (Steps.check verbose target url digest file); + + Log.task_begin quiet 3 n "Extracting..."; + Log.status quiet (Steps.extract verbose extract_cmd directory file); + + Log.task_begin quiet 4 n "Patching..."; + Log.status quiet (Steps.patch verbose patches); + +(* Log.task_begin quiet 5 n "Managing dependencies..."; *) +(* Log.status quiet (Steps.dependencies verbose ()); *) + + (* We make the difference between configure step and others *) + Log.task_begin quiet 6 n "Configuring..."; + Log.status quiet (Steps.run ~configure:true verbose conf_cmd conf_options base name version); + + Log.task_begin quiet 7 n "Building..."; + Log.status quiet (Steps.run verbose build_cmd build_options base name version); + + Log.task_begin quiet 8 n "Installing..."; + Log.status quiet (Steps.run verbose install_cmd install_options base name version); + + Log.task_begin quiet 9 n "Registering..."; + Log.status quiet (Steps.register verbose base name version source); + + Log.task_begin quiet 10 n "Cleaning build directory..."; + Log.status quiet (Steps.clean verbose temp); + + Log.task_begin quiet 11 n "Updating packages base..."; + Log.status quiet (Init.update base); + + () + hunk ./lack.ml 28 +open Install hunk ./lack.ml 32 -let base = - try Sys.getenv "LACK" with - Not_found -> (printf "Error: $LACK is not defined\nRun \"eval $(lack-init)\"\n"; exit(1)) -let temp = temp_dir () - -let date = chomp (slurp "date +%F") - -let install quiet verbose pkg source localfile = - let name = pkg.pkg_name in - let version = substitute (total [ ("date", date) ]) pkg.pkg_version in - - let url = pkg.pkg_url in - let filename = pkg.pkg_file in - let directory = pkg.pkg_directory in - let fetch_cmd = pkg.pkg_fetch_cmd in - let extract_cmd = pkg.pkg_extract_cmd in - let digest = pkg.pkg_digest in - - let patches = pkg.pkg_patches in - - let conf_options = pkg.pkg_conf_options in - let conf_cmd = pkg.pkg_conf_cmd in - - let build_options = pkg.pkg_build_options in - let build_cmd = pkg.pkg_build_cmd in - - let install_options = pkg.pkg_install_options in - let install_cmd = pkg.pkg_install_cmd in - - let file = - match localfile with - | None -> (match filename with - | None -> basename url - | Some s -> s) - | Some s -> basename s - in - let target = Steps.prepare verbose temp base name version fetch_cmd url in - - let n = 11 in - - Log.task_begin quiet 1 n ("Fetching "^url^"..."); - Log.status quiet (Steps.fetch verbose fetch_cmd url localfile); - - Log.task_begin quiet 2 n "Verifying digest..."; - Log.status quiet (Steps.check verbose target url digest file); - - Log.task_begin quiet 3 n "Extracting..."; - Log.status quiet (Steps.extract verbose extract_cmd directory file); - - Log.task_begin quiet 4 n "Patching..."; - Log.status quiet (Steps.patch verbose patches); - -(* Log.task_begin quiet 5 n "Managing dependencies..."; *) -(* Log.status quiet (Steps.dependencies verbose ()); *) - - (* We make the difference between configure step and others *) - Log.task_begin quiet 6 n "Configuring..."; - Log.status quiet (Steps.run ~configure:true verbose conf_cmd conf_options base name version); - - Log.task_begin quiet 7 n "Building..."; - Log.status quiet (Steps.run verbose build_cmd build_options base name version); - - Log.task_begin quiet 8 n "Installing..."; - Log.status quiet (Steps.run verbose install_cmd install_options base name version); - - Log.task_begin quiet 9 n "Registering..."; - Log.status quiet (Steps.register verbose base name version source); - - Log.task_begin quiet 10 n "Cleaning build directory..."; - Log.status quiet (Steps.clean verbose temp); - - Log.task_begin quiet 11 n "Updating packages base..."; - Log.status quiet (Init.update base); - - () - hunk ./OMakefile 27 + needs hunk ./install.ml 36 -let install quiet verbose pkg source localfile = +let rec dependencies quiet verbose needs = + let needs = List.map (fun u -> (u, Package.parse verbose u base)) needs in + let needed = List.fold_left (fun acc (u, p) -> + if Needs.test verbose base p then + acc + else + (u, p)::acc + ) [] needs in + List.iter (fun (u, p) -> install quiet verbose p u None) needed; + true + +and install quiet verbose pkg source localfile = hunk ./install.ml 60 + let needs = pkg.pkg_needs in + hunk ./install.ml 81 + let i = ref 1 in + Log.task_begin quiet !i n "Managing dependencies..."; + Log.status quiet (dependencies quiet verbose needs); + i := !i + 1; hunk ./install.ml 86 - Log.task_begin quiet 1 n ("Fetching "^url^"..."); + Log.task_begin quiet !i n ("Fetching "^url^"..."); hunk ./install.ml 88 + i := !i + 1; hunk ./install.ml 90 - Log.task_begin quiet 2 n "Verifying digest..."; + Log.task_begin quiet !i n "Verifying digest..."; hunk ./install.ml 92 + i := !i + 1; hunk ./install.ml 94 - Log.task_begin quiet 3 n "Extracting..."; + Log.task_begin quiet !i n "Extracting..."; hunk ./install.ml 96 + i := !i + 1; hunk ./install.ml 98 - Log.task_begin quiet 4 n "Patching..."; + Log.task_begin quiet !i n "Patching..."; hunk ./install.ml 100 - -(* Log.task_begin quiet 5 n "Managing dependencies..."; *) -(* Log.status quiet (Steps.dependencies verbose ()); *) + i := !i + 1; hunk ./install.ml 103 - Log.task_begin quiet 6 n "Configuring..."; + Log.task_begin quiet !i n "Configuring..."; hunk ./install.ml 105 + i := !i + 1; hunk ./install.ml 107 - Log.task_begin quiet 7 n "Building..."; + Log.task_begin quiet !i n "Building..."; hunk ./install.ml 109 + i := !i + 1; hunk ./install.ml 111 - Log.task_begin quiet 8 n "Installing..."; + Log.task_begin quiet !i n "Installing..."; hunk ./install.ml 113 + i := !i + 1; hunk ./install.ml 115 - Log.task_begin quiet 9 n "Registering..."; + Log.task_begin quiet !i n "Registering..."; hunk ./install.ml 117 + i := !i + 1; hunk ./install.ml 119 - Log.task_begin quiet 10 n "Cleaning build directory..."; + Log.task_begin quiet !i n "Cleaning build directory..."; hunk ./install.ml 121 + i := !i + 1; hunk ./install.ml 123 - Log.task_begin quiet 11 n "Updating packages base..."; + Log.task_begin quiet !i n "Updating packages base..."; hunk ./install.ml 125 + i := !i + 1; hunk ./lack.ml 56 - | _ -> printf "Failure !!! Ouch in %s\n" temp; exit 1 +(* | _ -> printf "Failure !!! Ouch in %s\n" temp; exit 1 *) addfile ./needs.ml hunk ./needs.ml 1 +(**************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify *) +(* it under the terms of the GNU General Public License as published by *) +(* the Free Software Foundation, either version 3 of the License, or *) +(* (at your option) any later version. *) +(* *) +(* Foobar is distributed in the hope that it will be useful, *) +(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) +(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) +(* GNU General Public License for more details. *) +(* *) +(* You should have received a copy of the GNU General Public License *) +(* along with Foobar. If not, see . *) +(* *) +(**************************************************************************) + +open Package +open Utils + +exception Unknown_test + +let test verbose base p = + let (test, kind) = p.pkg_test in + match kind with + | "exec" -> command verbose test + | _ -> raise Unknown_test hunk ./package.ml 30 +exception Invalid_test hunk ./package.ml 68 + pkg_needs: string list; + pkg_test: string * string; hunk ./package.ml 106 +(* return the list of dependencies url *) +let get_needs l = + try + let p = find_node l "needs" in + let f acc x = + match x with + | Xml.Element("url", _, [Xml.PCData(url)]) -> + url::acc + | _ -> acc + in + List.rev (Xml.fold f [] p) + with + Not_found -> [] + +(* get the test to know if the package is present *) +let get_test l = + try + let t = find_node l "test" in + let value = match t with + | Xml.Element("test", _, [Xml.PCData(value)]) -> value + | _ -> raise Invalid_test + in + let kind = try Xml.attrib t "kind" with + | Xml.No_attribute _ -> "exec" + in + value, kind + with + Not_found -> Printf.fprintf stderr "Warning: field 'test' is missing"; ("true", "exec") + hunk ./package.ml 246 + let needs = get_needs l in + let test = get_test l in hunk ./package.ml 271 + pkg_needs = needs; + pkg_test = test; hunk ./package.mli 69 + pkg_needs: string list; + pkg_test: string * string; hunk ./install.ml 32 -let temp = temp_dir () hunk ./install.ml 47 - let name = pkg.pkg_name in - let version = substitute (total [ ("date", date) ]) pkg.pkg_version in + let temp = temp_dir () in + try + let name = pkg.pkg_name in + let version = substitute (total [ ("date", date) ]) pkg.pkg_version in hunk ./install.ml 52 - let url = pkg.pkg_url in - let filename = pkg.pkg_file in - let directory = pkg.pkg_directory in - let fetch_cmd = pkg.pkg_fetch_cmd in - let extract_cmd = pkg.pkg_extract_cmd in - let digest = pkg.pkg_digest in + let url = pkg.pkg_url in + let filename = pkg.pkg_file in + let directory = pkg.pkg_directory in + let fetch_cmd = pkg.pkg_fetch_cmd in + let extract_cmd = pkg.pkg_extract_cmd in + let digest = pkg.pkg_digest in hunk ./install.ml 59 - let patches = pkg.pkg_patches in + let patches = pkg.pkg_patches in hunk ./install.ml 61 - let needs = pkg.pkg_needs in + let needs = pkg.pkg_needs in hunk ./install.ml 63 - let conf_options = pkg.pkg_conf_options in - let conf_cmd = pkg.pkg_conf_cmd in + let conf_options = pkg.pkg_conf_options in + let conf_cmd = pkg.pkg_conf_cmd in hunk ./install.ml 66 - let build_options = pkg.pkg_build_options in - let build_cmd = pkg.pkg_build_cmd in + let build_options = pkg.pkg_build_options in + let build_cmd = pkg.pkg_build_cmd in hunk ./install.ml 69 - let install_options = pkg.pkg_install_options in - let install_cmd = pkg.pkg_install_cmd in + let install_options = pkg.pkg_install_options in + let install_cmd = pkg.pkg_install_cmd in hunk ./install.ml 72 - let file = - match localfile with - | None -> (match filename with - | None -> basename url - | Some s -> s) - | Some s -> basename s - in - let target = Steps.prepare verbose temp base name version fetch_cmd url in + let file = + match localfile with + | None -> (match filename with + | None -> basename url + | Some s -> s) + | Some s -> basename s + in + let target = Steps.prepare verbose temp base name version fetch_cmd url in hunk ./install.ml 81 - let n = 11 in - let i = ref 1 in - Log.task_begin quiet !i n "Managing dependencies..."; - Log.status quiet (dependencies quiet verbose needs); - i := !i + 1; + let n = 11 in + let i = ref 1 in + Log.task_begin name quiet !i n ("Managing dependencies..."); + Log.status quiet (dependencies quiet verbose needs); + i := !i + 1; hunk ./install.ml 87 - Log.task_begin quiet !i n ("Fetching "^url^"..."); - Log.status quiet (Steps.fetch verbose fetch_cmd url localfile); - i := !i + 1; + Log.task_begin name quiet !i n ("Fetching "^url^"..."); + Log.status quiet (Steps.fetch verbose fetch_cmd url localfile (Some target)); + i := !i + 1; hunk ./install.ml 91 - Log.task_begin quiet !i n "Verifying digest..."; - Log.status quiet (Steps.check verbose target url digest file); - i := !i + 1; + Log.task_begin name quiet !i n ("Verifying digest..."); + Log.status quiet (Steps.check verbose target url digest file); + i := !i + 1; hunk ./install.ml 95 - Log.task_begin quiet !i n "Extracting..."; - Log.status quiet (Steps.extract verbose extract_cmd directory file); - i := !i + 1; + Log.task_begin name quiet !i n ("Extracting..."); + Log.status quiet (Steps.extract verbose extract_cmd directory file); + i := !i + 1; hunk ./install.ml 99 - Log.task_begin quiet !i n "Patching..."; - Log.status quiet (Steps.patch verbose patches); - i := !i + 1; + Log.task_begin name quiet !i n ("Patching..."); + Log.status quiet (Steps.patch verbose patches); + i := !i + 1; hunk ./install.ml 103 - (* We make the difference between configure step and others *) - Log.task_begin quiet !i n "Configuring..."; - Log.status quiet (Steps.run ~configure:true verbose conf_cmd conf_options base name version); - i := !i + 1; + (* We make the difference between configure step and others *) + Log.task_begin name quiet !i n ("Configuring..."); + Log.status quiet (Steps.run ~configure:true verbose conf_cmd conf_options base name version); + i := !i + 1; hunk ./install.ml 108 - Log.task_begin quiet !i n "Building..."; - Log.status quiet (Steps.run verbose build_cmd build_options base name version); - i := !i + 1; + Log.task_begin name quiet !i n ("Building..."); + Log.status quiet (Steps.run verbose build_cmd build_options base name version); + i := !i + 1; hunk ./install.ml 112 - Log.task_begin quiet !i n "Installing..."; - Log.status quiet (Steps.run verbose install_cmd install_options base name version); - i := !i + 1; + Log.task_begin name quiet !i n ("Installing..."); + Log.status quiet (Steps.run verbose install_cmd install_options base name version); + i := !i + 1; hunk ./install.ml 116 - Log.task_begin quiet !i n "Registering..."; - Log.status quiet (Steps.register verbose base name version source); - i := !i + 1; + Log.task_begin name quiet !i n ("Registering..."); + Log.status quiet (Steps.register verbose base name version source); + i := !i + 1; hunk ./install.ml 120 - Log.task_begin quiet !i n "Cleaning build directory..."; - Log.status quiet (Steps.clean verbose temp); - i := !i + 1; + Log.task_begin name quiet !i n ("Cleaning build directory..."); + Log.status quiet (Steps.clean verbose base temp); + i := !i + 1; hunk ./install.ml 124 - Log.task_begin quiet !i n "Updating packages base..."; - Log.status quiet (Init.update base); - i := !i + 1; - - () + Log.task_begin name quiet !i n ("Updating packages base..."); + Log.status quiet (Init.update base); + i := !i + 1; hunk ./install.ml 128 + () + with + | e -> printf "Failure !!! Ouch in %s\n" temp; raise e hunk ./lack.ml 56 -(* | _ -> printf "Failure !!! Ouch in %s\n" temp; exit 1 *) - hunk ./log.ml 27 -let task_begin quiet i n name = +let task_begin package quiet i n name = hunk ./log.ml 29 - printf "%i/%i - %s \n%!" i n name + printf "%s: %i/%i - %s \n%!" package i n name hunk ./steps.ml 43 - chdir target; hunk ./steps.ml 45 -let fetch verbose cmd url file = +let fetch verbose cmd url file target = + (match target with + | None -> () + | Some d -> chdir d); hunk ./steps.ml 71 - if fetch verbose "wget" url None then + if fetch verbose "wget" url None None then hunk ./steps.ml 138 -let clean verbose dir = +let clean verbose base dir = + chdir base; changepref boringfile _darcs/prefs/boring hunk ./package.ml 133 - Not_found -> Printf.fprintf stderr "Warning: field 'test' is missing"; ("true", "exec") + Not_found -> Printf.fprintf stderr "Warning: field 'test' is missing\n"; ("true", "exec") hunk ./install.ml 130 - | e -> printf "Failure !!! Ouch in %s\n" temp; raise e + | Log.Failure -> printf "Failure !!! Ouch in %s\n" temp hunk ./steps.ml 98 + let cmd = substitute (total ["PREFIX", prefix;]) cmd in hunk ./steps.ml 100 - let cmd = cmd^" "^arg_line in + let cmd = if arg_line <> "" then cmd^" "^arg_line else cmd in hunk ./find.ml 38 - let cmd = sprintf "find %s -maxdepth 3 -type f -name meta.xml" base in + let cmd = sprintf "ls %s/*/current/meta.xml" base in hunk ./defaults.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./defaults.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./defaults.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./defaults.ml [A-Za-z_0-9] Foobar Lack hunk ./find.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./find.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./find.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./find.ml [A-Za-z_0-9] Foobar Lack hunk ./init.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./init.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./init.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./init.ml [A-Za-z_0-9] Foobar Lack hunk ./install.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./install.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./install.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./install.ml [A-Za-z_0-9] Foobar Lack hunk ./lack-init.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./lack-init.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./lack-init.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) hunk ./lack-init.ml 27 -let usage = sprintf "Lack %s, a package manager for all it lacks on your computer\nRun this program to initializate the lack environment" Version.version +let usage = sprintf "Foobar %s, a package manager for all it lacks on your computer\nRun this program to initializate the lack environment" Version.version replace ./lack-init.ml [A-Za-z_0-9] Foobar Lack hunk ./lack.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./lack.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./lack.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) hunk ./lack.ml 30 -let usage = sprintf "Lack %s, a package manager for all it lacks on your computer" Version.version +let usage = sprintf "Foobar %s, a package manager for all it lacks on your computer" Version.version replace ./lack.ml [A-Za-z_0-9] Foobar Lack hunk ./log.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./log.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./log.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./log.ml [A-Za-z_0-9] Foobar Lack hunk ./meta.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./meta.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./meta.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./meta.ml [A-Za-z_0-9] Foobar Lack hunk ./needs.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./needs.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./needs.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./needs.ml [A-Za-z_0-9] Foobar Lack hunk ./package.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./package.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./package.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./package.ml [A-Za-z_0-9] Foobar Lack hunk ./package.mli 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./package.mli 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./package.mli 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./package.mli [A-Za-z_0-9] Foobar Lack hunk ./parameter.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./parameter.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./parameter.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./parameter.ml [A-Za-z_0-9] Foobar Lack hunk ./parse.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./parse.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./parse.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./parse.ml [A-Za-z_0-9] Foobar Lack hunk ./steps.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./steps.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./steps.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./steps.ml [A-Za-z_0-9] Foobar Lack hunk ./utils.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./utils.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./utils.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./utils.ml [A-Za-z_0-9] Foobar Lack hunk ./version.ml 2 -(* Lack - Package manager for non-root users *) +(* Foobar - Package manager for non-root users *) hunk ./version.ml 6 -(* This file is part of Lack. *) +(* This file is part of Foobar. *) hunk ./version.ml 8 -(* Lack is free software: you can redistribute it and/or modify *) +(* Foobar is free software: you can redistribute it and/or modify *) replace ./version.ml [A-Za-z_0-9] Foobar Lack hunk ./install.ml 72 + let paths = pkg.pkg_paths in + hunk ./install.ml 119 - Log.status quiet (Steps.register verbose base name version source); + Log.status quiet (Steps.register verbose base name version source paths); hunk ./package.ml 82 + + pkg_paths: (string * string) list; hunk ./package.ml 122 +(* returns the paths node if existing *) +let get_paths l = + let p = find_node l "paths" in + let f acc x = + match x with + | Xml.Element("path", _, [Xml.PCData(path)]) -> + let name = Xml.attrib x "name" in + (name, path)::acc + | _ -> acc + in + List.rev (Xml.fold f [] p) + hunk ./package.ml 265 + let paths = get_paths l in hunk ./package.ml 300 + + pkg_paths = paths; hunk ./package.mli 83 + + pkg_paths: (string * string) list; hunk ./steps.ml 107 -let register verbose prefix name version source = +let register verbose prefix name version source paths = hunk ./steps.ml 124 - let children = List.flatten (List.map build Meta.sources) in + let children = + match paths with + | [] -> + List.flatten (List.map build Meta.sources) + | l -> List.map (fun (n, p) -> gen_path n (Filename.concat install_path p)) l + in hunk ./steps.ml 134 - Xml.Element("paths", [], children) + Xml.Element("paths", [], children); hunk ./steps.ml 136 + hunk ./version.ml 23 -let version = "0.4" +let version = "1.1" hunk ./package.ml 99 - let p = find_node l "patches" in - let f acc x = - match x with - | Xml.Element("url", _, [Xml.PCData(url)]) -> - url::acc - | _ -> acc - in - List.rev (Xml.fold f [] p) + try + let p = find_node l "patches" in + let f acc x = + match x with + | Xml.Element("url", _, [Xml.PCData(url)]) -> + url::acc + | _ -> acc + in + List.rev (Xml.fold f [] p) + with + | Not_found -> [] hunk ./package.ml 127 - let p = find_node l "paths" in - let f acc x = - match x with - | Xml.Element("path", _, [Xml.PCData(path)]) -> - let name = Xml.attrib x "name" in - (name, path)::acc - | _ -> acc - in - List.rev (Xml.fold f [] p) + try + let p = find_node l "paths" in + let f acc x = + match x with + | Xml.Element("path", _, [Xml.PCData(path)]) -> + let name = Xml.attrib x "name" in + (name, path)::acc + | _ -> acc + in + List.rev (Xml.fold f [] p) + with + | Not_found -> [] hunk ./OMakefile 44 -LACKINIT_FILES[] = - lack-init - meta - find - parse - defaults - version - utils - init - -LACKINIT_PROGRAM = lack-init - -OCamlProgram($(LACKINIT_PROGRAM), $(LACKINIT_FILES)) - hunk ./OMakefile 47 -all: $(LACK_PROGRAM) $(LACKINIT_PROGRAM) +all: $(LACK_PROGRAM) hunk ./OMakefile 50 + hunk ./init.ml 36 - sprintf "%s=%s/_links/%s:$%s\nexport %s" var base dir var var + sprintf "%s=%s/_links/%s:$%s\nexport %s\n" var base dir var var hunk ./init.ml 50 - List.iter print_endline variables; - printf "LACK=%s\nexport LACK\n" base; + let initfile = open_out (base ^ "/init.sh") in + List.iter (output_string initfile) variables; + fprintf initfile "LACK=%s\nexport LACK\n" base; + close_out initfile; hunk ./init.ml 66 - let dir = !base^"/_links" in + let dir = base^"/_links" in hunk ./lack-init.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) - -open Printf -open Utils -open Init - -let usage = sprintf "Lack %s, a package manager for all it lacks on your computer\nRun this program to initializate the lack environment" Version.version - -let _ = - let is_prepare = ref false in - let is_update = ref false in - let base = ref (Defaults.give "base") in - let arguments = (Arg.align [ - "--prepare", Arg.Set is_prepare , (" Create the lack directory (defaults to "^ !base ^")"); - "--update" , Arg.Set is_update , (" Update lack envirronement using $LACK"); - "--prefix" , Arg.Set_string base, (" Path to lack files (defaults to "^ !base ^")"); - ]) - in - Arg.parse arguments (fun x -> ()) usage; - if !is_prepare then - prepare base - else - if !is_update then - ignore (update (Sys.getenv "LACK")) - else - expose !base rmfile ./lack-init.ml hunk ./lack.ml 37 + let is_prepare = ref false in + let is_update = ref false in + let base = ref "" in hunk ./lack.ml 44 + "--init" , Arg.Set is_prepare , (" Create the lack directory (defaults to "^ !base ^")"); + "--update" , Arg.Set is_update , (" Update lack envirronement using $LACK"); + "--prefix" , Arg.Set_string base, (" Path to lack files (defaults to "^ !base ^")"); hunk ./lack.ml 51 - if !xml = "" then - Arg.usage arguments usage + if !is_prepare then + let base = if !base = "" then Defaults.give "base" else !base in + Init.prepare base; + Init.expose base; + printf "Initialization successful\n"; + printf "Now, add \"source %s/init.sh\" to your ~/.bashrc\n" base; + () hunk ./lack.ml 59 - try - let pkg = parse !verbose !xml base in - if !file = "" then - install quiet !verbose pkg !xml None - else - install quiet !verbose pkg !xml (Some !file) - with - | Package.File_not_found s -> printf "Unable to find the package file %s\n" s; exit 1 + if !is_update then + let base = if !base = "" then Sys.getenv "LACK" else !base in + ignore (Init.update base) + else + if !xml = "" then + Arg.usage arguments usage + else + try + let pkg = parse !verbose !xml !base in + if !file = "" then + install quiet !verbose pkg !xml None + else + install quiet !verbose pkg !xml (Some !file) + with + | Package.File_not_found s -> printf "Unable to find the package file %s\n" s; exit 1 + hunk ./OMakefile 1 -.PHONY: all install clean +.PHONY: all install clean headers hunk ./OMakefile 44 +headers: header $(glob *.ml) $(glob *.mli) + headache -h header *.ml *.mli + hunk ./defaults.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./find.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) addfile ./header hunk ./header 1 +Lack - Package manager for non-root users +(C) 2008-2010 Olivier Schwander +http://chadok.info/lack + +This file is part of Lack. + +Lack is free software: you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your +option) any later version. + +Lack is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +more details. + +You should have received a copy of the GNU General Public License along +with Lack. If not, see . + hunk ./init.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./install.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./lack.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./log.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./meta.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./needs.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./package.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./package.mli 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./parameter.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./parse.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./steps.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./utils.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./version.ml 1 -(**************************************************************************) -(* Lack - Package manager for non-root users *) -(* (C) 2008 Olivier Schwander *) -(* http://chadok.info/lack *) -(* *) -(* This file is part of Lack. *) -(* *) -(* Lack is free software: you can redistribute it and/or modify *) -(* it under the terms of the GNU General Public License as published by *) -(* the Free Software Foundation, either version 3 of the License, or *) -(* (at your option) any later version. *) -(* *) -(* Lack is distributed in the hope that it will be useful, *) -(* but WITHOUT ANY WARRANTY; without even the implied warranty of *) -(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *) -(* GNU General Public License for more details. *) -(* *) -(* You should have received a copy of the GNU General Public License *) -(* along with Lack. If not, see . *) -(* *) -(**************************************************************************) +(******************************************************************************) +(* Lack - Package manager for non-root users *) +(* (C) 2008-2010 Olivier Schwander *) +(* http://chadok.info/lack *) +(* *) +(* This file is part of Lack. *) +(* *) +(* Lack is free software: you can redistribute it and/or modify it under *) +(* the terms of the GNU General Public License as published by the Free *) +(* Software Foundation, either version 3 of the License, or (at your *) +(* option) any later version. *) +(* *) +(* Lack is distributed in the hope that it will be useful, but WITHOUT ANY *) +(* WARRANTY; without even the implied warranty of MERCHANTABILITY or *) +(* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for *) +(* more details. *) +(* *) +(* You should have received a copy of the GNU General Public License along *) +(* with Lack. If not, see . *) +(* *) +(******************************************************************************) hunk ./lack.ml 39 + let is_version = ref false in hunk ./lack.ml 47 + "--version", Arg.Set is_version , (" Display version number"); hunk ./version.ml 23 -let version = "1.1" +let version = "1.5" hunk ./lack.ml 45 - "--init" , Arg.Set is_prepare , (" Create the lack directory (defaults to "^ !base ^")"); - "--update" , Arg.Set is_update , (" Update lack envirronement using $LACK"); + "--init" , Arg.Set is_prepare , (" Create the lack directory (defaults to "^ (Defaults.give "base") ^")"); + "--update" , Arg.Set is_update , (" Update lack environment"); hunk ./lack.ml 48 - "--prefix" , Arg.Set_string base, (" Path to lack files (defaults to "^ !base ^")"); + "--prefix" , Arg.Set_string base, (" Path to lack files (defaults to "^ (Defaults.give "base") ^")"); hunk ./lack.ml 68 + let base = if !base = "" then Sys.getenv "LACK" else !base in hunk ./lack.ml 70 - let pkg = parse !verbose !xml !base in + let pkg = parse !verbose !xml base in hunk ./lack.ml 59 + printf "Moreover, you should probably install the atool package.\n"; addfile ./COPYING hunk ./COPYING 1 + + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + addfile ./INSTALL hunk ./INSTALL 1 +Instruction for installing Lack + +* Precompiled binaries + +As you can hardly rely on a compiler on the target machine there will +always be a precompiled binary available on the Lack homepage. + +* Classical version + +The main branch of Lack uses ocaml, omake, ocamlfind and the xml-light +library, so you will need a working installation of these packages +before compiling Lack. + +So, simply type omake to get a Lack binary and put it somewhere in your +$PATH. + +* All-in-one version + +This version is intended to have the fewer possible dependencies. The +goal is to be able to compile Lack with only an OCaml installation. + +Right now, you still need: + - omake + - ocamlfind + +The xml-light sources are included in the archive. + +Before running omake, you will need to launch omake xml-light to compile +omake. + +I am working on a version which needs only the classical make and does +not use ocamlfind. + addfile ./README hunk ./README 1 +Lack, version 1.5 + +* DESCRIPTION + +Lack is a package manager designed for everyone who is not the root on +his computer. + +Usually, when you miss your favourite software upon the computer +you are using at works, you have three choices: + + - have a kind root who accepts to install the packages + + - hack the root account (don't try the first point after this one) + + - use C<./configure --prefix foo/bar && make && make install> (or + whatever build process) + +So, there is no way to benefit from the power and reliability of a full +featured package manager such as apt. + +Lack intends to fill this lack thanks to simple principles: + + - Anyone can install a package + - + - Anyone can make a package + - + - Anyone can publish packages, there is no central repository + - + - Any distribution can use it, it does not rely on distribution specific tools + - + - It must use the library installed on the host computer, you + don't have to compile everything from the libc on your own + + - It must have the fewest possible build dependancies: ideally, it would be + distributed as a small statically linked binary + + - It must support each possible build process (without patching the sources) + +* INSTALLATION + +See the INSTALL file + +* LICENCE + +This software is released under the terms of the GPLv3 or later. + +* COPYRIGHT + +(C) 2008-2010 Olivier Schwander + hunk ./install.ml 35 -let rec dependencies quiet verbose needs = - let needs = List.map (fun u -> (u, Package.parse verbose u base)) needs in +let rec dependencies quiet verbose needs repos = + let needs = List.map (fun u -> + let u = + if Filename.dirname u = "." then + Filename.concat repos u + else + u + in + (u, Package.parse verbose u base)) needs + in hunk ./install.ml 60 + let repo = pkg.pkg_repo in hunk ./install.ml 95 - Log.status quiet (dependencies quiet verbose needs); + Log.status quiet (dependencies quiet verbose needs repo); hunk ./package.ml 59 + + pkg_repo: string; hunk ./package.ml 241 -let retrieve verbose url base = - let may_http = String.sub url 0 7 in - let may_https = String.sub url 0 8 in - let may_ftp = String.sub url 0 6 in - let filename = Filename.basename url in +let retrieve verbose xml base = + let url = schema xml in hunk ./package.ml 244 - (if may_http = "http://" or may_https = "https://" or may_ftp = "ftp://" then - ignore (command verbose ("wget -N "^url)) - else - ignore (command verbose ("cp "^url^" ."))); - filename + (match url with + | Http url | Https url | Ftp url -> ignore (command verbose ("wget -N "^url)) + | File path -> ignore (command verbose ("cp "^path^" .")) + ); + (Filename.dirname xml, Filename.basename xml) hunk ./package.ml 251 - let file = retrieve verbose url base in + let (repo, file) = retrieve verbose url base in hunk ./package.ml 280 + pkg_repo = repo; hunk ./package.mli 59 + pkg_repo: string; hunk ./utils.ml 23 +type schema = + | Http of string + | Https of string + | Ftp of string + | File of string + +let schema url = + let may_http = String.sub url 0 7 in + let may_https = String.sub url 0 8 in + let may_ftp = String.sub url 0 6 in + if may_http = "http://" then + Http url + else + if may_https = "https://" then + Https url + else + if may_ftp = "ftp://" then + Ftp url + else + if Filename.is_relative url then + File (Filename.concat (Unix.getcwd ()) url) + else + File url +