diff --git a/master_changes.md b/master_changes.md index 0a5d89e2eab..8132a716e27 100644 --- a/master_changes.md +++ b/master_changes.md @@ -11,7 +11,7 @@ moved, etc.), please update the _API updates_ part (it helps opam library users) ## Version - * + * Upgrade root version to 2.2~alpha [#4926 @rjbou] ## Global CLI * Fix typo in error message for opam var [#4786 @kit-ty-kate - fix #4785] @@ -154,6 +154,7 @@ users) * Add `with-tools` variable for recommended tools [#5016 @rjbou] * Add `x-locked` extension fields for overlay internal use, it stores if the files originate from a locked file, if so its extension [#5080 @rjbou] * Set `depext-bypass` parsing with depth 1, no needed brakcet if single package [#5154 @rjbou] + * `repo-config"`: add an optional field for repository initialisation state [#4933 @rjbou] ## External dependencies * Set `DEBIAN_FRONTEND=noninteractive` for unsafe-yes confirmation level [#4735 @dra27 - partially fix #4731] [2.1.0~rc2 #4739] @@ -179,6 +180,7 @@ users) * Set opam root version to 2.1 [#4763 @rjbou] [2.1.0~rc2 #4715] * Fix 2.1~alpha2 to 2.1 format upgrade with reinit [#4763 @rjbou - fix #4748] [2.1.0~rc2 #4750] * Fix bypass-check handling on reinit [#4750 @rjbou] [#4763 @rjbou] [2.1.0~rc2 #4750 #4756] + * Reorganise intermediate roots that need an uipgrade handling (for 2.1, prone to generalisation) [#4926 @rjbou] ## Sandbox * Sync the behaviour of the macOS sandbox script with Linux's: /tmp is now ready-only [#4719 @kit-ty-kate] @@ -187,6 +189,13 @@ users) * Print error message if command doesn't exist [#4971 @kit-ty-kat - fix #4112] * Resolve symlink for `ccache` directory [#5267 @rjbou - fix #5194] +## Repository + * Don't display global message when `this-switch` is given [#4899 @rjbou - fix #4889] + * Set the priority of user-set archive-mirrors higher than the repositories'. + This allows opam-repository to use the default opam.ocaml.org cache and be more resilient to changed/force-pushed or unavailable archives. [#4830 @kit-ty-kate - fixes #4411] + * [NEW] Add `--no-action` for `add` and `set-url` subcommands to permit delay the update [#XXXX rjbou - fix #4617] + * [NEW] Add `--no-action` for `add` and `set-url` subcommands to permit delay the update [#4933 rjbou - fix #4617] + ## VCS * Pass --depth=1 to git-fetch in the Git repo backend [#4442 @dra27] * Use 4.08's unnamed functor arguments to silence warning 67 [#4775 @dra27] @@ -334,7 +343,9 @@ users) * Escape for cmdliner.1.1.1 output change [#5131 @rjbou] * Add deprectaed flag test [#4523 @kit-ty-kate] * Add deps-only, install formula [#4975 @AltGr] - * Update opam root version test do escape `OPAMROOTVERSION` sed, it matches generated hexa temporary directory names [#5007 @AltGr #5301 @rjbou] + * Update opam root version test: + * to escape `OPAMROOTVERSION` sed, it matches generated hexa temporary directory names [#5007 @AltGr #5301 @rjbou] + * several improvments: add repo config check, update generator [#5303 @rjbou] * Add json output test [#5143 @rjbou] * Add test for opam file write with format preserved bug in #4936, fixed in #4941 [#4159 @rjbou] * Add test for switch upgrade from 2.0 root, with pinned compiler [#5176 @rjbou @kit-ty-kate] @@ -517,6 +528,8 @@ users) * `OpamFormula`: add generic `formula_to_cnf` and `formula_to_dnf`, and use them in `to_cnf` and `to_dnf` [#5171 @cannorin] * `OpamFilter`: add `?custom` argument in `to_string` to tweak the output [#5171 @cannorin] + * `OpamFile.repos_config.t`: add an initialised state argument in map value [#4933 @rjbou] + * `OpamFormat`: add `map_options_4` [#4933 @rjbou] ## opam-core * OpamSystem: avoid calling Unix.environment at top level [#4789 @hannesm] * `OpamStd.ABSTRACT`: add `compare` and `equal`, that added those functions to `OpamFilename`, `OpamHash`, `OpamStd`, `OpamStd`, `OpamUrl`, and `OpamVersion` [#4918 @rjbou] diff --git a/src/client/opamAdminCommand.ml b/src/client/opamAdminCommand.ml index c17bc479a5a..51782d37c35 100644 --- a/src/client/opamAdminCommand.ml +++ b/src/client/opamAdminCommand.ml @@ -781,6 +781,7 @@ let get_virtual_switch_state repo_root env = let repo = { repo_name = OpamRepositoryName.of_string "local"; repo_url = OpamUrl.empty; + repo_initialised = false; repo_trust = None; } in let repo_file = OpamRepositoryPath.repo repo_root in @@ -795,6 +796,7 @@ let get_virtual_switch_state repo_root env = load ~lock_kind:`Lock_read !r.root_dir) +! OpamFile.Config.empty); global_variables = OpamVariable.Map.empty; + global_upgrade_status = None; } in let singl x = OpamRepositoryName.Map.singleton repo.repo_name x in let repos_tmp = diff --git a/src/client/opamClient.ml b/src/client/opamClient.ml index 9ce38e5bd48..b4c6cdf8ca5 100644 --- a/src/client/opamClient.ml +++ b/src/client/opamClient.ml @@ -769,8 +769,9 @@ let init in OpamFile.Config.write config_f config; let repos_config = - OpamRepositoryName.Map.of_list repos |> - OpamRepositoryName.Map.map OpamStd.Option.some + List.map (fun (n, (u,t)) -> (n, (u, true, t))) repos + |> OpamRepositoryName.Map.of_list + |> OpamRepositoryName.Map.map OpamStd.Option.some in OpamFile.Repos_config.write (OpamPath.repos_config root) repos_config; diff --git a/src/client/opamCommands.ml b/src/client/opamCommands.ml index 8aae04461b6..bb370c095be 100644 --- a/src/client/opamCommands.ml +++ b/src/client/opamCommands.ml @@ -404,7 +404,7 @@ let init cli = let repo = OpamStd.Option.map (fun url -> let repo_url = OpamUrl.parse ?backend:repo_kind ~from_file:false url in - { repo_name; repo_url; repo_trust = None }) + { repo_name; repo_url; repo_initialised = false; repo_trust = None }) repo_url in let gt, rt, default_compiler = @@ -2215,7 +2215,13 @@ let repository cli = otherwise be used to explicitly set the repository list at once." Arg.(int) 1 in - let repository global_options command kind short scope rank params () = + let no_action = + mk_flag ~cli (cli_from cli2_2) ["n"; "no-action"] + "Do not automatically update when adding or changin repository url. \ + You must update afterwards" + in + let repository global_options command kind short scope rank params + no_action () = apply_global_options cli global_options; let global = List.mem `Default scope in let command, params, rank = match command, params, rank with @@ -2288,13 +2294,14 @@ let repository cli = in OpamRepositoryState.with_ `Lock_write gt (fun rt -> let rt = OpamRepositoryCommand.add rt name url trust_anchors in - let failed, rt = - OpamRepositoryCommand.update_with_auto_upgrade rt [name] - in - if failed <> [] then - (OpamRepositoryState.drop @@ OpamRepositoryCommand.remove rt name; - OpamConsole.error_and_exit `Sync_error - "Initial repository fetch failed")); + if not no_action then + let failed, rt = + OpamRepositoryCommand.update_with_auto_upgrade rt [name] + in + if failed <> [] then + (OpamRepositoryState.drop @@ OpamRepositoryCommand.remove rt name; + OpamConsole.error_and_exit `Sync_error + "Initial repository fetch failed")); OpamGlobalState.drop @@ OpamRepositoryCommand.update_selection gt ~global ~switches (update_repos name); if scope = [`Current_switch] then @@ -2359,9 +2366,8 @@ let repository cli = OpamGlobalState.with_ `Lock_none @@ fun gt -> OpamRepositoryState.with_ `Lock_write gt @@ fun rt -> let rt = OpamRepositoryCommand.set_url rt name url trust_anchors in - let _failed, _rt = - OpamRepositoryCommand.update_with_auto_upgrade rt [name] - in + if not no_action then + ignore @@ OpamRepositoryCommand.update_with_auto_upgrade rt [name]; `Ok () | Some `set_repos, names -> let names = List.map OpamRepositoryName.of_string names in @@ -2406,7 +2412,7 @@ let repository cli = mk_command_ret ~cli cli_original "repository" ~doc ~man Term.(const repository $global_options cli $command $repo_kind_flag cli cli_original $print_short_flag cli cli_original - $scope $rank $params) + $scope $rank $params $no_action) (* SWITCH *) diff --git a/src/client/opamRepositoryCommand.ml b/src/client/opamRepositoryCommand.ml index 583b23e42eb..3b4f107a2b9 100644 --- a/src/client/opamRepositoryCommand.ml +++ b/src/client/opamRepositoryCommand.ml @@ -79,7 +79,7 @@ let add rt name url trust_anchors = (OpamRepositoryName.to_string name) (OpamUrl.to_string url) | None -> - let repo = { repo_name = name; repo_url = url; + let repo = { repo_name = name; repo_url = url; repo_initialised = false; repo_trust = trust_anchors; } in if OpamFilename.exists_dir (OpamRepositoryPath.root root name) || @@ -224,6 +224,17 @@ let update_with_auto_upgrade rt repo_names = let repos = List.map (OpamRepositoryState.get_repo rt) repo_names in let failed, rt = OpamUpdate.repositories rt repos in let failed = List.map (fun r -> r.repo_name) failed in + let rt = { + rt with + repositories = + (OpamRepositoryName.Map.mapi (fun name repo -> + { repo with + repo_initialised = + List.for_all (fun n -> + not (OpamRepositoryName.equal name n)) failed }) + rt.repositories) + } in + OpamRepositoryState.write_config rt; if OpamFormatConfig.(!r.skip_version_checks) || OpamClientConfig.(!r.no_auto_upgrade) then diff --git a/src/core/opamFilename.ml b/src/core/opamFilename.ml index 70aa38e4a8c..c7adc79d741 100644 --- a/src/core/opamFilename.ml +++ b/src/core/opamFilename.ml @@ -174,12 +174,6 @@ let touch t = let chmod t p = Unix.chmod (to_string t) p -let written_since file = - let last_update = - (Unix.stat (to_string file)).Unix.st_mtime - in - (Unix.time () -. last_update) - let of_string s = let dirname = Filename.dirname s in let basename = Filename.basename s in @@ -227,6 +221,14 @@ let opt_file filename = let with_contents fn filename = fn (read filename) +let written_since file = + if exists file then + let last_update = + (Unix.stat (to_string file)).Unix.st_mtime + in + (Unix.time () -. last_update) + else -1. + let check_suffix filename s = Filename.check_suffix (to_string filename) s diff --git a/src/format/opamFile.ml b/src/format/opamFile.ml index c33bfb54aae..511bdc33e1b 100644 --- a/src/format/opamFile.ml +++ b/src/format/opamFile.ml @@ -1234,7 +1234,7 @@ module ConfigSyntax = struct let internal = "config" let format_version = OpamVersion.of_string "2.1" let file_format_version = OpamVersion.of_string "2.0" - let root_version = OpamVersion.of_string "2.1" + let root_version = OpamVersion.of_string "2.2~alpha" let default_old_root_version = OpamVersion.of_string "2.1~~previous" @@ -1751,25 +1751,44 @@ end module Repos_configSyntax = struct let internal = "repos-config" - let format_version = OpamVersion.of_string "2.0" + let format_version = OpamVersion.of_string "2.1" let file_format_version = OpamVersion.of_string "2.0" - type t = ((url * trust_anchors option) option) OpamRepositoryName.Map.t + type t = ((url * bool * trust_anchors option) option) OpamRepositoryName.Map.t let empty = OpamRepositoryName.Map.empty + let pp_repository_def = + Pp.V.map_options_4 + (Pp.V.string -| + Pp.of_module "repository" (module OpamRepositoryName)) + (Pp.opt @@ Pp.singleton -| Pp.V.url) + (Pp.opt @@ Pp.singleton -| Pp.V.bool) + (Pp.map_list Pp.V.string) + (Pp.opt @@ + Pp.singleton -| Pp.V.int -| + OpamPp.check ~name:"quorum" ~errmsg:"quorum must be >= 0" ((<=) 0)) -| + Pp.pp + (fun ~pos:_ (name, url, initialised, fingerprints, quorum) -> + name, url, not (initialised = Some false), + match fingerprints with [] -> None | fingerprints -> + Some {fingerprints; quorum = OpamStd.Option.default 1 quorum}) + (fun (name, url, initialised, ta) -> match ta with + | Some ta -> name, url, Some initialised, ta.fingerprints, Some ta.quorum + | None -> name, url, Some initialised, [], None) + let fields = [ "repositories", Pp.ppacc (fun x _ -> x) (fun x -> x) ((Pp.V.map_list ~depth:1 @@ - InitConfigSyntax.pp_repository_def -| + pp_repository_def -| Pp.pp (fun ~pos:_ -> function - | (name, Some url, ta) -> name, Some (url, ta) - | (name, None, _) -> name, None) + | (name, Some url, init, ta) -> name, Some (url, init, ta) + | (name, None, _, _) -> name, None) (fun (name, def) -> match def with - | Some (url, ta) -> name, Some url, ta - | None -> name, None, None)) -| + | Some (url, init, ta) -> name, Some url, init, ta + | None -> name, None, false, None)) -| Pp.of_pair "repository-url-list" OpamRepositoryName.Map.(of_list, bindings)); ] diff --git a/src/format/opamFile.mli b/src/format/opamFile.mli index 47759a5ebf5..3aceb6955b3 100644 --- a/src/format/opamFile.mli +++ b/src/format/opamFile.mli @@ -997,7 +997,7 @@ module Repo_config_legacy : sig end module Repos_config: sig - type t = (url * trust_anchors option) option OpamRepositoryName.Map.t + type t = (url * bool * trust_anchors option) option OpamRepositoryName.Map.t include IO_FILE with type t := t module BestEffort: BestEffortRead with type t := t end diff --git a/src/format/opamFormat.ml b/src/format/opamFormat.ml index aa89b793677..aac54c2cb78 100644 --- a/src/format/opamFormat.ml +++ b/src/format/opamFormat.ml @@ -244,6 +244,19 @@ module V = struct pp4 -| pp (fun ~pos:_ (((a,b),c),d) -> a,b,c,d) (fun (a,b,c,d) -> ((a,b),c),d) + let map_options_4 pp1 pp2 pp3 pp4 pp5 = + option_depth 4 -| + option_strict -| map_option_contents + (option_strict -| map_option_contents + (option_strict -| map_option_contents + (option_strict -| map_option_contents + pp1 pp2) + pp3) + pp4) + pp5 -| + pp (fun ~pos:_ ((((a,b),c),d), e) -> a,b,c,d,e) + (fun (a,b,c,d,e) -> (((a,b),c),d),e) + let map_pair pp1 pp2 = pp ~name:(Printf.sprintf "[%s %s]" pp1.ppname pp2.ppname) (fun ~pos:_ v -> match v.pelem with diff --git a/src/format/opamFormat.mli b/src/format/opamFormat.mli index aa55a928473..93a177206c9 100644 --- a/src/format/opamFormat.mli +++ b/src/format/opamFormat.mli @@ -101,6 +101,12 @@ module V : sig (value list, 'b) t -> (value list, 'c) t -> (value list, 'd) t -> (value, 'a * 'b * 'c * 'd) t + (** Maps over four options (e.g. [v {op1} {op2} {op3} {op4}]) *) + val map_options_4 : + (value, 'a) t -> (value list, 'b) t -> (value list, 'c) t -> + (value list, 'd) t -> (value list, 'e) t -> + (value, 'a * 'b * 'c * 'd * 'e) t + (** A pair is simply a list with two elements in the [value] type *) val map_pair : (value, 'a) t -> diff --git a/src/format/opamTypes.mli b/src/format/opamTypes.mli index 42f98458d4d..f22bee44faf 100644 --- a/src/format/opamTypes.mli +++ b/src/format/opamTypes.mli @@ -179,6 +179,7 @@ type repository = { repo_name : repository_name; repo_url : url; repo_trust : trust_anchors option; + repo_initialised: bool; } (** {2 Variable-based filters} *) diff --git a/src/state/opamFormatUpgrade.ml b/src/state/opamFormatUpgrade.ml index dc0afa10b5f..944e37cbc65 100644 --- a/src/state/opamFormatUpgrade.ml +++ b/src/state/opamFormatUpgrade.ml @@ -354,7 +354,7 @@ let opam_file_from_1_2_to_2_0 ?filename opam = let v1_1 = OpamVersion.of_string "1.1" -let from_1_0_to_1_1 root _config = +let from_1_0_to_1_1 root ~on_the_fly:_ _config = OpamConsole.error_and_exit `Configuration_error "You appear to have an opam setup dating back to opam 1.0, which is no \ longer supported since opam 2.0. Please remove \"%s\" and run \ @@ -363,7 +363,7 @@ let from_1_0_to_1_1 root _config = let v1_2 = OpamVersion.of_string "1.2" -let from_1_1_to_1_2 root config = +let from_1_1_to_1_2 root ~on_the_fly:_ config = log "Upgrade pinned packages format to 1.2"; let aliases = OpamFile.Aliases.safe_read (OpamFile.make (root // "aliases")) in let remove_pinned_suffix d = @@ -430,11 +430,11 @@ let from_1_1_to_1_2 root config = ) (OpamFilename.files (switch_root / "config")) ) aliases; - config + config, None let v1_3_dev2 = OpamVersion.of_string "1.3~dev2" -let from_1_2_to_1_3_dev2 root config = +let from_1_2_to_1_3_dev2 root ~on_the_fly:_ config = log "Upgrade switch state files format to 1.3"; let aliases = OpamFile.Aliases.safe_read (OpamFile.make (root // "aliases")) @@ -522,11 +522,11 @@ let from_1_2_to_1_3_dev2 root config = OpamFilename.move ~src ~dst) installed) aliases; - config + config, None let v1_3_dev5 = OpamVersion.of_string "1.3~dev5" -let from_1_3_dev2_to_1_3_dev5 root conf = +let from_1_3_dev2_to_1_3_dev5 root ~on_the_fly:_ conf = log "Upgrade switch state files format to 1.3 step 2"; let aliases_f = OpamFile.make (root // "aliases") in let aliases = OpamFile.Aliases.safe_read aliases_f in @@ -670,11 +670,11 @@ let from_1_3_dev2_to_1_3_dev5 root conf = OpamFile.Config.with_installed_switches (OpamSwitch.Map.keys aliases) conf in OpamFilename.remove (OpamFile.filename aliases_f); - conf + conf, None let v1_3_dev6 = OpamVersion.of_string "1.3~dev6" -let from_1_3_dev5_to_1_3_dev6 root conf = +let from_1_3_dev5_to_1_3_dev6 root ~on_the_fly:_ conf = log "Upgrade switch state files format to 1.3 step 3"; (* Move switch internals to [switch/.opam-switch] *) List.iter (fun switch -> @@ -693,11 +693,11 @@ let from_1_3_dev5_to_1_3_dev6 root conf = ["backup"; "build"; "install"; "config"; "packages.dev"; "overlay"] ) (OpamFile.Config.installed_switches conf); - conf + conf, None let v1_3_dev7 = OpamVersion.of_string "1.3~dev7" -let from_1_3_dev6_to_1_3_dev7 root conf = +let from_1_3_dev6_to_1_3_dev7 root ~on_the_fly:_ conf = log "Upgrade switch state files format to 1.3 step 4"; (* Get mirrors of the metadata of all installed packages into switch_meta_dir/packages *) @@ -738,11 +738,11 @@ let from_1_3_dev6_to_1_3_dev7 root conf = OpamFilename.rmdir (root / "packages"); OpamFilename.rmdir (root / "packages.dev"); OpamFilename.rmdir (root / "state.cache"); - conf + conf, None let v2_0_alpha = OpamVersion.of_string "2.0~alpha" -let from_1_3_dev7_to_2_0_alpha root conf = +let from_1_3_dev7_to_2_0_alpha root ~on_the_fly:_ conf = log "Upgrade switch state files format to 2.0~alpha"; (* leftovers from previous upgrades *) OpamFilename.rmdir (root / "compilers"); @@ -764,18 +764,18 @@ let from_1_3_dev7_to_2_0_alpha root conf = in OpamFile.Repos_config.write (OpamPath.repos_config root) (OpamRepositoryName.Map.of_list - (List.map (fun (_, r, u) -> r, Some (u,None)) prio_repositories)); + (List.map (fun (_, r, u) -> r, Some (u,true,None)) prio_repositories)); let prio_repositories = List.stable_sort (fun (prio1, _, _) (prio2, _, _) -> prio2 - prio1) prio_repositories in let repositories_list = List.map (fun (_, r, _) -> r) prio_repositories in OpamFile.Config.with_repositories repositories_list conf - |> OpamFile.Config.with_opam_version v2_0 + |> OpamFile.Config.with_opam_version v2_0, None let v2_0_alpha2 = OpamVersion.of_string "2.0~alpha2" -let from_2_0_alpha_to_2_0_alpha2 root conf = +let from_2_0_alpha_to_2_0_alpha2 root ~on_the_fly:_ conf = List.iter (fun switch -> let switch_dir = root / OpamSwitch.to_string switch in let meta_dir = switch_dir / ".opam-switch" in @@ -904,11 +904,11 @@ let from_2_0_alpha_to_2_0_alpha2 root conf = OpamFile.Config.with_eval_variables [ OpamVariable.of_string "sys-ocaml-version", ["ocamlc"; "-vnum"], "OCaml version present on your system independently of opam, if any"; - ] conf + ] conf, None let v2_0_alpha3 = OpamVersion.of_string "2.0~alpha3" -let from_2_0_alpha2_to_2_0_alpha3 root conf = +let from_2_0_alpha2_to_2_0_alpha3 root ~on_the_fly:_ conf = List.iter (fun switch -> let switch_dir = root / OpamSwitch.to_string switch in let old_global_config = @@ -946,11 +946,11 @@ let from_2_0_alpha2_to_2_0_alpha3 root conf = OpamFilename.remove old_global_config ) (OpamFile.Config.installed_switches conf); - conf + conf, None let v2_0_beta = OpamVersion.of_string "2.0~beta" -let from_2_0_alpha3_to_2_0_beta root conf = +let from_2_0_alpha3_to_2_0_beta root ~on_the_fly:_ conf = List.iter (fun switch -> let switch_meta_dir = root / OpamSwitch.to_string switch / ".opam-switch" @@ -1001,11 +1001,11 @@ let from_2_0_alpha3_to_2_0_beta root conf = OpamFile.Config.with_eval_variables ((OpamVariable.of_string "arch", ["uname"; "-m"], "Host architecture, as returned by 'uname -m'") - :: OpamFile.Config.eval_variables conf) + :: OpamFile.Config.eval_variables conf), None let v2_0_beta5 = OpamVersion.of_string "2.0~beta5" -let from_2_0_beta_to_2_0_beta5 root conf = +let from_2_0_beta_to_2_0_beta5 root ~on_the_fly:_ conf = List.iter (fun switch -> let switch_meta_dir = root / OpamSwitch.to_string switch / ".opam-switch" @@ -1043,9 +1043,9 @@ let from_2_0_beta_to_2_0_beta5 root conf = OpamFile.Config.with_eval_variables (List.filter (fun (v,_,_) -> not (List.mem v rem_eval_variables)) (OpamFile.Config.eval_variables conf)) - conf + conf, None -let from_2_0_beta5_to_2_0 _ conf = conf +let from_2_0_beta5_to_2_0 _ ~on_the_fly:_ conf = conf, None (* swiitch config with opam-version 2.1 *) let v2_1_alpha = OpamVersion.of_string "2.1~alpha" @@ -1056,7 +1056,7 @@ let v2_1_rc = OpamVersion.of_string "2.1~rc" let v2_1 = OpamVersion.of_string "2.1" -let from_2_0_to_2_1_alpha _ conf = conf +let from_2_0_to_2_1_alpha _ ~on_the_fly:_ conf = conf, None let downgrade_2_1_switches root conf = List.iter (fun switch -> @@ -1066,22 +1066,33 @@ let downgrade_2_1_switches root conf = (OpamFile.Config.installed_switches conf); conf -let from_2_1_alpha_to_2_1_alpha2 root conf = - downgrade_2_1_switches root conf +let from_2_1_alpha_to_2_1_alpha2 root ~on_the_fly:_ conf = + downgrade_2_1_switches root conf, Some `Switch + +let from_2_1_alpha2_to_2_1_rc root ~on_the_fly:_ conf = + downgrade_2_1_switches root conf, Some `Switch + +let from_2_1_rc_to_2_1 _ ~on_the_fly:_ conf = conf, None + +let from_2_0_to_2_1 _ ~on_the_fly:_ conf = conf, None -let from_2_1_alpha2_to_v2_1_rc root conf = - downgrade_2_1_switches root conf +let v2_2_alpha = OpamVersion.of_string "2.2~alpha" -let from_2_1_rc_to_v2_1 _ conf = conf +let from_2_1_to_2_2_alpha_repo root _conf = + let f = OpamPath.repos_config root in + OpamStd.Option.iter (OpamFile.Repos_config.write f) + (OpamFile.Repos_config.read_opt f) -let from_2_0_to_v2_1 _ conf = conf +let from_2_1_to_2_2_alpha root ~on_the_fly conf = + if not on_the_fly then from_2_1_to_2_2_alpha_repo root conf; + conf, Some `Repo let latest_version = OpamFile.Config.root_version let latest_hard_upgrade = (* to *) v2_0_beta5 -(* intermediates roots that need an hard upgrade *) -let intermediate_roots = [ +(* intermediates roots that needs an hard upgrade if upgraded from them *) +let v2_1_intermediate_roots = [ v2_1_alpha; v2_1_alpha2; v2_1_rc ] @@ -1094,6 +1105,18 @@ let remove_missing_switches root conf = in OpamFile.Config.with_installed_switches exists conf, missing +let dontblock = + let t = lazy ( + (* Deadlock until one is killed in interactive mode, but abort in batch *) + if OpamStd.Sys.tty_out then None else Some true + ) in + fun () -> Lazy.force t + +let erase_plugin_links root = + let plugins_bin = OpamPath.plugins_bin root in + if OpamFilename.exists_dir plugins_bin then + List.iter OpamFilename.remove @@ OpamFilename.files_and_links plugins_bin + let as_necessary ?reinit requested_lock global_lock root config = let root_version = match OpamFile.Config.opam_root_version_opt config with @@ -1111,44 +1134,40 @@ let as_necessary ?reinit requested_lock global_lock root config = with Sys_error _ | OpamPp.Bad_version _ -> v2_1_alpha in let cmp = OpamVersion.(compare OpamFile.Config.root_version root_version) in - if cmp <= 0 then config (* newer or same *) else - let is_intermdiate_root = List.mem root_version intermediate_roots in - let keep_needed_upgrades = - List.filter (fun (v,_) -> OpamVersion.compare root_version v < 0) - in - (* to generalise *) - let intermediates = - let hard = [ - v2_1_alpha, from_2_0_to_2_1_alpha; - v2_1_alpha2, from_2_1_alpha_to_2_1_alpha2; - v2_1_rc, from_2_1_alpha2_to_v2_1_rc; - ] in - let light = [ - v2_1, from_2_1_rc_to_v2_1; - ] in - keep_needed_upgrades hard, - light - in + if cmp <= 0 then config, None (* newer or same *) else let hard_upg, light_upg = - if is_intermdiate_root then intermediates else - [ - v1_1, from_1_0_to_1_1; - v1_2, from_1_1_to_1_2; - v1_3_dev2, from_1_2_to_1_3_dev2; - v1_3_dev5, from_1_3_dev2_to_1_3_dev5; - v1_3_dev6, from_1_3_dev5_to_1_3_dev6; - v1_3_dev7, from_1_3_dev6_to_1_3_dev7; - v2_0_alpha, from_1_3_dev7_to_2_0_alpha; - v2_0_alpha2, from_2_0_alpha_to_2_0_alpha2; - v2_0_alpha3, from_2_0_alpha2_to_2_0_alpha3; - v2_0_beta, from_2_0_alpha3_to_2_0_beta; - v2_0_beta5, from_2_0_beta_to_2_0_beta5; - v2_0, from_2_0_beta5_to_2_0; - v2_1, from_2_0_to_v2_1; - ] - |> keep_needed_upgrades - |> List.partition (fun (v,_) -> - OpamVersion.compare v latest_hard_upgrade <= 0) + let is_2_1_intermediate_root = + List.exists (OpamVersion.equal root_version) v2_1_intermediate_roots + in + let latest_hard_upgrade = + if is_2_1_intermediate_root then v2_1_rc else latest_hard_upgrade + in + (if is_2_1_intermediate_root then [ + v2_1_alpha, from_2_0_to_2_1_alpha; + v2_1_alpha2, from_2_1_alpha_to_2_1_alpha2; + v2_1_rc, from_2_1_alpha2_to_2_1_rc; + v2_1, from_2_1_rc_to_2_1; + ] else [ + v1_1, from_1_0_to_1_1; + v1_2, from_1_1_to_1_2; + v1_3_dev2, from_1_2_to_1_3_dev2; + v1_3_dev5, from_1_3_dev2_to_1_3_dev5; + v1_3_dev6, from_1_3_dev5_to_1_3_dev6; + v1_3_dev7, from_1_3_dev6_to_1_3_dev7; + v2_0_alpha, from_1_3_dev7_to_2_0_alpha; + v2_0_alpha2, from_2_0_alpha_to_2_0_alpha2; + v2_0_alpha3, from_2_0_alpha2_to_2_0_alpha3; + v2_0_beta, from_2_0_alpha3_to_2_0_beta; + v2_0_beta5, from_2_0_beta_to_2_0_beta5; + v2_0, from_2_0_beta5_to_2_0; + v2_1, from_2_0_to_2_1; + ]) @ [ + v2_2_alpha, from_2_1_to_2_2_alpha; + ] + |> List.filter (fun (v,_) -> + OpamVersion.compare root_version v < 0) + |> List.partition (fun (v,_) -> + OpamVersion.compare v latest_hard_upgrade <= 0) in let need_hard_upg = hard_upg <> [] in let on_the_fly, global_lock_kind = @@ -1157,29 +1176,33 @@ let as_necessary ?reinit requested_lock global_lock root config = else false, `Lock_write in - let erase_plugin_links root = - let plugins_bin = OpamPath.plugins_bin root in - if OpamFilename.exists_dir plugins_bin then begin - List.iter OpamFilename.remove @@ OpamFilename.files_and_links plugins_bin - end + let add_chg (c1: [`Repo|`Switch] option) (c2: [`Repo|`Switch] option) = + match c1, c2 with + | None, None -> None + | Some c, None | None, Some c -> Some c + | Some `Repo, _ | _, Some `Repo-> Some `Repo + | Some `Switch, _ -> Some `Switch in let light config = - let config = - List.fold_left (fun config (v, from) -> - from root config |> OpamFile.Config.with_opam_root_version v) - config light_upg + let config, changes = + List.fold_left (fun (config, changes) (v, from) -> + let config, change = from root ~on_the_fly config in + config |> OpamFile.Config.with_opam_root_version v, + add_chg change changes) + (config, None) light_upg in if not on_the_fly then begin OpamFile.Config.write (OpamPath.config root) config; erase_plugin_links root; end; - config + config, changes in let hard config = List.fold_left (fun config (v, from) -> - let config = from root config |> OpamFile.Config.with_opam_root_version v in + let config, _change = from root ~on_the_fly config in + let config = config |> OpamFile.Config.with_opam_root_version v in (* save the current version to mitigate damage is the upgrade goes - wrong afterwards *) + wrong afterwards *) OpamFile.Config.write (OpamPath.config root) config; erase_plugin_links root; config) @@ -1196,12 +1219,12 @@ let as_necessary ?reinit requested_lock global_lock root config = @> OpamConsole.colorise `bold @> Printf.sprintf "'%s'") global)) - (match global with - | [_] -> "it no longer exists" - | _ -> "they no longer exist"); - config + (match global with + | [_] -> "it no longer exists" + | _ -> "they no longer exist"); + config in - if hard_upg = [] && light_upg = [] then config (* no upgrade to do *) else + if hard_upg = [] && light_upg = [] then config, None (* no upgrade to do *) else let is_dev = OpamVersion.is_dev_version () in log "%s config upgrade, from %s to %s" (if on_the_fly then "On-the-fly" else @@ -1219,12 +1242,9 @@ let as_necessary ?reinit requested_lock global_lock root config = (OpamFilename.Dir.to_string root) (OpamVersion.to_string root_version) (OpamVersion.to_string latest_version); - let dontblock = - (* Deadlock until one is killed in interactive mode, but abort in batch *) - if OpamStd.Sys.tty_out then None else Some true - in try - OpamFilename.with_flock_upgrade global_lock_kind ?dontblock global_lock + OpamFilename.with_flock_upgrade global_lock_kind ?dontblock:(dontblock ()) + global_lock @@ fun _ -> if not on_the_fly then if need_hard_upg then @@ -1234,7 +1254,7 @@ let as_necessary ?reinit requested_lock global_lock root config = || not is_dev && OpamConsole.confirm "Perform the update and continue?" then - let config = hard config |> light in + let config, _changes = hard config |> light in OpamConsole.msg "Format upgrade done.\n"; (* We need to re run init in case of hard upgrade *) raise (Upgrade_done (config, reinit)) @@ -1242,19 +1262,46 @@ let as_necessary ?reinit requested_lock global_lock root config = OpamStd.Sys.exit_because `Aborted else if OpamConsole.confirm "Continue?" then - (let config = light config in + (let config, _changes = light config in OpamConsole.msg "Format upgrade done.\n"; - config) + config, None) else OpamStd.Sys.exit_because `Aborted else - (let config = light config in + (let config, changes = light config in log "Format upgrade done"; - config) + config, + OpamStd.Option.map (fun chg -> chg, root_version) changes) with OpamSystem.Locked -> OpamConsole.error_and_exit `Locked "Could not acquire lock for performing format upgrade." +let finish_hard_upgrade old_root_version global_lock root config = + let is_dev = OpamVersion.is_dev_version () in + let upgrades = + [ + v2_2_alpha, from_2_1_to_2_2_alpha_repo + ] + |> List.filter (fun (v,_) -> + OpamVersion.compare old_root_version v < 0) + in + if upgrades = [] then () else + OpamFilename.with_flock_upgrade `Lock_write ?dontblock:(dontblock ()) + global_lock + @@ fun _ -> + if is_dev && + Some "yes" = + OpamConsole.read "Type \"yes\" to perform the update and continue:" + || not is_dev && + OpamConsole.confirm "Perform the update and continue?" + then + (List.iter (fun (_v, from) -> + from root config) upgrades; + OpamFile.Config.write (OpamPath.config root) config; + erase_plugin_links root) + else + OpamStd.Sys.exit_because `Aborted + let hard_upgrade_from_2_1_intermediates ?reinit ?global_lock root = let config_f = OpamPath.config root in let opam_root_version = OpamFile.Config.raw_root_version config_f in diff --git a/src/state/opamFormatUpgrade.mli b/src/state/opamFormatUpgrade.mli index 48f89f48f16..be37f483d42 100644 --- a/src/state/opamFormatUpgrade.mli +++ b/src/state/opamFormatUpgrade.mli @@ -35,7 +35,11 @@ val latest_version: OpamVersion.t the upgraded or unchanged config file.*) val as_necessary: ?reinit:(OpamFile.Config.t -> unit) -> 'a lock -> OpamSystem.lock -> dirname -> - OpamFile.Config.t -> OpamFile.Config.t + OpamFile.Config.t -> + OpamFile.Config.t * ([ `Repo | `Switch ] * OpamVersion.t) option + +val finish_hard_upgrade: + OpamVersion.t -> OpamSystem.lock -> dirname -> OpamFile.Config.t -> unit (* Try to launch a hard upgrade from 2;1 alpha's & beta's root to 2.1~rc one. Raises [Upgrade_done] (catched by main diff --git a/src/state/opamGlobalState.ml b/src/state/opamGlobalState.ml index 968f5e31b5c..589115e82bb 100644 --- a/src/state/opamGlobalState.ml +++ b/src/state/opamGlobalState.ml @@ -60,7 +60,7 @@ let load lock_kind = OpamConsole.error_and_exit `Configuration_error "Opam has not been initialised, please run `opam init'"; let config_lock = OpamFilename.flock lock_kind (OpamPath.config_lock root) in - let config = + let config, global_upgrade_status = try load_config lock_kind global_lock root with OpamFormatUpgrade.Upgrade_done _ as e -> OpamSystem.funlock config_lock; @@ -124,7 +124,9 @@ let load lock_kind = { global_lock = config_lock; root; config; - global_variables; } + global_variables; + global_upgrade_status; + } let switches gt = OpamFile.Config.installed_switches gt.config @@ -213,3 +215,10 @@ let fix_switch_list gt = with OpamSystem.Locked -> gt else gt +let check_upgrade_todo lock_kind kind gt = + if lock_kind = `Lock_write then + OpamStd.Option.iter (fun (upgrade, version) -> + if upgrade = kind then + OpamFormatUpgrade.finish_hard_upgrade version gt.global_lock gt.root + gt.config) gt.global_upgrade_status + diff --git a/src/state/opamGlobalState.mli b/src/state/opamGlobalState.mli index e8d32d167c9..3ebc7decd53 100644 --- a/src/state/opamGlobalState.mli +++ b/src/state/opamGlobalState.mli @@ -75,3 +75,6 @@ val fix_switch_list: 'a global_state -> 'a global_state (** Description used for system inferred variables *) val inferred_from_system: string + +val check_upgrade_todo: + 'a lock -> [ `Repo | `Switch ] -> 'b global_state -> unit diff --git a/src/state/opamRepositoryState.ml b/src/state/opamRepositoryState.ml index 1e515a1bac4..ef49172054c 100644 --- a/src/state/opamRepositoryState.ml +++ b/src/state/opamRepositoryState.ml @@ -150,6 +150,7 @@ let get_repo_root rt repo = get_root_raw rt.repos_global.root rt.repos_tmp repo.repo_name let load lock_kind gt = + OpamGlobalState.check_upgrade_todo lock_kind `Repo gt; log "LOAD-REPOSITORY-STATE %@ %a" (slog OpamFilename.Dir.to_string) gt.root; let lock = OpamFilename.flock lock_kind (OpamPath.repos_lock gt.root) in let repos_map = OpamStateConfig.Repos.safe_read ~lock_kind gt in @@ -158,11 +159,12 @@ let load lock_kind gt = load with best-effort (read-only)" (OpamVersion.to_string (OpamFile.Config.opam_root_version gt.config)) (OpamVersion.to_string (OpamFile.Config.root_version)); - let mk_repo name url_opt = { - repo_name = name; - repo_url = OpamStd.Option.Op.((url_opt >>| fst) +! OpamUrl.empty); - repo_trust = OpamStd.Option.Op.(url_opt >>= snd); - } in + let mk_repo repo_name url_opt = + let repo_url, repo_initialised, repo_trust = + OpamStd.Option.Op.(url_opt +! (OpamUrl.empty, false, None)) + in + { repo_name; repo_url; repo_trust; repo_initialised; } + in let uncached = (* Don't cache repositories without remote, as they should be editable in-place *) @@ -293,7 +295,7 @@ let write_config rt = OpamFile.Repos_config.write (OpamPath.repos_config rt.repos_global.root) (OpamRepositoryName.Map.map (fun r -> if r.repo_url = OpamUrl.empty then None - else Some (r.repo_url, r.repo_trust)) + else Some (r.repo_url, r.repo_initialised, r.repo_trust)) rt.repositories) let check_last_update () = diff --git a/src/state/opamStateTypes.mli b/src/state/opamStateTypes.mli index 10a158dc095..e7c01b6923b 100644 --- a/src/state/opamStateTypes.mli +++ b/src/state/opamStateTypes.mli @@ -65,6 +65,8 @@ type +'lock global_state = { (** A map of variables that have been defined globally, e.g. through `.opam/config`. They may need evaluation so are stored as lazy values. The extra string is the supplied variable documentation *) + + global_upgrade_status: ([ `Repo | `Switch ] * OpamVersion.t) option; } constraint 'lock = 'lock lock (** State corresponding to the repo/ subdir: all available packages and diff --git a/src/state/opamSwitchState.ml b/src/state/opamSwitchState.ml index 7b39cd3393b..14442f9cf0f 100644 --- a/src/state/opamSwitchState.ml +++ b/src/state/opamSwitchState.ml @@ -229,6 +229,7 @@ let depexts_unavailable_raw sys_packages nv = | _ -> None let load lock_kind gt rt switch = + OpamGlobalState.check_upgrade_todo lock_kind `Switch gt; let chrono = OpamConsole.timer () in log "LOAD-SWITCH-STATE %@ %a" (slog OpamSwitch.to_string) switch; if not (OpamGlobalState.switch_exists gt switch) then diff --git a/src/state/opamUpdate.ml b/src/state/opamUpdate.ml index 39898ccbcdb..135cb838c1e 100644 --- a/src/state/opamUpdate.ml +++ b/src/state/opamUpdate.ml @@ -164,9 +164,15 @@ let repositories rt repos = OpamProcess.Job.catch (fun ex -> OpamStd.Exn.fatal ex; - OpamConsole.error "Could not update repository %S: %s" + OpamConsole.error "Could not update repository %S: %s%s" (OpamRepositoryName.to_string repo.repo_name) - (match ex with Failure s -> s | ex -> Printexc.to_string ex); + (match ex with Failure s -> s | ex -> Printexc.to_string ex) + (if repo.repo_initialised then "" else + Printf.sprintf + "\nIt was added with url %s but not initialised\n\ + Check url and update it `opam repository set-url %s '" + (OpamConsole.colorise `bold (OpamUrl.to_string repo.repo_url)) + (OpamRepositoryName.to_string repo.repo_name)); Done ([repo], None)) @@ fun () -> repository rt repo @@| fun f -> [], f diff --git a/tests/reftests/opamroot-versions.test b/tests/reftests/opamroot-versions.test index f8e874ac316..ef026b91836 100644 --- a/tests/reftests/opamroot-versions.test +++ b/tests/reftests/opamroot-versions.test @@ -85,8 +85,9 @@ RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found # No matches found ### # ro global state, rw repo state -### opam repo add root-config ./root-config --set-default +### opam repo add root-config ./root-config GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +[WARNING] No switch is currently set, perhaps you meant '--set-default'? RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM [WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: - At ${BASEDIR}/OPAM/repo/repos-config:2:0-2:8:: @@ -94,6 +95,8 @@ RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found [root-config] Initialised +[ERROR] No switch is currently set. Please use 'opam switch' to set or install a switch +# Return code 50 # ### opam repo remove root-config --all --debug-level=0 ### :I:2:b: Good repo config file : ### cp repos-config $OPAMROOT/repo/repos-config @@ -104,11 +107,14 @@ RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found # No matches found ### # ro global state, rw repo state -### opam repo add root-config ./root-config --set-default +### opam repo add root-config ./root-config GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +[WARNING] No switch is currently set, perhaps you meant '--set-default'? RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found [root-config] Initialised +[ERROR] No switch is currently set. Please use 'opam switch' to set or install a switch +# Return code 50 # ### opam switch create foo --empty --debug-level=0 ### :I:3:a: Bad switch config file : ### cp switch-config.err $OPAMROOT/foo/.opam-switch/switch-config @@ -260,9 +266,10 @@ RSTATE root version (4.8) is greater than running binar RSTATE Cache found # No matches found ### # ro global state, rw repo state -### opam repo add root-config ./root-config --set-default | "[(]?${OPAMROOTVERSION}[)]" -> "current" +### opam repo add root-config ./root-config | "[(]?${OPAMROOTVERSION}[)]" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM GSTATE root version (4.8) is greater than running binary's current; load with best-effort (read-only) +[WARNING] No switch is currently set, perhaps you meant '--set-default'? RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM [ERROR] Refusing write access to ${BASEDIR}/OPAM, which is more recent than this version of opam (4.8 > current, aborting. # Return code 15 # @@ -277,9 +284,10 @@ RSTATE root version (4.8) is greater than running binar RSTATE Cache found # No matches found ### # ro global state, rw repo state -### opam repo add root-config ./root-config --set-default | "[(]?${OPAMROOTVERSION}[)]" -> "current" +### opam repo add root-config ./root-config | "[(]?${OPAMROOTVERSION}[)]" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM GSTATE root version (4.8) is greater than running binary's current; load with best-effort (read-only) +[WARNING] No switch is currently set, perhaps you meant '--set-default'? RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM [ERROR] Refusing write access to ${BASEDIR}/OPAM, which is more recent than this version of opam (4.8 > current, aborting. # Return code 15 # @@ -384,7 +392,7 @@ In ${BASEDIR}/OPAM/config: unsupported or missing file format version; should be 2.0 or older # Return code 99 # ### # ro global state, rw repo state -### opam repo add root-config ./root-config --set-default +### opam repo add root-config ./root-config GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM Fatal error: In ${BASEDIR}/OPAM/config: @@ -400,7 +408,7 @@ In ${BASEDIR}/OPAM/config: unsupported or missing file format version; should be 2.0 or older # Return code 99 # ### # ro global state, rw repo state -### opam repo add root-config ./root-config --set-default +### opam repo add root-config ./root-config GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM Fatal error: In ${BASEDIR}/OPAM/config: @@ -513,6 +521,8 @@ let mode = | "orphaned" -> `Orphaned version | s -> failwith s +let opamroot = Sys.getenv "OPAMROOT" + let opam_version = Printf.sprintf "opam-version: %S" let opam_version_2_0 = opam_version "2.0" let opam_version_2_1 = opam_version "2.1" @@ -555,9 +565,14 @@ let invariant_sw_comp = {|invariant: ["i-am-compiler"]|} let invariant_sw_sys_comp = {|invariant: ["i-am-sys-compiler"]|} let root_version = Printf.sprintf "opam-root-version: %S" let synopsis = Printf.sprintf "synopsis: %S" -let opam_root = Printf.sprintf "opam-root: %S" (Sys.getenv "OPAMROOT") +let opam_root = Printf.sprintf "opam-root: %S" opamroot +let repos_config = Printf.sprintf {| +opam-version: "2.0" +repositories: "default" {"file://%s/default"} +|} (Sys.getenv "BASEDIR" |> String.map (function '\\' -> '/' | c -> c)) let opam_20 = [ "config", [ opam_version_2_0; repo; installed_switches; eval; default_compiler ]; + "repo/repos-config", [ repos_config ]; "default/.opam-switch/switch-config", [ opam_version_2_0; synopsis "default switch" ]; "default/.opam-switch/switch-state", [ opam_version_2_0; sw_state_default ]; "sw-comp/.opam-switch/switch-config", [ opam_version_2_0; synopsis "switch with compiler" ]; @@ -570,6 +585,7 @@ let opam_20 = ] let opam_21alpha = [ "config", [ opam_version_2_0; repo; installed_switches; eval; default_compiler ]; + "repo/repos-config", [ repos_config ]; "default/.opam-switch/switch-config", [ opam_version_2_1; synopsis "default switch"; invariant_default ]; "default/.opam-switch/switch-state", [ opam_version_2_0; sw_state_default ]; "sw-comp/.opam-switch/switch-config", [ opam_version_2_1; synopsis "switch with compiler"; invariant_sw_comp ]; @@ -582,6 +598,7 @@ let opam_21alpha = ] let opam_21alpha2 = [ "config", [ opam_version_2_1; repo; installed_switches; eval; default_compiler; depext; ]; + "repo/repos-config", [ repos_config ]; "default/.opam-switch/switch-config", [ opam_version_2_1; synopsis "default switch"; invariant_default ]; "default/.opam-switch/switch-state", [ opam_version_2_0; sw_state_default ]; "sw-comp/.opam-switch/switch-config", [ opam_version_2_1; synopsis "switch with compiler"; invariant_sw_comp ]; @@ -595,6 +612,7 @@ let opam_21alpha2 = let opam_21rc = let root_version = {|opam-root-version: "2.1~rc"|} in [ "config", [ opam_version_2_0; root_version; repo; installed_switches; eval; default_compiler; default_invariant; depext ]; + "repo/repos-config", [ repos_config ]; "default/.opam-switch/switch-config", [ opam_version_2_0; synopsis "default switch"; invariant_default ]; "default/.opam-switch/switch-state", [ opam_version_2_0; sw_state_default ]; "sw-comp/.opam-switch/switch-config", [ opam_version_2_0; synopsis "switch with compiler"; invariant_sw_comp ]; @@ -607,6 +625,7 @@ let opam_21rc = ] let opam_current v = [ "config", [ opam_version_2_0; root_version v; repo; installed_switches; eval; default_compiler; default_invariant; depext ]; + "repo/repos-config", [ repos_config ]; "default/.opam-switch/switch-config", [ opam_version_2_0; synopsis "default switch"; invariant_default ]; "default/.opam-switch/switch-state", [ opam_version_2_0; sw_state_default ]; "sw-comp/.opam-switch/switch-config", [ opam_version_2_0; synopsis "switch with compiler"; invariant_sw_comp ]; @@ -617,6 +636,15 @@ let opam_current v = "_opam/.opam-switch/switch-config", [ opam_version_2_0; synopsis "local switch"; invariant_default; opam_root ]; "_opam/.opam-switch/switch-state", [ opam_version_2_0; sw_state_default ]; ] +let clean_repo () = + List.iter (fun f -> try Sys.remove (Filename.concat opamroot f) with Sys_error _ -> ()) [ + "repo/state-003ACE73.cache"; + "repo/root-config/repo"; + ]; + List.iter (fun d -> try Sys.rmdir (Filename.concat opamroot d) with Sys_error _ -> ()) [ + "repo/root-config/packages"; + "repo/root-config"; + ] let _ = let get_files = function | "2.0" -> opam_20 @@ -633,7 +661,8 @@ let _ = close_out fd in let root,_ = get_files Sys.argv.(1) in - List.iter (write (Sys.getenv "OPAMROOT")) root; + clean_repo (); + List.iter (write opamroot) root; match mode with | `Local v | `Orphaned v -> let _, local = get_files v in @@ -646,7 +675,6 @@ No configuration file found, using built-in defaults. <><> Fetching repository information ><><><><><><><><><><><><><><><><><><><><><> [default] Initialised -### mkdir -p $OPAMROOT $OPAMROOT/repo $OPAMROOT/default/.opam-switch $OPAMROOT/sw-comp/.opam-switch $OPAMROOT/sw-sys-comp/.opam-switch ### :V:1:a: From 2.0 root, global ### ocaml generate.ml 2.0 ### # ro global state @@ -660,7 +688,8 @@ GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.0 to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ sw-sys-comp STATE Inferred invariant: from base packages { i-am-sys-compiler.1 }, (roots { i-am-sys-compiler.1 }) => ["i-am-sys-compiler"] STATE Switch state loaded in 0.000s @@ -715,6 +744,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler" {>= "2"}] opam-version: "2.0" @@ -738,7 +770,8 @@ GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.0 to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Inferred invariant: from base packages { i-am-sys-compiler.2 }, (roots { i-am-sys-compiler.2 }) => ["i-am-sys-compiler"] STATE Switch state loaded in 0.000s @@ -765,6 +798,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM [WARNING] Removing global switch 'this-internal-error' as it no longer exists @@ -788,6 +822,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -813,7 +850,8 @@ GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.0 to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Inferred invariant: from base packages { i-am-sys-compiler.2 }, (roots { i-am-sys-compiler.2 }) => ["i-am-sys-compiler"] STATE Switch state loaded in 0.000s @@ -839,6 +877,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM [WARNING] Removing global switch 'this-internal-error' as it no longer exists @@ -862,6 +901,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -884,7 +926,8 @@ roots: ["i-am-package.2" "i-am-sys-compiler.2"] ### opam list GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Inferred invariant: from base packages { i-am-sys-compiler.2 }, (roots { i-am-sys-compiler.2 }) => ["i-am-sys-compiler"] STATE Switch state loaded in 0.000s @@ -907,6 +950,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM Set to '4' the field jobs in global configuration @@ -924,6 +968,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -953,7 +1000,8 @@ You may want to back it up before going further. Continue? [y/n] y Format upgrade done. RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default @@ -1005,7 +1053,8 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default @@ -1061,6 +1110,9 @@ switch: "sw-comp" wrap-build-commands: ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"} wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"} wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -1091,12 +1143,14 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default Update done, please now retry your command. # Return code 10 # +### # ro global state, ro repo state, rw switch state ### opam install i-am-package GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM @@ -1128,6 +1182,9 @@ switch: "sw-sys-comp" wrap-build-commands: ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"} wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"} wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1160,12 +1217,14 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default Update done, please now retry your command. # Return code 10 # +### # ro global state, ro repo state, rw switch state ### opam install i-am-package FILE(switch-config) Wrote ${BASEDIR}/_opam/.opam-switch/switch-config in 0.000s GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM @@ -1198,6 +1257,9 @@ switch: "sw-sys-comp" wrap-build-commands: ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"} wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"} wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1221,7 +1283,8 @@ roots: ["i-am-package.2" "i-am-sys-compiler.2"] FILE(switch-config) Wrote ${BASEDIR}/_opam/.opam-switch/switch-config in 0.000s GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s # Packages matching: installed @@ -1242,6 +1305,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM Set to '4' the field jobs in global configuration @@ -1259,6 +1323,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1291,7 +1358,8 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default @@ -1348,7 +1416,8 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default @@ -1404,6 +1473,9 @@ switch: "sw-comp" wrap-build-commands: ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"} wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"} wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -1436,12 +1508,14 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default Update done, please now retry your command. # Return code 10 # +### # ro global state, ro repo state, rw switch state ### opam install i-am-package GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM @@ -1473,6 +1547,9 @@ switch: "sw-sys-comp" wrap-build-commands: ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"} wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"} wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1507,12 +1584,14 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default Update done, please now retry your command. # Return code 10 # +### # ro global state, ro repo state, rw switch state ### opam install i-am-package FILE(switch-config) Wrote ${BASEDIR}/_opam/.opam-switch/switch-config in 0.000s GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM @@ -1545,6 +1624,9 @@ switch: "sw-sys-comp" wrap-build-commands: ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"} wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"} wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1568,7 +1650,8 @@ roots: ["i-am-package.2" "i-am-sys-compiler.2"] FILE(switch-config) Wrote ${BASEDIR}/_opam/.opam-switch/switch-config in 0.000s GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s # Packages matching: installed @@ -1589,6 +1672,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM Set to '4' the field jobs in global configuration @@ -1606,6 +1690,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1639,7 +1726,8 @@ Format upgrade done. <><> Rerunning init and update ><><><><><><><><><><><><><><><><><><><><><><><><> GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default @@ -1690,7 +1778,8 @@ GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.1~rc to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ sw-sys-comp STATE Switch state loaded in 0.000s # Packages matching: installed @@ -1715,6 +1804,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-another-package.2 Done. +### # rw global state ### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM [WARNING] Removing global switch 'this-internal-error' as it no longer exists @@ -1739,6 +1829,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -1755,12 +1848,14 @@ GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.1~rc to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s # Packages matching: installed # Name # Installed # Synopsis i-am-sys-compiler 2 One-line description +### # ro global state, ro repo state, rw switch state ### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.1~rc to current @@ -1778,6 +1873,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM [WARNING] Removing global switch 'this-internal-error' as it no longer exists @@ -1802,6 +1898,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1820,12 +1919,14 @@ GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.1~rc to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s # Packages matching: installed # Name # Installed # Synopsis i-am-sys-compiler 2 One-line description +### # ro global state, ro repo state, rw switch state ### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.1~rc to current @@ -1843,6 +1944,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM [WARNING] Removing global switch 'this-internal-error' as it no longer exists @@ -1867,6 +1969,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1883,7 +1988,8 @@ roots: ["i-am-package.2" "i-am-sys-compiler.2"] ### opam list GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s # Packages matching: installed @@ -1904,6 +2010,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM Set to '4' the field jobs in global configuration @@ -1921,6 +2028,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1944,7 +2054,8 @@ You may want to back it up before going further. Continue? [y/n] y Format upgrade done. RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default @@ -1984,13 +2095,18 @@ wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "ma ### :V:5:a: From 2.1 root, global ### ocaml generate.ml 2.1 ### # ro global state -### opam option jobs +### opam option jobs | "${OPAMROOTVERSION}$" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done ### # ro global state, ro repo state, ro switch state -### opam list +### opam list | "${OPAMROOTVERSION}$" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ sw-sys-comp STATE Switch state loaded in 0.000s # Packages matching: installed @@ -1999,8 +2115,10 @@ i-am-another-package 2 One-line description i-am-package 2 One-line description i-am-sys-compiler 1 One-line description ### # ro global state, ro repo state, rw switch state -### opam install i-am-another-package --switch sw-comp +### opam install i-am-another-package --switch sw-comp | "${OPAMROOTVERSION}$" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found STATE LOAD-SWITCH-STATE @ sw-comp @@ -2013,18 +2131,34 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-another-package.2 Done. +### # ro global state, rw repo state +### opam repo add root-config ./root-config +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to 2.2~alpha +FMT_UPG Format upgrade done +Perform the update and continue? [y/n] y +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE Cache found +[root-config] Initialised +[NOTE] Repository root-config has been added to the selections of switch sw-sys-comp only. + Run `opam repository add root-config --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + ### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" default-compiler: ["i-am-sys-compiler" "i-am-compiler"] default-invariant: ["i-am-sys-compiler"] depext: true depext-cannot-install: false depext-run-installs: true +download-jobs: 1 eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] -installed-switches: ["sw-sys-comp" "sw-comp" "default" "${BASEDIR}/why-did-you-delete-me" "this-internal-error"] +installed-switches: ["sw-sys-comp" "sw-comp" "default"] opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: ["default" {"file://${BASEDIR}/default"} {true} "root-config" {"file://${BASEDIR}/root-config"} {true}] ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -2034,19 +2168,63 @@ compiler: ["i-am-compiler.2"] installed: ["i-am-another-package.2" "i-am-compiler.2" "i-am-package.2"] opam-version: "2.0" roots: ["i-am-another-package.2" "i-am-compiler.2" "i-am-package.2"] +### :V:5:a:aleph: From 2.1 root, global upgrade from global state +### ocaml generate.ml 2.1 +### # rw global state +### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +[WARNING] Removing global switch 'this-internal-error' as it no longer exists +FMT_UPG Light config upgrade, from 2.1 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.1 to version current which can't be reverted. +You may want to back it up before going further. + +Continue? [y/n] y +Format upgrade done. +Set to '4' the field jobs in global configuration +### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" +default-compiler: ["i-am-sys-compiler" "i-am-compiler"] +default-invariant: ["i-am-sys-compiler"] +depext: true +depext-cannot-install: false +depext-run-installs: true +download-jobs: 1 +eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] +installed-switches: ["sw-sys-comp" "sw-comp" "default"] +jobs: 4 +opam-root-version: current +opam-version: "2.0" +repositories: "default" +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} +### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config +invariant: ["i-am-compiler"] +opam-version: "2.0" +synopsis: "switch with compiler" +### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-state +compiler: ["i-am-compiler.2"] +installed: ["i-am-compiler.2" "i-am-package.2"] +opam-version: "2.0" +roots: ["i-am-package.2" "i-am-compiler.2"] ### :V:5:b: From 2.1 root, local ### ocaml generate.ml 2.1 local ### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s # Packages matching: installed # Name # Installed # Synopsis i-am-sys-compiler 2 One-line description -### opam install i-am-package +### opam install i-am-package | "${OPAMROOTVERSION}$" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found STATE LOAD-SWITCH-STATE @ ${BASEDIR} @@ -2060,18 +2238,34 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state +### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +[WARNING] Removing global switch 'this-internal-error' as it no longer exists +FMT_UPG Light config upgrade, from 2.1 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.1 to version current which can't be reverted. +You may want to back it up before going further. + +Continue? [y/n] y +Format upgrade done. +Set to '4' the field jobs in global configuration ### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" default-compiler: ["i-am-sys-compiler" "i-am-compiler"] default-invariant: ["i-am-sys-compiler"] depext: true depext-cannot-install: false depext-run-installs: true +download-jobs: 1 eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] -installed-switches: ["sw-sys-comp" "sw-comp" "${BASEDIR}" "default" "${BASEDIR}/why-did-you-delete-me" "this-internal-error"] +installed-switches: ["sw-sys-comp" "sw-comp" "${BASEDIR}" "default"] +jobs: 4 opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2084,17 +2278,24 @@ opam-version: "2.0" roots: ["i-am-package.2" "i-am-sys-compiler.2"] ### :V:5:c: From 2.1 root, local unknown from config ### ocaml generate.ml 2.1 local +### # ro global state, ro repo state, ro switch state ### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s # Packages matching: installed # Name # Installed # Synopsis i-am-sys-compiler 2 One-line description +### # ro global state, ro repo state, rw switch state ### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found STATE LOAD-SWITCH-STATE @ ${BASEDIR} @@ -2107,18 +2308,34 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state +### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +[WARNING] Removing global switch 'this-internal-error' as it no longer exists +FMT_UPG Light config upgrade, from 2.1 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.1 to version current which can't be reverted. +You may want to back it up before going further. + +Continue? [y/n] y +Format upgrade done. +Set to '4' the field jobs in global configuration ### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" default-compiler: ["i-am-sys-compiler" "i-am-compiler"] default-invariant: ["i-am-sys-compiler"] depext: true depext-cannot-install: false depext-run-installs: true +download-jobs: 1 eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] -installed-switches: ["sw-sys-comp" "sw-comp" "${BASEDIR}" "default" "${BASEDIR}/why-did-you-delete-me" "this-internal-error"] +installed-switches: ["sw-sys-comp" "sw-comp" "${BASEDIR}" "default"] +jobs: 4 opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2132,12 +2349,323 @@ roots: ["i-am-package.2" "i-am-sys-compiler.2"] ### :V:5:d: Upgraded root and local 2.1 switch not recorded ### ocaml generate.ml 2.1 orphaned 2.1 ### # ro global state, ro repo state, ro switch state +### opam list | "${OPAMROOTVERSION}$" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s +STATE LOAD-SWITCH-STATE @ ${BASEDIR} +STATE Switch state loaded in 0.000s +# Packages matching: installed +# Name # Installed # Synopsis +i-am-sys-compiler 2 One-line description +### # ro global state, ro repo state, rw switch state +### opam install i-am-package | "${OPAMROOTVERSION}$" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.1 to current +FMT_UPG Format upgrade done +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE Cache found +STATE LOAD-SWITCH-STATE @ ${BASEDIR} +STATE Switch state loaded in 0.000s +STATE Detected changed packages (marked for reinstall): {} +The following actions will be performed: +=== install 1 package + - install i-am-package 2 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed i-am-package.2 +Done. +### # rw global state +### opam option jobs=4 | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +[WARNING] Removing global switch 'this-internal-error' as it no longer exists +FMT_UPG Light config upgrade, from 2.1 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.1 to version current which can't be reverted. +You may want to back it up before going further. + +Continue? [y/n] y +Format upgrade done. +Set to '4' the field jobs in global configuration +### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" +default-compiler: ["i-am-sys-compiler" "i-am-compiler"] +default-invariant: ["i-am-sys-compiler"] +depext: true +depext-cannot-install: false +depext-run-installs: true +download-jobs: 1 +eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] +installed-switches: ["sw-sys-comp" "sw-comp" "default"] +jobs: 4 +opam-root-version: current +opam-version: "2.0" +repositories: "default" +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} {true} +### opam-cat _opam/.opam-switch/switch-config +invariant: ["i-am-sys-compiler" | "i-am-compiler"] +opam-root: "${BASEDIR}/OPAM" +opam-version: "2.0" +synopsis: "local switch" +### opam-cat _opam/.opam-switch/switch-state +compiler: ["i-am-sys-compiler.2"] +installed: ["i-am-package.2" "i-am-sys-compiler.2"] +opam-version: "2.0" +roots: ["i-am-package.2" "i-am-sys-compiler.2"] +### :V:5:e: reinit from 2.1 +### ocaml generate.ml 2.1 +### opam init --reinit --bypass-checks --no-setup | "${OPAMROOTVERSION}($|,)" -> "current" +No configuration file found, using built-in defaults. +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +[WARNING] Removing global switch 'this-internal-error' as it no longer exists +FMT_UPG Light config upgrade, from 2.1 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.1 to version current which can't be reverted. +You may want to back it up before going further. + +Continue? [y/n] y +Format upgrade done. +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s + +<><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> +[default] no changes from file://${BASEDIR}/default +### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" +default-compiler: ["i-am-sys-compiler" "i-am-compiler"] +default-invariant: ["i-am-sys-compiler"] +depext: true +depext-cannot-install: false +depext-run-installs: true +download-jobs: 3 +eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] +installed-switches: ["sw-sys-comp" "sw-comp" "default"] +opam-root-version: current +opam-version: "2.0" +repositories: "default" +switch: "sw-sys-comp" +wrap-build-commands: ["%{hooks}%/sandbox.sh" "build"] {os = "linux" | os = "macos"} +wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = "macos"} +wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} +### opam switch --short +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +${BASEDIR} +default +sw-comp +sw-sys-comp +### opam list +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE Cache found +STATE LOAD-SWITCH-STATE @ ${BASEDIR} +STATE Switch state loaded in 0.000s +# Packages matching: installed +# Name # Installed # Synopsis +i-am-package 2 One-line description +i-am-sys-compiler 2 One-line description +### rm -rf _opam +### :V:6:a: From 2.2~alpha root, global +### ocaml generate.ml $OPAMROOTVERSION +### # ro global state +### opam option jobs +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +### # ro global state, ro repo state, ro switch state ### opam list GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s +STATE LOAD-SWITCH-STATE @ sw-sys-comp +STATE Switch state loaded in 0.000s +# Packages matching: installed +# Name # Installed # Synopsis +i-am-another-package 2 One-line description +i-am-package 2 One-line description +i-am-sys-compiler 1 One-line description +### # ro global state, ro repo state, rw switch state +### opam install i-am-another-package --switch sw-comp +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE Cache found +STATE LOAD-SWITCH-STATE @ sw-comp +STATE Switch state loaded in 0.000s +STATE Detected changed packages (marked for reinstall): {} +The following actions will be performed: +=== install 1 package + - install i-am-another-package 2 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed i-am-another-package.2 +Done. +### # ro global state, rw repo state +### opam repo add root-config ./root-config +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE Cache found +[root-config] Initialised +[NOTE] Repository root-config has been added to the selections of switch sw-sys-comp only. + Run `opam repository add root-config --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + +### # rw global state +### opam option jobs=4 +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +Set to '4' the field jobs in global configuration +### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" +default-compiler: ["i-am-sys-compiler" "i-am-compiler"] +default-invariant: ["i-am-sys-compiler"] +depext: true +depext-cannot-install: false +depext-run-installs: true +download-jobs: 1 +eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] +installed-switches: ["sw-sys-comp" "sw-comp" "default" "this-internal-error"] +jobs: 4 +opam-root-version: current +opam-version: "2.0" +repositories: "default" +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: ["default" {"file://${BASEDIR}/default"} {true} "root-config" {"file://${BASEDIR}/root-config"} {true}] +### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config +invariant: ["i-am-compiler"] +opam-version: "2.0" +synopsis: "switch with compiler" +### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-state +compiler: ["i-am-compiler.2"] +installed: ["i-am-another-package.2" "i-am-compiler.2" "i-am-package.2"] +opam-version: "2.0" +roots: ["i-am-another-package.2" "i-am-compiler.2" "i-am-package.2"] +### :V:6:b: From 2.2~alpha root, local +### ocaml generate.ml $OPAMROOTVERSION local +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s +STATE LOAD-SWITCH-STATE @ ${BASEDIR} +STATE Switch state loaded in 0.000s +# Packages matching: installed +# Name # Installed # Synopsis +i-am-sys-compiler 2 One-line description +### # ro global state, ro repo state, rw switch state +### opam install i-am-package +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE Cache found +STATE LOAD-SWITCH-STATE @ ${BASEDIR} +STATE Definition missing for installed package i-am-sys-compiler.2, copying from repo +STATE Switch state loaded in 0.000s +STATE Detected changed packages (marked for reinstall): {} +The following actions will be performed: +=== install 1 package + - install i-am-package 2 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed i-am-package.2 +Done. +### # rw global state +### opam option jobs=4 +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +Set to '4' the field jobs in global configuration +### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" +default-compiler: ["i-am-sys-compiler" "i-am-compiler"] +default-invariant: ["i-am-sys-compiler"] +depext: true +depext-cannot-install: false +depext-run-installs: true +download-jobs: 1 +eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] +installed-switches: ["sw-sys-comp" "sw-comp" "${BASEDIR}" "default" "this-internal-error"] +jobs: 4 +opam-root-version: current +opam-version: "2.0" +repositories: "default" +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} +### opam-cat _opam/.opam-switch/switch-config +invariant: ["i-am-sys-compiler" | "i-am-compiler"] +opam-root: "${BASEDIR}/OPAM" +opam-version: "2.0" +synopsis: "local switch" +### opam-cat _opam/.opam-switch/switch-state +compiler: ["i-am-sys-compiler.2"] +installed: ["i-am-package.2" "i-am-sys-compiler.2"] +opam-version: "2.0" +roots: ["i-am-package.2" "i-am-sys-compiler.2"] +### :V:6:c: From 2.2~alpha root, local unknown from config +### ocaml generate.ml $OPAMROOTVERSION local +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s +STATE LOAD-SWITCH-STATE @ ${BASEDIR} +STATE Switch state loaded in 0.000s +# Packages matching: installed +# Name # Installed # Synopsis +i-am-sys-compiler 2 One-line description +### # ro global state, ro repo state, rw switch state +### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM RSTATE Cache found STATE LOAD-SWITCH-STATE @ ${BASEDIR} STATE Switch state loaded in 0.000s +STATE Detected changed packages (marked for reinstall): {} +The following actions will be performed: +=== install 1 package + - install i-am-package 2 + +<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> +-> installed i-am-package.2 +Done. +### # rw global state +### opam option jobs=4 +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +Set to '4' the field jobs in global configuration +### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" +default-compiler: ["i-am-sys-compiler" "i-am-compiler"] +default-invariant: ["i-am-sys-compiler"] +depext: true +depext-cannot-install: false +depext-run-installs: true +download-jobs: 1 +eval-variables: [sys-comp-version ["sh" "-c" "echo $OPAMSYSCOMP"] "comp version"] +installed-switches: ["sw-sys-comp" "sw-comp" "${BASEDIR}" "default" "this-internal-error"] +jobs: 4 +opam-root-version: current +opam-version: "2.0" +repositories: "default" +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} +### opam-cat _opam/.opam-switch/switch-config +invariant: ["i-am-sys-compiler" | "i-am-compiler"] +opam-root: "${BASEDIR}/OPAM" +opam-version: "2.0" +synopsis: "local switch" +### opam-cat _opam/.opam-switch/switch-state +compiler: ["i-am-sys-compiler.2"] +installed: ["i-am-package.2" "i-am-sys-compiler.2"] +opam-version: "2.0" +roots: ["i-am-package.2" "i-am-sys-compiler.2"] +### :V:6:d: Upgraded root and local 2.2~alpha switch not recorded +### ocaml generate.ml $OPAMROOTVERSION orphaned 2.2~alpha +### # ro global state, ro repo state, ro switch state +### opam list +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s +STATE LOAD-SWITCH-STATE @ ${BASEDIR} +STATE Switch state loaded in 0.000s # Packages matching: installed # Name # Installed # Synopsis i-am-sys-compiler 2 One-line description @@ -2156,6 +2684,7 @@ The following actions will be performed: <><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><> -> installed i-am-package.2 Done. +### # rw global state ### opam option jobs=4 GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM Set to '4' the field jobs in global configuration @@ -2173,6 +2702,9 @@ opam-root-version: current opam-version: "2.0" repositories: "default" switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: "default" {"file://${BASEDIR}/default"} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2183,13 +2715,14 @@ compiler: ["i-am-sys-compiler.2"] installed: ["i-am-package.2" "i-am-sys-compiler.2"] opam-version: "2.0" roots: ["i-am-package.2" "i-am-sys-compiler.2"] -### :V:5:e: reinit from 2.1 -### ocaml generate.ml 2.1 +### :V:6:e: reinit from 2.2~alpha +### ocaml generate.ml 2.2~alpha ### opam init --reinit --bypass-checks --no-setup No configuration file found, using built-in defaults. GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -RSTATE Cache found +RSTATE No cache found +RSTATE loaded opam files from repo default in 0.000s <><> Updating repositories ><><><><><><><><><><><><><><><><><><><><><><><><><><> [default] no changes from file://${BASEDIR}/default diff --git a/tests/reftests/repository.test b/tests/reftests/repository.test index 378d66e9931..38ed0233102 100644 --- a/tests/reftests/repository.test +++ b/tests/reftests/repository.test @@ -121,6 +121,7 @@ FILE(opam) Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/fo FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s CACHE(repository) Writing the repository cache to ${BASEDIR}/OPAM/repo/state-003ACE73.cache ... CACHE(repository) ${BASEDIR}/OPAM/repo/state-003ACE73.cache written in 0.000s +FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s Now run 'opam upgrade' to apply any package updates. ### opam install foo.4 The following actions will be performed: @@ -139,6 +140,7 @@ FILE(opam) Read ${BASEDIR}/OPAM/tarring/.opam-switch/packag <><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> [tarred] no changes from file://${BASEDIR}/REPO +FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s ### opam list --all --all-versions # Packages matching: any # Package # Installed # Synopsis @@ -175,6 +177,7 @@ FILE(opam) Read ${BASEDIR}/OPAM/tarring/.opam-switch/packag <><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> [repo2] no changes from file://${BASEDIR}/REPO2 [tarred] no changes from file://${BASEDIR}/REPO +FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s ### opam install bar.1 The following actions will be performed: === install 1 package @@ -202,6 +205,7 @@ FILE(opam) Read ${BASEDIR}/OPAM/repo/repo2/packages/bar/bar FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s CACHE(repository) Writing the repository cache to ${BASEDIR}/OPAM/repo/state-003ACE73.cache ... CACHE(repository) ${BASEDIR}/OPAM/repo/state-003ACE73.cache written in 0.000s +FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s Now run 'opam upgrade' to apply any package updates. ### opam install bar.2 The following actions will be performed: @@ -246,6 +250,7 @@ FILE(opam) Read ${BASEDIR}/OPAM/repo/tarred/packages/foo/fo FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s CACHE(repository) Writing the repository cache to ${BASEDIR}/OPAM/repo/state-003ACE73.cache ... CACHE(repository) ${BASEDIR}/OPAM/repo/state-003ACE73.cache written in 0.000s +FILE(repos-config) Wrote ${BASEDIR}/OPAM/repo/repos-config in 0.000s Now run 'opam upgrade' to apply any package updates. ### opam install bar.3 foo.6 | unordered The following actions will be performed: @@ -259,3 +264,116 @@ The following actions will be performed: -> removed bar.2 -> installed bar.3 Done. +### :: Url setting :: +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### +opam-version: "2.0" +### opam repository add pore ./PORE --set-default +[pore] Initialised +### opam switch create repos --empty --repositories pore +### opam list --all --short +first +### :: repo addition :: +### opam repository add pore2 ./PORE2 +[pore2] Initialised +[NOTE] Repository pore2 has been added to the selections of switch repos only. + Run `opam repository add pore2 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: ["pore" {"file://${BASEDIR}/PORE"} {true} "pore2" {"file://${BASEDIR}/PORE2"} {true} "repo2" {"file://${BASEDIR}/REPO2"} {true} "tarred" {"file://${BASEDIR}/REPO"} {true}] +### opam list --all --short +first +second +### :: repo addition with no action :: +### opam repository add pore3 ./PORE3 --no-action +[NOTE] Repository pore3 has been added to the selections of switch repos only. + Run `opam repository add pore3 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + +### opam list --all --short +first +second +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: ["pore" {"file://${BASEDIR}/PORE"} {true} "pore2" {"file://${BASEDIR}/PORE2"} {true} "pore3" {"file://${BASEDIR}/PORE3"} {false} "repo2" {"file://${BASEDIR}/REPO2"} {true} "tarred" {"file://${BASEDIR}/REPO"} {true}] +### opam update pore3 + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[pore3] Initialised +Now run 'opam upgrade' to apply any package updates. +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: ["pore" {"file://${BASEDIR}/PORE"} {true} "pore2" {"file://${BASEDIR}/PORE2"} {true} "pore3" {"file://${BASEDIR}/PORE3"} {true} "repo2" {"file://${BASEDIR}/REPO2"} {true} "tarred" {"file://${BASEDIR}/REPO"} {true}] +### opam list --all --short +first +second +third +### :: repo set-url :: +### opam repository remove pore3 +Repositories removed from the selections of switch repos. Use '--all' to forget about them altogether. +### opam repository set-url pore2 ./PORE3 +[pore2] Initialised +### opam list --all --short +first +third +### :: repo set-url with no-action :: +### opam repository set-url pore2 ./PORE2 --no-action +### opam list --all --short +first +### opam update pore2 + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[pore2] Initialised +Now run 'opam upgrade' to apply any package updates. +### opam list --all --short +first +second +### :: add with wrong url :: +### opam repository add pore4 ./PORE4 +[ERROR] Could not update repository "pore4": rsync failed + It was added with url file://${BASEDIR}/PORE4 but not initialised + Check url and update it `opam repository set-url pore4 ' +[ERROR] Initial repository fetch failed +# Return code 40 # +### opam repository add pore4 ./PORE4 --no-action +[NOTE] Repository pore4 has been added to the selections of switch repos only. + Run `opam repository add pore4 --all-switches|--set-default' to use it in all existing switches, or in newly created switches, respectively. + +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: ["pore" {"file://${BASEDIR}/PORE"} {true} "pore2" {"file://${BASEDIR}/PORE2"} {true} "pore3" {"file://${BASEDIR}/PORE3"} {true} "pore4" {"file://${BASEDIR}/PORE4"} {false} "repo2" {"file://${BASEDIR}/REPO2"} {true} "tarred" {"file://${BASEDIR}/REPO"} {true}] +### opam list --all --short +first +second +### opam update pore4 + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Could not update repository "pore4": rsync failed + It was added with url file://${BASEDIR}/PORE4 but not initialised + Check url and update it `opam repository set-url pore4 ' +# Return code 40 # +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repositories: ["pore" {"file://${BASEDIR}/PORE"} {true} "pore2" {"file://${BASEDIR}/PORE2"} {true} "pore3" {"file://${BASEDIR}/PORE3"} {true} "pore4" {"file://${BASEDIR}/PORE4"} {false} "repo2" {"file://${BASEDIR}/REPO2"} {true} "tarred" {"file://${BASEDIR}/REPO"} {true}] +### :: set-url with wrong url :: +### opam repository set-url pore ./PORE4 +[ERROR] Could not update repository "pore": rsync failed +### opam repository set-url pore ./PORE4 --no-action +### opam list --all --short +second +### opam update pore + +<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><> +[ERROR] Could not update repository "pore": rsync failed + It was added with url file://${BASEDIR}/PORE4 but not initialised + Check url and update it `opam repository set-url pore ' +# Return code 40 #