diff options
-rwxr-xr-x | bin/just-lock.py | 40 | ||||
-rw-r--r-- | doc/future-designs/just-lock.md | 26 | ||||
-rw-r--r-- | share/man/just-lock-config.5.md | 12 | ||||
-rw-r--r-- | test/end-to-end/just-lock/git-tree-imports.sh | 14 |
4 files changed, 46 insertions, 46 deletions
diff --git a/bin/just-lock.py b/bin/just-lock.py index e8c6b2d7..b4cdd078 100755 --- a/bin/just-lock.py +++ b/bin/just-lock.py @@ -666,7 +666,7 @@ def rewrite_file_repo(repo: Json, remote_type: str, remote_stub: Dict[str, Any], subdir = os.path.join(existing, subdir) changes["subdir"] = subdir return dict(remote_stub, **changes) - elif remote_type == "git-tree": + elif remote_type == "git tree": # for imports from git-trees, file repos become 'git tree' types; the # subtree Git identifier is computed relative to the root Git tree, so # compute and validate the subtree path based on the source tree subdir @@ -963,16 +963,16 @@ def import_from_git(core_repos: Json, imports_entry: Json) -> Json: "Expected field \"mirrors\" to be a list, but found:\n%r" % (json.dumps(mirrors, indent=2), )) - inherit_env: Optional[List[str]] = imports_entry.get("inherit_env", []) + inherit_env: Optional[List[str]] = imports_entry.get("inherit env", []) if inherit_env is not None and not isinstance(inherit_env, list): fail(fail_context + - "Expected field \"inherit_env\" to be a list, but found:\n%r" % + "Expected field \"inherit env\" to be a list, but found:\n%r" % (json.dumps(inherit_env, indent=2), )) - as_plain: Optional[bool] = imports_entry.get("as_plain", False) + as_plain: Optional[bool] = imports_entry.get("as plain", False) if as_plain is not None and not isinstance(as_plain, bool): fail(fail_context + - "Expected field \"as_plain\" to be a bool, but found:\n%r" % + "Expected field \"as plain\" to be a bool, but found:\n%r" % (json.dumps(as_plain, indent=2), )) foreign_config_file: Optional[str] = imports_entry.get("config", None) @@ -1062,10 +1062,10 @@ def import_from_file(core_repos: Json, imports_entry: Json) -> Json: "Expected field \"path\" to be a string, but found:\n%r" % (json.dumps(path, indent=2), )) - as_plain: Optional[bool] = imports_entry.get("as_plain", False) + as_plain: Optional[bool] = imports_entry.get("as plain", False) if as_plain is not None and not isinstance(as_plain, bool): fail(fail_context + - "Expected field \"as_plain\" to be a bool, but found:\n%r" % + "Expected field \"as plain\" to be a bool, but found:\n%r" % (json.dumps(as_plain, indent=2), )) foreign_config_file: Optional[str] = imports_entry.get("config", None) @@ -1332,10 +1332,10 @@ def import_from_archive(core_repos: Json, imports_entry: Json) -> Json: if subdir == ".": subdir = None # treat as if missing - as_plain: Optional[bool] = imports_entry.get("as_plain", False) + as_plain: Optional[bool] = imports_entry.get("as plain", False) if as_plain is not None and not isinstance(as_plain, bool): fail(fail_context + - "Expected field \"as_plain\" to be a bool, but found:\n%r" % + "Expected field \"as plain\" to be a bool, but found:\n%r" % (json.dumps(as_plain, indent=2), )) foreign_config_file: Optional[str] = imports_entry.get("config", None) @@ -1446,7 +1446,7 @@ def git_tree_checkout(command: List[str], do_generate: bool, *, # Import root tree to Git cache; as we do not have the tree hash, identify # commits by the hash of the generating command instead tree_id = import_to_git(workdir, - repo_type="git-tree", + repo_type="git tree", content_id=git_hash( json.dumps(command).encode('utf-8'))[0], fail_context=fail_context) @@ -1474,7 +1474,7 @@ def import_from_git_tree(core_repos: Json, imports_entry: Json) -> Json: """Handles imports from general Git trees obtained by running a command (explicitly given or generated by a given command).""" # Set granular logging message - fail_context: str = "While importing from source \"git-tree\":\n" + fail_context: str = "While importing from source \"git tree\":\n" # Get the repositories list repos: List[Any] = imports_entry.get("repos", []) @@ -1493,14 +1493,14 @@ def import_from_git_tree(core_repos: Json, imports_entry: Json) -> Json: fail(fail_context + "Expected field \"cmd\" to be a list, but found:\n%r" % (json.dumps(command, indent=2), )) - command_gen: Optional[List[str]] = imports_entry.get("cmd_gen", None) + command_gen: Optional[List[str]] = imports_entry.get("cmd gen", None) if command_gen is not None and not isinstance(command_gen, list): fail(fail_context + - "Expected field \"cmd_gen\" to be a list, but found:\n%r" % + "Expected field \"cmd gen\" to be a list, but found:\n%r" % (json.dumps(command_gen, indent=2), )) if command is None == command_gen is None: fail(fail_context + - "Only one of fields \"cmd\" and \"cmd_gen\" must be provided!") + "Only one of fields \"cmd\" and \"cmd gen\" must be provided!") subdir: Optional[str] = imports_entry.get("subdir", None) if subdir is not None: @@ -1523,16 +1523,16 @@ def import_from_git_tree(core_repos: Json, imports_entry: Json) -> Json: "Expected field \"env\" to be a map, but found:\n%r" % (json.dumps(command_env, indent=2), )) - inherit_env: Optional[List[str]] = imports_entry.get("inherit_env", []) + inherit_env: Optional[List[str]] = imports_entry.get("inherit env", []) if inherit_env is not None and not isinstance(inherit_env, list): fail(fail_context + - "Expected field \"inherit_env\" to be a list, but found:\n%r" % + "Expected field \"inherit env\" to be a list, but found:\n%r" % (json.dumps(inherit_env, indent=2), )) - as_plain: Optional[bool] = imports_entry.get("as_plain", False) + as_plain: Optional[bool] = imports_entry.get("as plain", False) if as_plain is not None and not isinstance(as_plain, bool): fail(fail_context + - "Expected field \"as_plain\" to be a bool, but found:\n%r" % + "Expected field \"as plain\" to be a bool, but found:\n%r" % (json.dumps(as_plain, indent=2), )) foreign_config_file: Optional[str] = imports_entry.get("config", None) @@ -1583,7 +1583,7 @@ def import_from_git_tree(core_repos: Json, imports_entry: Json) -> Json: (json.dumps(repo_entry, indent=2), )) repo_entry = cast(Json, repo_entry) - core_repos = handle_import("git-tree", + core_repos = handle_import("git tree", remote_stub, repo_entry, core_repos, @@ -1923,7 +1923,7 @@ def lock_config(input_file: str) -> Json: elif source == "archive": core_config["repositories"] = import_from_archive( core_config["repositories"], entry) - elif source == "git-tree": + elif source == "git tree": core_config["repositories"] = import_from_git_tree( core_config["repositories"], entry) elif source == "generic": diff --git a/doc/future-designs/just-lock.md b/doc/future-designs/just-lock.md index 097e03ac..0ee3bf62 100644 --- a/doc/future-designs/just-lock.md +++ b/doc/future-designs/just-lock.md @@ -251,9 +251,9 @@ The type of a _source_ is defined by the string value of the mandatory subfield , "branch": "master" // mandatory (as we have no sane default value between "master" and "main"); // corresponds to `branch` var (option -b) , "commit": "<HASH>" // optional; if missing, take HEAD commit of branch - , "inherit_env": [...] // optional; corresponds to `inherit_env` var (option --inherit-env) + , "inherit env": [...] // optional; corresponds to `inherit_env` var (option --inherit-env) , "config": "<foreign_repos.json>" // optional; corresponds to `foreign_repository_config` var (option -R) - , "as_plain": false // optional; corresponds to `plain` var (option --plain) + , "as plain": false // optional; corresponds to `plain` var (option --plain) } ``` @@ -284,7 +284,7 @@ The type of a _source_ is defined by the string value of the mandatory subfield // fields related to obtaining source config , "path": "<source/repo/path>" // mandatory , "config": "<foreign_repos.json>" // optional; corresponds to `foreign_repository_config` var (option -R) - , "as_plain": false // optional; corresponds to `plain` var (option --plain) + , "as plain": false // optional; corresponds to `plain` var (option --plain) } ``` @@ -322,28 +322,28 @@ The type of a _source_ is defined by the string value of the mandatory subfield , "sha256": "<HASH>" // optional checksum; if given, will be checked , "sha512": "<HASH>" // optional checksum; if given, will be checked , "config": "<foreign_repos.json>" // optional; corresponds to `foreign_repository_config` var (option -R) - , "as_plain": false // optional; corresponds to `plain` var (option --plain) + , "as plain": false // optional; corresponds to `plain` var (option --plain) } ``` -- **git-tree** +- **git tree** This _source_ type proposed to be the canonical way of importing *justbuild* dependencies under version control systems other than Git. The command that produces the tree is either given explicitly (field `"cmd"`) - or indirectly by a command-generating command (field `"cmd_gen"`). The tool + or indirectly by a command-generating command (field `"cmd gen"`). The tool will run the so-given command to produce the content in a temporary directory, it will import the given subdirectory to Git, and it will generate a - corresponding `"git-tree"`-type repository description to be added to the + corresponding `"git tree"`-type repository description to be added to the configuration. - The fields `"cmd"`, `"env"`, `"inherit_env"` have the same meaning as those + The fields `"cmd"`, `"env"`, `"inherit env"` have the same meaning as those of the `"git tree"`-type repository (as per `just-mr-repository-config`). **IMPORTANT:** The user has to be the one to ensure that the environment in which `just-lock` is run matches the one intended for running `just-mr` with - respect to all the provided envariables in the `"inherit_env"` list. This is + respect to all the provided envariables in the `"inherit env"` list. This is because `just-lock` and `just-mr` must produce the same tree when running the same command. @@ -356,7 +356,7 @@ The type of a _source_ is defined by the string value of the mandatory subfield Proposed format: ``` jsonc - { "source": "git-tree" + { "source": "git tree" // "source"-specific fields , "repos": // mandatory; list of entries describing repositories to import [ { "alias": "<name>" // mandatory; same meaning as `import_as` var @@ -371,12 +371,12 @@ The type of a _source_ is defined by the string value of the mandatory subfield // command as list of strings , "subdir": "<subdir>" // optional; default is "."; subdir to consider as main entry point , "env": {...} // optional; map of envariables needed by "cmd" - , "inherit_env": [...] // optional; list of envariables to inherit - , "cmd_gen": [...] // one and only one of {"cmd", "cmd_gen"} must be provided; + , "inherit env": [...] // optional; list of envariables to inherit + , "cmd gen": [...] // one and only one of {"cmd", "cmd_gen"} must be provided; // command producing the "cmd" value to use, as list of strings , "config": "<foreign_repos.json>" // optional; corresponds to `foreign_repository_config` var (option -R) // searched for in the "subdir" tree - , "as_plain": false // optional; corresponds to `plain` var (option --plain) + , "as plain": false // optional; corresponds to `plain` var (option --plain) } ``` diff --git a/share/man/just-lock-config.5.md b/share/man/just-lock-config.5.md index 16767d53..5e53ca71 100644 --- a/share/man/just-lock-config.5.md +++ b/share/man/just-lock-config.5.md @@ -98,7 +98,7 @@ The following fields are supported: imported `"git"`-type repositories (see **`just-mr-configuration-format`**(5)). This entry is optional. - - *`"as_plain"`* has a boolean value. If the field evaluates to `true`, it + - *`"as plain"`* has a boolean value. If the field evaluates to `true`, it informs **`just-lock`**(1) to consider the foreign repository configuration to be the canonical one for a single repository. This can be useful if the Git repository does not have a repository configuration or should be imported @@ -106,7 +106,7 @@ The following fields are supported: - *`"config"`* has a string value defining the relative path of the foreign repository configuration file to be considered from the Git repository. This - entry is optional. If not provided and the `"as_plain"` field does not + entry is optional. If not provided and the `"as plain"` field does not evaluate to `true`, **`just-lock`**(1) will search for a configuration file in the same locations as **`just-mr`**(1) does when invoked with **`--norc`** in the root directory of the Git repository. @@ -127,7 +127,7 @@ The following fields are supported: - *`"path"`* has a string value defining the path to the local checkout. This entry is mandatory. - - *`"as_plain"`* has a boolean value. If the field evaluates to `true`, it + - *`"as plain"`* has a boolean value. If the field evaluates to `true`, it informs **`just-lock`**(1) to consider the foreign repository configuration to be the canonical one for a single repository. This can be useful if the Git repository does not have a repository configuration or should be imported @@ -135,7 +135,7 @@ The following fields are supported: - *`"config"`* has a string value defining the relative path of the foreign repository configuration file to be considered from the Git repository. This - entry is optional. If not provided and the `"as_plain"` field does not + entry is optional. If not provided and the `"as plain"` field does not evaluate to `true`, **`just-lock`**(1) will search for a configuration file in the same locations as **`just-mr`**(1) does when invoked with **`--norc`** in the root directory of the Git repository. @@ -181,7 +181,7 @@ The following fields are supported: locations for the archive to be used if the given URL fails to provide it. This entry is optional. - - *`"as_plain"`* has a boolean value. If the field evaluates to `true`, it + - *`"as plain"`* has a boolean value. If the field evaluates to `true`, it informs **`just-lock`**(1) to consider the foreign repository configuration to be the canonical one for a single repository. This can be useful if the archived repository does not have a configuration file or should be imported @@ -189,7 +189,7 @@ The following fields are supported: - *`"config"`* has a string value defining the relative path of the foreign repository configuration file to be considered from the unpacked archive - root. This entry is optional. If not provided and the `"as_plain"` field does + root. This entry is optional. If not provided and the `"as plain"` field does not evaluate to `true`, **`just-lock`**(1) will search for a configuration file in the same locations as **`just-mr`**(1) does when invoked with **`--norc`** in the root directory of the unpacked archive. diff --git a/test/end-to-end/just-lock/git-tree-imports.sh b/test/end-to-end/just-lock/git-tree-imports.sh index 9338dd2c..5136bbe0 100644 --- a/test/end-to-end/just-lock/git-tree-imports.sh +++ b/test/end-to-end/just-lock/git-tree-imports.sh @@ -89,12 +89,12 @@ cat > repos.in.json <<EOF } } , "imports": - [ { "source": "git-tree" + [ { "source": "git tree" , "repos": [{"alias": "foo"}] , "cmd": ["mock-vcs", "checkout"] - , "inherit_env": ["PATH", "CREDENTIAL_PATH"] + , "inherit env": ["PATH", "CREDENTIAL_PATH"] , "subdir": "data" - , "as_plain": true + , "as plain": true } ] } @@ -119,12 +119,12 @@ cat > repos.in.json <<EOF } } , "imports": - [ { "source": "git-tree" + [ { "source": "git tree" , "repos": [{"alias": "foo"}] - , "cmd_gen": ["mock-vcs-gen"] - , "inherit_env": ["PATH", "CREDENTIAL_PATH"] + , "cmd gen": ["mock-vcs-gen"] + , "inherit env": ["PATH", "CREDENTIAL_PATH"] , "subdir": "data" - , "as_plain": true + , "as plain": true } ] } |