You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2019/10/10 17:15:09 UTC
[mynewt-newt] 05/08: Export basic env vars in newt process
This is an automated email from the ASF dual-hosted git repository.
ccollins pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git
commit 14e3cd9f5243ac003d6316da3c7b34911e9e313f
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Fri Oct 4 14:41:13 2019 -0700
Export basic env vars in newt process
Export the following environment variables in the newt process itself:
"CORE_PATH"
"BSP_PATH"
"BIN_ROOT"
"MYNEWT_PROJECT_ROOT"
"MYNEWT_NEWT_PATH"
These allows a `pkg.yml` file to use these settings in its list of
custom commands.
---
go.mod | 1 +
go.sum | 2 ++
newt/builder/targetbuild.go | 9 +++++++++
3 files changed, 12 insertions(+)
diff --git a/go.mod b/go.mod
index e0368d0..da59696 100644
--- a/go.mod
+++ b/go.mod
@@ -5,6 +5,7 @@ go 1.12
require (
github.com/NickBall/go-aes-key-wrap v0.0.0-20170929221519-1c3aa3e4dfc5
github.com/apache/mynewt-artifact v0.0.3
+ github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/sirupsen/logrus v1.4.2
github.com/spf13/cast v1.3.0
diff --git a/go.sum b/go.sum
index de1f0bd..22f3207 100644
--- a/go.sum
+++ b/go.sum
@@ -16,6 +16,8 @@ github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
+github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 h1:iQTw/8FWTuc7uiaSepXwyf3o52HaUYcV+Tu66S3F5GA=
+github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNUXsshfwJMBgNA0RU6/i7WVaAegv3PtuIHPMs=
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
diff --git a/newt/builder/targetbuild.go b/newt/builder/targetbuild.go
index ba9728b..db337e5 100644
--- a/newt/builder/targetbuild.go
+++ b/newt/builder/targetbuild.go
@@ -225,6 +225,15 @@ func (t *TargetBuilder) ensureResolved() error {
return err
}
+ // Configure the basic set of environment variables in the current process.
+ env := BasicEnvVars("", t.bspPkg)
+ for k, v := range env {
+ if err := os.Setenv(k, v); err != nil {
+ return util.FmtNewtError(
+ "failed to set env var %s=%s: %s", k, v, err.Error())
+ }
+ }
+
return nil
}