You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2022/03/30 11:36:53 UTC

[mynewt-newt] 01/02: Add options to skip some git related stuff on each build

This is an automated email from the ASF dual-hosted git repository.

andk pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newt.git

commit 69976cfd40db1a095f7837f2f8187aef0d032ca9
Author: Andrzej Kaczmarek <an...@codecoup.pl>
AuthorDate: Wed Mar 30 11:26:04 2022 +0200

    Add options to skip some git related stuff on each build
    
    This adds two new options to newtrc.yml:
    - skip_newt_compat - allows to skip checking newt compatibility
    - skip_syscfg_repo_hash - allows to skip generation of repo hashes to
      syscfg
    
    Those can skip operations that are not essential for build but can be
    potentially git-intensive which means they are painfully slow on
    Windows.
    
    Both options are boolean and disabled by default.
---
 newt/project/project.go   | 8 +++++---
 newt/settings/settings.go | 3 +++
 newt/syscfg/syscfg.go     | 6 ++++--
 util/util.go              | 2 ++
 4 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/newt/project/project.go b/newt/project/project.go
index 42f443b..879e392 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -587,9 +587,11 @@ func (proj *Project) loadConfig(download bool) error {
 		return err
 	}
 
-	// Warn the user about incompatibilities with this version of newt.
-	if err := proj.verifyNewtCompat(); err != nil {
-		return err
+	if !util.SkipNewtCompat {
+		// Warn the user about incompatibilities with this version of newt.
+		if err := proj.verifyNewtCompat(); err != nil {
+			return err
+		}
 	}
 
 	ignoreDirs, err := yc.GetValStringSlice("project.ignore_dirs", nil)
diff --git a/newt/settings/settings.go b/newt/settings/settings.go
index ad577f0..c70b58b 100644
--- a/newt/settings/settings.go
+++ b/newt/settings/settings.go
@@ -56,6 +56,9 @@ func processNewtrc(yc ycfg.YCfg) {
 
 	// default is 0 anyway, no need to initialize first
 	util.ShallowCloneDepth, _ = yc.GetValIntDflt("shallow_clone", nil, -1)
+
+	util.SkipNewtCompat, _ = yc.GetValBoolDflt("skip_newt_compat", nil, false)
+	util.SkipSyscfgRepoHash, _ = yc.GetValBoolDflt("skip_syscfg_repo_hash", nil, false)
 }
 
 func readNewtrc() ycfg.YCfg {
diff --git a/newt/syscfg/syscfg.go b/newt/syscfg/syscfg.go
index 985cae9..2c73f6c 100644
--- a/newt/syscfg/syscfg.go
+++ b/newt/syscfg/syscfg.go
@@ -1589,8 +1589,10 @@ func write(cfg Cfg, w io.Writer) {
 	writeCheckMacros(w)
 	fmt.Fprintf(w, "\n")
 
-	writeReposInfo(w)
-	fmt.Fprintf(w, "\n")
+	if !util.SkipSyscfgRepoHash {
+		writeReposInfo(w)
+		fmt.Fprintf(w, "\n")
+	}
 
 	writeSettings(cfg, w)
 	fmt.Fprintf(w, "\n")
diff --git a/util/util.go b/util/util.go
index 95817df..41632bc 100644
--- a/util/util.go
+++ b/util/util.go
@@ -49,6 +49,8 @@ var ExecuteShell bool
 var EscapeShellCmds bool
 var ShallowCloneDepth int
 var logFile *os.File
+var SkipNewtCompat bool
+var SkipSyscfgRepoHash bool
 
 func ParseEqualsPair(v string) (string, string, error) {
 	s := strings.Split(v, "=")