Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(996)

Unified Diff: vpython/venv/venv.go

Issue 2918623003: [vpython] Verify environment, named installs. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « vpython/venv/config.go ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vpython/venv/venv.go
diff --git a/vpython/venv/venv.go b/vpython/venv/venv.go
index 34908cb520d95d6e72d952f775a5318722239902..2e27fe8cf68483f84afd3de30eb7e56cbe73902a 100644
--- a/vpython/venv/venv.go
+++ b/vpython/venv/venv.go
@@ -20,6 +20,7 @@ import (
"github.com/luci/luci-go/vpython/api/vpython"
"github.com/luci/luci-go/vpython/python"
+ "github.com/luci/luci-go/vpython/spec"
"github.com/luci/luci-go/vpython/wheel"
"github.com/luci/luci-go/common/clock"
@@ -394,6 +395,25 @@ func (e *Env) AssertCompleteAndLoad() error {
D("path", e.EnvironmentStampPath).
Err()
}
+ if err := spec.NormalizeEnvironment(&environment); err != nil {
+ return errors.Annotate(err).Reason("failed to normalize stamp environment").Err()
+ }
+
+ // If we are configured with an environment, validate that it matches the
+ // the environment that we just loaded.
+ //
+ // We only consider our environment-defining fields (Spec and Runtime).
+ //
+ // Note that both environments will have been normalized at this point, so
+ // comparison should be reliable.
+ if e.Environment != nil {
+ if !proto.Equal(e.Environment.Spec, environment.Spec) {
+ return errors.New("environment stamp specification does not match")
+ }
+ if !proto.Equal(e.Environment.Runtime, environment.Runtime) {
+ return errors.New("environment stamp runtime does not match")
+ }
+ }
e.Environment = &environment
return nil
}
« no previous file with comments | « vpython/venv/config.go ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698