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


The following commit(s) were added to refs/heads/master by this push:
     new ec8c217  Log exported environnment variables with `-ldebug`
ec8c217 is described below

commit ec8c217bac1985f34c9a6f62902a3e5ee7abfa45
Author: Christopher Collins <ccoll...@apache.org>
AuthorDate: Wed Apr 22 10:39:23 2020 -0700

    Log exported environnment variables with `-ldebug`
---
 newt/builder/targetbuild.go | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/newt/builder/targetbuild.go b/newt/builder/targetbuild.go
index bbc35ff..57e4952 100644
--- a/newt/builder/targetbuild.go
+++ b/newt/builder/targetbuild.go
@@ -25,6 +25,7 @@ import (
        "io/ioutil"
        "os"
        "path/filepath"
+       "sort"
        "strings"
 
        log "github.com/sirupsen/logrus"
@@ -227,8 +228,19 @@ func (t *TargetBuilder) ensureResolved() error {
 
        // 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 {
+       keys := make([]string, 0, len(env))
+       for k, _ := range env {
+               keys = append(keys, k)
+       }
+       sort.Strings(keys)
+
+       log.Debugf("exporting environment variables:")
+       for _, k := range keys {
+               v := env[k]
+               log.Debugf("    %s=%s", k, env[k])
+
+               err := os.Setenv(k, v)
+               if err != nil {
                        return util.FmtNewtError(
                                "failed to set env var %s=%s: %s", k, v, 
err.Error())
                }

Reply via email to