diff --git a/master_changes.md b/master_changes.md index 9d195a39fc7..11542ad8b3c 100644 --- a/master_changes.md +++ b/master_changes.md @@ -72,6 +72,7 @@ users) ## External dependencies ## Format upgrade + * Fix switch and repo format upgrade on Windows. A block occurred because the global lock fd was reopened instead of using the one already opened. [#6839 @rjbou] ## Sandbox * Allow the macOS sandbox to write in the `/var/folders/` and `/var/db/mds/` directories as it is required by some of macOS core tools [#4797 @kit-ty-kate - fix #4389 #6460] @@ -164,6 +165,7 @@ users) * `OpamRepositoryState.load_opams_from_diff` track added packages to avoid removing version-equivalent packages [#6774 @arozovyk fix #6754] * `OpamGlobalState.all_installed_versions`: was added [#6818 @dra27] * `OpamGlobalState.installed_versions`: was removed [#6818 @dra27] + * `OpamStateTypes.global_state`: add field `lock` that contains the global lock (not config one) [#6839 @rjbou] ## opam-solver diff --git a/src/client/opamAdminCommand.ml b/src/client/opamAdminCommand.ml index 0b57ee84b33..60d27fa2797 100644 --- a/src/client/opamAdminCommand.ml +++ b/src/client/opamAdminCommand.ml @@ -1087,6 +1087,7 @@ let get_virtual_switch_state repo_root env = in let gt = { global_lock = OpamSystem.lock_none; + lock = OpamSystem.lock_none; root = OpamStateConfig.(!r.root_dir); config = OpamStd.Option.Op.(OpamStateConfig.( load ~lock_kind:`Lock_read !r.root_dir) +! diff --git a/src/client/opamClient.ml b/src/client/opamClient.ml index 539759db326..a628f40fd9f 100644 --- a/src/client/opamClient.ml +++ b/src/client/opamClient.ml @@ -1849,9 +1849,15 @@ let init OpamStd.Sys.exit_because `Aborted); try (* Create the content of ~/.opam/config *) - let repos = match repo with - | Some r -> [r.repo_name, (r.repo_url, r.repo_trust)] - | None -> OpamFile.InitConfig.repositories init_config + let repos = + match repo with + | Some r -> + [r.repo_name, + OpamFile.Repo_config.create ?trust:r.repo_trust r.repo_url] + | None -> + List.map (fun (n,(u,t)) -> + n, OpamFile.Repo_config.create ?trust:t u) + (OpamFile.InitConfig.repositories init_config) in let config = update_with_init_config @@ -1862,7 +1868,7 @@ let init let config, mechanism, system_packages, msys2_check_root = if Sys.win32 then determine_windows_configuration ?cygwin_setup ?git_location - ~bypass_checks ~interactive config + ~bypass_checks ~interactive config else config, None, [], None in @@ -1899,7 +1905,9 @@ let init else config in OpamFile.Config.write config_f config; - let repos_config = OpamRepositoryName.Map.of_list repos in + let repos_config = + OpamFile.Repos_config.create (OpamRepositoryName.Map.of_list repos) + in OpamFile.Repos_config.write (OpamPath.repos_config root) repos_config; diff --git a/src/client/opamCommands.ml b/src/client/opamCommands.ml index 06ec904ed9b..fe91444ce65 100644 --- a/src/client/opamCommands.ml +++ b/src/client/opamCommands.ml @@ -2565,6 +2565,7 @@ let repository cli = OpamGlobalState.with_ `Lock_none @@ fun gt -> let repos = OpamStateConfig.Repos.safe_read ~lock_kind:`Lock_read gt + |> OpamFile.Repos_config.repos in let not_found = List.filter (fun r -> not (OpamRepositoryName.Map.mem r repos)) names @@ -4330,6 +4331,7 @@ let clean cli = @@ fun _lock -> let repos_config = OpamStateConfig.Repos.safe_read ~lock_kind:`Lock_write gt + |> OpamFile.Repos_config.repos in let all_repos = OpamRepositoryName.Map.keys repos_config |> @@ -4368,7 +4370,8 @@ let clean cli = OpamConsole.msg "Updating %s\n" (OpamFile.to_string (OpamPath.repos_config root)); if not dry_run then - OpamFile.Repos_config.write (OpamPath.repos_config root) repos_config); + OpamFile.Repos_config.write (OpamPath.repos_config root) + (OpamFile.Repos_config.create repos_config)); if repo_cache then (OpamConsole.msg "Clearing repository cache\n"; if not dry_run then OpamRepositoryState.Cache.remove ()); diff --git a/src/format/opamFile.ml b/src/format/opamFile.ml index 716fd4ea727..5af5e8087f4 100644 --- a/src/format/opamFile.ml +++ b/src/format/opamFile.ml @@ -1395,7 +1395,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.2" + let root_version = OpamVersion.of_string "2.6~alpha1" let default_old_root_version = OpamVersion.of_string "2.1~~previous" @@ -1966,7 +1966,9 @@ module InitConfig = struct include SyntaxFile(InitConfigSyntax) end -module Repos_configSyntax = struct +(** Repositories configuration *) + +module Repos_config_LegacySyntax = struct let internal = "repos-config" let format_version = OpamVersion.of_string "2.0" @@ -2000,6 +2002,145 @@ module Repos_configSyntax = struct let pp = pp_cond () end + +module Repos_config_Legacy = struct + include Repos_config_LegacySyntax + include SyntaxFile(Repos_config_LegacySyntax) + module BestEffort = MakeBestEffort(Repos_config_LegacySyntax) +end + +(* A repository configuration section "repo" in file *) + +module Repo_configSyntax = struct + let internal = "repo-config" + let format_version = OpamVersion.of_string "2.6" + + type t = { + url: url; + trust: trust_anchors option; + errors: (string * Pp.bad_format) list; + } + + let empty = { + url = OpamUrl.empty; + trust = None; + errors = []; + } + + let create ?trust url = { url; trust; errors = [] } + + let url t = t.url + let trust t = t.trust + + let fields = [ + "url", Pp.ppacc + (fun url t -> { t with url }) + (fun { url; _ } -> url) + Pp.V.url; + "fingerprint", Pp.ppacc_opt + (fun fingerprints t -> + match t.trust with + | Some x -> { t with trust = Some { x with fingerprints }} + | None -> { t with trust = Some { fingerprints; quorum = 1}}) + (fun t -> + match t.trust with + | Some {fingerprints; _} -> Some fingerprints + | None -> None) + (Pp.V.map_list ~depth:1 Pp.V.string); + "quorum", + Pp.ppacc_opt + (fun quorum t -> + match t.trust with + | Some x -> { t with trust = Some { x with quorum }} + | None -> { t with trust = Some { quorum; fingerprints = []}}) + (fun t -> + match t.trust with + | Some {quorum; _} -> Some quorum + | None -> None) + Pp.V.int; + ] + + let pp_contents : (opamfile_item list, t) OpamPp.t = + let name = internal in + Pp.I.fields ~name ~empty fields + -| Pp.I.on_errors ~name (fun t e -> {t with errors = e::t.errors}) + -| Pp.pp ~name + (fun ~pos t -> + if t.url = OpamUrl.empty then + OpamPp.bad_format ~pos "missing URL in repo field" + else t) + (fun x -> x) + + let pp = Pp.I.map_file pp_contents + +end + +module Repo_config = struct + include Repo_configSyntax + include SyntaxFile(Repo_configSyntax) +end + +(* Repositories configuration *) + +module Repos_configSyntax = struct + + let internal = "repos-config" + let format_version = OpamVersion.of_string "2.6" + let file_format_version = OpamVersion.of_string "2.0" + + type repo = Repo_config.t + type t = { + opam_version: opam_version; + repos : repo OpamRepositoryName.Map.t; + } + + let empty = { + opam_version = file_format_version; + repos = OpamRepositoryName.Map.empty; + } + + let create ?opam_version repos = { + opam_version = OpamStd.Option.default file_format_version opam_version; + repos; + } + + let opam_version t = t.opam_version + let repos t = t.repos + let with_opam_version opam_version t = { t with opam_version } + let with_repos repos t = { t with repos } + + let fields = [ + "opam-version", Pp.ppacc with_opam_version opam_version + (Pp.V.string -| Pp.of_module "opam-version" (module OpamVersion)); + ] + + let sections = [ + "repo", Pp.ppacc with_repos repos + ((Pp.map_list + (Pp.map_pair + (Pp.pp + (fun ~pos -> function + | Some o -> OpamRepositoryName.of_string o + | None -> Pp.bad_format ~pos "missing repo name") + (fun b -> Some (OpamRepositoryName.to_string b))) + Repo_config.pp_contents)) + -| Pp.of_pair "RepositoryNameMap" + OpamRepositoryName.Map.(of_list, bindings)) + ] + + let pp_cond ?f ?condition () = + let name = internal in + let format_version = file_format_version in + Pp.I.map_file @@ + Pp.I.check_opam_version ?f ~format_version () + -| Pp.I.opam_version ~format_version () + -| Pp.I.fields ~name ~empty ~sections fields + -| Pp.I.show_errors ~name ?condition () + + let pp = pp_cond () + +end + module Repos_config = struct include Repos_configSyntax include SyntaxFile(Repos_configSyntax) diff --git a/src/format/opamFile.mli b/src/format/opamFile.mli index 4e4098ae254..d4f33e390cf 100644 --- a/src/format/opamFile.mli +++ b/src/format/opamFile.mli @@ -1067,12 +1067,43 @@ module Repo_config_legacy : sig include IO_FILE with type t := t end -module Repos_config: sig +module Repos_config_Legacy: sig type t = (url * trust_anchors option) OpamRepositoryName.Map.t include IO_FILE with type t := t module BestEffort: BestEffortRead with type t := t end +module Repo_config: sig + type t = { + url: url; + trust: trust_anchors option; + errors: (string * OpamPp.bad_format) list; + } + + val create: ?trust:trust_anchors -> url -> t + + val url: t -> url + val trust: t -> trust_anchors option + + include IO_FILE with type t := t +end + +module Repos_config: sig + type repo = Repo_config.t + type t = { + opam_version: opam_version; + repos : repo OpamTypes.repository_name_map; + } + + val create: + ?opam_version:opam_version -> repo OpamTypes.repository_name_map -> t + + val repos: t -> repo OpamTypes.repository_name_map + + include IO_FILE with type t := t + module BestEffort: BestEffortRead with type t := t +end + module Switch_config: sig type t = { opam_version: OpamVersion.t; diff --git a/src/state/opamFormatUpgrade.ml b/src/state/opamFormatUpgrade.ml index ba53e469357..44be82814ee 100644 --- a/src/state/opamFormatUpgrade.ml +++ b/src/state/opamFormatUpgrade.ml @@ -352,7 +352,7 @@ let opam_file_from_1_2_to_2_0 ?filename opam = (* Global state changes that need to be propagated *) let gtc_none = { gtc_repo = false; gtc_switch = false } -let _gtc_repo = { gtc_repo = true; gtc_switch = false } +let gtc_repo = { gtc_repo = true; gtc_switch = false } let _gtc_switch = { gtc_repo = false; gtc_switch = true } let _gtc_both = { gtc_repo = true; gtc_switch = true } @@ -769,8 +769,12 @@ let from_1_3_dev7_to_2_0_alpha ~on_the_fly:_ root conf = (OpamFile.Config.repositories conf) in OpamFile.Repos_config.write (OpamPath.repos_config root) - (OpamRepositoryName.Map.of_list - (List.map (fun (_, r, u) -> r, (u,None)) prio_repositories)); + (OpamFile.Repos_config.create + (OpamRepositoryName.Map.of_list + (List.map (fun (_, repo_name, url) -> + repo_name, + OpamFile.Repo_config.create url) + prio_repositories))); let prio_repositories = List.stable_sort (fun (prio1, _, _) (prio2, _, _) -> prio2 - prio1) prio_repositories @@ -1152,9 +1156,35 @@ let v2_2 = OpamVersion.of_string "2.2" let from_2_2_beta_to_2_2 ~on_the_fly:_ _ conf = conf, gtc_none +let v2_6_alpha1 = OpamVersion.of_string "2.6~alpha1" + +let from_2_2_to_2_6_alpha1_repo ?config:_ root _conf = + let f = OpamPath.repos_config root in + Option.map (fun old_repoconfig -> + OpamFile.Repos_config.create @@ + OpamRepositoryName.Map.map (fun old_repo -> + let (repoc_url, repoc_trust) = old_repo in + OpamFile.Repo_config.create ?trust:repoc_trust repoc_url) + old_repoconfig) + (OpamFile.Repos_config_Legacy.BestEffort.read_opt + (OpamFile.make (OpamFile.filename f))) + +let from_2_2_to_2_6_alpha1 ~on_the_fly root conf = + if not on_the_fly then + (let f = OpamPath.repos_config root in + Option.iter (fun repos -> + OpamFile.Repos_config.write f repos) + (from_2_2_to_2_6_alpha1_repo root conf)); + conf, gtc_repo + (* To add an upgrade layer * If it is a light upgrade, returns as second element if the repo or switch need an light upgrade with `gtc_*` values. + * If it is a repo or switch upgrade: + * define 'on the fly' function + * add it in the main function with a write action if not 'on the fly' + * add it in [as_necessary_swich] or [as_necessary_repo] functions + upgrades list. * [Should not happen] If it is an hard upgrade, performs repo & switch upgrade in upgrade function. *) @@ -1204,12 +1234,8 @@ let flock_root = ) in fun () -> Lazy.force t in - fun ?global_lock kind root -> + fun ~global_lock kind -> try - let global_lock = match global_lock with - | Some g -> g - | None -> OpamFilename.flock `Lock_read (OpamPath.lock root) - in OpamFilename.with_flock_upgrade kind ?dontblock:(dontblock ()) global_lock with OpamSystem.Locked -> OpamConsole.error_and_exit `Locked @@ -1246,6 +1272,7 @@ let upgrades root_version = v2_2_alpha, from_2_1_to_2_2_alpha; v2_2_beta, from_2_2_alpha_to_2_2_beta; v2_2, from_2_2_beta_to_2_2; + v2_6_alpha1, from_2_2_to_2_6_alpha1; ] |> List.filter (fun (v,_) -> OpamVersion.compare root_version v < 0) @@ -1345,7 +1372,7 @@ 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); - flock_root global_lock_kind ~global_lock root @@ fun _ -> + flock_root ~global_lock global_lock_kind @@ fun _ -> if not on_the_fly then if need_hard_upg then if is_dev && @@ -1416,7 +1443,7 @@ let as_necessary_repo_switch_t updates read_f lock_kind gt = (OpamVersion.to_string written_root_version) (OpamVersion.to_string (OpamFile.Config.opam_root_version config)); if OpamConsole.confirm "Continue?" then - flock_root `Lock_write root @@ fun _ -> + flock_root `Lock_write ~global_lock:gt.lock @@ fun _ -> (* we keep only light upgrades as hard upgrade is already handled by global state loading, so we must not have to handle hard upgrades as this point. *) @@ -1441,6 +1468,7 @@ let as_necessary_repo lock_kind gt = (* No upgrade to do *) if not gt.global_state_to_upgrade.gtc_repo then None else let updates = [ + v2_6_alpha1, from_2_2_to_2_6_alpha1_repo; ] in as_necessary_repo_switch_t updates diff --git a/src/state/opamGlobalState.ml b/src/state/opamGlobalState.ml index cebe6980f60..211fd54f6e7 100644 --- a/src/state/opamGlobalState.ml +++ b/src/state/opamGlobalState.ml @@ -139,12 +139,14 @@ let load lock_kind = acc) global_variables eval_variables in - { global_lock = config_lock; + { + lock = global_lock; + global_lock = config_lock; root; config; global_variables; global_state_to_upgrade; - } + } let switches gt = OpamFile.Config.installed_switches gt.config diff --git a/src/state/opamRepositoryState.ml b/src/state/opamRepositoryState.ml index 7b2153bf9b1..cf9273465cb 100644 --- a/src/state/opamRepositoryState.ml +++ b/src/state/opamRepositoryState.ml @@ -245,19 +245,20 @@ let load lock_kind 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 = - match OpamFormatUpgrade.as_necessary_repo lock_kind gt with + (match OpamFormatUpgrade.as_necessary_repo lock_kind gt with | Some repos_map -> repos_map - | None -> OpamStateConfig.Repos.safe_read ~lock_kind gt + | None -> OpamStateConfig.Repos.safe_read ~lock_kind gt) + |> OpamFile.Repos_config.repos in if OpamStateConfig.is_newer_than_self ~lock_kind gt then log "root version (%s) is greater than running binary's (%s); \ 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, ta) = { + let mk_repo name repo = { repo_name = name; - repo_url = url; - repo_trust = ta; + repo_url = OpamFile.Repo_config.url repo; + repo_trust = OpamFile.Repo_config.trust repo; } in let repositories = OpamRepositoryName.Map.mapi mk_repo repos_map in let repos_tmp_root = lazy (OpamFilename.mk_tmp_dir ()) in @@ -369,9 +370,11 @@ let with_ lock gt f = let write_config rt = OpamFile.Repos_config.write (OpamPath.repos_config rt.repos_global.root) + @@ OpamFile.Repos_config.create (OpamRepositoryName.Map.filter_map (fun _ r -> if r.repo_url = OpamUrl.empty then None - else Some (r.repo_url, r.repo_trust)) + else + Some (OpamFile.Repo_config.create ?trust:r.repo_trust r.repo_url)) rt.repositories) let check_last_update () = diff --git a/src/state/opamStateTypes.mli b/src/state/opamStateTypes.mli index 2cee9a48630..ad9fc7d50c9 100644 --- a/src/state/opamStateTypes.mli +++ b/src/state/opamStateTypes.mli @@ -51,6 +51,10 @@ type gt_changes = { gtc_repo: bool; gtc_switch: bool } (** Global state corresponding to an opam root and its configuration *) type +'lock global_state = { global_lock: OpamSystem.lock; + (** Global config lock file *) + + lock: OpamSystem.lock; + (** Global lock file *) root: OpamPath.t; (** The global opam root path (caution: this is stored here but some code may diff --git a/tests/reftests/init-ocaml-eval-variables.unix.test b/tests/reftests/init-ocaml-eval-variables.unix.test index 0cd6ccdfee3..f9c318a21d2 100644 --- a/tests/reftests/init-ocaml-eval-variables.unix.test +++ b/tests/reftests/init-ocaml-eval-variables.unix.test @@ -7,6 +7,10 @@ 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" +let basedir = String.escaped (Sys.getenv "BASEDIR") +let repos_config = Printf.sprintf {|opam-version: "2.0" +repositories: "default" {"file://%s/REPO"} +|} basedir let repo = {|repositories: "default"|} let depext = {| depext: true @@ -33,6 +37,10 @@ let _ = let content = get_files Sys.argv.(1) in let fd = open_out name in List.iter (fun l -> output_string fd (l^"\n")) content; + close_out fd; + let rcname = Filename.concat (Filename.concat opamroot "repo") "repos-config" in + let fd = open_out rcname in + output_string fd repos_config; close_out fd ### rm -rf "$OPAMROOT" ### :::::::::::::::::::::::::: diff --git a/tests/reftests/init-ocaml-eval-variables.win32.test b/tests/reftests/init-ocaml-eval-variables.win32.test index 804f61e6fa8..131bbe965a9 100644 --- a/tests/reftests/init-ocaml-eval-variables.win32.test +++ b/tests/reftests/init-ocaml-eval-variables.win32.test @@ -7,6 +7,10 @@ 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" +let basedir = String.escaped (Sys.getenv "BASEDIR") +let repos_config = Printf.sprintf {|opam-version: "2.0" +repositories: "default" {"file://%s/REPO"} +|} basedir let repo = {|repositories: "default"|} let depext = {| depext: true @@ -33,6 +37,10 @@ let _ = let content = get_files Sys.argv.(1) in let fd = open_out name in List.iter (fun l -> output_string fd (l^"\n")) content; + close_out fd; + let rcname = Filename.concat (Filename.concat opamroot "repo") "repos-config" in + let fd = open_out rcname in + output_string fd repos_config; close_out fd ### rm -rf "$OPAMROOT" ### :::::::::::::::::::::::::: diff --git a/tests/reftests/init.test b/tests/reftests/init.test index b46d99c61f1..7c7aa895ea8 100644 --- a/tests/reftests/init.test +++ b/tests/reftests/init.test @@ -248,7 +248,9 @@ wrap-install-commands: ["%{hooks}%/a-script.sh" "wrap-install"] wrap-remove-commands: ["%{hooks}%/a-script.sh" "wrap-remove"] ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "norepo" {"file://${BASEDIR}/REPO"} +repo "norepo" { +url: "file://${BASEDIR}/REPO" +} ### sh $OPAMROOT/opam-init/hooks/a-script.sh test script test launched STOP i repeat STOP script test launched ### :II:c: partially configured opamrc :: @@ -302,7 +304,9 @@ wrap-install-commands: ["%{hooks}%/a-script.sh" "wrap-install"] wrap-remove-commands: ["%{hooks}%/sandbox.sh" "remove"] {os = "linux" | os = "macos"} ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "norepo" {"file://${BASEDIR}/REPO"} +repo "norepo" { +url: "file://${BASEDIR}/REPO" +} ### :II:d: Parse error on config file ### this is not the content of a config file diff --git a/tests/reftests/opamroot-versions.test b/tests/reftests/opamroot-versions.test index 4481e6c3009..e15ad3102b0 100644 --- a/tests/reftests/opamroot-versions.test +++ b/tests/reftests/opamroot-versions.test @@ -12,7 +12,8 @@ installed-switches: "foo" switch: "foo" |} let neant = "neant: 0" -let repo = {|repositories: [ "default" {"file:///${BASEDIR/dontexist"} ]|} +let basedir = String.escaped (Sys.getenv "BASEDIR") +let repo = Printf.sprintf {|repo "default" {url:"file://%s/dontexist"}|} basedir let switch_config = {|synopsis: "foo"|} let _ = let configs = @@ -29,7 +30,7 @@ let _ = ]) in let files = [ - "repos-config", [ repo ]; + "repos-config", [ opam_version "2.0"; repo ]; "switch-config", [ opam_version "2.0"; switch_config ]; ] @ configs in @@ -80,7 +81,7 @@ GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM 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:: + - At ${BASEDIR}/OPAM/repo/repos-config:3:0-3:8:: Invalid field neant RSTATE Cache found @@ -91,7 +92,7 @@ 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:: + - At ${BASEDIR}/OPAM/repo/repos-config:3:0-3:8:: Invalid field neant RSTATE Cache found @@ -261,7 +262,7 @@ GSTATE root version (4.8) is greater than running binar GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM GSTATE root version (4.8) is greater than running binary's current; load with best-effort (read-only) RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM -FORMAT File errors in ${BASEDIR}/OPAM/repo/repos-config, ignored fields: At ${BASEDIR}/OPAM/repo/repos-config:2:0-2:8:: +FORMAT File errors in ${BASEDIR}/OPAM/repo/repos-config, ignored fields: At ${BASEDIR}/OPAM/repo/repos-config:3:0-3:8:: Invalid field neant RSTATE root version (4.8) is greater than running binary's current; load with best-effort (read-only) RSTATE Cache found @@ -568,13 +569,15 @@ 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" opamroot -let repos_config = Printf.sprintf {| -opam-version: "2.0" -repositories: "default" {"file://%s/default"} -|} (Sys.getenv "BASEDIR" |> String.map (function '\\' -> '/' | c -> c)) +let repos_config v = {|opam-version: "2.0" +|} ^ + Printf.sprintf + (if v < 2.6 then {|repositories: ["default" {"file://%s/default"}]|} + else {|repo "default" {url:"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 ]; + "repo/repos-config", [ repos_config 2.0 ]; "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" ]; @@ -587,7 +590,7 @@ let opam_20 = ] let opam_21alpha = [ "config", [ opam_version_2_0; repo; installed_switches; eval; default_compiler ]; - "repo/repos-config", [ repos_config ]; + "repo/repos-config", [ repos_config 2.1 ]; "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 ]; @@ -600,7 +603,7 @@ let opam_21alpha = ] let opam_21alpha2 = [ "config", [ opam_version_2_1; repo; installed_switches; eval; default_compiler; depext; ]; - "repo/repos-config", [ repos_config ]; + "repo/repos-config", [ repos_config 2.1 ]; "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 ]; @@ -614,7 +617,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 ]; + "repo/repos-config", [ repos_config 2.1 ]; "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 ]; @@ -627,7 +630,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 ]; + "repo/repos-config", [ repos_config (float_of_string (String.sub v 0 3)) ]; "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 ]; @@ -687,12 +690,12 @@ No configuration file found, using built-in defaults. ### :V:1:a: From 2.0 root, global ### ocaml generate.ml 2.0 ### # ro global state -### opam option jobs | "${OPAMROOTVERSION}$" -> "current" +### opam option jobs | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.0 to current FMT_UPG Format upgrade done ### # ro global state, ro repo state, ro switch state -### opam list | "${OPAMROOTVERSION}$" -> "current" +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.0 to current FMT_UPG Format upgrade done @@ -708,7 +711,7 @@ 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 | "${OPAMROOTVERSION}$" -> "current" +### 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.0 to current FMT_UPG Format upgrade done @@ -758,7 +761,9 @@ swh-fallback: false switch: "sw-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler" {>= "2"}] opam-version: "2.0" @@ -837,7 +842,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -856,7 +863,7 @@ roots: ["i-am-package.2" "i-am-sys-compiler.2"] ### :V:1:c: From 2.0 root, local unknown from config ### ocaml generate.ml 2.0 orphaned ### # ro global state, ro repo state, ro switch state -### opam list | "${OPAMROOTVERSION}$" -> " current" +### opam list | "${OPAMROOTVERSION}($|,)" -> " current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.0 to current FMT_UPG Format upgrade done @@ -870,7 +877,7 @@ STATE Switch state loaded in 0.000s # 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" +### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.0 to current FMT_UPG Format upgrade done @@ -917,7 +924,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -984,7 +993,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1129,7 +1140,9 @@ wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = " 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"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -1202,7 +1215,9 @@ wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = " 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"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1278,7 +1293,9 @@ wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = " 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"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1344,7 +1361,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1497,7 +1516,9 @@ wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = " 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"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -1572,7 +1593,9 @@ wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = " 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"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1650,7 +1673,9 @@ wrap-install-commands: ["%{hooks}%/sandbox.sh" "install"] {os = "linux" | os = " 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"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1716,7 +1741,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -1858,7 +1885,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -1930,7 +1959,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2004,7 +2035,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2065,7 +2098,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2132,12 +2167,12 @@ 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 | "${OPAMROOTVERSION}$" -> "current" +### 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 | "${OPAMROOTVERSION}$" -> "current" +### 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 @@ -2152,7 +2187,7 @@ 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 | "${OPAMROOTVERSION}$" -> "current" +### 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 @@ -2170,11 +2205,16 @@ The following actions will be performed: STATE dependencies (0.000) result={ i-am-compiler.2 } Done. ### # ro global state, rw repo state -### opam repo add root-config ./root-config | "${OPAMROOTVERSION}$" -> "current" +### opam repo add root-config ./root-config | "${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 +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 +[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using: + opam option jobs=1 --global RSTATE Cache found [root-config] Initialised [NOTE] Repository root-config has been added to the selections of switch sw-sys-comp only. @@ -2183,15 +2223,6 @@ RSTATE Cache found ### # 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 -[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using: - opam option jobs=1 --global -Format upgrade done. Set to '4' the field jobs in global configuration ### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" | grep -v sys-pkg-manager-cmd | grep -v global-variables | grep -v eval-variables: default-compiler: ["i-am-sys-compiler" "i-am-compiler"] @@ -2200,7 +2231,7 @@ depext: true depext-cannot-install: false depext-run-installs: true download-jobs: 1 -installed-switches: ["sw-sys-comp" "sw-comp" "default"] +installed-switches: ["sw-sys-comp" "sw-comp" "default" "this-internal-error"] jobs: 4 opam-root-version: current opam-version: "2.0" @@ -2209,7 +2240,12 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: ["default" {"file://${BASEDIR}/default"} "root-config" {"file://${BASEDIR}/root-config"}] +repo "default" { +url: "file://${BASEDIR}/default" +} +repo "root-config" { +url: "file://${BASEDIR}/root-config" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -2233,7 +2269,7 @@ 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 | "${OPAMROOTVERSION}$" -> "current" +### 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 @@ -2280,7 +2316,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2353,7 +2391,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2367,7 +2407,7 @@ 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" +### 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 @@ -2380,7 +2420,7 @@ STATE Switch state loaded in 0.000s # 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" +### 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 @@ -2426,7 +2466,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2493,12 +2535,12 @@ i-am-sys-compiler 2 One-line description ### :V:6:a: From 2.2~alpha root, global ### ocaml generate.ml 2.2~alpha ### # ro global state -### opam option jobs | "${OPAMROOTVERSION}$" -> "current" +### opam option jobs | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~alpha to current FMT_UPG Format upgrade done ### # ro global state, ro repo state, ro switch state -### opam list | "${OPAMROOTVERSION}$" -> "current" +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~alpha to current FMT_UPG Format upgrade done @@ -2513,7 +2555,7 @@ 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 | "${OPAMROOTVERSION}$" -> "current" +### 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.2~alpha to current FMT_UPG Format upgrade done @@ -2531,11 +2573,16 @@ The following actions will be performed: STATE dependencies (0.000) result={ i-am-compiler.2 } Done. ### # ro global state, rw repo state -### opam repo add root-config ./root-config | "${OPAMROOTVERSION}$" -> "current" +### opam repo add root-config ./root-config | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~alpha to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~alpha to version current which can't be reverted. +You may want to back it up before going further. +Continue? [Y/n] y +[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using: + opam option jobs=1 --global RSTATE Cache found [root-config] Initialised [NOTE] Repository root-config has been added to the selections of switch sw-sys-comp only. @@ -2544,15 +2591,6 @@ RSTATE Cache found ### # 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.2~alpha to current -This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~alpha to version current which can't be reverted. -You may want to back it up before going further. - -Continue? [Y/n] y -[NOTE] The 'jobs' option was reset, its value was 1 and its new value will vary according to the current number of cores on your machine. You can restore the fixed value using: - opam option jobs=1 --global -Format upgrade done. Set to '4' the field jobs in global configuration ### opam-cat $OPAMROOT/config | '"${OPAMROOTVERSION}"' -> "current" | grep -v sys-pkg-manager-cmd | grep -v global-variables default-compiler: ["i-am-sys-compiler" "i-am-compiler"] @@ -2562,7 +2600,7 @@ 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"] +installed-switches: ["sw-sys-comp" "sw-comp" "default" "this-internal-error"] jobs: 4 opam-root-version: current opam-version: "2.0" @@ -2571,7 +2609,12 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: ["default" {"file://${BASEDIR}/default"} "root-config" {"file://${BASEDIR}/root-config"}] +repo "default" { +url: "file://${BASEDIR}/default" +} +repo "root-config" { +url: "file://${BASEDIR}/root-config" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -2596,7 +2639,7 @@ STATE Switch state loaded in 0.000s # 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" +### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~alpha to current FMT_UPG Format upgrade done @@ -2644,7 +2687,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2717,7 +2762,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2731,7 +2778,7 @@ 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 2.2~alpha orphaned 2.2~alpha ### # ro global state, ro repo state, ro switch state -### opam list | "${OPAMROOTVERSION}$" -> "current" +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~alpha to current FMT_UPG Format upgrade done @@ -2744,7 +2791,7 @@ STATE Switch state loaded in 0.000s # 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" +### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~alpha to current FMT_UPG Format upgrade done @@ -2791,7 +2838,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -2859,12 +2908,12 @@ i-am-sys-compiler 2 One-line description ### :V:7:a: From 2.2~beta root, global ### ocaml generate.ml 2.2~beta ### # ro global state -### opam option jobs | "${OPAMROOTVERSION}$" -> "current" +### opam option jobs | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~beta to current FMT_UPG Format upgrade done ### # ro global state, ro repo state, ro switch state -### opam list | "${OPAMROOTVERSION}$" -> "current" +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~beta to current FMT_UPG Format upgrade done @@ -2879,7 +2928,7 @@ 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 | "${OPAMROOTVERSION}$" -> "current" +### 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.2~beta to current FMT_UPG Format upgrade done @@ -2897,26 +2946,22 @@ The following actions will be performed: STATE dependencies (0.000) result={ i-am-compiler.2 } Done. ### # ro global state, rw repo state -### opam repo add root-config ./root-config | "${OPAMROOTVERSION}$" -> "current" +### opam repo add root-config ./root-config | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~beta to current FMT_UPG Format upgrade done RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version current which can't be reverted. +You may want to back it up before going further. +Continue? [Y/n] y 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 | "${OPAMROOTVERSION}$" -> "current" +### 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.2~beta to current -This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version 2.2, 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" | grep -v sys-pkg-manager-cmd | grep -v global-variables default-compiler: ["i-am-sys-compiler" "i-am-compiler"] @@ -2926,7 +2971,7 @@ 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"] +installed-switches: ["sw-sys-comp" "sw-comp" "default" "this-internal-error"] jobs: 4 opam-root-version: current opam-version: "2.0" @@ -2935,7 +2980,12 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: ["default" {"file://${BASEDIR}/default"} "root-config" {"file://${BASEDIR}/root-config"}] +repo "default" { +url: "file://${BASEDIR}/default" +} +repo "root-config" { +url: "file://${BASEDIR}/root-config" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -2960,7 +3010,7 @@ STATE Switch state loaded in 0.000s # 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" +### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~beta to current FMT_UPG Format upgrade done @@ -2979,11 +3029,11 @@ The following actions will be performed: STATE dependencies (0.000) result={ i-am-sys-compiler.2 } Done. ### # rw global state -### opam option jobs=4 | "${OPAMROOTVERSION}$" -> "current" +### 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.2~beta to current -This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version 2.2, which can't be reverted. +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version current which can't be reverted. You may want to back it up before going further. Continue? [Y/n] y @@ -3006,7 +3056,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -3050,11 +3102,11 @@ The following actions will be performed: STATE dependencies (0.000) result={ i-am-sys-compiler.2 } Done. ### # rw global state -### opam option jobs=4 | "${OPAMROOTVERSION}$" -> "current" +### 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.2~beta to current -This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version 2.2, which can't be reverted. +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version current which can't be reverted. You may want to back it up before going further. Continue? [Y/n] y @@ -3077,7 +3129,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -3091,7 +3145,7 @@ roots: ["i-am-package.2" "i-am-sys-compiler.2"] ### :V:7:d: Upgraded root and local 2.2~beta switch not recorded ### ocaml generate.ml 2.2~beta orphaned 2.2~beta ### # ro global state, ro repo state, ro switch state -### opam list | "${OPAMROOTVERSION}$" -> "current" +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~beta to current FMT_UPG Format upgrade done @@ -3104,7 +3158,7 @@ STATE Switch state loaded in 0.000s # 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" +### opam install i-am-package | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM FMT_UPG On-the-fly config upgrade, from 2.2~beta to current FMT_UPG Format upgrade done @@ -3122,11 +3176,11 @@ The following actions will be performed: STATE dependencies (0.000) result={ i-am-sys-compiler.2 } Done. ### # rw global state -### opam option jobs=4 | "${OPAMROOTVERSION}$" -> "current" +### 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.2~beta to current -This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version 2.2, which can't be reverted. +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version current which can't be reverted. You may want to back it up before going further. Continue? [Y/n] y @@ -3149,7 +3203,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -3162,12 +3218,12 @@ opam-version: "2.0" roots: ["i-am-package.2" "i-am-sys-compiler.2"] ### :V:7:e: reinit from 2.2~beta ### ocaml generate.ml 2.2~beta -### opam init --reinit --bypass-checks --no-setup | grep -v Cygwin +### opam init --reinit --bypass-checks --no-setup | grep -v Cygwin | '${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.2~beta to 2.2 -This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version 2.2, which can't be reverted. +FMT_UPG Light config upgrade, from 2.2~beta to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2~beta to version current which can't be reverted. You may want to back it up before going further. Continue? [Y/n] y @@ -3215,6 +3271,369 @@ i-am-sys-compiler 2 One-line description ### :V:8:a: From 2.2 root, global ### ocaml generate.ml 2.2 ### # ro global state +### opam option jobs | '${OPAMROOTVERSION}($|,)' -> current +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.2 to current +FMT_UPG Format upgrade done +### # 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.2 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 @ 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 | '${OPAMROOTVERSION}($|,)' -> current +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.2 to current +FMT_UPG Format upgrade done +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 +STATE dependencies (0.000) result={ i-am-compiler.2 } +Done. +### # ro global state, rw repo state +### opam repo add root-config ./root-config | '${OPAMROOTVERSION}($|,)' -> current +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.2 to current +FMT_UPG Format upgrade done +RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2 to version current which can't be reverted. +You may want to back it up before going further. +Continue? [Y/n] y +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" | grep -v sys-pkg-manager-cmd | grep -v global-variables +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" +swh-fallback: false +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repo "default" { +url: "file://${BASEDIR}/default" +} +repo "root-config" { +url: "file://${BASEDIR}/root-config" +} +### 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:8:b: From 2.2 root, local +### ocaml generate.ml 2.2 local +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.2 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.2 to current +FMT_UPG Format upgrade done +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 +STATE dependencies (0.000) result={ i-am-sys-compiler.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.2 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2 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" | grep -v sys-pkg-manager-cmd | grep -v global-variables +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"] +jobs: 4 +opam-root-version: current +opam-version: "2.0" +repositories: "default" +swh-fallback: false +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repo "default" { +url: "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:8:c: From 2.2 root, local unknown from config +### ocaml generate.ml 2.2 local +### opam list | "${OPAMROOTVERSION}($|,)" -> "current" +GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM +FMT_UPG On-the-fly config upgrade, from 2.2 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.2 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 +STATE dependencies (0.000) result={ i-am-sys-compiler.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.2 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2 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" | grep -v sys-pkg-manager-cmd | grep -v global-variables +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"] +jobs: 4 +opam-root-version: current +opam-version: "2.0" +repositories: "default" +swh-fallback: false +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repo "default" { +url: "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:8:d: Upgraded root and local 2.2 switch not recorded +### ocaml generate.ml 2.2 orphaned 2.2 +### # 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.2 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.2 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 +STATE dependencies (0.000) result={ i-am-sys-compiler.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.2 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2 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" | grep -v sys-pkg-manager-cmd | grep -v global-variables +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" +swh-fallback: false +switch: "sw-sys-comp" +### opam-cat $OPAMROOT/repo/repos-config +opam-version: "2.0" +repo "default" { +url: "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:8:e: reinit from 2.2 +### ocaml generate.ml 2.2 +### opam init --reinit --bypass-checks --no-setup | grep -v Cygwin | '${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.2 to current +This version of opam requires an update to the layout of ${BASEDIR}/OPAM from version 2.2 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" | grep -v sys-pkg-manager-cmd | grep -v global-variables +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" +swh-fallback: false +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:9:a: From 2.6~alpha1 root, global +### ocaml generate.ml 2.6~alpha1 +### # ro global state ### opam option jobs GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM ### # ro global state, ro repo state, ro switch state @@ -3276,7 +3695,12 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: ["default" {"file://${BASEDIR}/default"} "root-config" {"file://${BASEDIR}/root-config"}] +repo "default" { +url: "file://${BASEDIR}/default" +} +repo "root-config" { +url: "file://${BASEDIR}/root-config" +} ### opam-cat $OPAMROOT/sw-comp/.opam-switch/switch-config invariant: ["i-am-compiler"] opam-version: "2.0" @@ -3286,8 +3710,8 @@ 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:8:b: From 2.2 root, local -### ocaml generate.ml 2.2 local +### :V:9:b: From 2.6~alpha1 root, local +### ocaml generate.ml 2.6~alpha1 local ### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM @@ -3336,7 +3760,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -3347,8 +3773,8 @@ 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:8:c: From 2.2 root, local unknown from config -### ocaml generate.ml 2.2 local +### :V:9:c: From 2.6~alpha1 root, local unknown from config +### ocaml generate.ml 2.6~alpha1 local ### opam list | "${OPAMROOTVERSION}($|,)" -> "current" GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM @@ -3396,7 +3822,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -3407,8 +3835,8 @@ 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:8:d: Upgraded root and local 2.2 switch not recorded -### ocaml generate.ml 2.2 orphaned 2.2 +### :V:9:d: Upgraded root and local 2.6~alpha1 switch not recorded +### ocaml generate.ml 2.6~alpha1 orphaned 2.6~alpha1 ### # ro global state, ro repo state, ro switch state ### opam list GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM @@ -3457,7 +3885,9 @@ swh-fallback: false switch: "sw-sys-comp" ### opam-cat $OPAMROOT/repo/repos-config opam-version: "2.0" -repositories: "default" {"file://${BASEDIR}/default"} +repo "default" { +url: "file://${BASEDIR}/default" +} ### opam-cat _opam/.opam-switch/switch-config invariant: ["i-am-sys-compiler" | "i-am-compiler"] opam-root: "${BASEDIR}/OPAM" @@ -3468,9 +3898,9 @@ 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:8:e: reinit from 2.2 -### ocaml generate.ml 2.2 -### opam init --reinit --bypass-checks --no-setup | grep -v Cygwin +### :V:9:e: reinit from 2.6~alpha1 +### ocaml generate.ml 2.6~alpha1 +### opam init --reinit --bypass-checks --no-setup | grep -v Cygwin | "${OPAMROOTVERSION}" -> "current" No configuration file found, using built-in defaults. GSTATE LOAD-GLOBAL-STATE @ ${BASEDIR}/OPAM RSTATE LOAD-REPOSITORY-STATE @ ${BASEDIR}/OPAM @@ -3513,3 +3943,4 @@ STATE Switch state loaded in 0.000s # Name # Installed # Synopsis i-am-package 2 One-line description i-am-sys-compiler 2 One-line description +### rm -rf _opam diff --git a/tests/reftests/repository.test b/tests/reftests/repository.test index c49b7ca87e4..2d2442d27ed 100644 --- a/tests/reftests/repository.test +++ b/tests/reftests/repository.test @@ -811,37 +811,157 @@ nourl file://${BASEDIR}/nourl nourl # Packages matching: any # Name # Installed # Synopsis no -- +### # --- ### opam-version: "2.0" -repositories: [ "nourl" ] +repo "nourl" { } ### opam repo --all [WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: - - At ${BASEDIR}/OPAM/repo/repos-config:2:16-2:23:: - expected url + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field # Repository # Url # Switches(rank) ### opam-version: "2.0" ### opam update nourl [WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: - - At ${BASEDIR}/OPAM/repo/repos-config:2:16-2:23:: - expected url + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field [ERROR] Unknown repositories or installed packages: nourl # Return code 40 # ### opam list -A [WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: - - At ${BASEDIR}/OPAM/repo/repos-config:2:16-2:23:: - expected url + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field # Packages matching: any # No matches found ### sh -c "rm OPAM/repo/state-*.cache" ### opam list -A [WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: - - At ${BASEDIR}/OPAM/repo/repos-config:2:16-2:23:: - expected url + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field +# Packages matching: any +# No matches found +### # --- +### +opam-version: "2.0" +repo "nourl" { another-field: "this is not an url" } +### opam repo --all +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +# Repository # Url # Switches(rank) +### +opam-version: "2.0" +### opam update nourl +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +[ERROR] Unknown repositories or installed packages: nourl +# Return code 40 # +### opam list -A +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +# Packages matching: any +# No matches found +### sh -c "rm OPAM/repo/state-*.cache" +### opam list -A +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +# Packages matching: any +# No matches found +### # --- +### +opam-version: "2.0" +repo { url: "https://thi.s/is/a/lin.g" } +### opam repo --all +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing repo name + +# Repository # Url # Switches(rank) +### +opam-version: "2.0" +### opam update nourl +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing repo name + +[ERROR] Unknown repositories or installed packages: nourl +# Return code 40 # +### opam list -A +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing repo name + +# Packages matching: any +# No matches found +### sh -c "rm OPAM/repo/state-*.cache" +### opam list -A +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing repo name + +# Packages matching: any +# No matches found +### # --- +### +opam-version: "2.0" +repo { } +### opam repo --all +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +# Repository # Url # Switches(rank) +### +opam-version: "2.0" +### opam update nourl +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +[ERROR] Unknown repositories or installed packages: nourl +# Return code 40 # +### opam list -A +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +# Packages matching: any +# No matches found +### sh -c "rm OPAM/repo/state-*.cache" +### opam list -A +[WARNING] Errors in ${BASEDIR}/OPAM/repo/repos-config, some fields have been ignored: + - In ${BASEDIR}/OPAM/repo/repos-config: + missing URL in repo field + +# Packages matching: any +# No matches found +### # --- +### +opam-version: "2.0" +### opam repo --all +# Repository # Url # Switches(rank) +### +opam-version: "2.0" +### opam update nourl +[ERROR] Unknown repositories or installed packages: nourl +# Return code 40 # +### opam list -A +# Packages matching: any +# No matches found +### sh -c "rm OPAM/repo/state-*.cache" +### opam list -A # Packages matching: any # No matches found ### mv repos-config.bak OPAM/repo/repos-config diff --git a/tests/reftests/upgrade-two-point-o.test b/tests/reftests/upgrade-two-point-o.test index d880a4c45b1..3fe0b958708 100644 --- a/tests/reftests/upgrade-two-point-o.test +++ b/tests/reftests/upgrade-two-point-o.test @@ -21,6 +21,13 @@ pinned: ["i-am-compiler.1"] ### opam-version: "2.0" synopsis: "switch with pinned compiler" +### +basedir=$(printf '%s' "$BASEDIR" | sed 's/\\/\\\\/g') +cat > OPAM/repo/repos-config <