diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0c779e5c8..bd5e66846 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,7 +47,6 @@ jobs: ci/${RELEASE} \ ci/repository.yml \ --workspace ${{ runner.temp }}/kmd-ws \ - --cache ${{ runner.temp }}/kmd-cache \ --prefix ${{ runner.temp }}/pfx \ --release ci \ --locations-config $(realpath ci/locations.yml) \ diff --git a/docs/basic-usage.md b/docs/basic-usage.md index e2e780d9d..e415251af 100644 --- a/docs/basic-usage.md +++ b/docs/basic-usage.md @@ -52,7 +52,7 @@ A full software distribution can then be built and deployed to a specified path, e.g. `./builds/stable-0.0.1`, with the following command: ```bash -kmd stable.yml repository.yml --prefix builds --release stable-0.0.1 --locations-config locations.yml --cache pip-cache +kmd stable.yml repository.yml --prefix builds --release stable-0.0.1 --locations-config locations.yml ``` To use this environment, type `source builds/stable-0.0.1/enable`. diff --git a/komodo/cli.py b/komodo/cli.py index c7af03ebb..c29a235dc 100755 --- a/komodo/cli.py +++ b/komodo/cli.py @@ -54,7 +54,7 @@ def _main(args): data = Data(extra_data_dirs=args.extra_data_dirs) if args.download or (not args.build and not args.install): - git_hashes = fetch(args.pkgs, args.repo, outdir=args.cache, pip=args.pip) + git_hashes = fetch(args.pkgs, args.repo, outdir=args.downloads, pip=args.pip) if args.download and not args.build: sys.exit(0) @@ -70,7 +70,7 @@ def _main(args): args.repo, data, prefix=str(tmp_prefix), - dlprefix=args.cache, + dlprefix=args.downloads, builddir=args.tmp, jobs=args.jobs, cmk=args.cmake, @@ -137,8 +137,9 @@ def _main(args): shell(f"rm -rf {args.prefix}/{args.release}.delete", sudo=args.sudo) if args.tmp: - # Allows e.g. pip to use this folder as tmpfolder, instead of in some - # cases falling back to /tmp, which is undesired when building on nfs. + # Allows e.g. pip to use this folder as a destination for "pip + # download", instead of in some cases falling back to /tmp, which is + # undesired when building on nfs. os.environ["TMPDIR"] = args.tmp release_path = Path(args.prefix) / Path(args.release) @@ -159,8 +160,9 @@ def _main(args): "--no-index", "--no-deps", "--ignore-installed", - f"--cache-dir {args.cache}", - f"--find-links {args.cache}", + # assuming fetch.py has done "pip download" to this directory: + f"--cache-dir {args.downloads}", + f"--find-links {args.downloads}", ] shell_input.append(current.get("makeopts")) @@ -265,11 +267,15 @@ def parse_args(args: List[str]) -> argparse.Namespace: "current working directory.", ) optional_args.add_argument( - "--cache", - "-c", + "--downloads", + "--cache", # deprecated + "-c", # deprecated type=str, - default="pip-cache", - help="The temporary directory used for downloads, e.g. by pip.", + default="downloads", + help="A destination directory relative to the workspace, used for downloads, " + "used by pip download, cp, rsync and git clone. This directory " + "must be empty if it already exists, otherwise it will be created, " + "unless you are running with the --build option.", ) optional_args.add_argument( "--jobs", @@ -282,13 +288,15 @@ def parse_args(args: List[str]) -> argparse.Namespace: "--download", "-d", action="store_true", - help="Flag to choose whether to download the packages.", + help="If set, packages will be downloaded but nothing will be built, unless " + "--build is also included.", ) optional_args.add_argument( "--build", "-b", action="store_true", - help="Flag to choose whether to build the packages.", + help="Flag to only build. If set and --download is not, " + "the downloads directory must already be populated.", ) optional_args.add_argument( "--install", diff --git a/komodo/fetch.py b/komodo/fetch.py index 3c8453ab5..530e3cfdb 100644 --- a/komodo/fetch.py +++ b/komodo/fetch.py @@ -70,8 +70,12 @@ def fetch(pkgs, repo, outdir, pip="pip") -> dict: if not outdir: raise ValueError( - "The value of `outdir`, the cache location for pip and other " - "tools, cannot be None or the empty string." + "The value of `outdir`, the download destination location " + "cannot be None or the empty string." + ) + if os.path.exists(outdir) and os.listdir(outdir): + raise RuntimeError( + f"Downloading to non-empty directory {outdir} is not supported." ) if not os.path.exists(outdir): os.mkdir(outdir) @@ -171,13 +175,14 @@ def fetch(pkgs, repo, outdir, pip="pip") -> dict: "-o", type=str, required=True, - help="The cache location for pip and other tools; will be created.", + help="The download destination for pip, cp, rsync and git. " + "Must be non-existing or empty.", ) parser.add_argument( "--pip", type=str, default="pip", - help="The command to use for downloading.", + help="The command to use for downloading pip packages.", ) args = parser.parse_args() fetch(args.pkgfile, args.repofile, outdir=args.output, pip=args.pip) diff --git a/tests/data/cli/nominal_repository.yml b/tests/data/cli/nominal_repository.yml index 749f107de..26e169705 100644 --- a/tests/data/cli/nominal_repository.yml +++ b/tests/data/cli/nominal_repository.yml @@ -17,7 +17,7 @@ setuptools: hackres: 0.0.5289: - source: ../hackres # we assume here hackres is copied into cache/.. + source: ../hackres # we assume here hackres is copied into _work/.. fetch: fs-cp make: sh makefile: test_build_script.sh