aboutsummaryrefslogtreecommitdiff
path: root/src/cli/stasis/stasis_main.c
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2024-12-18 10:54:52 -0500
committerJoseph Hunkeler <jhunkeler@gmail.com>2024-12-18 11:11:53 -0500
commit54ac1e2e256252ec75fbdfe668a3328fb5d02c31 (patch)
tree787308045ca6bbfade19062e6764876db1fac00d /src/cli/stasis/stasis_main.c
parent07011c46bdaee9efb1b643415e15c9be9ff12f03 (diff)
downloadstasis-54ac1e2e256252ec75fbdfe668a3328fb5d02c31.tar.gz
Add (conda|pip)_packages_purge configuration keys and driver
Diffstat (limited to 'src/cli/stasis/stasis_main.c')
-rw-r--r--src/cli/stasis/stasis_main.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cli/stasis/stasis_main.c b/src/cli/stasis/stasis_main.c
index dc4e2d1..61f198e 100644
--- a/src/cli/stasis/stasis_main.c
+++ b/src/cli/stasis/stasis_main.c
@@ -390,6 +390,20 @@ int main(int argc, char *argv[]) {
}
if (!isempty(ctx.meta.based_on)) {
+ if (ctx.conda.conda_packages_purge && strlist_count(ctx.conda.conda_packages_purge)) {
+ msg(STASIS_MSG_L2, "Purging conda packages\n");
+ if (delivery_purge_packages(&ctx, env_name_testing, PKG_USE_CONDA)) {
+ msg(STASIS_MSG_ERROR | STASIS_MSG_L2, "unable to purge requested conda packages from %s\n", env_name_testing);
+ exit(1);
+ }
+ }
+ if (ctx.conda.pip_packages_purge && strlist_count(ctx.conda.pip_packages_purge)) {
+ msg(STASIS_MSG_L2, "Purging pip packages\n");
+ if (delivery_purge_packages(&ctx, env_name_testing, PKG_USE_PIP)) {
+ msg(STASIS_MSG_ERROR | STASIS_MSG_L2, "unable to purge requested pip packages from %s\n", env_name_testing);
+ exit(1);
+ }
+ }
msg(STASIS_MSG_L1, "Generating package overlay from environment: %s\n", env_name);
if (delivery_overlay_packages_from_env(&ctx, env_name)) {
msg(STASIS_MSG_L2 | STASIS_MSG_ERROR, "%s", "Failed to generate package overlay. Resulting environment integrity cannot be guaranteed.\n");
@@ -462,6 +476,22 @@ int main(int argc, char *argv[]) {
msg(STASIS_MSG_L3, "No deferred conda packages\n");
}
+ if (ctx.conda.conda_packages_purge && strlist_count(ctx.conda.conda_packages_purge)) {
+ msg(STASIS_MSG_L2, "Purging conda packages\n");
+ if (delivery_purge_packages(&ctx, env_name, PKG_USE_CONDA)) {
+ msg(STASIS_MSG_ERROR | STASIS_MSG_L2, "unable to purge requested conda packages\n");
+ exit(1);
+ }
+ }
+
+ if (ctx.conda.pip_packages_purge && strlist_count(ctx.conda.pip_packages_purge)) {
+ msg(STASIS_MSG_L2, "Purging pip packages\n");
+ if (delivery_purge_packages(&ctx, env_name, PKG_USE_PIP)) {
+ msg(STASIS_MSG_ERROR | STASIS_MSG_L2, "unable to purge requested pip packages");
+ exit(1);
+ }
+ }
+
msg(STASIS_MSG_L2, "Installing pip packages\n");
if (strlist_count(ctx.conda.pip_packages)) {
if (delivery_install_packages(&ctx, ctx.storage.conda_install_prefix, env_name, INSTALL_PKG_PIP, (struct StrList *[]) {ctx.conda.pip_packages, NULL})) {