aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2019-06-01 12:16:43 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2019-06-01 12:16:43 -0400
commit8fc1017d809c69943f0257902e4e408fc7b47cb9 (patch)
treebf0618f082c31f34e15d4de097f0ecf733177a7b
parent5505aa564eb741d6f024a176f9674db459b6a958 (diff)
downloaddm-8fc1017d809c69943f0257902e4e408fc7b47cb9.tar.gz
Refactor creation/test procedure
-rw-r--r--source/app.d16
-rw-r--r--source/merge.d6
2 files changed, 18 insertions, 4 deletions
diff --git a/source/app.d b/source/app.d
index 1fc3e32..4344492 100644
--- a/source/app.d
+++ b/source/app.d
@@ -5,6 +5,7 @@ import std.format;
import std.file;
import std.typecons;
import std.path : buildPath, chainPath, absolutePath;
+import std.range : enumerate;
import conda;
import merge;
import session;
@@ -100,20 +101,33 @@ int main(string[] args) {
output_dir.mkdirRecurse;
}
+ conda.activate(session.delivery);
writeln("Creating YAML dump: " ~ dumpfile_yaml);
conda.dump_env_yaml(dumpfile_yaml);
writeln("Creating explicit dump: " ~ dumpfile_explicit);
conda.dump_env_explicit(dumpfile_explicit);
writeln("Creating pip-freeze dump: " ~ dumpfile_freeze);
conda.dump_env_freeze(dumpfile_freeze);
+ conda.deactivate();
if (session.run_tests) {
int failures = 0;
string testdir = buildPath(output_dir, "testdir");
testable_t[] pkgs = testable_packages(conda, session.conda_requirements, session.test_filter_git_orgs);
- foreach (pkg; pkgs) {
+ foreach (i, pkg; pkgs.enumerate(0)) {
+ string tmpenv = format("%04d_%s", i, session.delivery);
+ if(conda.run("create -n " ~ tmpenv ~ " --clone " ~ session.delivery)) {
+ return false;
+ }
+ conda.activate(tmpenv);
+
failures += integration_test(session, conda, testdir, pkg);
+
+ conda.deactivate();
+ if(conda.run("env remove -n " ~ tmpenv)) {
+ return false;
+ }
}
if (failures) {
diff --git a/source/merge.d b/source/merge.d
index 72805d6..528582c 100644
--- a/source/merge.d
+++ b/source/merge.d
@@ -55,7 +55,7 @@ string[string][] dmfile(string[] packages) {
bool env_combine(ref Session_t session, ref Conda conda) {
if (indexOf(session.base_spec, "://", 0) < 0 && !session.base_spec.exists) {
- throw new Exception(session.base_spec~ " does not exist");
+ throw new Exception(session.base_spec ~ " does not exist");
}
int retval = 0;
@@ -67,7 +67,7 @@ bool env_combine(ref Session_t session, ref Conda conda) {
return false;
}
- conda.activate(session.delivery);
+ //conda.activate(session.delivery);
writeln("Delivery merge specification:");
foreach (record; dmfile(session.conda_requirements)) {
@@ -78,7 +78,7 @@ bool env_combine(ref Session_t session, ref Conda conda) {
specs ~= record["fullspec"];
}
- if (conda.run("install " ~ conda.multiarg("-c", conda.channels)
+ if (conda.run("install -n " ~ session.delivery ~ " " ~ conda.multiarg("-c", conda.channels)
~ " " ~ safe_install(specs))) {
return false;
}