diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-07 12:52:03 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2024-10-07 12:52:03 -0400 |
commit | 4d525473d1f2b4d02e29747a45d2a02ffcff4398 (patch) | |
tree | bacbf92477f43041e5cdad6c74068fba03dcbfef /src | |
parent | 4b6fd13d290f9de731589f936c304c7bc74e6b88 (diff) | |
download | stasis-4d525473d1f2b4d02e29747a45d2a02ffcff4398.tar.gz |
Break down the existence check
* These checks can fail due to external factors, so handle those first
* Build the package for the host system the package isn't found in the index/channel
* Change EXISTING to EXTERNAL to be more clear. The package exists... externally
Diffstat (limited to 'src')
-rw-r--r-- | src/delivery.c | 29 |
1 files changed, 21 insertions, 8 deletions
diff --git a/src/delivery.c b/src/delivery.c index e7dfece..07e04c8 100644 --- a/src/delivery.c +++ b/src/delivery.c @@ -252,23 +252,36 @@ void delivery_defer_packages(struct Delivery *ctx, int type) { } } - ignore_pkg = 0; - if (DEFER_PIP == type && pip_index_provides(PYPI_INDEX_DEFAULT, nametmp, version)) { - fprintf(stderr, "(%s provided by index %s): ", version, PYPI_INDEX_DEFAULT); - } else if (DEFER_CONDA == type && conda_provides(nametmp)) { - fprintf(stderr, "(%s provided by conda channel): ", version); + int upstream_exists = 0; + if (DEFER_PIP == type) { + upstream_exists = pip_index_provides(PYPI_INDEX_DEFAULT, name); + } else if (DEFER_CONDA == type) { + upstream_exists = conda_provides(name); } else { - ignore_pkg = 1; + fprintf(stderr, "\nUnknown package type: %d\n", type); + exit(1); } + + if (upstream_exists < 0) { + fprintf(stderr, "%s's existence command failed for '%s'\n" + "(This may be due to a network/firewall issue!)\n", mode, name); + exit(1); + } + if (!upstream_exists) { + build_for_host = 1; + } else { + build_for_host = 0; + } + break; } } - if (ignore_pkg) { + if (build_for_host) { printf("BUILD FOR HOST\n"); strlist_append(&deferred, name); } else { - printf("USE EXISTING\n"); + printf("USE EXTERNAL\n"); strlist_append(&filtered, name); } } |