diff --git a/master_changes.md b/master_changes.md index 12171485718..cf9e1feb909 100644 --- a/master_changes.md +++ b/master_changes.md @@ -70,6 +70,8 @@ users) ## Clean + * Use the [dead_code_analyzer](https://github.com/LexiFi/dead_code_analyzer) to remove unused exported values, fields and constructors [#6954 @fantazio] + ## Env ## Opamfile @@ -210,10 +212,24 @@ users) * `OpamSolution` remove the heuristic of recomputing depexts of additional (pinned) packages. [#6489 @arozovyk] * `OpamClient` update the system package status check for dependencies during `opam install --deps-only`, including support for pinned packages; also update this in `OpamAuxCommands.autopin` [#6489 @arozovyk] * `OpamSolution.get_depexts` remove no longer needed `recover` option that was used with `--depext-only` option [#6489 @arozovyk] + * `OpamAdminCheck`: remove `installability_check`, `cycle_check`, and `get_obsolete` [#6954 @fantazio] + * `OpamArg`: remove `cli2_5`, `escape_path`, `name_list`, `param_list`, `atom_list`, `nonempty_atom_list`, `locked`, `package_with_version`, `atom_or_local`, `atom_or_dir`, `opamlist_columns`, and `scrubbed_environment_variables` [#6954 @fantazio] + * `OpamAuxCommands`: remove `name_and_dir_of_opam_file`, and `resolve_locals` [#6954 @fantazio] + * `OpamCliMain`: remove `check_and_run_external_commands`, `main_catch_all`, `json_out`, and `run` [#6954 @fantazio] + * `OpamClient`: remove `reinstall_t`, `upgrade_t`, and `PIN.post_pin_action` [#6954 @fantazio] + * `OpamClientConfig`: remove `search_files` [#6954 @fantazio] + * `OpamConfigCommand`: remove `parse_whole` [#6954 @fantazio] + * `OpamInitDefaults`: remove `default_compiler`, and `eval_variables` [#6954 @fantazio] + * `OpamListCommand`: remove `field_of_string`, `pattern_selector.ext_fields`, and `selector.Atoms` [#6954 @fantazio] + * `OpamCommand`: remove `update_global_selection` [#6954 @fantazio] + * `OpamSolution`: remove `eq_atom`, and `sum` [#6954 @fantazio] ## opam-repository * `OpamRepositoryPath` was moved to `opam-format` [#6917 @rjbou] * `OpamRepositoryRoot` was added [#6680 @kit-ty-kate @rjbou] + * `OpamRepository`: remove `find_backend` [#6954 @fantazio] + * `OpamRepositoryBackend`: remove `to_json`, `compare`, and `check_digest` [#6954 @fantazio] + * `OpamRepositoryConfig`: remove `E.curl`, and `E.fetch` [#6954 @fantazio] ## opam-state * `OpamStateConfig.t`: replace `no_depexts` fields that contains disabling informations by `depexts` field that returns if the depexts mechanism is enabled. This field is automatically update by global config value in `OpamStateConfig.load_defaults` [#6489 @rjbou] @@ -236,9 +252,21 @@ users) * `OpamUpdate.get_sys_available`: factorize depexts availability computation logic from `OpamUpdate.repositories` [#6489 @arozovyk] * `OpamRepositoryState`: add `syspkgs_available` that returns the stored depext availability status in repository state [#6489 @rjbou] * `OpamSysInteract`: add `available_packages_and_family` that returns availability status and the os family [#6489 @rjbou] + * `OpamEnv`: remove `get_opam`, `get_opam_raw`, `cygwin_non_shadowed_programs`, `path`, `update_user_setup`, `write_static_init_scripts`, and `clear_dynamic_init_scripts` [#6954 @fantazio] + * `OpamFileTools`: remove `lint_string` [#6954 @fantazio] + * `OpamFormatUpgrade`: remove `latest_version` [#6954 @fantazio] + * `OpamGlobalState`: remove `all_installed`, and `unlock` [#6954 @fantazio] + * `OpamRepositoryState`: remove `load_repo`, and `cleanup` [#6954 @fantazio] + * `OpamScript`: remove `prompt` [#6954 @fantazio] + * `OpamStateConfig`: remove `safe_load`, and `load_config_root` [#6954 @fantazio] + * `OpamSwitchState`: remove `get_conflicts_t`, `unlock`, `descr`, `descr_opt`, and `dev_packages` [#6954 @fantazio] + * `OpamUpdate`: remove `dev_package`, `pinned_packages, and `pinned_package` [#6954 @fantazio] + * `OpamStateTypes`: remove `switch_state.invalidated` [#6954 @fantazio] ## opam-solver + * `OpamCudf`: remove `Package.equal`, `Package.compare`, `Package.to_json`, `Package.of_json`, `diff`, `check_request`, `get_final_universe`, `actions_of_diff`, `remove`, `uninstall_all`, `install`, `remove_all_uninstalled_versions_but`, `opam_invariant_package_name`, `opam_deprequest_package_name`, `unavailable_package`, `is_unavailable_package`, `string_of_vpkgs`, `string_of_explanation`, `conflict_cycles`, `string_of_atom`, `string_of_request`, `string_of_universe`, `string_of_packages`, `packages`, `to_cudf`, and `Json` [#6954 @fantazio] + * `OpamSolver`: remove `empty_universe`, `string_of_request`, `solution_to_json`, `solution_of_json`, `cudf_versions_map`, `check_for_conflicts`, and `coinstallability_check` [#6954 @fantazio] ## opam-format * `OpamFile.Descr` was moved to `OpamFile.Descr_legacy` and a simpler `OpamFile.Descr` module was created only containing non-IO functions removing the outdated `descr` file support [#6827 @kit-ty-kate] @@ -254,6 +282,25 @@ users) * `OpamRepositoryPath` was moved from `opam-repository` [#6917 @rjbou] * `OpamRepositoryPath.{root,repo,packages_dir,packages,opam,files,descr,url}: have been moved to a new `OpamRepositoryPath.Make` functor [#6680 @rjbou @kit-ty-kate] * `OpamFilter.expand_interpolations_in_file`: changed argument type from `basename` to `filename` [#6910 @NathanReb] + * `OpamFile.Config`: remove `with_best_effort_prefix`, `with_solver`, and `with_dl_tool` [#6954 @fantazio] + * `OpaFile.InitConfig`: remove `opam_version`, `with_jobs`, `with_dl_jobs`, `with_dl_cache`, `with_solver_criteria`, `with_solver`, and `with_global_variables` [#6954 @fantazio] + * `OpamFile.Descr_legacy`: remove `of_string`, and `full` [#6954 @fantazio] + * `OpamFile.URL`: remove `with_mirrors`, `with_swhid`, `with_subpath`, and `with_subpath_opt` [#6954 @fantazio] + * `OpamFile.Environment`: remove `read`, `read_from_channel`, and `read_from_string` [#6954 @fantazio] + * `OpamFile.Comp`: remove `create_preinstalled`, `opam_version`, `name`, `src`, `configure`, `make`, `make`, `env`, `tags`, `with_src`, `with_patches`, `with_configure`, `with_make`, `with_build`, and `with_packages` [#6954 @fantazio] + * `OpamFile.Dot_installed`: remove `with_bin`, `with_sbin`, `with_lib`, `with_toplevel`, `with_stublibs`, `with_share`, `with_share_root`, `with_etc`, `with_doc`, `with_man`, `with_libexec`, `with_lib_root`, `with_libexec_root`, and `with_misc` [#6954 @fantazio] + * `OpamFile.Dot_config: remove `variables` [#6954 @fantazio] + * `OpamFile.Report`: remove `browse`, `with_browse`, `with_upstream`, `with_announce`, and `with_stamp_opt` [#6954 @fantazio] + * `OpamFile.Syntax`: remove `pp_channel`, `to_channel`, `to_string`, and `to_string_with_preserved_format` [#6954 @fantazio] + * `OpamFilter`: remove `string_interp_regex`, `eval_to_string`, `ident_value`, `ident_bool`, `expand_interpolations_in_file_full`, and `gen_filter_formula` [#6954 @fantazio] + * `OpamFormat`: remove `value_pos`, `V.simple_arg`, `V.group`, `V.map_group`, `V.filter_ident`, `V.package_atom`, `I.file`, `I.item`, and `I.extract_field` [#6954 @fantazio] + * `OpamFormula`: remove `compare_relop`, `compare_version_constraint`, `string_of_disjunction`, `string_of_cnf`, `string_of_dnf`, `compare`, `compare_nc`, `formula_to_cnf`, `dnf_of_formula`, `simplify_ineq_formula`, `to_conjunction`, `of_conjunction`, `to_disjunction`, and `of_disjunction` [#6954 @fantazio] + * `OpamPath`: remove `backup`, `plugins`, `plugin`, `Switch.meta_dirname`, `Switch.extra_file`, `Switch.Default.lib_dir`, `Switch.Default.stublibs`, `Switch.Default.toplevel`, `Switch.Default.doc_dir`, `Switch.Default.share_dir`, `Switch.Default.etc_dir`, `Switch.Default.man_dir`, `Switch.Default.man_dirs`, `Switch.Default.sbin`, `Switch.DefaultF.doc_dir`, `Switch.DefaultF.etc_dir`, and `Switch.DefaultF.man_dirs` [#6954 @fantazio] + * `OpamPp`: remove `ignore` [#6954 @fantazio] + * `OpamSysPkg`: remove `string_of_status`, and `string_of_to_install` [#6954 @fantazio] + * `OpamTypesBase`: remove `map_atomic_action`, `map_highlevel_action`, `map_concrete_action`, `nullify_pos_map`, `pos_best`, `iter_success`, `env_update`, `switch_selections_compare`, `simple_arg_equal`, and `arg_equal` [#6954 @fantazio] + * `OpamTypes`: remove `universe.u_action` [#6954 @fantazio] + * `OpamTypes`: make type `lock` private [#6954 @fantazio] ## opam-core * `OpamCmdliner` was added. It is accessible through a new `opam-core.cmdliner` sub-library [#6755 @kit-ty-kate] @@ -277,3 +324,19 @@ users) * `OpamSystem.in_dir`: removed [#6910 @NathanReb] * `OpamSystem.chdir`: removed [#6910 @NathanReb] * `OpamSystem.{command,commands,read_command_output}`: add a `?dir: dirname` optional arg to launch the command in a specific directory [#6910 @NathanReb] + * `Cmdliner_msg`: remove `pp_try_help` [#6954 @fantazio] + * `Cmdliner_trie`: remove `is_empty` [#6954 @fantazio] + * `OpamCmdliner.Manpage`: remove `title`, `t`, `s_name`, `s_synopsis`, `s_environment_intro`, `s_see_also`, `s_none`, and `print` [#6954 @fantazio] + * `OpamCmdliner.Term`: remove `app`, `map`, `product`, `Syntax`, `term_result`, `term_result'`, `cli_parse_result`, `cli_parse_result'`, `main_name`, `with_used_args`, `exit_info`, `default_exits`, `default_error_exits`, `env_info`, `name`, `eval_choice`, `eval_peek_opts`, `exit_status_success`, `exit_status_cli_error`, `exit_status_internal_error`, `exit_status_of_result`, `exit_status_of_status_result`, `exit`, `exit_status`, `pure`, and `man_format` [#6954 @fantazio] + * `OpamCmdliner.Cmd`: remove `Exit.ok`, `Exit.some_error`, `Exit.cli_error`, `Exit.internal_error`, `Exit.info`, `Exit.info_code`, `Exit.defaults`, `Env.var`, `Env.info`, `eval`, `eval'`, `eval_result`, `eval_result'`, `eval_exit`, `eval_value'`, and `eval_peek_opts` [#6954 @fantazio] + * `OpamCmdliner.Arg`: remove `conv`, `conv'`, `conv_parser`, `conv_printer`, `conv_docv`, `parser_of_kind_of_string`, `some'`, `pos_left`, `last`, `bool`, `char`, `nativeint`, `int32`, `int64`, `float` `file`, `dir`, `non_dir_file`, `array`, `t2`, `t3`, `t4`, `doc_quote`, `doc_alts`, `converter`, `pconv`, `env`, and `env_var` [#6954 @fantazio] + * `OpamConsole`: remove `color`, `utf8_extended`, `acolor`, `acolor_w`, `Symbols.latin_capital_letter_o_with_stroke`, and `Tree.get_default_symbols` [#6954 @fantazio] + * `OpamCoreConfig`: remove `E.confirmlevel`, `E.yes`, `set`, and `setk` [#6954 @fantazio] + * `OpamDirTrack`: remove `is_empty`, and `string_of_change` [#6954 @fantazio] + * `OpamFilename`: remove `env_of_list`, `to_list_dir`, `with_open_out_bin`, `with_tmp_file`, `with_tmp_file_job`, `with_contents`, `copy_in`, `extract_generic_file`, `with_flock_write_then_read`, `Attribute.to_string_list`, and `Attribute.of_string_list` [#6954 @fantazio] + * `OpamHash`: remove `md5`, `sha256`, and `sha512` [#6954 @fantazio] + * `OpamProcess`: remove `is_verbose`, `Job.seq_map`, and `t.p_info` [#6954 @fantazio] + * `OpamSHA`: remove `sha1_file`, `sha256_file`, `sha512_file`, `sha1_string`, `sha256_string`, and `sha512_string` [#6954 @fantazio] + * `OpamSystem`: remove `verbose_for_base_commands`, `get_files`, `files_with_links`, `directories_with_links`, `lock_max`, `register_printer`, and `classify_executable` [#6954 @fantazio] + * `OpamVersion`: remove `major`, `git`, and `message` [#6954 @fantazio] + * `OpamVersionCompare`: remove `equal` [#6954 @fantazio] diff --git a/src/client/opamAdminCheck.ml b/src/client/opamAdminCheck.ml index 57033a1a872..393d9b715a2 100644 --- a/src/client/opamAdminCheck.ml +++ b/src/client/opamAdminCheck.ml @@ -35,7 +35,6 @@ let get_universe opams = let packages = OpamPackage.keys opams in { u_packages = packages; - u_action = Query; u_installed = OpamPackage.Set.empty; u_available = lazy packages; u_depends = diff --git a/src/client/opamAdminCheck.mli b/src/client/opamAdminCheck.mli index d7433babb14..7592f11b176 100644 --- a/src/client/opamAdminCheck.mli +++ b/src/client/opamAdminCheck.mli @@ -10,15 +10,6 @@ open OpamTypes -(** Analyses a given package universe, and returns - [uninstallable_roots,uninstallable]. The first is a subset of the second, - where internal dependents have been removed. *) -val installability_check: universe -> package_set * package_set - -(** Analyses a universe for dependency cycles. Returns the set of packages - involved, and the cycles (reduced to formula lists) *) -val cycle_check: universe -> package_set * formula list list - (** Runs checks on the repository at the given repository. Returns [all_packages], [uninstallable_roots], [uninstallable], [cycle_packages], [obsolete_packages]. If the corresponding option was disabled, the returned @@ -27,7 +18,3 @@ val check: quiet:bool -> installability:bool -> cycles:bool -> obsolete:bool -> OpamRepositoryRoot.Dir.t -> package_set * package_set * package_set * package_set * package_set - -(** Returns a subset of "obsolete" packages, i.e. packages for which a strictly - better version exists *) -val get_obsolete: universe -> OpamFile.OPAM.t package_map -> package_set diff --git a/src/client/opamArg.ml b/src/client/opamArg.ml index a2783006409..69e26ea7bd1 100644 --- a/src/client/opamArg.ml +++ b/src/client/opamArg.ml @@ -1209,15 +1209,6 @@ let formula_flag ?section cli = dependencies in package definition files, e.g. '\"foo\" {>= \"1.1\"}'" dep_formula OpamFormula.Empty -let name_list = - arg_list "PACKAGES" "List of package names." package_name - -let atom_list = - arg_list "PACKAGES" - "List of package names, with an optional version or constraint, \ - e.g `pkg', `pkg.1.0' or `pkg>=0.5'." - atom - let atom_or_local_list = arg_list "PACKAGES" (Printf.sprintf @@ -1234,15 +1225,6 @@ let atom_or_dir_list = description, with explicit directory (e.g. `.%ssrcdir' or `.')" dir_sep) atom_or_dir -let nonempty_atom_list = - nonempty_arg_list "PACKAGES" - "List of package names, with an optional version or constraint, \ - e.g `pkg', `pkg.1.0' or `pkg>=0.5'." - atom - -let param_list = - arg_list "PARAMS" "List of parameters." Arg.string - (* Options common to all commands *) let global_options cli = let section = global_option_section in diff --git a/src/client/opamArg.mli b/src/client/opamArg.mli index 153e58b5330..d36ca301616 100644 --- a/src/client/opamArg.mli +++ b/src/client/opamArg.mli @@ -26,7 +26,6 @@ val cli2_1: OpamCLIVersion.t val cli2_2: OpamCLIVersion.t val cli2_3: OpamCLIVersion.t val cli2_4: OpamCLIVersion.t -val cli2_5: OpamCLIVersion.t (* [cli_from ?platform ?experimental since] validity flag since [since], and no removal version. If [experimental] is true, it is marked as is (warning and @@ -96,9 +95,6 @@ val mk_vflag_all: manpage strings *) val dir_sep: string -(* Escape Windows path *) -val escape_path: string -> string - (** {2 Flags} *) (** --short *) @@ -125,18 +121,6 @@ val jobs_flag: val formula_flag: ?section:string -> OpamCLIVersion.Sourced.t -> formula Term.t -(** package names *) -val name_list: name list Term.t - -(** parameters *) -val param_list: string list Term.t - -(** package list with optional constraints *) -val atom_list: OpamFormula.atom list Term.t - -(** package list with optional constraints *) -val nonempty_atom_list: OpamFormula.atom list Term.t - val atom_or_local_list: [ `Atom of atom | `Filename of filename | `Dirname of dirname ] list Term.t @@ -213,7 +197,6 @@ val subpath: ?section:string -> OpamCLIVersion.Sourced.t -> subpath option Term. val apply_build_options: OpamCLIVersion.Sourced.t -> build_options -> unit (** Lock options *) -val locked: ?section:string -> OpamCLIVersion.Sourced.t -> bool Term.t val lock_suffix: ?section:string -> OpamCLIVersion.Sourced.t -> string Term.t (** Checksum options *) @@ -278,19 +261,9 @@ val package_version: version Arg.conv (** [name{.version}] (or [name=version]) *) val package: (name * version option) Arg.conv -(** [name.version] (or [name=version]) *) -val package_with_version: package Arg.conv - (** [name{(.|=|!=|>|<|>=|<=)version}] converter*) val atom: atom Arg.conv -(** Accepts [atom] but also (explicit) file and directory names *) -val atom_or_local: - [ `Atom of atom | `Filename of filename | `Dirname of dirname ] Arg.conv - -val atom_or_dir: - [ `Atom of atom | `Dirname of dirname ] Arg.conv - (** Formula, in the same format as [depends:] in opam files *) val dep_formula: formula Arg.conv @@ -300,8 +273,6 @@ val variable_bindings: (OpamVariable.t * string) list Arg.conv (** Warnings string ["+3..10-4@12"] *) val warn_selector: (int * [`Enable | `Disable | `EnableError]) list Arg.conv -val opamlist_columns: OpamListCommand.output_format list Arg.conv - val hash_kinds : OpamHash.kind Arg.conv (** {2 Subcommands} *) @@ -384,4 +355,3 @@ val help_sections: OpamCLIVersion.Sourced.t -> Manpage.block list val preinit_opam_env_variables: unit -> unit val init_opam_env_variabes: OpamCLIVersion.Sourced.t -> unit -val scrubbed_environment_variables: string list diff --git a/src/client/opamAuxCommands.mli b/src/client/opamAuxCommands.mli index 167031c5ac4..ff49cb25b32 100644 --- a/src/client/opamAuxCommands.mli +++ b/src/client/opamAuxCommands.mli @@ -29,10 +29,6 @@ val remove_files_from_destdir: 'a switch_state -> dirname -> package_set -> unit suffixing `#current-branch` if no branch/tag/hash was specified. *) val url_with_local_branch: url -> url -(** From an in-source opam file, return the corresponding package name if it can - be found, and the corresponding source directory *) -val name_and_dir_of_opam_file: ?locked:string -> filename -> name option * dirname - (** From a directory, retrieve its opam files and returns packages name, opam file and subpath option *) val opams_of_dir: @@ -49,16 +45,6 @@ val opams_of_dir_w_target: ?same_kind:(OpamUrl.t -> bool) -> OpamUrl.t -> OpamFilename.Dir.t -> name_and_file_w_url list -(** Resolves the opam files and directories in the list to package name and - location, and returns the corresponding pinnings and atoms. May fail and - exit if package names for provided [`Filename] could not be inferred, or if - the same package name appears multiple times. -*) -val resolve_locals: - ?quiet:bool -> ?locked:string -> ?recurse:bool -> ?subpath:subpath -> - [ `Atom of atom | `Filename of filename | `Dirname of dirname ] list -> - name_and_file_w_url list * atom list - (** Resolves the opam files and directories in the list to package name and location, according to what is currently pinned, and returns the corresponding list of atoms. Prints warnings for directories where nothing diff --git a/src/client/opamCliMain.mli b/src/client/opamCliMain.mli index 8384c1a6c4a..1b9dc014ca0 100644 --- a/src/client/opamCliMain.mli +++ b/src/client/opamCliMain.mli @@ -10,27 +10,5 @@ exception InvalidCLI of OpamCLIVersion.Sourced.t -(** Handles calling opam plugins (à la git). E.g. [opam publish] runs - [opam-publish] from PATH, with specific addition of OpamPath.plugins_bin and - the current switch bin directory). - - Note that this does load some configuration and env, but only handles a - leading [--yes] argument. - @raise InvalidCLI *) -val check_and_run_external_commands: - unit -> OpamCLIVersion.Sourced.t * string list - -(** Handles flushing buffers and catching exceptions from the main call, - including special cases like {!OpamStd.Sys.Exec} that is expected to do a - {!Unix.exec}, but after all proper cleanup has been done. *) -val main_catch_all: (unit -> unit) -> unit - -(** Handling of debug JSON output, according to {!OpamClientConfig.json_out} *) -val json_out: unit -> unit - -(** [run default command_list] runs command-line argument parsing and processing - of the command *) -val run: unit -> unit - (** Default entry point with handling of debug finalisers *) val main: unit -> unit diff --git a/src/client/opamClient.mli b/src/client/opamClient.mli index 3e717dc8c0e..f0b7d2fdcb7 100644 --- a/src/client/opamClient.mli +++ b/src/client/opamClient.mli @@ -90,12 +90,6 @@ val check_installed: val reinstall: rw switch_state -> ?assume_built:bool -> atom list -> rw switch_state -(** Low-level version of {!reinstall}, bypassing the package name sanitization - and dev package update, and offering more control *) -val reinstall_t: - rw switch_state -> ?ask:bool -> ?force:bool -> assume_built:bool -> atom list - -> rw switch_state - (** Update the local mirrors for the repositories and/or development packages. Returns [(success, changes, rt)], where [success] is [true] only if all updates were successful, [changes] is true if any upstream had updates, and @@ -114,16 +108,6 @@ val upgrade: ?formula:formula -> ?check:bool -> ?only_installed:bool -> all:bool -> atom list -> rw switch_state -(** Low-level version of {!upgrade}, bypassing the package name sanitization and - dev package update, and offering more control. [terse] avoids the verbose - message when we are at a local maximum, but there are possible upgrades *) -val upgrade_t: - ?strict_upgrade:bool -> ?auto_install:bool -> ?ask:bool -> ?check:bool -> - ?terse:bool -> - ?only_installed:bool -> - all:bool -> atom list -> ?formula:formula -> - rw switch_state -> rw switch_state - (** Recovers from an inconsistent universe *) val fixup: ?formula:formula -> rw switch_state -> rw switch_state @@ -166,9 +150,4 @@ module PIN: sig (** List the current pinned packages. *) val list: 'a switch_state -> short:bool -> unit - (** Runs an install/upgrade on the listed packages if necessary. - [post_pin_action st was_pinned names] takes the set of packages pinned - beforehand, and a list of newly pinned packages *) - val post_pin_action: rw switch_state -> package_set -> name list -> rw switch_state - end diff --git a/src/client/opamClientConfig.ml b/src/client/opamClientConfig.ml index 1127e8f7d99..42506422c74 100644 --- a/src/client/opamClientConfig.ml +++ b/src/client/opamClientConfig.ml @@ -204,8 +204,6 @@ let initk k = let init ?noop:_ = initk (fun () -> ()) -let search_files = ["findlib"] - let opam_init ?root_dir ?strict ?solver = let open OpamStd.Option.Op in diff --git a/src/client/opamClientConfig.mli b/src/client/opamClientConfig.mli index 406f37a93cc..97fa05290a8 100644 --- a/src/client/opamClientConfig.mli +++ b/src/client/opamClientConfig.mli @@ -89,9 +89,6 @@ include OpamStd.Config.Sig with type t := t and type 'a options_fun := 'a options_fun -(** Extra files included in [opam search] *) -val search_files: string list - (** Load the global configuration file (opamroot/config) and initialise all opam sub-libraries, overriding the given arguments *) val opam_init: diff --git a/src/client/opamConfigCommand.ml b/src/client/opamConfigCommand.ml index 0bd9609e524..4ac2eecbb28 100644 --- a/src/client/opamConfigCommand.ml +++ b/src/client/opamConfigCommand.ml @@ -526,11 +526,6 @@ let whole_of_update_op = function | #whole_op as w -> w | _ -> raise Not_found -let parse_whole fv = - let v, upd = parse_update fv in - try v, (whole_of_update_op upd) - with Not_found -> raise (Invalid_argument "parse_whole: append operator") - let global_doc = "global configuration" let switch_doc switch = Printf.sprintf "switch %s" @@ -665,7 +660,7 @@ let allwd_wrappers wdef wrappers with_wrappers = "wrap-install-commands", Wrappers.with_wrap_install, Wrappers.wrap_install; "wrap-remove-commands", - Wrappers.with_pre_remove, Wrappers.pre_remove; + Wrappers.with_wrap_remove, Wrappers.wrap_remove; "post-build-commands", Wrappers.with_post_build, Wrappers.post_build; "post-install-commands", diff --git a/src/client/opamConfigCommand.mli b/src/client/opamConfigCommand.mli index a205bd376a5..45c7a9d60c3 100644 --- a/src/client/opamConfigCommand.mli +++ b/src/client/opamConfigCommand.mli @@ -70,11 +70,6 @@ type update_op = [ append_op | whole_op ] Raise [Invalid_argument] if the string is malformed *) val parse_update: string -> string * update_op -(** As {!parse_update} but parse only overwrites and reverts. String is of the - form [var=[value]]`. - Raise [Invalid_argument] if the string is malformed *) -val parse_whole: string -> string * whole_op - val whole_of_update_op: update_op -> whole_op (** [set_opt_global gt field value] updates global config field with update diff --git a/src/client/opamInitDefaults.mli b/src/client/opamInitDefaults.mli index 797b7d205aa..b8d06f5c2d5 100644 --- a/src/client/opamInitDefaults.mli +++ b/src/client/opamInitDefaults.mli @@ -17,10 +17,6 @@ open OpamTypes (** Url of the default Opam repository *) val repository_url: url -val default_compiler: formula - -val eval_variables: (OpamVariable.t * string list * string) list - val sandbox_wrappers: [> `build of command list | `install of command list diff --git a/src/client/opamListCommand.ml b/src/client/opamListCommand.ml index fa4dacb3f1a..5c1ee9b4d14 100644 --- a/src/client/opamListCommand.ml +++ b/src/client/opamListCommand.ml @@ -45,7 +45,6 @@ type pattern_selector = { exact: bool; glob: bool; fields: string list; - ext_fields: bool; } let default_pattern_selector = { @@ -53,7 +52,6 @@ let default_pattern_selector = { exact = false; glob = true; fields = ["name"; "synopsis"; "descr"; "tags"]; - ext_fields = false; } type selector = @@ -71,7 +69,6 @@ type selector = | Coinstallable_with of dependency_toggles * package list | Solution of dependency_toggles * atom list | Pattern of pattern_selector * string - | Atoms of atom list | Flag of package_flag | NotFlag of package_flag | Tag of string @@ -122,9 +119,6 @@ let string_of_selector = | _ -> fctname in Printf.sprintf "%s(%s)" (fctname % `green) (str % `bold) - | Atoms atoms -> - OpamStd.List.concat_map ~left:"(" ~right:")" " | " - (fun a -> OpamFormula.short_string_of_atom a % `bold) atoms | Flag fl -> Printf.sprintf "%s(%s)" ("has-flag" % `green) (OpamTypesBase.string_of_pkg_flag fl % `bold) @@ -225,7 +219,6 @@ let uses_depexts = function | Pinned | Latests_only | Pattern _ - | Atoms _ | Flag _ | NotFlag _ | Tag _ @@ -336,8 +329,6 @@ let apply_selector ~base st = function (fun nv -> List.exists (OpamStd.String.Set.exists (Re.execp re)) (content_strings nv)) base - | Atoms atoms -> - OpamFormula.packages_of_atoms base atoms | Flag f -> OpamPackage.Set.filter (fun nv -> get_opam st nv |> OpamFile.OPAM.has_flag f) diff --git a/src/client/opamListCommand.mli b/src/client/opamListCommand.mli index 0793d05531d..5cc0db05c31 100644 --- a/src/client/opamListCommand.mli +++ b/src/client/opamListCommand.mli @@ -35,7 +35,6 @@ type pattern_selector = { exact: bool; glob: bool; fields: string list; - ext_fields: bool; (** Match on raw strings in [x-foo] fields *) } val default_pattern_selector: pattern_selector @@ -56,7 +55,6 @@ type selector = | Coinstallable_with of dependency_toggles * package list | Solution of dependency_toggles * atom list | Pattern of pattern_selector * string - | Atoms of atom list | Flag of package_flag | NotFlag of package_flag | Tag of string @@ -129,8 +127,6 @@ val field_names: (output_format * string) list val string_of_field: ?raw:bool -> output_format -> string -val field_of_string: raw:bool -> string -> output_format - type package_listing_format = { short: bool; header: bool; diff --git a/src/client/opamRepositoryCommand.mli b/src/client/opamRepositoryCommand.mli index 110d3f6b299..9d5e323f30c 100644 --- a/src/client/opamRepositoryCommand.mli +++ b/src/client/opamRepositoryCommand.mli @@ -35,12 +35,6 @@ val add: (** Remove a repository from ~/.opam/repos, without updating any selections *) val remove: rw repos_state -> repository_name -> rw repos_state -(** Updates the global switch selection, used as default for switches that don't - specify their selections (e.g. newly created switches) *) -val update_global_selection: - rw global_state -> (repository_name list -> repository_name list) -> - rw global_state - (** Updates the specified selections using the given functions, taking locks as required *) val update_selection: diff --git a/src/client/opamSolution.ml b/src/client/opamSolution.ml index 9696b657594..43bb9164511 100644 --- a/src/client/opamSolution.ml +++ b/src/client/opamSolution.ml @@ -114,9 +114,6 @@ let check_solution ?(quiet=false) st = function if not OpamClientConfig.(!r.show) then OpamStd.Sys.exit_because `Aborted -let sum stats = - stats.s_install + stats.s_reinstall + stats.s_remove + stats.s_upgrade + stats.s_downgrade - let eq_atom name version = name, Some (`Eq, version) diff --git a/src/client/opamSolution.mli b/src/client/opamSolution.mli index f34881202b1..d94353fdde0 100644 --- a/src/client/opamSolution.mli +++ b/src/client/opamSolution.mli @@ -98,9 +98,6 @@ val install_depexts: ?force_depext:bool -> ?confirm:bool -> rw switch_state -> (** {2 Atoms} *) -(** Return an atom with a strict version constraint *) -val eq_atom: name -> version -> atom - (** Return a simple atom, with no version constraint, from a package*) val atom_of_package: package -> atom @@ -131,6 +128,3 @@ val fuzzy_name: 'a switch_state -> name -> name Exits with a message on error. *) val sanitize_atom_list: ?permissive: bool -> ?installed: bool -> 'a switch_state -> atom list -> atom list - -(** {2 Stats} *) -val sum: stats -> int diff --git a/src/core/cmdliner/cmdliner_msg.mli b/src/core/cmdliner/cmdliner_msg.mli index ff6b4f2b977..e5d71b65b6b 100644 --- a/src/core/cmdliner/cmdliner_msg.mli +++ b/src/core/cmdliner/cmdliner_msg.mli @@ -30,7 +30,6 @@ val err_cmd_missing : dom:string list -> string (** {1:msgs Other messages} *) val pp_version : Format.formatter -> Cmdliner_info.Eval.t -> unit -val pp_try_help : Format.formatter -> Cmdliner_info.Eval.t -> unit val pp_err : Format.formatter -> Cmdliner_info.Eval.t -> err:string -> unit val pp_err_usage : Format.formatter -> Cmdliner_info.Eval.t -> err_lines:bool -> err:string -> unit diff --git a/src/core/cmdliner/cmdliner_trie.mli b/src/core/cmdliner/cmdliner_trie.mli index decf409413a..29447f138e0 100644 --- a/src/core/cmdliner/cmdliner_trie.mli +++ b/src/core/cmdliner/cmdliner_trie.mli @@ -11,7 +11,6 @@ type 'a t val empty : 'a t -val is_empty : 'a t -> bool val add : 'a t -> string -> 'a -> [ `New of 'a t | `Replaced of 'a * 'a t ] val find : 'a t -> string -> [ `Ok of 'a | `Ambiguous | `Not_found ] val ambiguities : 'a t -> string -> string list diff --git a/src/core/cmdliner/opamCmdliner.mli b/src/core/cmdliner/opamCmdliner.mli index 7e886cdf857..9f7e73be1d4 100644 --- a/src/core/cmdliner/opamCmdliner.mli +++ b/src/core/cmdliner/opamCmdliner.mli @@ -52,13 +52,6 @@ module Manpage : sig (** [escape s] escapes [s] so that it doesn't get interpreted by the {{!page-tool_man.doclang}documentation markup language}. *) - type title = string * int * string * string * string - (** The type for man page titles. Describes the man page - [title], [section], [center_footer], [left_footer], [center_header]. *) - - type t = title * block list - (** The type for a man page. A title and the page text as a list of blocks. *) - type xref = [ `Main | `Cmd of string | `Tool of string | `Page of string * int ] (** The type for man page cross-references. @@ -76,15 +69,6 @@ module Manpage : sig {{:http://man7.org/linux/man-pages/man7/man-pages.7.html}[man man-pages]} for more elaborations about what sections should contain. *) - val s_name : string - (** The [NAME] section. This section is automatically created by - [Cmdliner] for your. *) - - val s_synopsis : string - (** The [SYNOPSIS] section. By default this section is automatically - created by [Cmdliner] for you, unless it is the first section of - your term's man page, in which case it will replace it with yours. *) - val s_description : string (** The [DESCRIPTION] section. This should be a description of what the tool does and provide a little bit of usage and @@ -114,10 +98,6 @@ module Manpage : sig (** The [ENVIRONMENT] section. By default environment variables get listed here. *) - val s_environment_intro : block - (** [s_environment_intro] is the introduction content used by cmdliner - when it creates the {!s_environment} section. *) - val s_files : string (** The [FILES] section. *) @@ -130,13 +110,6 @@ module Manpage : sig val s_authors : string (** The [AUTHORS] section. *) - val s_see_also : string - (** The [SEE ALSO] section. *) - - val s_none : string - (** [s_none] is a special section named ["cmdliner-none"] that can be used - whenever you do not want something to be listed. *) - (** {1:output Output} The {!print} function can be useful if the client wants to define @@ -151,14 +124,6 @@ module Manpage : sig uses the [`Plain] format.} {- [`Plain], formats to plain text.} {- [`Groff], formats to groff commands.}} *) - - val print : - ?errs:Format.formatter -> - ?subst:(string -> string option) -> format -> Format.formatter -> t -> unit - (** [print ~errs ~subst fmt ppf page] prints [page] on [ppf] in the - format [fmt]. [subst] can be used to perform variable - substitution,(defaults to the identity). [errs] is used to print - formatting errors, it defaults to {!Format.err_formatter}. *) end (** Terms. @@ -181,66 +146,12 @@ module Term : sig (** [f $ v] is a term that evaluates to the result of applying the evaluation of [v] to the one of [f]. *) - val app : ('a -> 'b) t -> 'a t -> 'b t - (** [app] is {!($)}. *) - - val map : ('a -> 'b) -> 'a t -> 'b t - (** [map f t] is [app (const f) t]. *) - - val product : 'a t -> 'b t -> ('a * 'b) t - (** [product t0 t1] is [app (app (map (fun x y -> (x, y)) t0) t1)] *) - - (** [let] operators. *) - module Syntax : sig - val ( let+ ) : 'a t -> ('a -> 'b) -> 'b t - (** [( let+ )] is {!map}. *) - - val ( and+ ) : 'a t -> 'b t -> ('a * 'b) t - (** [( and* )] is {!product}. *) - end - (** {1 Interacting with Cmdliner's evaluation} *) - val term_result : ?usage:bool -> ('a, [`Msg of string]) result t -> 'a t - (** [term_result ~usage t] evaluates to - {ul - {- [`Ok v] if [t] evaluates to [Ok v]} - {- [`Error `Term] with the error message [e] and usage shown according - to [usage] (defaults to [false]), if [t] evaluates to - [Error (`Msg e)].}} - - See also {!term_result'}. *) - - val term_result' : ?usage:bool -> ('a, string) result t -> 'a t - (** [term_result'] is like {!term_result} but with a [string] - error case. *) - - val cli_parse_result : ('a, [`Msg of string]) result t -> 'a t - (** [cli_parse_result t] is a term that evaluates to: - {ul - {- [`Ok v] if [t] evaluates to [Ok v].} - {- [`Error `Parse] with the error message [e] - if [t] evaluates to [Error (`Msg e)].}} - - See also {!cli_parse_result'}. *) - - val cli_parse_result' : ('a, string) result t -> 'a t - (** [cli_parse_result'] is like {!cli_parse_result} but with a [string] - error case. *) - - val main_name : string t - (** [main_name] is a term that evaluates to the main command name; - that is the name of the tool. *) - val choice_names : string list t (** [choice_names] is a term that evaluates to the names of the commands that are children of the main command. *) - val with_used_args : 'a t -> ('a * string list) t - (** [with_used_args t] is a term that evaluates to [t] tupled - with the arguments from the command line that where used to - evaluate [t]. *) - type 'a ret = [ `Help of Manpage.format * string option | `Error of (bool * string) @@ -279,50 +190,10 @@ module Term : sig [@@ocaml.deprecated "Use Cmd.Exit.info instead."] (** The type for exit status information. *) - val exit_info : ?docs:string -> ?doc:string -> ?max:int -> int -> exit_info - [@@ocaml.deprecated "Use Cmd.Exit.info instead."] - (** [exit_info ~docs ~doc min ~max] describe the range of exit - statuses from [min] to [max] (defaults to [min]). [doc] is the - man page information for the statuses, defaults to ["undocumented"]. - [docs] is the title of the man page section in which the statuses - will be listed, it defaults to {!Manpage.s_exit_status}. - - In [doc] the {{!page-tool_man.doclang}documentation markup language} - can be used with following variables: - {ul - {- [$(status)], the value of [min].} - {- [$(status_max)], the value of [max].} - {- The variables mentioned in {!val-info}}} *) - - val default_exits : exit_info list - [@@ocaml.deprecated - "Use Cmd.Exit.defaults or Cmd.info's defaults ~exits value instead."] - (** [default_exits] is information for exit status {!exit_status_success} - added to {!default_error_exits}. *) - - val default_error_exits : exit_info list - [@@ocaml.deprecated "List.filter the Cmd.Exit.defaults value instead."] - (** [default_error_exits] is information for exit statuses - {!exit_status_cli_error} and {!exit_status_internal_error}. *) - type env_info [@@ocaml.deprecated "Use Cmd.Env.info instead."] (** The type for environment variable information. *) - val env_info : ?docs:string -> ?doc:string -> string -> env_info - [@@ocaml.deprecated "Use Cmd.Env.info instead."] - (** [env_info ~docs ~doc var] describes an environment variable - [var]. [doc] is the man page information of the environment - variable, defaults to ["undocumented"]. [docs] is the title of - the man page section in which the environment variable will be - listed, it defaults to {!Cmdliner.Manpage.s_environment}. - - In [doc] the {{!page-tool_man.doclang}documentation markup language} - can be used with following variables: - {ul - {- [$(env)], the value of [var].} - {- The variables mentioned in {!val-info}}} *) - type info [@@ocaml.deprecated "Use Cmd.info instead."] (** The type for term information. *) @@ -361,10 +232,6 @@ module Term : sig {- [$(tname)] the term's name.} {- [$(mname)] the main term's name.}} *) - val name : info -> string - [@@ocaml.deprecated "Use Cmd.name instead."] - (** [name ti] is the name of the term information. *) - (** {2:evaluation Evaluation} *) type 'a result = @@ -401,51 +268,6 @@ module Term : sig [env] is used for environment variable lookup, the default uses {!Sys.getenv}. *) - val eval_choice : - ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> - ?env:(string -> string option) -> ?argv:string array -> - 'a t * info -> ('a t * info) list -> 'a result - [@@ocaml.deprecated "Use Cmd.group and one of Cmd.eval* instead."] - (** [eval_choice help err catch argv (t,i) choices] is like {!eval} - except that if the first argument on the command line is not an option - name it will look in [choices] for a term whose information has this - name and evaluate it. - - If the command name is unknown an error is reported. If the name - is unspecified the "main" term [t] is evaluated. [i] defines the - name and man page of the program. *) - - val eval_peek_opts : - ?version_opt:bool -> ?env:(string -> string option) -> - ?argv:string array -> 'a t -> 'a option * 'a result - [@@ocaml.deprecated "Use Cmd.eval_peek_opts instead."] - (** [eval_peek_opts version_opt argv t] evaluates [t], a term made - of optional arguments only, with the command line [argv] - (defaults to {!Sys.argv}). In this evaluation, unknown optional - arguments and positional arguments are ignored. - - The evaluation returns a pair. The first component is - the result of parsing the command line [argv] stripped from - any help and version option if [version_opt] is [true] (defaults - to [false]). It results in: - {ul - {- [Some _] if the command line would be parsed correctly given the - {e partial} knowledge in [t].} - {- [None] if a parse error would occur on the options of [t]}} - - The second component is the result of parsing the command line - [argv] without stripping the help and version options. It - indicates what the evaluation would result in on [argv] given - the partial knowledge in [t] (for example it would return - [`Help] if there's a help option in [argv]). However in - contrasts to {!eval} and {!eval_choice} no side effects like - error reporting or help output occurs. - - {b Note.} Positional arguments can't be peeked without the full - specification of the command line: we can't tell apart a - positional argument from the value of an unknown optional - argument. *) - (** {2:exits Turning evaluation results into exit codes} {b Note.} If you are using the following functions to handle @@ -456,55 +278,6 @@ module Term : sig as those may be used by {{:https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html} some} shells. *) - - val exit_status_success : int - [@@ocaml.deprecated "Use Cmd.Exit.ok instead."] - (** [exit_status_success] is 0, the exit status for success. *) - - val exit_status_cli_error : int - [@@ocaml.deprecated "Use Cmd.Exit.cli_error instead."] - (** [exit_status_cli_error] is 124, an exit status for command line - parsing errors. *) - - val exit_status_internal_error : int - [@@ocaml.deprecated "Use Cmd.Exit.internal_error instead."] - (** [exit_status_internal_error] is 125, an exit status for unexpected - internal errors. *) - - val exit_status_of_result : ?term_err:int -> unit result -> int - [@@ocaml.deprecated "Use Cmd.eval instead."] - (** [exit_status_of_result ~term_err r] is an [exit(3)] status - code determined from [r] as follows: - {ul - {- {!exit_status_success} if [r] is one of [`Ok ()], [`Version], [`Help]} - {- [term_err] if [r] is [`Error `Term], [term_err] defaults to [1].} - {- {!exit_status_cli_error} if [r] is [`Error `Parse]} - {- {!exit_status_internal_error} if [r] is [`Error `Exn]}} *) - - val exit_status_of_status_result : ?term_err:int -> int result -> int - [@@ocaml.deprecated "Use Cmd.eval' instead."] - (** [exit_status_of_status_result] is like {!exit_status_of_result} - except for [`Ok n] where [n] is used as the status exit code. *) - - val exit : ?term_err:int -> unit result -> unit - [@@ocaml.deprecated "Use Stdlib.exit and Cmd.eval instead."] - (** [exit ~term_err r] is - [Stdlib.exit @@ exit_status_of_result ~term_err r] *) - - val exit_status : ?term_err:int -> int result -> unit - [@@ocaml.deprecated "Use Stdlib.exit and Cmd.eval' instead."] - (** [exit_status ~term_err r] is - [Stdlib.exit @@ exit_status_of_status_result ~term_err r] *) - - (**/**) - val pure : 'a -> 'a t - [@@ocaml.deprecated "Use Term.const instead."] - (** @deprecated use {!const} instead. *) - - val man_format : Manpage.format t - [@@ocaml.deprecated "Use Arg.man_format instead."] - (** @deprecated Use {!Arg.man_format} instead. *) - (**/**) end (** Commands. @@ -535,80 +308,21 @@ module Cmd : sig {{:https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html} some} shells. *) - val ok : code - (** [ok] is [0], the exit status for success. *) - - val some_error : code - (** [some_error] is [123], an exit status for indisciminate errors - reported on stderr. *) - - val cli_error : code - (** [cli_error] is [124], an exit status for command line parsing - errors. *) - - val internal_error : code - (** [internal_error] is [125], an exit status for unexpected internal - errors. *) - (** {1:info Exit code information} *) type info (** The type for exit code information. *) - - val info : ?docs:string -> ?doc:string -> ?max:code -> code -> info - (** [exit_info ~docs ~doc min ~max] describe the range of exit - statuses from [min] to [max] (defaults to [min]). [doc] is the - man page information for the statuses, defaults to ["undocumented"]. - [docs] is the title of the man page section in which the statuses - will be listed, it defaults to {!Manpage.s_exit_status}. - - In [doc] the {{!page-tool_man.doclang}documentation markup language} - can be used with following variables: - {ul - {- [$(status)], the value of [min].} - {- [$(status_max)], the value of [max].} - {- The variables mentioned in the {!Cmd.val-info}}} *) - - val info_code : info -> code - (** [info_code i] is the minimal code of [i]. *) - - val defaults : info list - (** [defaults] are exit code information for {!ok}, {!some_error} - {!cli_error} and {!internal_error}. *) end (** Environment variable and their information. *) module Env : sig - (** {1:envvars Environment variables} *) - - type var = string - (** The type for environment names. *) - (** {1:info Environment variable information} *) [@@@alert "-deprecated"] type info = Term.env_info (* because of Arg. *) (** The type for environment variable information. *) [@@@alert "+deprecated"] - - val info : ?deprecated:string -> ?docs:string -> ?doc:string -> var -> info - (** [info ~docs ~doc var] describes an environment variable - [var] such that: - {ul - {- [doc] is the man page information of the environment - variable, defaults to ["undocumented"].} - {- [docs] is the title of the man page section in which the environment - variable will be listed, it defaults to - {!Cmdliner.Manpage.s_environment}.} - {- [deprecated], if specified the environment is deprecated and the - string is a message output on standard error when the environment - variable gets used to lookup the default value of an argument.}} - In [doc] the {{!page-tool_man.doclang}documentation markup language} - can be used with following variables: - {ul - {- [$(env)], the value of [var].} - {- The variables mentioned in {!val-info}.}} *) end type info @@ -688,42 +402,6 @@ module Cmd : sig These exit codes are described in {!Exit.defaults} which is the default value of the [?exits] argument of function {!val-info}. *) - val eval : - ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> - ?env:(string -> string option) -> ?argv:string array -> - ?term_err:Exit.code -> unit t -> Exit.code - (** [eval cmd] is {!Exit.ok} if [cmd] evaluates to [()]. - See {!eval_value} for other arguments. *) - - val eval' : - ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> - ?env:(string -> string option) -> ?argv:string array -> - ?term_err:Exit.code -> Exit.code t -> Exit.code - (** [eval' cmd] is [c] if [cmd] evaluates to the exit code [c]. - See {!eval_value} for other arguments. *) - - val eval_result : - ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> - ?env:(string -> string option) -> ?argv:string array -> - ?term_err:Exit.code -> (unit, string) result t -> Exit.code - (** [eval_result cmd] is: - {ul - {- {!Exit.ok} if [cmd] evaluates to [Ok ()].} - {- {!Exit.some_error} if [cmd] evaluates to [Error msg]. In this - case [msg] is printed on [err].}} - See {!eval_value} for other arguments. *) - - val eval_result' : - ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> - ?env:(string -> string option) -> ?argv:string array -> - ?term_err:Exit.code -> (Exit.code, string) result t -> Exit.code - (** [eval_result' cmd] is: - {ul - {- [c] if [cmd] evaluates to [Ok c].} - {- {!Exit.some_error} if [cmd] evaluates to [Error msg]. In this - case [msg] is printed on [err].}} - See {!eval_value} for other arguments. *) - (** {2:eval_low Low level evaluation} This interface gives more information on command evaluation results @@ -741,10 +419,6 @@ module Cmd : sig | `Exn (** An uncaught exception occurred. *) ] (** The type for erroring evaluation results. *) - type 'a eval_exit = - [ `Ok of 'a (** The term of the command evaluated to this value. *) - | `Exit of Exit.code (** The evaluation wants to exit with this code. *) ] - val eval_value : ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> ?env:(string -> string option) -> ?argv:string array -> 'a t -> @@ -763,45 +437,6 @@ module Cmd : sig {- [err] is the formatter used to print error messages (defaults to {!Format.err_formatter}).}} *) - val eval_value' : - ?help:Format.formatter -> ?err:Format.formatter -> ?catch:bool -> - ?env:(string -> string option) -> ?argv:string array -> ?term_err:int -> - 'a t -> 'a eval_exit - (** [eval_value'] is like {!eval_value}, but if the command term - does not evaluate, returns an exit code like the - {{!eval}evaluation} function do (which can be {!Exit.ok} in case - help or version was requested). *) - - val eval_peek_opts : - ?version_opt:bool -> ?env:(string -> string option) -> - ?argv:string array -> 'a Term.t -> - 'a option * ('a eval_ok, eval_error) result - (** [eval_peek_opts version_opt argv t] evaluates [t], a term made - of optional arguments only, with the command line [argv] - (defaults to {!Sys.argv}). In this evaluation, unknown optional - arguments and positional arguments are ignored. - - The evaluation returns a pair. The first component is - the result of parsing the command line [argv] stripped from - any help and version option if [version_opt] is [true] (defaults - to [false]). It results in: - {ul - {- [Some _] if the command line would be parsed correctly given the - {e partial} knowledge in [t].} - {- [None] if a parse error would occur on the options of [t]}} - - The second component is the result of parsing the command line - [argv] without stripping the help and version options. It - indicates what the evaluation would result in on [argv] given - the partial knowledge in [t] (for example it would return - [`Help] if there's a help option in [argv]). However in - contrasts to {!val-eval_value} no side effects like error - reporting or help output occurs. - - {b Note.} Positional arguments can't be peeked without the full - specification of the command line: we can't tell apart a - positional argument from the value of an unknown optional - argument. *) end (** Terms for command line arguments. @@ -837,47 +472,6 @@ module Arg : sig This type will become abstract in the next major version of cmdliner. *) [@@@alert "+deprecated"] (* Need to be able to mention them ! *) - val conv : - ?docv:string -> (string -> ('a, [`Msg of string]) result) * 'a printer -> - 'a conv - (** [conv ~docv (parse, print)] is an argument converter - parsing values with [parse] and printing them with - [print]. [docv] is a documentation meta-variable used in the - documentation to stand for the argument value, defaults to - ["VALUE"]. *) - - val conv' : - ?docv:string -> (string -> ('a, string) result) * 'a printer -> - 'a conv - (** [conv'] is like {!val-conv} but the [Error] case has an unlabelled - string. *) - - val conv_parser : 'a conv -> (string -> ('a, [`Msg of string]) result) - (** [conv_parser c] is the parser of [c]. *) - - val conv_printer : 'a conv -> 'a printer - (** [conv_printer c] is the printer of [c]. *) - - val conv_docv : 'a conv -> string - (** [conv_docv c] is [c]'s documentation meta-variable. - - {b Warning.} Currently always returns ["VALUE"] in the future - will return the value given to {!val-conv} or {!val-conv'}. *) - - val parser_of_kind_of_string : - kind:string -> (string -> 'a option) -> - (string -> ('a, [`Msg of string]) result) - (** [parser_of_kind_of_string ~kind kind_of_string] is an argument - parser using the [kind_of_string] function for parsing and [kind] - to report errors (e.g. could be ["an integer"] for an [int] parser.). *) - - val some' : ?none:'a -> 'a conv -> 'a option conv - (** [some' ?none c] is like the converter [c] except it returns - [Some] value. It is used for command line arguments that default - to [None] when absent. If provided, [none] is used with [conv]'s - printer to document the value taken on absence; to document - a more complex behaviour use the [absent] argument of {!val-info}. *) - val some : ?none:string -> 'a conv -> 'a option conv (** [some ?none c] is like [some'] but [none] is described as a string that will be rendered in bold. *) @@ -1022,16 +616,6 @@ module Arg : sig all the positional arguments of the command line as converted by [c] or [v] if there are none. *) - val pos_left : - ?rev:bool -> int -> 'a conv -> 'a list -> info -> 'a list t - (** [pos_left rev n c v i] is an ['a list] argument that holds - all the positional arguments as converted by [c] found on the left - of the [n]th positional argument or [v] if there are none. - - If [rev] is [true] (defaults to [false]), the computed - position is [max-n] where [max] is the position of - the last positional argument present on the command line. *) - val pos_right : ?rev:bool -> int -> 'a conv -> 'a list -> info -> 'a list t (** [pos_right] is like {!pos_left} except it holds all the positional @@ -1054,12 +638,6 @@ module Arg : sig evaluates to [a]'s list otherwise. Use this for non empty lists of positional arguments. *) - val last : 'a list t -> 'a Term.t - (** [last a] is a term that fails if [a]'s list is empty and evaluates - to the value of the last element of the list otherwise. Use this - for lists of flags or options where the last occurrence takes precedence - over the others. *) - (** {1:predef Predefined arguments} *) val man_format : Manpage.format Term.t @@ -1068,27 +646,9 @@ module Arg : sig (** {1:converters Predefined converters} *) - val bool : bool conv - (** [bool] converts values with {!bool_of_string}. *) - - val char : char conv - (** [char] converts values by ensuring the argument has a single char. *) - val int : int conv (** [int] converts values with {!int_of_string}. *) - val nativeint : nativeint conv - (** [nativeint] converts values with {!Nativeint.of_string}. *) - - val int32 : int32 conv - (** [int32] converts values with {!Int32.of_string}. *) - - val int64 : int64 conv - (** [int64] converts values with {!Int64.of_string}. *) - - val float : float conv - (** [float] converts values with {!float_of_string}. *) - val string : string conv (** [string] converts values with the identity function. *) @@ -1100,66 +660,17 @@ module Arg : sig @raise Invalid_argument if [l] is empty. *) - val file : string conv - (** [file] converts a value with the identity function and - checks with {!Sys.file_exists} that a file with that name exists. *) - - val dir : string conv - (** [dir] converts a value with the identity function and checks - with {!Sys.file_exists} and {!Sys.is_directory} - that a directory with that name exists. *) - - val non_dir_file : string conv - (** [non_dir_file] converts a value with the identity function and checks - with {!Sys.file_exists} and {!Sys.is_directory} - that a non directory file with that name exists. *) - val list : ?sep:char -> 'a conv -> 'a list conv (** [list sep c] splits the argument at each [sep] (defaults to [',']) character and converts each substrings with [c]. *) - val array : ?sep:char -> 'a conv -> 'a array conv - (** [array sep c] splits the argument at each [sep] (defaults to [',']) - character and converts each substring with [c]. *) - val pair : ?sep:char -> 'a conv -> 'b conv -> ('a * 'b) conv (** [pair sep c0 c1] splits the argument at the {e first} [sep] character (defaults to [',']) and respectively converts the substrings with [c0] and [c1]. *) - val t2 : ?sep:char -> 'a conv -> 'b conv -> ('a * 'b) conv - (** {!t2} is {!pair}. *) - - val t3 : ?sep:char -> 'a conv ->'b conv -> 'c conv -> ('a * 'b * 'c) conv - (** [t3 sep c0 c1 c2] splits the argument at the {e first} two [sep] - characters (defaults to [',']) and respectively converts the - substrings with [c0], [c1] and [c2]. *) - - val t4 : - ?sep:char -> 'a conv -> 'b conv -> 'c conv -> 'd conv -> - ('a * 'b * 'c * 'd) conv - (** [t4 sep c0 c1 c2 c3] splits the argument at the {e first} three [sep] - characters (defaults to [',']) respectively converts the substrings - with [c0], [c1], [c2] and [c3]. *) - (** {1:doc_helpers Documentation formatting helpers} *) - val doc_quote : string -> string - (** [doc_quote s] quotes the string [s]. *) - - val doc_alts : ?quoted:bool -> string list -> string - (** [doc_alts alts] documents the alternative tokens [alts] - according the number of alternatives. If [quoted] is: - {ul - {- [None], the tokens are enclosed in manpage markup directives - to render them in bold (manpage convention).} - {- [Some true], the tokens are quoted with {!doc_quote}.} - {- [Some false], the tokens are written as is}} - The resulting string can be used in sentences of - the form ["$(docv) must be %s"]. - - @raise Invalid_argument if [alts] is the empty list. *) - val doc_alts_enum : ?quoted:bool -> (string * 'a) list -> string (** [doc_alts_enum quoted alts] is [doc_alts quoted (List.map fst alts)]. *) @@ -1167,24 +678,4 @@ module Arg : sig [@@@alert "-deprecated"] - type 'a converter = 'a conv - [@@ocaml.deprecated "Use Arg.conv' function instead."] - (** See {!Arg.conv'}. *) - - val pconv : - ?docv:string -> 'a parser * 'a printer -> 'a conv - [@@ocaml.deprecated "Use Arg.conv or Arg.conv' function instead."] - (** [pconv] is like {!val-conv} or {!val-conv'}, but uses a - deprecated {!parser} signature. *) - - - type env = Cmd.Env.info - [@@ocaml.deprecated "Use Cmd.Env.info instead."] - (** See {!Cmd.Env.type-info} *) - - val env_var : - ?deprecated:string -> ?docs:string -> ?doc:string -> Cmd.Env.var -> - Cmd.Env.info - [@@ocaml.deprecated "Use Cmd.Env.info instead."] - (** See {!Cmd.Env.val-info}. *) end diff --git a/src/core/opamConsole.ml b/src/core/opamConsole.ml index e0af36f6c38..01da158a6cb 100644 --- a/src/core/opamConsole.ml +++ b/src/core/opamConsole.ml @@ -97,7 +97,6 @@ module Symbols = struct let south_east_arrow = Uchar.of_int 0x2198 let clockwise_open_circle_arrow = Uchar.of_int 0x21bb let greek_small_letter_lambda = Uchar.of_int 0x03bb - let latin_capital_letter_o_with_stroke = Uchar.of_int 0x00d8 let six_pointed_black_star = Uchar.of_int 0x2736 let upwards_arrow = Uchar.of_int 0x2191 let downwards_arrow = Uchar.of_int 0x2193 diff --git a/src/core/opamConsole.mli b/src/core/opamConsole.mli index d0a09b33b9f..c27fb21f445 100644 --- a/src/core/opamConsole.mli +++ b/src/core/opamConsole.mli @@ -16,9 +16,7 @@ val debug: unit -> bool val verbose: unit -> bool -val color: unit -> bool val utf8: unit -> bool -val utf8_extended: unit -> bool val disp_status_line: unit -> bool (** General text formatting *) @@ -42,8 +40,6 @@ type text_style = disabled *) val colorise : text_style -> string -> string val colorise' : text_style list -> string -> string -val acolor : text_style -> unit -> string -> string -val acolor_w : int -> text_style -> Format.formatter -> string -> unit module Symbols : sig val rightwards_arrow : Uchar.t @@ -58,7 +54,6 @@ module Symbols : sig val south_east_arrow : Uchar.t val clockwise_open_circle_arrow : Uchar.t val greek_small_letter_lambda : Uchar.t - val latin_capital_letter_o_with_stroke : Uchar.t val six_pointed_black_star : Uchar.t val upwards_arrow : Uchar.t val downwards_arrow : Uchar.t @@ -168,9 +163,6 @@ module Tree : sig hook: string; (** '- *) } - (** Returns UTF8 or ASCII tree symbols depending on [utf8 ()]. *) - val get_default_symbols: unit -> symbols - (** Prints the given tree as a Unicode/ASCII art. @param printer may return a multi-line string, but should not return an empty string. *) diff --git a/src/core/opamCoreConfig.ml b/src/core/opamCoreConfig.ml index d34c2b2ed14..f342338036e 100644 --- a/src/core/opamCoreConfig.ml +++ b/src/core/opamCoreConfig.ml @@ -163,8 +163,6 @@ let setk k t in_opam = t.in_opam; } -let set t = setk (fun x () -> x) t - (* Global configuration reference *) let r = ref default diff --git a/src/core/opamCoreConfig.mli b/src/core/opamCoreConfig.mli index 83ec84c20be..128da410c80 100644 --- a/src/core/opamCoreConfig.mli +++ b/src/core/opamCoreConfig.mli @@ -31,10 +31,8 @@ module E : sig | VERBOSE of OpamStd.Config.level option | YES of bool option - val confirmlevel: unit -> OpamStd.Config.answer option val debug: unit -> int option val logs: unit -> string option - val yes: unit -> bool option end type t = private { @@ -110,10 +108,6 @@ type 'a options_fun = val default : t -val set : t -> (unit -> t) options_fun - -val setk : (t -> 'a) -> t -> 'a options_fun - val r : t ref val update : ?noop:_ -> (unit -> unit) options_fun diff --git a/src/core/opamDirTrack.ml b/src/core/opamDirTrack.ml index d57f87385e9..6bb6d2a650d 100644 --- a/src/core/opamDirTrack.ml +++ b/src/core/opamDirTrack.ml @@ -42,12 +42,6 @@ let string_of_change ?(full=false) = | Perm_changed d -> str "permission change" d | Kind_changed d -> str "kind change" d -let to_string t = - OpamStd.Format.itemize (fun (f, change) -> - Printf.sprintf "%s of %s" - (String.capitalize_ascii (string_of_change change)) f) - (SM.bindings t) - let to_summary_string t = let freq_table = SM.fold (fun _ change -> diff --git a/src/core/opamDirTrack.mli b/src/core/opamDirTrack.mli index de36d723ead..01ac6236a3c 100644 --- a/src/core/opamDirTrack.mli +++ b/src/core/opamDirTrack.mli @@ -25,18 +25,12 @@ type change = type t = change OpamStd.String.Map.t -(** Returns a printable, multi-line string *) -val to_string: t -> string - (** Returns a summary of the changes as a printable, single-line string *) val to_summary_string: t -> string val digest_of_string: string -> digest val string_of_digest: digest -> string -(** Return the [change] action, with digest if [full] is set to true *) -val string_of_change: ?full:bool -> change -> string - (** Wraps a job to track the changes that happened under [dirname] during its execution (changes done by the application of the job function to [()] are tracked too, for consistency with jobs without commands) *) diff --git a/src/core/opamFilename.ml b/src/core/opamFilename.ml index 9a397ba9b0b..ef7fe10faf0 100644 --- a/src/core/opamFilename.ml +++ b/src/core/opamFilename.ml @@ -135,14 +135,6 @@ let link_dir ~target ~link = else OpamSystem.link (Dir.to_string target) (Dir.to_string link) -let to_list_dir dir = - let base d = Dir.of_string (Filename.basename (Dir.to_string d)) in - let rec aux acc dir = - let d = dirname_dir dir in - if d <> dir then aux (base dir :: acc) d - else base dir :: acc in - aux [] dir - let (/) d1 s2 = let s1 = Dir.to_string d1 in raw_dir (Filename.concat s1 s2) @@ -246,9 +238,6 @@ let with_open_out_bin_aux open_out_bin filename f = OpamStd.Exn.finalise e @@ fun () -> close_out oc; remove filename -let with_open_out_bin [@deprecated] = - with_open_out_bin_aux (fun f -> (), open_out_bin f) - let with_open_out_bin_atomic filename f = let open_temp_file filename = let mode = [Open_binary] in @@ -270,15 +259,6 @@ let exists filename = let opt_file filename = if exists filename then Some filename else None -let with_tmp_file fn = - OpamSystem.with_tmp_file (fun file -> fn (of_string file)) - -let with_tmp_file_job fjob = - OpamSystem.with_tmp_file_job (fun file -> fjob (of_string file)) - -let with_contents fn filename = - fn (read filename) - let check_suffix filename s = Filename.check_suffix (to_string filename) s @@ -365,18 +345,6 @@ let remove_prefix_dir prefix dir = OpamStd.String.remove_prefix ~prefix dirname |> OpamStd.String.remove_prefix ~prefix:Filename.dir_sep -let process_in ?root fn src dst = - let basename = match root with - | None -> basename src - | Some r -> - if starts_with r src then remove_prefix r src - else OpamSystem.internal_error "%s is not a prefix of %s" - (Dir.to_string r) (to_string src) in - let dst = Filename.concat (Dir.to_string dst) basename in - fn ~src ~dst:(of_string dst) - -let copy_in ?root = process_in ?root copy - let is_archive filename = OpamSystem.is_archive (to_string filename) @@ -399,21 +367,6 @@ type generic_file = | D of Dir.t | F of t -let extract_generic_file filename dirname = - match filename with - | F f -> - log "extracting %a to %a" - (slog to_string) f - (slog Dir.to_string) dirname; - extract f dirname - | D d -> - if d <> dirname then ( - log "copying %a to %a" - (slog Dir.to_string) d - (slog Dir.to_string) dirname; - copy_dir ~src:d ~dst:dirname - ) - let ends_with suffix filename = OpamCompat.String.ends_with ~suffix (to_string filename) @@ -514,18 +467,6 @@ let with_flock_upgrade flag ?dontblock lock f = OpamSystem.flock_update old_flag lock ) -let with_flock_write_then_read ?dontblock file write read = - let lock = OpamSystem.flock `Lock_write ?dontblock (to_string file) in - try - let r = write (OpamSystem.get_lock_fd lock) in - OpamSystem.flock_update `Lock_read lock; - let r = read r in - OpamSystem.funlock lock; - r - with e -> - OpamStd.Exn.finalise e @@ fun () -> - OpamSystem.funlock lock - let prettify_path s = let aux ~short ~prefix = let prefix = Filename.concat prefix "" in diff --git a/src/core/opamFilename.mli b/src/core/opamFilename.mli index 32c82cc5ab5..07d12675fe4 100644 --- a/src/core/opamFilename.mli +++ b/src/core/opamFilename.mli @@ -60,9 +60,6 @@ val is_dir_read_only: Dir.t -> bool (** List the sub-directory (do not recurse) *) val dirs: Dir.t -> Dir.t list -(** Turns an assoc list into an array suitable to be provided as environment *) -val env_of_list: (string * string) list -> string array - (** Execute a list of commands in a given directory *) val exec: Dir.t -> ?env:(string * string) list -> ?name:string -> ?metadata:(string * string) list -> ?keep_going:bool -> string list list -> unit @@ -93,9 +90,6 @@ val dirname_dir: Dir.t -> Dir.t (** Return the deeper directory name *) val basename_dir: Dir.t -> Base.t -(** Turn a full path into a list of directory names *) -val to_list_dir: Dir.t -> Dir.t list - (** Creation from a raw string, without resolving symlinks etc. *) val raw_dir: string -> Dir.t @@ -152,12 +146,6 @@ val open_in_bin: t -> in_channel val open_out: t -> out_channel val open_out_bin: t -> out_channel -(** [with_open_out_bin filename f] opens [f] and passes the out_channel to [f]. - If [f] raises an exception, then [filename] is deleted and then exception is - propagated. The out_channel does not have to be closed by [f]. *) -val with_open_out_bin: t -> (out_channel -> unit) -> unit -[@@deprecated "use with_open_out_bin_atomic instead"] - (** [with_open_out_bin_atomic filename f] opens [f] and passes the out_channel to [f]. If [f] raises an exception, then [filename] will be unaltered and then exception is propagated. The out_channel does not have to be closed by [f]. *) @@ -176,13 +164,6 @@ val exists: t -> bool a symlink to one *) val opt_file: t -> t option -(** Execute a function with a file in a temp directory. - It is always cleaned up afterwards. *) -val with_tmp_file: (t -> 'a) -> 'a - -(** Provide an automatically cleaned up file in temp directory to a job *) -val with_tmp_file_job: (t -> 'a OpamProcess.job) -> 'a OpamProcess.job - (** Check whether a file has a given suffix *) val check_suffix: t -> string -> bool @@ -202,14 +183,6 @@ val files: Dir.t -> t list not all entries will satisfy {!exists}). *) val files_and_links: Dir.t -> t list -(** Apply a function on the contents of a file *) -val with_contents: (string -> 'a) -> t -> 'a - -(** Copy a file in a directory. If [root] is set, copy also the - sub-directories. For instance, [copy_in ~root:"/foo" "/foo/bar/gni" - "/toto"] creates ["/toto/bar/gni"]. *) -val copy_in: ?root:Dir.t -> t -> Dir.t -> unit - (** Move a file *) val move: src:t -> dst:t -> unit @@ -253,9 +226,6 @@ val extract_in_job: t -> Dir.t -> exn option OpamProcess.job val make_tar_gz_job: t -> Dir.t -> exn option OpamProcess.job -(** Extract a generic file *) -val extract_generic_file: generic_file -> Dir.t -> unit - (** Check whether a filename starts by a given Dir.t *) val starts_with: Dir.t -> t -> bool @@ -326,11 +296,6 @@ val with_flock: [< OpamSystem.lock_flag ] -> ?dontblock:bool -> t -> val with_flock_upgrade: [< OpamSystem.actual_lock_flag ] -> ?dontblock:bool -> OpamSystem.lock -> (Unix.file_descr -> 'a) -> 'a -(** Runs first function with a write lock on the given file, then releases it to - a read lock and runs the second function. *) -val with_flock_write_then_read: - ?dontblock:bool -> t -> (Unix.file_descr -> 'a) -> ('a -> 'b) -> 'b - module Op: sig (** Create a new directory *) @@ -346,10 +311,6 @@ module Attribute: sig include OpamStd.ABSTRACT - val to_string_list: t -> string list - - val of_string_list: string list -> t - (** Get remote filename *) val base: t -> Base.t diff --git a/src/core/opamHash.ml b/src/core/opamHash.ml index 19bcd83c2e1..1a0deff5e6e 100644 --- a/src/core/opamHash.ml +++ b/src/core/opamHash.ml @@ -69,8 +69,6 @@ let make kind s = else invalid_arg ("OpamHash.make_"^string_of_kind kind) let md5 = make `MD5 -let sha256 = make `SHA256 -let sha512 = make `SHA512 let of_string_opt s = try diff --git a/src/core/opamHash.mli b/src/core/opamHash.mli index 1683bd61d49..fc34f91994b 100644 --- a/src/core/opamHash.mli +++ b/src/core/opamHash.mli @@ -23,10 +23,6 @@ val contents: t -> string val string_of_kind: kind -> string -val md5: string -> t -val sha256: string -> t -val sha512: string -> t - include OpamStd.ABSTRACT with type t := t val of_string_opt: string -> t option diff --git a/src/core/opamProcess.ml b/src/core/opamProcess.ml index a1662e36b2c..ee39fed9025 100644 --- a/src/core/opamProcess.ml +++ b/src/core/opamProcess.ml @@ -248,7 +248,6 @@ type t = { p_stdout : string option; p_stderr : string option; p_env : string option; - p_info : string option; p_metadata: (string * string) list; p_verbose: bool; p_tmp_files: string list; @@ -468,7 +467,6 @@ let create ?info_file ?env_file ?(allow_stdin=not Sys.win32) ?stdout_file ?stder p_stdout = stdout_file; p_stderr = stderr_file; p_env = env_file; - p_info = info_file; p_metadata = metadata; p_verbose = verbose; p_tmp_files = tmp_files; @@ -573,7 +571,6 @@ let dry_run_background c = { p_stdout = None; p_stderr = None; p_env = None; - p_info = None; p_metadata = OpamStd.Option.default [] c.cmd_metadata; p_verbose = is_verbose_command c; p_tmp_files = []; @@ -969,12 +966,6 @@ module Job = struct let seq job start = List.fold_left (@@+) (Done start) job - let seq_map f l = - List.fold_left (fun job x -> - job @@+ fun acc -> f x @@| fun y -> y :: acc) - (Done []) l - @@| List.rev - let rec with_text text = function | Done _ as j -> j | Run (cmd, cont) -> diff --git a/src/core/opamProcess.mli b/src/core/opamProcess.mli index 8455369e534..f0c8eee2aac 100644 --- a/src/core/opamProcess.mli +++ b/src/core/opamProcess.mli @@ -51,7 +51,6 @@ val command: val string_of_command: command -> string val text_of_command: command -> string option -val is_verbose_command: command -> bool (** Returns a label suitable for printing the summary of running commands. First string is the topic (e.g. package), second the action (e.g. command name). @@ -70,7 +69,6 @@ type t = { p_stdout : string option; (** stdout dump file *) p_stderr : string option; (** stderr dump file *) p_env : string option; (** dump environment variables *) - p_info : string option; (** dump process info *) p_metadata: (string * string) list; (** Metadata associated to the process *) p_verbose: bool; (** whether output of the process should be displayed *) @@ -213,9 +211,6 @@ module Job: sig (** Returns the job made of the given homogeneous jobs run sequentially *) val seq: ('a -> 'a Op.job) list -> 'a -> 'a Op.job - (** Sequentially maps jobs on a list *) - val seq_map: ('a -> 'b Op.job) -> 'a list -> 'b list Op.job - (** Sets and overrides text of the underlying commands *) val with_text: string -> 'a Op.job -> 'a Op.job end diff --git a/src/core/opamSHA.mli b/src/core/opamSHA.mli index e05352bdfd3..de0c2f91e39 100644 --- a/src/core/opamSHA.mli +++ b/src/core/opamSHA.mli @@ -11,19 +11,7 @@ (** Pure OCaml implementation of SHA256/512 hashing functions. The hash is returned as an hex string. *) -val sha1_file: string -> string - -val sha256_file: string -> string - -val sha512_file: string -> string - val hash_file: [< `SHA1 | `SHA256 | `SHA512 ] -> string -> string -val sha1_string: string -> string - -val sha256_string: string -> string - -val sha512_string: string -> string - val hash_string: [< `SHA1 | `SHA256 | `SHA512 ] -> string -> string diff --git a/src/core/opamSWHID.ml b/src/core/opamSWHID.ml index ca0509eb14e..7d2e6f6515d 100644 --- a/src/core/opamSWHID.ml +++ b/src/core/opamSWHID.ml @@ -68,7 +68,7 @@ let to_url swh = (** Identifier computing *) module SHA1 = struct - let digest_string_to_hex = OpamSHA.sha1_string + let digest_string_to_hex = OpamSHA.hash_string `SHA1 end module OS = struct diff --git a/src/core/opamSystem.ml b/src/core/opamSystem.ml index a914efdaef6..9fdc8a02bef 100644 --- a/src/core/opamSystem.ml +++ b/src/core/opamSystem.ml @@ -615,9 +615,6 @@ let read_command_output ?verbose ?env ?metadata ?dir ?allow_stdin raise_on_process_error r; r.OpamProcess.r_stdout -let verbose_for_base_commands () = - OpamCoreConfig.(!r.verbose_level) >= 3 - let copy_file_t ?(with_log=true) src dst = if (try Sys.is_directory src with Sys_error _ -> raise (File_not_found src)) diff --git a/src/core/opamSystem.mli b/src/core/opamSystem.mli index e3dac92da0e..ad510978123 100644 --- a/src/core/opamSystem.mli +++ b/src/core/opamSystem.mli @@ -47,10 +47,6 @@ val with_tmp_file: (string -> 'a) -> 'a *) val with_tmp_file_job: (string -> 'a OpamProcess.job) -> 'a OpamProcess.job -(** Returns true if the default verbose level for base commands (cp, mv, etc.) - is reached *) -val verbose_for_base_commands: unit -> bool - (** {2 Filesystem management} *) (** Check if directory [dir] is read only. @@ -132,10 +128,6 @@ val read: string -> string advisory write lock to prevent concurrent reads or writes) *) val write: string -> string -> unit -(** [get_files dir] returns the list of files (without prefix) inside the - directory [dir]. *) -val get_files : string -> string list - (** Same as [get_files] except it avoids copying VCS directories ([.git], [.hg], [_darcs]) *) val get_files_except_vcs : string -> string list @@ -165,10 +157,6 @@ val is_reg_dir: string -> bool names) *) val ls: string -> string list -(** [files_with_links dir] returns the files in the directory [dir]. - Links simulating directory are ignored, others links are returned. *) -val files_with_links: string -> string list - (** [rec_files dir] returns the list of all files in [dir], recursively. Links behaving like directory are crossed. *) @@ -192,10 +180,6 @@ val dirs: string -> string list Returns [None] if the directory could not be found. *) val dir_is_empty: string -> bool option -(** [directories_with_links dir] returns the directories in the directory [dir]. - Links pointing to directory are also returned. *) -val directories_with_links: string -> string list - (** Make a comman suitable for OpamProcess.Job. if [verbose], is set, command and output will be displayed (at command end for the latter, if concurrent commands are running). [name] is used for @@ -330,10 +314,6 @@ val flock_update: [< lock_flag ] -> ?dontblock:bool -> lock -> unit (** Releases an acquired lock (equivalent to [flock_update `Lock_none]) *) val funlock: lock -> unit -(** Returns the highest of the two lock flags (with the order no lock < read - lock < write lock) *) -val lock_max: lock_flag -> lock_flag -> lock_flag - (** Returns true if the lock already has the lock_flag rights or more *) val lock_isatleast: [< lock_flag ] -> lock -> bool @@ -357,10 +337,6 @@ val get_eol_encoding : string -> bool option terminates (default: [true]). *) val temp_file: ?auto_clean:bool -> ?dir:string -> string -> string -(** Registers an exception printer that adds some OPAM version info, and details - on process and Unix errors *) -val register_printer: unit -> unit - (** Initialises signal handlers, catch_break and some exception printers. The lib may not perform properly without this if {!Sys.catch_break} isn't set and SIGPIPE isn't handled (with a no-op) *) @@ -371,12 +347,3 @@ val forward_to_back : string -> string (** On Unix, a no-op. On Windows, convert \ to / *) val back_to_forward : string -> string - -(** Identifies kinds of executable files. At present, only useful on Windows. - Executable or DLLs are recognised based on their content, not on their - filename. Any file beginning "#!" is assumed to be a shell script and all - files are classified [`Unknown]. *) -val classify_executable : string -> [ `Exe of [ `i386 | `x86 | `x86_64 ] - | `Dll of [ `x86 | `x86_64 ] - | `Script - | `Unknown ] diff --git a/src/core/opamVersion.ml b/src/core/opamVersion.ml index 524c1b10bac..a4f97d1fdff 100644 --- a/src/core/opamVersion.ml +++ b/src/core/opamVersion.ml @@ -40,12 +40,6 @@ let current_raw = OpamVersionInfo.version let current = of_string current_raw -let major v = - try - let i = String.index v '.' in - of_string (String.sub v 0 i) - with Not_found -> v - let nopatch v = try let i = String.index v '.' in @@ -62,17 +56,6 @@ let nopatch v = let current_nopatch = nopatch current_raw -let message () = - OpamConsole.msg "\n\ - %s version %s\n\ - \n\ - Copyright (C) 2012 OCamlPro - INRIA, 2013-2015 OCamlPro\n\ - \n\ - This is free software; see the source for copying conditions. There is NO\n\ - warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" - Sys.executable_name current_raw; - exit 0 - let gitversion = ref None let set_git s = gitversion := Some s diff --git a/src/core/opamVersion.mli b/src/core/opamVersion.mli index adddf754c70..3038cc921ae 100644 --- a/src/core/opamVersion.mli +++ b/src/core/opamVersion.mli @@ -16,18 +16,12 @@ include OpamStd.ABSTRACT (** The current OPAM version *) val current: t -(** Extracts the major version *) -val major: t -> t - (** Major+minor version, strips the patch version *) val nopatch: t -> t (** The current OPAM version, truncated (only MAJOR.MINOR) *) val current_nopatch: t -(** The 'git' version of OPAM *) -val git: unit -> t option - (** Side-effect to set the git version later in the build *) val set_git: string -> unit @@ -40,8 +34,5 @@ val full: unit -> t (** Magic string, always of length 8 *) val magic: unit -> string -(** Display the version message *) -val message: unit -> unit - (** Version comparison *) val compare: t -> t -> int diff --git a/src/core/opamVersionCompare.ml b/src/core/opamVersionCompare.ml index cde4c5026c0..8e5196f76b8 100644 --- a/src/core/opamVersionCompare.ml +++ b/src/core/opamVersionCompare.ml @@ -130,6 +130,3 @@ let compare (x : string) (y : string) = normalize_comp_result (loop_lexical lx ly x y (OpamCompat.Int.min (rx + 1) lx) (OpamCompat.Int.min (ry + 1) ly)) - -let equal (x : string) (y : string) = - if (x : string) = y then true else (compare x y) = 0 diff --git a/src/core/opamVersionCompare.mli b/src/core/opamVersionCompare.mli index 00dbe13cad1..d3af79e34ea 100644 --- a/src/core/opamVersionCompare.mli +++ b/src/core/opamVersionCompare.mli @@ -29,11 +29,6 @@ "1.02-0". *) -(** @return [true] iff the two strings define the same version. Hence, - the result may be true even when the two string differ - syntactically. *) -val equal : string -> string -> bool - (** [compare x y] returns 0 if x is eqivalent to y, -1 if x is smaller than y, and 1 if x is greater than y. This is consistent with {!Stdlib.compare}. *) diff --git a/src/format/opamFile.ml b/src/format/opamFile.ml index 132084e675c..8b8db0586c3 100644 --- a/src/format/opamFile.ml +++ b/src/format/opamFile.ml @@ -1763,7 +1763,6 @@ module InitConfigSyntax = struct let with_dl_tool dl_tool t = {t with dl_tool} let with_dl_jobs dl_jobs t = {t with dl_jobs} let with_dl_cache dl_cache t = {t with dl_cache = Some dl_cache} - let with_solver_criteria solver_criteria t = {t with solver_criteria} let with_solver solver t = {t with solver} let with_wrappers wrappers t = {t with wrappers} let with_global_variables global_variables t = {t with global_variables} @@ -2321,8 +2320,6 @@ module Dot_configSyntax = struct (fun t -> None, Pp.print pp_contents t) - let variables t = List.rev_map fst t.vars - let bindings t = t.vars let variable t s = @@ -2390,7 +2387,6 @@ module RepoSyntax = struct let with_dl_cache dl_cache t = { t with dl_cache = Some dl_cache } let with_announce announce t = { t with announce } let with_stamp id t = { t with stamp = Some id } - let with_stamp_opt stamp t = { t with stamp } let fields = [ "opam-version", Pp.ppacc_opt @@ -2549,7 +2545,6 @@ module URL = struct let with_url url t = { t with url } let with_mirrors mirrors t = { t with mirrors } let with_checksum checksum t = { t with checksum = checksum } - let with_swhid swhid t = { t with swhid = Some swhid } let with_swhid_opt swhid t = { t with swhid = swhid } let with_subpath subpath t = { t with subpath = Some subpath } let with_subpath_opt subpath t = { t with subpath = subpath } @@ -4071,11 +4066,6 @@ module CompSyntax = struct tags = []; } - let create_preinstalled name version packages env = - let mk n = Atom (n, Empty) in - let packages = OpamFormula.ands (List.map mk packages) in - { empty with name; version; preinstalled = true; packages; env } - let name (t:t) = t.name let version (t:t) = t.version let patches t = t.patches diff --git a/src/format/opamFile.mli b/src/format/opamFile.mli index 4e4098ae254..62bceac77ca 100644 --- a/src/format/opamFile.mli +++ b/src/format/opamFile.mli @@ -142,15 +142,12 @@ module Config: sig val with_opam_root_version: OpamVersion.t -> t -> t val with_criteria: (solver_criteria * string) list -> t -> t - val with_best_effort_prefix: string -> t -> t val with_best_effort_prefix_opt: string option-> t -> t - val with_solver: arg list -> t -> t val with_solver_opt: arg list option -> t -> t val with_jobs: int -> t -> t val with_jobs_opt: int option -> t -> t - val with_dl_tool: arg list -> t -> t val with_dl_tool_opt: arg list option -> t -> t val with_dl_jobs: int -> t -> t val with_dl_cache: url list -> t -> t @@ -254,7 +251,6 @@ end module InitConfig: sig include IO_FILE - val opam_version: t -> opam_version val repositories: t -> (repository_name * (url * trust_anchors option)) list val default_compiler: t -> formula val default_invariant: t -> formula @@ -273,19 +269,12 @@ module InitConfig: sig val sys_pkg_manager_cmd: t -> filename OpamStd.String.Map.t val git_location: t -> dirname option - val with_opam_version: opam_version -> t -> t val with_repositories: (repository_name * (url * trust_anchors option)) list -> t -> t val with_default_compiler: formula -> t -> t val with_default_invariant: formula -> t -> t - val with_jobs: int option -> t -> t val with_dl_tool: arg list option -> t -> t - val with_dl_jobs: int option -> t -> t - val with_dl_cache: url list -> t -> t - val with_solver_criteria: (solver_criteria * string) list -> t -> t - val with_solver: arg list option -> t -> t val with_wrappers: Wrappers.t -> t -> t - val with_global_variables: (variable * variable_contents * string) list -> t -> t val with_eval_variables: (variable * string list * string) list -> t -> t val with_recommended_tools: (string list * string option * filter option) list -> t -> t val with_required_tools: (string list * string option * filter option) list -> t -> t @@ -303,18 +292,12 @@ module Descr_legacy: sig val create: string -> t - (** Create an abstract description file from a string *) - val of_string: t typed_file -> string -> t - (** Return the first line *) val synopsis: t -> string (** Return the body *) val body: t -> string - (** Return the full description *) - val full: t -> string - end module Descr: sig @@ -381,11 +364,7 @@ module URL: sig (** Constructor *) val with_url: url -> t -> t val with_checksum: OpamHash.t list -> t -> t - val with_mirrors: OpamUrl.t list -> t -> t - val with_swhid: OpamSWHID.t -> t -> t val with_swhid_opt: OpamSWHID.t option -> t -> t - val with_subpath: subpath -> t -> t - val with_subpath_opt: subpath option -> t -> t val subpath: t -> subpath option @@ -844,11 +823,8 @@ module PkgList: IO_FILE with type t = package_set module Environment : sig include IO_FILE with type t = (spf_resolved, euok_writeable) env_update list - val read: t typed_file -> (spf_resolved, [> euok_writeable ]) env_update list val read_opt: t typed_file -> (spf_resolved, [> euok_writeable ]) env_update list option val safe_read: t typed_file -> (spf_resolved, [> euok_writeable ]) env_update list - val read_from_channel: ?filename:t typed_file -> in_channel -> (spf_resolved, [> euok_writeable ]) env_update list - val read_from_string: ?filename:t typed_file -> string -> (spf_resolved, [> euok_writeable ]) env_update list end (** Compiler version [$opam/compilers/]. Deprecated, only used to upgrade old @@ -860,54 +836,18 @@ module Comp: sig type compiler = string type compiler_version = string - (** Create a pre-installed compiler description file *) - val create_preinstalled: - compiler -> compiler_version -> name list -> (spf_unresolved, euok_writeable) env_update list -> t - (** Is it a pre-installed compiler description file *) val preinstalled: t -> bool - (** Get OPAM version *) - val opam_version: t -> opam_version - - (** Return the compiler name *) - val name: t -> compiler - (** Return the compiler version *) val version: t -> compiler_version - (** Return the url of the compiler *) - val src: t -> url option - (** Return the list of patches to apply *) val patches: t -> url list - (** Options to give to the "./configure" command *) - val configure: t -> string list - - (** Options to give to the "make" command *) - val make: t -> string list - - (** Options to give to build the package. If this one is provided, - nothing should be specified for [configure] and [make]. *) - val build: t -> command list - (** Packages to install immediately after the creation of OCaml *) val packages: t -> formula - (** Environment variable to set-up before running commands in the - subtree *) - val env: t -> (spf_unresolved, euok_writeable) env_update list - - val tags: t -> string list - - val with_src: url option -> t -> t - val with_patches: url list -> t -> t - val with_configure: string list -> t -> t - val with_make: string list -> t -> t - val with_build: command list -> t -> t - val with_packages: formula -> t -> t - (** Converts a compiler definition to package metadata. For compat. If [package] is unspecified, a package named "ocaml" is created for "standard" compilers (when the compiler name doesn't contain a "+" and is @@ -968,48 +908,6 @@ module Dot_install: sig (** List of other files to install *) val misc: t -> (basename optional * filename) list - (** List of files to install in $bin/ *) - val with_bin : (basename optional * basename option) list -> t -> t - - (** List of files to install in $sbin/ *) - val with_sbin : (basename optional * basename option) list -> t -> t - - (** List of files to install in $lib/ *) - val with_lib : (basename optional * basename option) list -> t -> t - - (** List of toplevel files *) - val with_toplevel : (basename optional * basename option) list -> t -> t - - (** C bindings *) - val with_stublibs : (basename optional * basename option) list -> t -> t - - (** List of architecture-independent files *) - val with_share : (basename optional * basename option) list -> t -> t - - (** List of files under the more general share prefix *) - val with_share_root : (basename optional * basename option) list -> t -> t - - (** List of etc files *) - val with_etc : (basename optional * basename option) list -> t -> t - - (** List of doc files *) - val with_doc : (basename optional * basename option) list -> t -> t - - (** Man pages *) - val with_man : (basename optional * basename option) list -> t -> t - - (** Executable files under lib/ *) - val with_libexec : (basename optional * basename option) list -> t -> t - - (** Not relative to the package's lib dir *) - val with_lib_root : (basename optional * basename option) list -> t -> t - - (** Not relative to the package's lib dir, and with +x set *) - val with_libexec_root : (basename optional * basename option) list -> t -> t - - (** List of other files to install *) - val with_misc : (basename optional * filename) list -> t -> t - end (** .changes files, bound to the OpamDirTrack module *) @@ -1037,9 +935,6 @@ module Dot_config: sig (** Top-level variables *) val variable: t -> variable -> variable_contents option - (** The list of top-level variables *) - val variables: t -> variable list - (** Lists all the variable bindings in the file *) val bindings: t -> (variable * variable_contents) list @@ -1126,9 +1021,6 @@ module Repo: sig (** The minimum OPAM version required for this repository, if defined *) val opam_version : t -> OpamVersion.t option - (** Base URL for browsing packages on the WWW *) - val browse: t -> string option - (** Base URL for browsing OPAM repository source on the WWW *) val upstream: t -> string option @@ -1148,21 +1040,13 @@ module Repo: sig val with_opam_version : OpamVersion.t -> t -> t - val with_browse: string -> t -> t - - val with_upstream: string -> t -> t - val with_redirect: (string * filter option) list -> t -> t val with_root_url: url -> t -> t val with_dl_cache: string list -> t -> t - val with_announce: (string * filter option) list -> t -> t - val with_stamp: string -> t -> t - - val with_stamp_opt: string option -> t -> t end (** {2 urls.txt file *} *) @@ -1172,22 +1056,8 @@ module File_attributes: IO_FILE with type t = file_attribute_set (the specific file handling modules are derived from this one) *) module Syntax : sig - val pp_channel: - 'a typed_file -> in_channel -> out_channel -> - (unit, opamfile) OpamPp.t - val of_channel: 'a typed_file -> in_channel -> opamfile - val to_channel: 'a typed_file -> out_channel -> opamfile -> unit val of_string: 'a typed_file -> string -> opamfile - val to_string: 'a typed_file -> opamfile -> string - val to_string_with_preserved_format: - 'a typed_file -> ?format_from:'a typed_file -> ?format_from_string:string -> - empty:'a -> - ?sections:('a, (string option * opamfile_item list) list) - OpamFormat.I.fields_def -> - fields:('a, value) OpamFormat.I.fields_def -> - (opamfile, filename * 'a) OpamPp.t -> - 'a -> string end diff --git a/src/format/opamFilter.ml b/src/format/opamFilter.ml index 17ae2d83c87..e9b40c239ed 100644 --- a/src/format/opamFilter.ml +++ b/src/format/opamFilter.ml @@ -418,12 +418,8 @@ let ident_of_var v = let ident_of_string s = ident_of_var (OpamVariable.Full.of_string s) -let ident_value ?default env id = value ?default (resolve_ident env id) - let ident_string ?default env id = value_string ?default (resolve_ident env id) -let ident_bool ?default env id = value_bool ?default (resolve_ident env id) - (* Substitute the file contents and specify the source and destination *) let expand_interpolations_in_file_full env ~src ~dst = let ic = OpamFilename.open_in_bin src in diff --git a/src/format/opamFilter.mli b/src/format/opamFilter.mli index 8b764e0772d..1cffaa38b44 100644 --- a/src/format/opamFilter.mli +++ b/src/format/opamFilter.mli @@ -50,10 +50,6 @@ val fold_down_left: ('a -> filter -> 'a) -> 'a -> filter -> 'a (** Maps on all nodes of a filter, bottom-up *) val map_up: (filter -> filter) -> filter -> filter -(** Regex matching string interpolation syntax (["%%"], ["%{xxx}%"], or - ["%{xxx"] if unclosed) *) -val string_interp_regex : Re.re - (* Extract string of variables appearing in interpolation in a string *) val extract_variables_from_string : string -> string list @@ -117,9 +113,6 @@ val eval_to_bool: ?default:bool -> env -> filter -> bool most common behaviour for using "filters" for filtering *) val opt_eval_to_bool: env -> filter option -> bool -(** Like {!eval} but casts the result to a string *) -val eval_to_string: ?default:string -> env -> filter -> string - (** Reduces what can be, keeps the rest unchanged *) val partial_eval: env -> filter -> filter @@ -129,20 +122,9 @@ val ident_of_var: full_variable -> fident (** A fident accessor directly referring a variable with the given name *) val ident_of_string: string -> fident -(** Resolves a filter ident. - @raise Failure if no default is provided, like {!eval} *) -val ident_value: ?default:variable_contents -> env -> fident -> variable_contents - (** Like {!ident_value}, but casts the result to a string *) val ident_string: ?default:string -> env -> fident -> string -(** Like {!ident_value}, but casts the result to a bool *) -val ident_bool: ?default:bool -> env -> fident -> bool - -val expand_interpolations_in_file_full: env -> src:filename -> dst:filename -> unit -(** Same as {!expand_interpolations_in_file} but allows to set the source [src] and - destination [dst] files independently instead of implying [src] = [dst].in *) - (** Rewrites [filename.in] to [filename], expanding interpolations. If the first line begins ["opam-version:"], assumes that expansion of variables within strings should be properly escaped. In particular, this @@ -183,13 +165,6 @@ val filter_formula: formula *) val partial_filter_formula: env -> filtered_formula -> filtered_formula -(** A more generic formula reduction function, that takes a "partial resolver" - as argument *) -val gen_filter_formula: - ('a -> [< `True | `False | `Formula of 'b OpamTypes.generic_formula ]) -> - ('c * 'a) OpamFormula.formula -> - ('c * 'b OpamTypes.generic_formula) OpamFormula.formula - val string_of_filtered_formula: filtered_formula -> string diff --git a/src/format/opamFormat.ml b/src/format/opamFormat.ml index c1471e69109..53d5c4f50f1 100644 --- a/src/format/opamFormat.ml +++ b/src/format/opamFormat.ml @@ -136,14 +136,6 @@ module V = struct | _ -> [v]) (fun l -> nullify_pos (List (nullify_pos l))) - let group = - pp ~name:"group" ~name_constr:(Printf.sprintf "(%s)") - (fun ~pos:_ v -> - match v.pelem with - | Group l -> l.pelem - | _ -> [v]) - (fun l -> nullify_pos (Group (nullify_pos l))) - let option = pp ~name:"option" (fun ~pos:_ v -> @@ -162,8 +154,6 @@ module V = struct | _ -> bad_format ~pos "Expected an option") (function (v, l) -> nullify_pos (Option (v, nullify_pos l))) - let map_group pp1 = group -| map_list ~posf:value_pos pp1 - let list_depth expected_depth = let rec depth v = match v.pelem with @@ -477,9 +467,6 @@ module V = struct let pkgname = string -| of_module "pkg-name" (module OpamPackage.Name) - let package_atom constraints = - map_option pkgname constraints - (* These two functions are duplicated from [OpamFormula] but we need to have a it here because of a change on [Block] handling: to have a coherent printing, we must not always discard them *) diff --git a/src/format/opamFormat.mli b/src/format/opamFormat.mli index 302fb9f413f..6c02c16c5bc 100644 --- a/src/format/opamFormat.mli +++ b/src/format/opamFormat.mli @@ -15,9 +15,6 @@ open OpamParserTypes.FullPos open OpamTypes open OpamPp -(** Get the position out of a value *) -val value_pos: value -> pos - (** {3 low-level Pps for the Lines parser ([string list list])} *) type lines = string list list @@ -60,25 +57,17 @@ module V : sig (** Trimmed string *) val string_tr : (value, string) t - (** Command arguments, i.e. strings or idents *) - val simple_arg : (value, simple_arg) t - (** Strings or bools *) val variable_contents : (value, variable_contents) t (** "[a b c]"; also allows just "a" to be parsed as a singleton list *) val list : (value, value list) t - (** "(a b c)" *) - val group : (value, value list) t - (** Options in the [value] type sense, i.e. a value with an optional list of parameters in braces: ["value {op1 op2}"] *) val option : (value, value * value list) t - val map_group : (value, 'a) t -> (value, 'a list) t - (** An expected list depth may be specified to enable removal of extra brackets (never use [~depth] for an inner list) *) val map_list : ?depth:int -> (value, 'a) t -> (value, 'a list) t @@ -119,12 +108,6 @@ module V : sig val compiler_version : (value, string) t - val filter_ident : - (value, - name option list * variable * - (string * string) option) - t - val filter : (value list, filter) t (** Arguments in commands (term + optional filter) *) @@ -152,11 +135,6 @@ module V : sig (** A package name, encoded as a string, but with restrictions *) val pkgname: (value, name) t - (** Returns an atom parser [("package" {>= "version"})] from a constraint - and a version parser*) - val package_atom: - (value list, 'a) t -> (value, name * 'a) t - (** Takes a parser for constraints. Lists without operator will be understood as conjunctions or disjunctions depending on the first argument. *) @@ -193,12 +171,8 @@ end module I : sig - val file : (opamfile, filename * opamfile_item list) t - val map_file : (opamfile_item list, 'a) t -> (opamfile, filename * 'a) t - val item : (opamfile_item, string * value) t - val items : (opamfile_item list, (string * value) list) t (** Suitable for the [fields] [sections] argument, when the sections are @@ -265,13 +239,6 @@ sig string -> (opamfile_item, (string option * opamfile_item list)) t - (** Extracts a single item with the given variable name from an item list. - The item is removed from the returned item list, and the two are - re-combined when printing *) - val extract_field : - string -> - (opamfile_item list, value option * opamfile_item list) t - (** Checks the [opam_version] field; otherwise the identity *) val check_opam_version : ?optional:bool -> format_version:opam_version -> ?f:(opam_version -> bool) diff --git a/src/format/opamFormula.ml b/src/format/opamFormula.ml index 9fc4827efc4..f06fafa18b5 100644 --- a/src/format/opamFormula.ml +++ b/src/format/opamFormula.ml @@ -97,27 +97,10 @@ let string_of_conjunction string_of_atom c = type 'a disjunction = 'a list -let string_of_disjunction string_of_atom c = - Printf.sprintf "(%s)" (OpamStd.List.concat_map " | " string_of_atom c) - type 'a cnf = 'a list list -let string_of_cnf string_of_atom cnf = - let string_of_clause c = - let left, right = match c with [_] -> "", "" | _ -> "(", ")" in - OpamStd.List.concat_map ~left ~right " | " string_of_atom c - in - OpamStd.List.concat_map " & " string_of_clause cnf - type 'a dnf = 'a list list -let string_of_dnf string_of_atom cnf = - let string_of_clause c = - let left, right = match c with [_] -> "", "" | _ -> "(", ")" in - OpamStd.List.concat_map ~left ~right " & " string_of_atom c - in - OpamStd.List.concat_map " | " string_of_clause cnf - type 'a formula = | Empty | Atom of 'a @@ -459,9 +442,6 @@ and rev_ands_to_list = function List.rev_append (ands_to_list f) (rev_ands_to_list e) | x -> [x] -let of_conjunction c = - of_atom_formula (ands (List.rev_map (fun x -> Atom x) c)) - let ors l = List.fold_left make_or Empty l let rec ors_to_list = function @@ -533,17 +513,6 @@ let formula_to_dnf t = let to_dnf t = formula_to_dnf @@ to_atom_formula t -let to_conjunction t = - if is_conjunction t then atoms t - else failwith (Printf.sprintf "%s is not a valid conjunction" (to_string t)) - -let to_disjunction t = - if is_disjunction t then atoms t - else failwith (Printf.sprintf "%s is not a valid disjunction" (to_string t)) - -let of_disjunction d = - of_atom_formula (ors (List.rev_map (fun x -> Atom x) d)) - let get_disjunction_formula version_set cstr = (* rev_ors_to_list cstr |> * List.fold_left *) diff --git a/src/format/opamFormula.mli b/src/format/opamFormula.mli index c5dac1d7532..c1b2083c2b3 100644 --- a/src/format/opamFormula.mli +++ b/src/format/opamFormula.mli @@ -15,7 +15,6 @@ (** binary operations (compatible with the Dose type for Cudf operators!) *) type relop = OpamParserTypes.FullPos.relop_kind (* = [ `Eq | `Neq | `Geq | `Gt | `Leq | `Lt ] *) -val compare_relop : relop -> relop -> int val equal_relop : relop -> relop -> bool (** A list containing each available operator once. *) @@ -28,8 +27,6 @@ val string_of_relop : relop -> string (** Version constraints for OPAM *) type version_constraint = relop * OpamPackage.Version.t -val compare_version_constraint : version_constraint -> version_constraint -> int - (** Formula atoms for OPAM *) type atom = OpamPackage.Name.t * version_constraint option @@ -69,21 +66,12 @@ val string_of_conjunction: ('a -> string) -> 'a conjunction -> string (** OR formulas *) type 'a disjunction = 'a list -(** Pretty print OR formulas *) -val string_of_disjunction: ('a -> string) -> 'a disjunction -> string - (** CNF formulas (Conjunctive Normal Form) *) type 'a cnf = 'a disjunction conjunction (** DNF formulas (Disjunctive Normal Form) *) type 'a dnf = 'a conjunction disjunction -(** Pretty print CNF formulas *) -val string_of_cnf: ('a -> string) -> 'a cnf -> string - -(** Pretty print DNF formulas *) -val string_of_dnf: ('a -> string) -> 'a dnf -> string - (** General formulas *) type 'a formula = | Empty @@ -169,7 +157,6 @@ val check_version_formula: version_formula -> OpamPackage.Version.t -> bool - "foo" \{= "1" | > "4"\} | ("bar" "bouh") *) type t = (OpamPackage.Name.t * version_formula) formula -val compare: t -> t -> int val equal: t -> t -> bool (** Returns [true] if [package] verifies [formula] (i.e. it is within at least @@ -187,20 +174,9 @@ val all_names: (OpamPackage.Name.t * 'a) formula -> OpamPackage.Name.Set.t all disjunction cases) *) val packages: OpamPackage.Set.t -> t -> OpamPackage.Set.t -val compare_nc: - (OpamPackage.Name.t * version_formula) -> - (OpamPackage.Name.t * version_formula) -> - int - (** Convert a formula to CNF *) val cnf_of_formula: 'a formula -> 'a formula -(** Convert a formula to CNF, but as a nested list *) -val formula_to_cnf: 'a formula -> 'a cnf - -(** Convert a formula to DNF *) -val dnf_of_formula: 'a formula -> 'a formula - (** Convert a formula to DNF, but as a nested list *) val formula_to_dnf: 'a formula -> 'a dnf @@ -211,13 +187,6 @@ val to_atom_formula: t -> atom formula (** Convert an atom-formula to a t-formula *) val of_atom_formula: atom formula -> t -(** [simplify_ineq_formula comp f] returns a canonical version of inequality - formula [f], based on comparison function [comp], where each version appears - at most once, and in increasing order. Returns [Some Empty] if the formula - is always [true], [None] if it is always false *) -val simplify_ineq_formula: - ('a -> 'a -> int) -> (relop * 'a) formula -> (relop * 'a) formula option - (** Like [simplify_ineq_formula], but specialised on version formulas *) val simplify_version_formula: version_formula -> version_formula option @@ -240,25 +209,11 @@ val atoms: t -> atom list (** Pretty print the formula *) val to_string: t -> string -(** Return a conjunction. If the initial formula is not a - conjunction, then fail. *) -val to_conjunction: t -> atom conjunction - -(** Return a formula from a conjunction of atoms *) -val of_conjunction: atom conjunction -> t - -(** Return a disjunction of atoms from a package formula. It the initial formula - is not a disjunction, then fail. *) -val to_disjunction: t -> atom disjunction - (** Like {!to_disjunction}, but accepts conjunctions within constraint formulas, resolving them using the provided package set. Conjunctions between packages still raise [Failure]. *) val set_to_disjunction: OpamPackage.Set.t -> t -> atom disjunction -(** Return a formula from a disjunction of atoms *) -val of_disjunction: atom disjunction -> t - (** Return an equivalent CNF formula *) val to_cnf: t -> atom cnf diff --git a/src/format/opamPath.ml b/src/format/opamPath.ml index a5975bbddc2..46e04ef6186 100644 --- a/src/format/opamPath.ml +++ b/src/format/opamPath.ml @@ -60,8 +60,6 @@ let backup_file = let backup_dir t = t / "backup" -let backup t = backup_dir t /- backup_file () - let plugin_prefix = "opam-" let plugins t = t / OpamPathName.plugins_d @@ -76,11 +74,6 @@ let plugin_bin t name = in plugins_bin t // basename -let plugin t name = - let sname = OpamPackage.Name.to_string name in - assert (sname <> "bin"); - plugins t / sname - let last_env t = t / ".last-env" module type LAYOUT = sig @@ -139,8 +132,6 @@ module Switch = struct let extra_files_dir t a = meta t a / "extra-files-cache" - let extra_file t a h = extra_files_dir t a // OpamHash.contents h - let sources t a nv = sources_dir t a / OpamPackage.to_string nv let pinned_package t a name = @@ -185,8 +176,6 @@ module Switch = struct | None -> L.root t a / "man" | Some n -> L.root t a / "man" / ("man" ^ n) - let man_dirs t a = List.map (fun num -> man_dir ~num t a) mans - let share_dir t a = L.root t a / "share" let share t a n = share_dir t a / OpamPackage.Name.to_string n diff --git a/src/format/opamPath.mli b/src/format/opamPath.mli index 28a615566dd..a9faae0d1f7 100644 --- a/src/format/opamPath.mli +++ b/src/format/opamPath.mli @@ -61,15 +61,9 @@ val log: t -> dirname (** The directory where global backups are stored *) val backup_dir: t -> dirname -(** Backup file for state export *) -val backup: t -> switch_selections OpamFile.t - (** The prefix for plugin commands (["opam-"]) *) val plugin_prefix : string -(** The directory for plugins data {i $opam/plugins} *) -val plugins: t -> dirname - (** The directory for shared plugin binaries {i $opam/plugins/bin} *) val plugins_bin: t -> dirname @@ -77,10 +71,6 @@ val plugins_bin: t -> dirname $opam/plugins/bin/opam-foo} *) val plugin_bin: t -> name -> filename -(** The directory for a given plugin's data {i $opam/plugins/$name}. ["bin"] is - forbidden. *) -val plugin: t -> name -> dirname - (** The last environment used regardless the switch *) val last_env: t -> dirname @@ -98,10 +88,6 @@ module Switch: sig (** The switch prefix: {i $opam/$switch} *) val root: t -> switch -> dirname - (** The name of the subdir of the switch prefix where opam data is stored - (".opam-switch") *) - val meta_dirname: string - (** The subdirectory of the prefix where opam data lives: {i $opam/$switch/.opam-switch}*) val meta: t -> switch -> dirname @@ -169,10 +155,6 @@ module Switch: sig This is used for switch-imports: {i $meta/extra-files-cache} *) val extra_files_dir: t -> switch -> dirname - (** Extra file with the given hash from the temporary switch-import cache: - {i $meta/extra-files-cache/HASH} *) - val extra_file: t -> switch -> OpamHash.t -> filename - (** Mirror of the sources for a given pinned package: {i $meta/sources/$name/} (without version) *) val pinned_package: t -> switch -> name -> dirname @@ -215,48 +197,20 @@ module Switch: sig {i $prefix/lib/$name} *) val lib: t -> switch -> name -> dirname - (** Library path: {i $prefix/lib} *) - val lib_dir: t -> switch -> dirname - - (** DLL paths *) - val stublibs: t -> switch -> dirname - - (** toplevel path: {i $prefix/lib/toplevel} *) - val toplevel: t -> switch -> dirname - (** Documentation path for a given package: {i $prefix/doc/$name} *) val doc: t -> switch -> name -> dirname - (** Documentation path: {i $prefix/doc/} *) - val doc_dir: t -> switch -> dirname - - (** Shared directory: {i $prefix/share} *) - val share_dir: t -> switch -> dirname - (** Share directory for a given package: {i $prefix/share/$package} *) val share: t -> switch -> name -> dirname - (** Etc directory: {i $prefix/etc} *) - val etc_dir: t -> switch -> dirname - (** Etc directory for a given package: {i $prefix/etc/$package} *) val etc: t -> switch -> name -> dirname - (** Man pages path: {i $prefix/man/}. The optional - [num] argument will add a {i manN } suffix if specified *) - val man_dir: ?num:string -> t -> switch -> dirname - - (** Man pages pathes: {i $prefix/man/manN/} *) - val man_dirs: t -> switch -> dirname list - (** Installed binaries: {i $prefix/bin} *) val bin: t -> switch -> dirname - - (** Installed system binaries: {i $prefix/sbin} *) - val sbin: t -> switch -> dirname end (** Fuctorised version of Default, for replicating @@ -272,20 +226,14 @@ module Switch: sig val doc: t -> L.ctx -> name -> dirname - val doc_dir: t -> L.ctx -> dirname - val share_dir: t -> L.ctx -> dirname val share: t -> L.ctx -> name -> dirname - val etc_dir: t -> L.ctx -> dirname - val etc: t -> L.ctx -> name -> dirname val man_dir: ?num:string -> t -> L.ctx -> dirname - val man_dirs: t -> L.ctx -> dirname list - val bin: t -> L.ctx -> dirname val sbin: t -> L.ctx -> dirname diff --git a/src/format/opamPp.ml b/src/format/opamPp.ml index a7918945396..8ad50c3e411 100644 --- a/src/format/opamPp.ml +++ b/src/format/opamPp.ml @@ -130,13 +130,6 @@ let identity = { name_constr = (fun x -> x); } -let ignore = { - parse = (fun ~pos:_ -> OpamStd.Option.none); - print = (fun _ -> assert false); - ppname = "ignored"; - name_constr = (fun _ -> ""); -} - let check ?name ?(raise=fun _ ?pos fmt -> bad_format ?pos fmt) ?errmsg f = pp ?name diff --git a/src/format/opamPp.mli b/src/format/opamPp.mli index d6c0555af19..233eff8c3e2 100644 --- a/src/format/opamPp.mli +++ b/src/format/opamPp.mli @@ -92,9 +92,6 @@ end val identity : ('a, 'a) t -(** Always parses to [None] *) -val ignore : ('a, 'b option) t - (** Identity pp, unless the check fails. The check is turned into an assertion when printing. If no [errmsg] is given, raises [Unexpected], otherwise call [raise] with the given [errmsg]. By default [raise] raises diff --git a/src/format/opamSysPkg.ml b/src/format/opamSysPkg.ml index 27949f159d7..748fe53b292 100644 --- a/src/format/opamSysPkg.ml +++ b/src/format/opamSysPkg.ml @@ -62,11 +62,6 @@ let status_empty = s_not_found = Set.empty; } -let string_of_status sp = - Printf.sprintf "available: %s; not_found: %s" - (Set.to_string sp.s_available) - (Set.to_string sp.s_not_found) - (* System package availability *) type availability_mode = | Available of Set.t @@ -94,8 +89,3 @@ let to_install_empty = { ti_new = Set.empty; ti_required = Set.empty; } - -let string_of_to_install ti = - Printf.sprintf "new: %s; required: %s" - (Set.to_string ti.ti_new) - (Set.to_string ti.ti_required) diff --git a/src/format/opamSysPkg.mli b/src/format/opamSysPkg.mli index bec33bb5445..bc9159caaf8 100644 --- a/src/format/opamSysPkg.mli +++ b/src/format/opamSysPkg.mli @@ -26,8 +26,6 @@ type status = val status_empty: status -val string_of_status: status -> string - (** System package availability *) type availability_mode = | Available of Set.t (** Set of available system packages *) @@ -51,5 +49,3 @@ type to_install = } val to_install_empty: to_install - -val string_of_to_install: to_install -> string diff --git a/src/format/opamTypes.mli b/src/format/opamTypes.mli index 3670a98b7b1..7e0a24721b9 100644 --- a/src/format/opamTypes.mli +++ b/src/format/opamTypes.mli @@ -308,7 +308,6 @@ type universe = { u_depends : filtered_formula package_map; u_depopts : filtered_formula package_map; u_conflicts: formula package_map; - u_action : user_action; u_installed_roots: package_set; u_pinned : package_set; u_invariant: formula; @@ -362,7 +361,7 @@ type switch_selections = { (** {2 Misc} *) (** The different kinds of locks *) -type lock = +type lock = private | Read_lock of (unit -> unit) (** The function does not modify anything, but it needs the state diff --git a/src/format/opamTypesBase.ml b/src/format/opamTypesBase.ml index 9e3d09a47a8..0195374d703 100644 --- a/src/format/opamTypesBase.ml +++ b/src/format/opamTypesBase.ml @@ -113,15 +113,6 @@ let rec nullify_pos_value {pelem; pos = _} = env_update_op, nullify_pos_value v2) -(* XXX update *) -let pos_best pos1 pos2 = - match pos1, pos2 with - | { filename = ""; _ }, _ -> pos2 - | _, { filename = ""; _ } -> pos1 - | { start = (-1,_) ; _ }, _ -> pos2 - | _, { start = (-1,_) ; _ } -> pos1 - | _, _ -> pos1 - (* if f1 = file_null then pos2 else if f2 = file_null then pos1 @@ -326,15 +317,6 @@ let map_success f = function | Success x -> Success (f x) | Conflicts c -> Conflicts c -let iter_success f = function - | Success x -> f x - | Conflicts _ -> () - -(** Environment update helpers *) -let env_update ?comment:envu_comment ~rewrite:envu_rewrite - envu_var envu_op envu_value = - { envu_var; envu_op; envu_value; envu_comment; envu_rewrite } - let env_update_resolved ?comment:envu_comment ?rewrite envu_var envu_op envu_value = { envu_var; envu_op; envu_value; envu_comment; diff --git a/src/format/opamTypesBase.mli b/src/format/opamTypesBase.mli index 634bdcdc438..213e50233bf 100644 --- a/src/format/opamTypesBase.mli +++ b/src/format/opamTypesBase.mli @@ -26,9 +26,6 @@ val action_equal : ('a -> 'a -> bool) -> 'a action -> 'a action -> bool (** Extract a package from a package action. *) val action_contents: [< 'a action ] -> 'a list -val map_atomic_action: ('a -> 'b) -> 'a atomic_action -> 'b atomic_action -val map_highlevel_action: ('a -> 'b) -> 'a highlevel_action -> 'b highlevel_action -val map_concrete_action: ('a -> 'b) -> 'a concrete_action -> 'b concrete_action val map_action: ('a -> 'b) -> 'a action -> 'b action (** Extract a packages from a package action. This returns all concerned @@ -44,13 +41,8 @@ val string_of_shell: shell -> string (** The empty file position *) val pos_null: pos val nullify_pos : 'a -> 'a with_pos -val nullify_pos_map : ('a -> 'b) -> 'a with_pos -> 'b with_pos val nullify_pos_value : value -> value -(** [pos_best pos1 pos2] returns the most detailed position between [pos1] and - [pos2] (defaulting to [pos1]) *) -val pos_best: pos -> pos -> pos - (** Position in the given file, with unspecified line and column *) val pos_file: filename -> pos @@ -94,15 +86,9 @@ val all_package_flags: package_flag list (** Map on a solver result *) val map_success: ('a -> 'b) -> ('a,'fail) solver_result -> ('b,'fail) solver_result -val iter_success: ('a -> unit) -> ('a, 'b) solver_result -> unit (** Environment update helpers *) (* Build an environment update *) -val env_update: - ?comment:string -> rewrite:'a separator_path_format option - -> string -> 'b env_update_op_kind -> string - -> ('a, 'b) env_update - val env_update_resolved: ?comment:string -> ?rewrite:spf_resolved separator_path_format option -> string -> 'a env_update_op_kind -> string @@ -122,10 +108,7 @@ val char_of_separator: separator -> char (** Comparators **) (* Switch selections *) -val switch_selections_compare : switch_selections -> switch_selections -> int val switch_selections_equal : switch_selections -> switch_selections -> bool -val simple_arg_equal : simple_arg -> simple_arg -> bool -val arg_equal : arg -> arg -> bool val filter_equal : filter -> filter -> bool val command_equal : command -> command -> bool diff --git a/src/repository/opamRepository.mli b/src/repository/opamRepository.mli index aa8ec6843bb..cc1519ccb29 100644 --- a/src/repository/opamRepository.mli +++ b/src/repository/opamRepository.mli @@ -84,7 +84,6 @@ val current_branch: url -> string option OpamProcess.job val is_dirty: ?subpath:subpath -> url -> bool OpamProcess.job (** Find a backend *) -val find_backend: repository -> (module OpamRepositoryBackend.S) val find_backend_by_kind: OpamUrl.backend -> (module OpamRepositoryBackend.S) (** Prints user messages upon the result of a download *) diff --git a/src/repository/opamRepositoryBackend.ml b/src/repository/opamRepositoryBackend.ml index fdbc35eb14b..f17a1570173 100644 --- a/src/repository/opamRepositoryBackend.ml +++ b/src/repository/opamRepositoryBackend.ml @@ -37,34 +37,11 @@ module type S = sig url option OpamProcess.job end -let compare r1 r2 = compare r1.repo_name r2.repo_name - let to_string r = Printf.sprintf "%s from %s" (OpamRepositoryName.to_string r.repo_name) (OpamUrl.to_string r.repo_url) -let to_json r = - `O [ ("name", OpamRepositoryName.to_json r.repo_name); - ("kind", `String (OpamUrl.string_of_backend r.repo_url.OpamUrl.backend)); - ] - -let check_digest filename = function - | Some expected - when OpamRepositoryConfig.(!r.force_checksums) <> Some false -> - (match OpamHash.mismatch (OpamFilename.to_string filename) expected with - | None -> true - | Some bad_hash -> - OpamConsole.error - "Bad checksum for %s: expected %s\n\ - \ got %s\n\ - Metadata might be out of date, in this case use `opam update`." - (OpamFilename.to_string filename) - (OpamHash.to_string expected) - (OpamHash.to_string bad_hash); - false) - | _ -> true - let job_text name label = OpamProcess.Job.with_text (Printf.sprintf "[%s: %s]" diff --git a/src/repository/opamRepositoryBackend.mli b/src/repository/opamRepositoryBackend.mli index 04c5b9a1e7b..a75deb3689c 100644 --- a/src/repository/opamRepositoryBackend.mli +++ b/src/repository/opamRepositoryBackend.mli @@ -94,14 +94,6 @@ end (** Pretty-print *) val to_string: repository -> string -val to_json: repository -> json - -(** Compare repositories *) -val compare: repository -> repository -> int - -(** [check_digest file expected] check that the [file] digest is the - one [expected]. *) -val check_digest: filename -> OpamHash.t option -> bool (** Adds a label to the given job, for the corresponding repository name and action *) diff --git a/src/repository/opamRepositoryConfig.mli b/src/repository/opamRepositoryConfig.mli index cb75b0c95bd..cff37332783 100644 --- a/src/repository/opamRepositoryConfig.mli +++ b/src/repository/opamRepositoryConfig.mli @@ -21,9 +21,6 @@ module E : sig | RETRIES of int option | VALIDATIONHOOK of string option - val curl: unit -> string option - val fetch: unit -> string list option - (* Non lazy access *) val curl_t: unit -> string option val fetch_t: unit -> string list option diff --git a/src/solver/opamCudf.ml b/src/solver/opamCudf.ml index 280cf2e0efb..10657d9b8fb 100644 --- a/src/solver/opamCudf.ml +++ b/src/solver/opamCudf.ml @@ -47,9 +47,6 @@ let is_opam_deprequest p = let unavailable_package_name = Dose_common.CudfAdd.encode "=unavailable" -let unavailable_package_version = 1 -let unavailable_package = unavailable_package_name, unavailable_package_version -let is_unavailable_package p = p.Cudf.package = unavailable_package_name let cudf2opam cpkg = if is_opam_invariant cpkg then @@ -87,15 +84,6 @@ let cudfnv2opam ?version_map ?cudf_universe (name,v) = fst (OpamPackage.Map.choose nvset) | None -> raise Not_found -let string_of_package p = - let installed = if p.Cudf.installed then "installed" else "not-installed" in - Printf.sprintf "%s.%d(%s)" - p.Cudf.package - p.Cudf.version installed - -let string_of_packages l = - OpamStd.List.to_string string_of_package l - module Json = struct let (>>=) = OpamStd.Option.Op.(>>=) @@ -621,9 +609,6 @@ let string_of_vpkgs constr = let constr = List.sort (fun (a,_) (b,_) -> String.compare a b) constr in OpamFormula.string_of_conjunction string_of_atom constr -let string_of_universe u = - string_of_packages (List.sort Dose_common.CudfAdd.compare (Cudf.get_packages u)) - let vpkg2atom cudfnv2opam (name,cstr) = match cstr with | None -> @@ -1223,11 +1208,6 @@ let conflict_explanations packages unav_reasons = function | _univ, _version_map, Conflict_cycle cycles -> [], strings_of_cycles cycles -let conflict_cycles = function - | _cudf_universe, _version_map, Conflict_cycle cycles -> - Some (List.map (List.map (map_action cudf2opam)) cycles) - | _ -> None - let string_of_explanations unav_reasons (cflts, cycles) = let cflts = List.map (string_of_explanation unav_reasons) cflts in let cycles = strings_of_cycles cycles in @@ -1285,29 +1265,6 @@ let remove universe name constr = let packages = Cudf.get_packages ~filter universe in Cudf.load_universe packages -let uninstall_all universe = - let packages = Cudf.get_packages universe in - let packages = List.rev_map (fun p -> { p with Cudf.installed = false }) packages in - Cudf.load_universe packages - -let install universe package = - let p = Cudf.lookup_package universe (package.Cudf.package, package.Cudf.version) in - let p = { p with Cudf.installed = true } in - let packages = - let filter p = - p.Cudf.package <> package.Cudf.package - || p.Cudf.version <> package.Cudf.version in - Cudf.get_packages ~filter universe in - Cudf.load_universe (p :: packages) - -let remove_all_uninstalled_versions_but universe name constr = - let filter p = - p.Cudf.installed - || p.Cudf.package <> name - || Cudf.version_matches p.Cudf.version constr in - let packages = Cudf.get_packages ~filter universe in - Cudf.load_universe packages - let to_cudf univ (req: Cudf_types.vpkg request) = let install = let conj = OpamFormula.ands_to_list req.wish_install in @@ -2053,5 +2010,3 @@ let trim_actions univ req g = let discard_actions = Action.Set.diff other_actions connex_actions in log "Removed unrelated actions: %s" (Action.Set.to_string discard_actions); Action.Set.iter (ActionGraph.remove_vertex g) discard_actions - -let packages u = Cudf.get_packages u diff --git a/src/solver/opamCudf.mli b/src/solver/opamCudf.mli index 86609ff5506..fd5b026a971 100644 --- a/src/solver/opamCudf.mli +++ b/src/solver/opamCudf.mli @@ -16,10 +16,6 @@ open OpamTypes module Package : sig type t = Cudf.package - val equal : t -> t -> bool - val compare : t -> t -> int - val to_json : t -> OpamJson.t - val of_json : OpamJson.t -> t option end (** Cudf sets *) @@ -47,10 +43,6 @@ module Graph: sig end -(** Computation of differences between universe. Returns the sets of packages to - install and remove respectively. *) -val diff: Cudf.universe -> Cudf.universe -> (Set.t * Set.t) - (** Cudf action graph *) module Action: OpamActionGraph.ACTION with type package = Package.t module ActionGraph: OpamActionGraph.SIG with type package = Package.t @@ -66,29 +58,6 @@ val dependency_sort: Cudf.universe -> Set.t -> Cudf.package list task of the solvers *) val trim_universe: Cudf.universe -> Set.t -> Cudf.universe -(** Check if a request is satisfiable and return the reasons why not unless - [explain] is set to [false] *) -val check_request: - ?explain:bool -> - version_map:int OpamPackage.Map.t -> - Cudf.universe -> - Cudf_types.vpkg request -> - (Cudf.universe, conflict) solver_result - -(** Compute the final universe state using the external solver. *) -val get_final_universe: - version_map:int OpamPackage.Map.t -> - Cudf.universe -> - Cudf_types.vpkg request -> - (Cudf.universe, conflict) solver_result - -(** Compute the list of actions to match the difference between two - universe. Remark: the result order is unspecified, ie. need to use - {!atomic_actions} to get a solution which respects the - topological order induced by dependencies. *) -val actions_of_diff: - (Set.t * Set.t) -> Cudf.package atomic_action list - exception Cyclic_actions of Cudf.package action list list (** Computes the actions to process from a solution, from the actions @@ -147,23 +116,6 @@ val to_actions: (Cudf.universe, conflict) solver_result -> (Cudf.package atomic_action list, conflict) solver_result -(** [remove universe name constr] Remove all the packages called - [name] satisfying the constraints [constr] in the universe - [universe]. *) -val remove: Cudf.universe -> Cudf_types.pkgname -> Cudf_types.constr -> Cudf.universe - -(** Uninstall all the package in the universe. *) -val uninstall_all: Cudf.universe -> Cudf.universe - -(** Install a package in the universe. We don't care about any - invariant here (eg. the resulting universe can have multiple - versions of the same package installed). *) -val install: Cudf.universe -> Cudf.package -> Cudf.universe - -(** Remove all the versions of a given package, but the one given as argument. *) -val remove_all_uninstalled_versions_but: Cudf.universe -> - string -> Cudf_types.constr -> Cudf.universe - (** Cudf labels for package fields in the cudf format (use for the field Cudf.pkg_extra and with Cudf.lookup_package_property) *) @@ -188,27 +140,20 @@ val s_version_lag: string (** valid cudf name for the dummy package used for enforcing opam's switch invariants *) -val opam_invariant_package_name: string (** valid cudf name and version for the dummy package used for enforcing opam's switch invariants *) val opam_invariant_package: string * int -val opam_deprequest_package_name: string val opam_deprequest_package: string * int val is_opam_invariant: Cudf.package -> bool (** dummy package that shouldn't exist and encodes unavailability (by depending on it) *) val unavailable_package_name: string -val unavailable_package: string * int -val is_unavailable_package: Cudf.package -> bool (** {2 Pretty-printing} *) -(** Convert a package constraint to something readable. *) -val string_of_vpkgs: Cudf_types.vpkg list -> string - val make_conflicts: version_map:int package_map -> Cudf.universe -> Dose_algo.Diagnostic.diagnosis -> ('a, conflict) solver_result @@ -241,10 +186,6 @@ val conflict_explanations: package_set -> (name * OpamFormula.version_formula -> string) -> conflict -> (string * string list * string list) list * string list -val string_of_explanation: - (name * OpamFormula.version_formula -> string) -> explanation -> - string * string list * string list - val conflict_explanations_raw: package_set -> conflict -> explanation list * Action.t list list @@ -253,74 +194,12 @@ val conflict_explanations_raw: val string_of_conflict: ?start_column:int -> string * string list * string list -> string -val conflict_cycles : conflict -> package action list list option - (** Dumps the given cudf universe to the given channel *) val dump_universe: out_channel -> Cudf.universe -> unit -(** Pretty-print atoms *) -val string_of_atom: Cudf_types.vpkg -> string - -(** Pretty-print requests *) -val string_of_request: Cudf_types.vpkg request -> string - -(** Pretty-print the universe *) -val string_of_universe: Cudf.universe -> string - -(** Pretty-print of packages *) -val string_of_packages: Cudf.package list -> string - (** Convert a cudf package back to an OPAM package *) val cudf2opam: Cudf.package -> package -(** Returns the list of packages in a Cudf universe *) -val packages: Cudf.universe -> Cudf.package list - -(** Converts an OPAM request to a Cudf request. The [wish_install] field is - required to be a conjunction *) -val to_cudf: Cudf.universe -> Cudf_types.vpkg request - -> Cudf.preamble * Cudf.universe * Cudf.request - (** Like {!OpamTypesBase.action_contents} but return the single package of remove, install, reinstal, and change action *) val action_contents: 'a action -> 'a - -module Json: sig - open Cudf_types - - val version_to_json : version OpamJson.encoder - val version_of_json : version OpamJson.decoder - - val relop_to_json : relop OpamJson.encoder - val relop_of_json : relop OpamJson.decoder - - val enum_keep_to_json : enum_keep OpamJson.encoder - val enum_keep_of_json : enum_keep OpamJson.decoder - - val constr_to_json : constr OpamJson.encoder - val constr_of_json : constr OpamJson.decoder - - val vpkg_to_json : vpkg OpamJson.encoder - val vpkg_of_json : vpkg OpamJson.decoder - val vpkglist_to_json : vpkglist OpamJson.encoder - val vpkglist_of_json : vpkglist OpamJson.decoder - - val veqpkg_to_json : veqpkg OpamJson.encoder - val veqpkg_of_json : veqpkg OpamJson.decoder - val veqpkglist_to_json : veqpkglist OpamJson.encoder - val veqpkglist_of_json : veqpkglist OpamJson.decoder - - val vpkgformula_to_json : vpkgformula OpamJson.encoder - val vpkgformula_of_json : vpkgformula OpamJson.decoder - - val typedecl1_to_json : typedecl1 OpamJson.encoder - val typedecl1_of_json : typedecl1 OpamJson.decoder - val typedecl_to_json : typedecl OpamJson.encoder - val typedecl_of_json : typedecl OpamJson.decoder - - val typed_value_to_json : typed_value OpamJson.encoder - val typed_value_of_json : typed_value OpamJson.decoder - - val package_to_json : Cudf.package OpamJson.encoder - val package_of_json : Cudf.package OpamJson.decoder -end diff --git a/src/solver/opamSolver.ml b/src/solver/opamSolver.ml index 1ed60cf1413..6e04f9cc21d 100644 --- a/src/solver/opamSolver.ml +++ b/src/solver/opamSolver.ml @@ -20,27 +20,6 @@ module Action = OpamActionGraph.MakeAction(OpamPackage) module ActionGraph = OpamActionGraph.Make(Action) type solution = OpamCudf.ActionGraph.t -let empty_universe = - { - u_packages = OpamPackage.Set.empty; - u_installed = OpamPackage.Set.empty; - u_available = lazy OpamPackage.Set.empty; - u_depends = OpamPackage.Map.empty; - u_depopts = OpamPackage.Map.empty; - u_conflicts = OpamPackage.Map.empty; - u_action = Install; - u_installed_roots = OpamPackage.Set.empty; - u_pinned = OpamPackage.Set.empty; - u_invariant = OpamFormula.Empty; - u_reinstall = OpamPackage.Set.empty; - u_attrs = []; - } - -let solution_to_json solution = - OpamCudf.ActionGraph.to_json solution -let solution_of_json json = - OpamCudf.ActionGraph.of_json json - let cudf_versions_map universe = log ~level:3 "cudf_versions_map"; let add_packages_from_formula acc formula = @@ -596,27 +575,6 @@ let dependency_sort ~depopts ~build ~post universe packages = List.map OpamCudf.cudf2opam (OpamCudf.dependency_sort cudf_universe cudf_packages) -let coinstallability_check universe packages = - let version_map = cudf_versions_map universe in - let cudf_universe, cudf_packages = - load_cudf_universe_with_packages - ~build:true ~post:true ~add_invariant:true - universe ~version_map universe.u_packages packages - in - match - Dose_algo.Depsolver.edos_coinstall cudf_universe - (OpamCudf.Set.elements cudf_packages) - with - | { Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Success _; _ } -> - None - | { Dose_algo.Diagnostic.result = Dose_algo.Diagnostic.Failure _; _ } as c -> - match OpamCudf.make_conflicts ~version_map cudf_universe c with - | Conflicts cs -> Some cs - | _ -> None - -let check_for_conflicts universe = - coinstallability_check universe universe.u_installed - let atom_coinstallability_check universe atoms = let version_map = cudf_versions_map universe in let check_pkg = { diff --git a/src/solver/opamSolver.mli b/src/solver/opamSolver.mli index 02b35e33a92..d31d2d636d3 100644 --- a/src/solver/opamSolver.mli +++ b/src/solver/opamSolver.mli @@ -19,13 +19,8 @@ module ActionGraph : OpamActionGraph.SIG with type package = package type solution -val empty_universe: universe - (** {2 Solver} *) -(** Convert a request to a string *) -val string_of_request: atom request -> string - (** Compute statistics about a solution *) val stats: solution -> stats @@ -53,13 +48,6 @@ val print_solution: ?skip:package OpamPackage.Map.t -> solution -> unit -(** Serialize a solution *) -val solution_to_json : solution OpamJson.encoder -val solution_of_json : solution OpamJson.decoder - -(** Computes an opam->cudf version map from an universe *) -val cudf_versions_map: universe -> int OpamPackage.Map.t - (** Creates a CUDF universe from an OPAM universe, including the given packages. Evaluation of the first 3 arguments is staged. Warning: when [depopts] is [true], the optional dependencies may become strong dependencies. @@ -117,14 +105,6 @@ val dependency_graph : unavailable:bool -> universe -> PkgGraph.t -(** Check the current set of installed packages in a universe for - inconsistencies *) -val check_for_conflicts : universe -> OpamCudf.conflict option - -(** Checks the given package set for complete installability ; returns None if - they can all be installed together *) -val coinstallability_check : universe -> package_set -> OpamCudf.conflict option - (** Checks if the given atoms can be honored at the same time in the given universe *) val atom_coinstallability_check : universe -> atom list -> bool diff --git a/src/state/opamEnv.ml b/src/state/opamEnv.ml index 7a671c30666..d6fc0825c33 100644 --- a/src/state/opamEnv.ml +++ b/src/state/opamEnv.ml @@ -698,9 +698,6 @@ let get_pure ?(updates=[]) () = let env = List.map (fun (v,va) -> v,va,None) (OpamStd.Env.list ()) in add env updates -let get_opam ~set_opamroot ~set_opamswitch ~force_path st = - add [] (updates ~set_opamroot ~set_opamswitch ~force_path st) - let get_opam_raw_updates ~set_opamroot ~set_opamswitch ~force_path root switch = let env_file = OpamPath.Switch.environment root switch in let upd = OpamFile.Environment.safe_read env_file in @@ -719,13 +716,6 @@ let get_opam_raw_updates ~set_opamroot ~set_opamswitch ~force_path root switch = in updates_common ~set_opamroot ~set_opamswitch root switch @ upd -let get_opam_raw ~set_opamroot ~set_opamswitch ?(base=[]) ~force_path - root switch = - let upd = - get_opam_raw_updates ~set_opamroot ~set_opamswitch ~force_path root switch - in - add base upd - let hash_env_updates upd = (* Should we use OpamFile.Environment.write_to_string ? cons: it contains tabulations *) @@ -808,13 +798,6 @@ let switch_path_update ~force_path root switch = (OpamFilename.Dir.to_string bindir) ~comment:"Current opam switch binary dir" ] -let path ~force_path root switch = - let env = expand (switch_path_update ~force_path root switch) in - let (_, path_value, _) = - List.find (fun (v, _, _) -> OpamStd.Env.Name.equal_string v "PATH") env - in - path_value - let full_with_path ~force_path ?(updates=[]) root switch = let env0 = List.map (fun (v,va) -> v,va,None) (OpamStd.Env.list ()) in add env0 (switch_path_update ~force_path root switch @ updates) @@ -1248,11 +1231,6 @@ let write_dynamic_init_scripts st = OpamConsole.warning "Global shell init scripts not installed (could not acquire lock)" -let clear_dynamic_init_scripts gt = - List.iter (fun shell -> - OpamFilename.remove (OpamPath.init gt.root // variables_file shell)) - [SH_sh; SH_csh; SH_fish; SH_pwsh Powershell; SH_cmd] - let dot_profile_needs_update root dot_profile = if not (OpamFilename.exists dot_profile) then `yes else let body = OpamFilename.read dot_profile in diff --git a/src/state/opamEnv.mli b/src/state/opamEnv.mli index a0add3196ba..4aa9dbc33db 100644 --- a/src/state/opamEnv.mli +++ b/src/state/opamEnv.mli @@ -29,24 +29,6 @@ val get_full: set_opamroot:bool -> set_opamswitch:bool -> force_path:bool -> ?updates: ('r, euok_internal) env_update list -> ?scrub:string list -> 'a switch_state -> env -(** Get only environment modified by OPAM. If [force_path], the PATH is modified - to ensure opam dirs are leading. [set_opamroot] and [set_opamswitch] can be - additionally used to set the [OPAMROOT] and [OPAMSWITCH] variables. - - With [base], apply the modifications to the specified base environment *) -val get_opam: - set_opamroot:bool -> set_opamswitch:bool -> force_path:bool -> - 'a switch_state -> env - -(** Like {!get_opam}, but reads the cache file from the given opam root and - switch instead of computing the environment from a switch state. - - With [base], apply the modifications to the specified base environment *) -val get_opam_raw: - set_opamroot:bool -> set_opamswitch:bool -> ?base:env -> - force_path:bool -> - dirname -> switch -> env - (** Like {!get_opam_raw}, but returns the list of updates instead of the new environment. *) val get_opam_raw_updates: @@ -61,12 +43,6 @@ val hash_env_updates: ('a, euok_writeable) env_update list -> string and optionally the given updates *) val get_pure: ?updates:(spf_resolved, euok_internal) env_update list -> unit -> env -(** The list of executables from Cygwin which must not be allowed to be shadowed - by other directories of PATH. This list must not contain git.exe - it is - added only if Cygwin's git is installed. The list is used to determine the - furthest point in PATH that Cygwin's bin directory can be placed. *) -val cygwin_non_shadowed_programs : string list - (** Update an environment, including reverting opam changes that could have been previously applied (therefore, don't apply to an already updated env as returned by e.g. {!get_full}!) *) @@ -105,10 +81,6 @@ val opam_env_invocation: val eval_string: 'a global_state -> ?set_opamswitch:bool -> switch option -> string -(** Returns the updated contents of the PATH variable for the given opam root - and switch (set [force_path] to ensure the opam path is leading) *) -val path: force_path:bool -> dirname -> switch -> string - (** Returns the full environment with only the PATH variable updated, as per [path] *) val full_with_path: @@ -129,17 +101,6 @@ val setup: (* (\** Display the global and user configuration for OPAM. *\) * val display_setup: dirname -> dot_profile:filename -> shell -> unit *) -(** Update the user configuration in $HOME for good opam integration. *) -val update_user_setup: - dirname -> ?dot_profile:filename -> shell -> unit - -(** Write the generic scripts in ~/.opam/opam-init needed to import state for - various shells. If specified, completion and env_hook files can also be - written or removed (the default is to keep them as they are). If [inplace] - is true, they are updated if they exist. *) -val write_static_init_scripts: - dirname -> ?completion:bool -> ?env_hook:bool -> ?inplace:bool -> unit -> unit - (** Write into {!OpamPath.hooks_dir} the given custom scripts (listed as (filename, content)), normally provided by opamrc ({!OpamFile.InitConfig}) *) val write_custom_init_scripts: @@ -152,10 +113,6 @@ val write_custom_init_scripts: ~/.opam/config) *) val write_dynamic_init_scripts: 'a switch_state -> unit -(** Removes the dynamic init scripts setting the variables for any given - switch. *) -val clear_dynamic_init_scripts: rw global_state -> unit - (** Print a warning if the environment is not set-up properly. (General message) *) val check_and_print_env_warning: 'a switch_state -> unit diff --git a/src/state/opamFileTools.ml b/src/state/opamFileTools.ml index 0a00d7e8622..59845a4241b 100644 --- a/src/state/opamFileTools.ml +++ b/src/state/opamFileTools.ml @@ -1233,11 +1233,6 @@ let lint_channel ?check_extra_files ?check_upstream ?handle_dirname let reader filename = OpamFile.Syntax.of_channel filename ic in lint_gen ?check_extra_files ?check_upstream ?handle_dirname reader filename -let lint_string ?check_extra_files ?check_upstream ?handle_dirname - filename string = - let reader filename = OpamFile.Syntax.of_string filename string in - lint_gen ?check_extra_files ?check_upstream ?handle_dirname reader filename - let all_lint_warnings () = t_lint ~all:true OpamFile.OPAM.empty diff --git a/src/state/opamFileTools.mli b/src/state/opamFileTools.mli index d3f2e9b5e14..7e0fb9b89f1 100644 --- a/src/state/opamFileTools.mli +++ b/src/state/opamFileTools.mli @@ -48,16 +48,6 @@ val lint_channel: OpamFile.OPAM.t OpamFile.typed_file -> in_channel -> (int * [`Warning|`Error] * string) list * OpamFile.OPAM.t option -(** Like {!lint_file}, but takes the file contents as a string. - [check_extra_files] defaults to a function that will look for a [files/] - directory besides [filename] *) -val lint_string: - ?check_extra_files:(basename * (OpamHash.t -> bool)) list -> - ?check_upstream: bool -> - ?handle_dirname:bool -> - OpamFile.OPAM.t OpamFile.typed_file -> string -> - (int * [`Warning|`Error] * string) list * OpamFile.OPAM.t option - val all_lint_warnings: unit -> (int * [`Warning|`Error] * string) list (** Utility function to print validation results *) diff --git a/src/state/opamFormatUpgrade.mli b/src/state/opamFormatUpgrade.mli index a727d717d03..50fc5c68344 100644 --- a/src/state/opamFormatUpgrade.mli +++ b/src/state/opamFormatUpgrade.mli @@ -21,10 +21,6 @@ open OpamStateTypes function to call instead of default (see {!OpamCliMain.main_catch_all}). *) exception Upgrade_done of OpamFile.Config.t * (OpamFile.Config.t -> unit) option -(** The latest version of the opam root format, that normal operation of this - instance of opam requires *) -val latest_version: OpamVersion.t - (** [as_necessary requested_lock global_lock root config] Runs the upgrade from its current format to the latest compatible version for the opam root at [root] directory. Performs an on-the-fly upgrade diff --git a/src/state/opamGlobalState.ml b/src/state/opamGlobalState.ml index 0d0b0b459d7..698cae6233a 100644 --- a/src/state/opamGlobalState.ml +++ b/src/state/opamGlobalState.ml @@ -164,11 +164,6 @@ let switch_exists gt switch = OpamStateConfig.local_switch_exists gt.root switch else OpamStd.List.mem OpamSwitch.equal switch (switches gt) -let all_installed gt = - fold_switches (fun _ sel acc -> - OpamPackage.Set.union acc sel.sel_installed) - gt OpamPackage.Set.empty - let all_installed_versions gt = fold_switches (fun switch sel acc -> OpamPackage.Set.fold (fun nv acc -> diff --git a/src/state/opamGlobalState.mli b/src/state/opamGlobalState.mli index eed6b7bb5ba..fcb37f696e8 100644 --- a/src/state/opamGlobalState.mli +++ b/src/state/opamGlobalState.mli @@ -22,9 +22,6 @@ val load: 'a lock -> 'a global_state it locked (as per the [lock] argument), releasing the lock afterwards *) val with_: 'a lock -> ('a global_state -> 'b) -> 'b -(** The set of all installed packages, in any switch *) -val all_installed: 'a global_state -> package_set - val switches: 'a global_state -> switch list (** Fold over switches, using switch selections. Switch selection file @@ -46,9 +43,6 @@ val all_installed_versions: 'a global_state -> switch list package_map have to include all configured repositories. *) val repos_list: 'a global_state -> repository_name list -(** Releases any locks on the given global_state *) -val unlock: 'a global_state -> unlocked global_state - (** Releases any locks on the given global state and then ignores it. Using [drop gt] is equivalent to [ignore (unlock gt)], diff --git a/src/state/opamRepositoryState.mli b/src/state/opamRepositoryState.mli index 7642b8eb535..ad05ddc8c03 100644 --- a/src/state/opamRepositoryState.mli +++ b/src/state/opamRepositoryState.mli @@ -69,12 +69,6 @@ val load_opams_from_diff: repository -> Patch.operation list -> 'a repos_state -> OpamFile.OPAM.t package_map -(** Load all the metadata within the local mirror of the given repository, - without cache *) -val load_repo: - repository -> OpamRepositoryRoot.t -> - OpamFile.Repo.t * OpamFile.OPAM.t OpamPackage.Map.t - (** Get the availability status of system packages of loaded repositories. This function also checks if the stored os_family is the same, if not, returns [None] *) @@ -123,10 +117,6 @@ val drop: ?cleanup:bool -> 'a repos_state -> unit (** Cleanup before removing the repository from temporary table *) val remove_from_repos_tmp: 'a repos_state -> repository_name -> unit -(** Clears tmp files corresponding to a repo state (uncompressed repository - contents) *) -val cleanup: 'a repos_state -> unit - (** Calls the provided function, ensuring a temporary write lock on the given repository state*) val with_write_lock: diff --git a/src/state/opamScript.mli b/src/state/opamScript.mli index 8bfe74d0e3e..354fbee57cb 100644 --- a/src/state/opamScript.mli +++ b/src/state/opamScript.mli @@ -13,7 +13,6 @@ val complete : string val complete_zsh : string -val prompt : string val bwrap : string val sandbox_exec : string val env_hook : string diff --git a/src/state/opamStateConfig.mli b/src/state/opamStateConfig.mli index e53eba474de..c5a76a239c3 100644 --- a/src/state/opamStateConfig.mli +++ b/src/state/opamStateConfig.mli @@ -93,7 +93,6 @@ val opamroot: ?root_dir:dirname -> unit -> dirname (** Loads the global configuration file, protecting against concurrent writes *) val load: lock_kind: 'a lock -> dirname -> OpamFile.Config.t option -val safe_load: lock_kind: 'a lock -> dirname -> OpamFile.Config.t (** Loads the config file from the OPAM root and updates default values for all related OpamXxxConfig modules. Doesn't read the env yet, the {!init} @@ -129,11 +128,6 @@ val is_newer_than_self: lock_kind:'a lock -> 'b global_state -> bool (** Check config root version regarding self-defined one *) val is_newer: OpamFile.Config.t -> bool -val load_config_root: - lock_kind:'a lock -> - ((OpamFile.Config.t OpamFile.t -> 'b) * (OpamFile.Config.t OpamFile.t -> 'b)) -> - dirname -> 'b - module Switch : sig val safe_load_t: lock_kind: 'a lock -> dirname -> switch -> OpamFile.Switch_config.t diff --git a/src/state/opamStateTypes.mli b/src/state/opamStateTypes.mli index 2731b77c8df..3bd7dba99b2 100644 --- a/src/state/opamStateTypes.mli +++ b/src/state/opamStateTypes.mli @@ -200,11 +200,6 @@ type +'lock switch_state = { reinstall: package_set Lazy.t; (** The set of packages which need to be reinstalled *) - invalidated: package_set Lazy.t; - (** The set of packages which are installed but no longer valid, e.g. because - of removed system dependencies. Only packages which are unavailable end up - in this set, they are otherwise put in {!field:reinstall}. *) - overwrote_opams: (bool * OpamFile.OPAM.t) package_map; (** In case of simulated pins, keep the old information of opam files. The boolean is set to true if the package was previously pinned. *) diff --git a/src/state/opamSwitchState.ml b/src/state/opamSwitchState.ml index 4ccf61d68f4..491824f7d09 100644 --- a/src/state/opamSwitchState.ml +++ b/src/state/opamSwitchState.ml @@ -637,12 +637,6 @@ let load lock_kind gt rt switch = (Lazy.force ext_files_changed %% Lazy.force available_packages) ++ Lazy.force sys_packages_changed ) in - let invalidated = lazy ( - Lazy.force changed ++ - Lazy.force ext_files_changed ++ - Lazy.force sys_packages_changed - -- Lazy.force available_packages - ) in let st = { switch_global = (gt :> unlocked global_state); switch_repos = (rt :> unlocked repos_state); @@ -651,7 +645,7 @@ let load lock_kind gt rt switch = repos_package_index; installed_opams; installed; pinned; installed_roots; opams; conf_files; - packages; available_packages; sys_packages; reinstall; invalidated; + packages; available_packages; sys_packages; reinstall; overwrote_opams = OpamPackage.Map.empty; } in log "Switch state loaded in %.3fs" (chrono ()); @@ -696,7 +690,6 @@ let load_virtual ?repos_list ?(avail_default=true) gt rt = sys_packages = lazy OpamPackage.Map.empty; available_packages; reinstall = lazy OpamPackage.Set.empty; - invalidated = lazy (OpamPackage.Set.empty); overwrote_opams = OpamPackage.Map.empty; } @@ -731,12 +724,6 @@ let opam st nv = OpamPackage.Map.find nv st.opams let opam_opt st nv = try Some (opam st nv) with Not_found -> None -let descr_opt st nv = - OpamStd.Option.Op.(opam_opt st nv >>= OpamFile.OPAM.descr) - -let descr st nv = - OpamStd.Option.Op.(descr_opt st nv +! OpamFile.Descr.empty) - let url st nv = OpamStd.Option.Op.(opam_opt st nv >>= OpamFile.OPAM.url) @@ -820,10 +807,6 @@ let depexts_status_of_packages st set = let depexts_unavailable st nv = depexts_unavailable_raw (Lazy.force st.sys_packages) nv -let dev_packages st = - OpamPackage.Set.filter (is_dev_package st) - (st.installed ++ OpamPinned.packages st) - let conflicts_with st subset = let forward_conflicts, conflict_classes = OpamPackage.Set.fold (fun nv (cf,cfc) -> @@ -996,7 +979,7 @@ let universe st ?(force_dev_deps=false) ?reinstall ~requested - user_action = + _user_action = let chrono = OpamConsole.timer () in let names = OpamPackage.names_of_packages requested in let requested_allpkgs = @@ -1079,7 +1062,6 @@ let universe st let u = { u_packages = st.packages; - u_action = user_action; u_installed = st.installed; u_available; u_depends; diff --git a/src/state/opamSwitchState.mli b/src/state/opamSwitchState.mli index 120e42da8c4..574d081a354 100644 --- a/src/state/opamSwitchState.mli +++ b/src/state/opamSwitchState.mli @@ -55,21 +55,10 @@ val compute_available_packages: pinned:package_set -> opams:OpamFile.OPAM.t package_map -> package_set -(** Raw function to compute the conflicts for all packages, given - the set of available packages and the corresponding opam files. - This is useful to populate the `u_conflicts` field when building - a universe manually. *) -val get_conflicts_t: - (package -> OpamFilter.env) -> package_set -> - OpamFile.OPAM.t package_map -> formula package_map - (** Infer a switch invariant from a switch state with compiler_packages and roots set, using some heuristics. Useful for migration from pre-2.1 opam *) val infer_switch_invariant: 'a switch_state -> OpamFormula.t -(** Releases any locks on the given switch_state *) -val unlock: 'a switch_state -> unlocked switch_state - (** Releases any locks on the given switch state and then ignores it. Using [drop st] is equivalent to [ignore (unlock st)], @@ -110,12 +99,6 @@ val primary_url: 'a switch_state -> package -> url option val primary_url_with_subpath: 'a switch_state -> package -> url option -(** Return the descr field for the given package (or an empty descr if none) *) -val descr: 'a switch_state -> package -> OpamFile.Descr.t - -(** Return the descr field for the given package *) -val descr_opt: 'a switch_state -> package -> OpamFile.Descr.t option - (** Return the installed package's local configuration *) val package_config: 'a switch_state -> name -> OpamFile.Dot_config.t @@ -147,9 +130,6 @@ val is_pinned: 'a switch_state -> name -> bool overlay metadata, and relying on the repo's data *) val is_version_pinned: 'a switch_state -> name -> bool -(** The set of all "dev packages" (see {!is_dev_package} for a definition) *) -val dev_packages: 'a switch_state -> package_set - (** Returns the local source mirror for the given package ({!OpamPath.Switch.sources} or {!OpamPath.Switch.pinned_package}, depending on wether it's pinned). *) diff --git a/src/state/opamSysInteract.ml b/src/state/opamSysInteract.ml index 544fdeea395..87d388854c5 100644 --- a/src/state/opamSysInteract.ml +++ b/src/state/opamSysInteract.ml @@ -371,7 +371,7 @@ module Cygwin = struct str "setup-x86_64.exe" ]) in - try Some (OpamHash.sha512 Re.(Group.get (exec re content) 1)) + try Some (OpamHash.compute ~kind:`SHA512 Re.(Group.get (exec re content) 1)) with Not_found -> None in if Option.equal OpamHash.equal current_checksum checksum && diff --git a/src/state/opamUpdate.ml b/src/state/opamUpdate.ml index f6230c15d5b..f73cf8f1344 100644 --- a/src/state/opamUpdate.ml +++ b/src/state/opamUpdate.ml @@ -531,40 +531,6 @@ let dev_packages st ?autolock ?(working_dir=OpamPackage.Set.empty) packages = selections1; success, st, updated_set -let pinned_packages st ?autolock ?(working_dir=OpamPackage.Name.Set.empty) names = - log "update-pinned-packages"; - let command name = - let working_dir = OpamPackage.Name.Set.mem name working_dir in - OpamProcess.Job.ignore_errors - ~default:((fun st -> st), OpamPackage.Name.Set.empty) - @@ fun () -> - pinned_package st ?autolock ~working_dir name @@| fun (st_update, changed) -> - st_update, - match changed with - | true -> OpamPackage.Name.Set.singleton name - | false -> OpamPackage.Name.Set.empty - in - let merge (st_update1, set1) (st_update2, set2) = - (fun st -> st_update1 (st_update2 st)), - OpamPackage.Name.Set.union set1 set2 - in - let st_update, updates = - OpamParallel.reduce - ~jobs:(Lazy.force OpamStateConfig.(!r.jobs)) - ~command - ~merge - ~nil:((fun st -> st), OpamPackage.Name.Set.empty) - (OpamPackage.Name.Set.elements names) - in - let st = st_update st in - let updates = - OpamPackage.Name.Set.fold (fun name acc -> - OpamPackage.Set.add (OpamPinned.package st name) acc) - updates OpamPackage.Set.empty - in - OpamSwitchAction.add_to_reinstall st ~unpinned_only:false updates, - updates - let active_caches st nvs = let global_cache = OpamFile.Config.dl_cache st.switch_global.config in let rt = st.switch_repos in diff --git a/src/state/opamUpdate.mli b/src/state/opamUpdate.mli index 041cbf69f71..59c09bcafc8 100644 --- a/src/state/opamUpdate.mli +++ b/src/state/opamUpdate.mli @@ -55,37 +55,6 @@ val dev_packages: rw switch_state -> ?autolock:bool -> ?working_dir:package_set -> package_set -> bool * rw switch_state * package_set -(** Updates a single dev or pinned package from its upstream. If [working_dir] - is set, and the package is bound to a local, version-controlled dir, use the - working dir state instead of what has been committed to version control. - - If [autolock] is set to true, automatically update package from lock file - if it was pinned with a lock file at first. - - Returns true if changed, false otherwise, and a switch_state update - function, applying possible changes in packages metadata *) -val dev_package: - rw switch_state -> ?autolock:bool -> ?working_dir:bool -> package -> - ((rw switch_state -> rw switch_state) * bool) OpamProcess.job - -(** A subset of update_dev_packages that only takes packages names and only - works on pinned packages. Also updates the reinstall file of the current - switch. - If [autolock] is set to true, automatically update package from lock file - if it was pinned with a lock file at first. *) -val pinned_packages: - rw switch_state -> ?autolock:bool -> ?working_dir:name_set -> name_set -> - rw switch_state * package_set - -(** Updates a dev pinned package from its upstream; returns true if changed, - false otherwise, and a switch_state update function that applies possible - changes in packages metadata. Updates the on-disk overlay. - If [autolock] is set to true, automatically update package from lock file - if it was pinned with a lock file at first. *) -val pinned_package: - rw switch_state -> ?version:version -> ?autolock:bool -> ?working_dir:bool -> - name -> ((rw switch_state -> rw switch_state) * bool) OpamProcess.job - (** Download or synchronise the upstream source for the given package into the given directory. Also places all of the package extra files (that have a known hash) into the cache. For non-VC remotes, verifies the checksum if diff --git a/src/state/shellscripts/prompt.sh b/src/state/shellscripts/prompt.sh deleted file mode 100644 index ecb19cd3423..00000000000 --- a/src/state/shellscripts/prompt.sh +++ /dev/null @@ -1,28 +0,0 @@ -# This script allows you to see the active opam switch in your prompt. It -# should be portable across all shells in common use. -# -# To enable, change your PS1 to call _opam_ps1 using command substitution. For -# example, in bash: -# -# PS1="$(__opam_ps1 "(%s)")\u@\h:\w\$ " -# - -__opam_ps1() -{ - local exit=$? - local printf_format='(%s)' - - case "$#" in - 0|1) printf_format="${1:-$printf_format}" - ;; - *) return $exit - ;; - esac - - local switch_name="$(opam switch show --safe 2>/dev/null)" - if [ -z "$switch_name" ]; then - return $exit - fi - printf -- "$printf_format" "$switch_name" - return $exit -}