You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ut...@apache.org on 2020/03/05 21:51:25 UTC

[mynewt-newt] branch master updated (db229b2 -> 34d7d90)

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

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


    from db229b2  Remove "final-atom" target specifier type
     new 403de36  Remove mcuboot submodule hack
     new 34d7d90  Fix skipping the copy of empty dirs on tree copies

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 newt/downloader/downloader.go | 68 ++-----------------------------------------
 util/util.go                  |  2 +-
 2 files changed, 3 insertions(+), 67 deletions(-)


[mynewt-newt] 01/02: Remove mcuboot submodule hack

Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 403de363933b868c7d959567720cb0b0fd6441b2
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Thu Mar 5 08:49:07 2020 -0300

    Remove mcuboot submodule hack
    
    After the conditional submodule feature added with
    905c71ce407f94da1f6812dd6b24cda885336548, the mcuboot repo was updated
    to inform that Mynewt does not required cloning of submodules; the hack
    is not required anymore.
    
    Signed-off-by: Fabio Utzig <ut...@apache.org>
---
 newt/downloader/downloader.go | 68 ++-----------------------------------------
 1 file changed, 2 insertions(+), 66 deletions(-)

diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index 43f1f02..474309d 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -372,58 +372,6 @@ func untrackedFilesFromCheckoutErr(err error) []string {
 	return files
 }
 
-// applyMcubootPreHack attempts to clean up the mcuboot repo so that the
-// subsequent checkout operation will succeed.  This hack is required because a
-// directory in the mcuboot repo was replaced with a submodule.  Git is unable
-// to transition from a post-replace commit to a pre-replace commit because
-// some files in the submodule used to exist in the mcuboot repo itself.  If
-// this issue is detected, this function deletes the submodule directory so
-// that the checkout operation can be attempted again.
-func applyMcubootPreHack(repoDir string, err error) error {
-	if !strings.HasSuffix(repoDir, "repos/mcuboot") {
-		// Not the mcuboot repo.
-		return err
-	}
-
-	// Check for an "untracked files" error.
-	files := untrackedFilesFromCheckoutErr(err)
-	if len(files) == 0 {
-		// Not a hackable error.
-		return err
-	}
-
-	for _, file := range files {
-		if !strings.HasPrefix(file, "ext/mbedtls") {
-			return err
-		}
-	}
-
-	path := repoDir + "/ext/mbedtls"
-	log.Debugf("applying mcuboot hack: removing %s", path)
-	os.RemoveAll(path)
-	return nil
-}
-
-// applyMcubootPostHack attempts to clean up the mcuboot repo so that the
-// subsequent checkout operation will succeed.  This hack is required because a
-// directory in the mcuboot repo was replaced with a submodule.  This hack
-// should be applied after a successful checkout from a pre-replace commit to a
-// post-replace commit.  This function deletes an orphan directory left behind
-// by the checkout operation.
-func applyMcubootPostHack(repoDir string, output string) {
-	if !strings.HasSuffix(repoDir, "repos/mcuboot") {
-		// Not the mcuboot repo.
-		return
-	}
-
-	// Check for a "unable to rmdir" warning (pre- to post- submodule move).
-	if strings.Contains(output, "unable to rmdir 'sim/mcuboot-sys/mbedtls'") {
-		path := repoDir + "/sim/mcuboot-sys/mbedtls"
-		log.Debugf("applying mcuboot hack: removing %s", path)
-		os.RemoveAll(path)
-	}
-}
-
 func (gd *GenericDownloader) Checkout(repoDir string, commit string) error {
 	// Get the hash corresponding to the commit in case the caller specified a
 	// branch or tag.  We always want to check out a hash and end up in a
@@ -439,20 +387,8 @@ func (gd *GenericDownloader) Checkout(repoDir string, commit string) error {
 		hash,
 	}
 
-	o, err := executeGitCommand(repoDir, cmd, true)
-	if err != nil {
-		if err := applyMcubootPreHack(repoDir, err); err != nil {
-			return err
-		}
-
-		if _, err := executeGitCommand(repoDir, cmd, true); err != nil {
-			return err
-		}
-	} else {
-		applyMcubootPostHack(repoDir, string(o))
-	}
-
-	return nil
+	_, err = executeGitCommand(repoDir, cmd, true)
+	return err
 }
 
 // Update one submodule tree in a repo (under path)


[mynewt-newt] 02/02: Fix skipping the copy of empty dirs on tree copies

Posted by ut...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 34d7d90344552a47d81d62cc2a354c3752263caa
Author: Fabio Utzig <ut...@apache.org>
AuthorDate: Thu Mar 5 08:53:18 2020 -0300

    Fix skipping the copy of empty dirs on tree copies
    
    The CopyDir implementation did not copy empty directories which was
    resulting in a dirty repo after the tree copy with non-cloned submodules
    (empty dirs) was performed.
    
    The issue resulted from calling `MkdirAll` with the parent directory of
    the current directory under copy, followed by a `ReadDir` which would
    result in an empty list of files/dirs, skipping the directory creation
    (by skipping the recursive tree copy).
    
    Signed-off-by: Fabio Utzig <ut...@apache.org>
---
 util/util.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/util/util.go b/util/util.go
index ac92c28..91e8aed 100644
--- a/util/util.go
+++ b/util/util.go
@@ -525,7 +525,7 @@ func CopyDir(srcDirStr, dstDirStr string) error {
 		return ChildNewtError(err)
 	}
 
-	if err := os.MkdirAll(filepath.Dir(dstDirStr), info.Mode()); err != nil {
+	if err := os.MkdirAll(dstDirStr, info.Mode()); err != nil {
 		return ChildNewtError(err)
 	}