Repository: incubator-mynewt-newt
Updated Branches:
  refs/heads/develop 4b6affe1a -> 8b84facab


Paths use slash sepaparator and do not end with a slash


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo
Commit: 
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/7f5e2594
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/7f5e2594
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/7f5e2594

Branch: refs/heads/develop
Commit: 7f5e2594e56731bf87b2cb5ca8cbb3044a627529
Parents: 9c50472
Author: Simon Ratner <[email protected]>
Authored: Tue Dec 27 19:52:41 2016 -0800
Committer: Simon Ratner <[email protected]>
Committed: Tue Dec 27 20:43:39 2016 -0800

----------------------------------------------------------------------
 newt/builder/build.go         |  3 +++
 newt/downloader/downloader.go |  3 +++
 newt/pkg/localpackage.go      | 10 +++++-----
 newt/project/project.go       |  3 ++-
 newt/repo/repo.go             |  4 ++--
 newt/toolchain/compiler.go    | 28 ++++++++++++++++++----------
 6 files changed, 33 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7f5e2594/newt/builder/build.go
----------------------------------------------------------------------
diff --git a/newt/builder/build.go b/newt/builder/build.go
index 8e3a1b4..6e2fbdb 100644
--- a/newt/builder/build.go
+++ b/newt/builder/build.go
@@ -321,6 +321,9 @@ func (b *Builder) link(elfName string, linkerScripts 
[]string,
 
        for _, bpkg := range b.PkgMap {
                archiveNames, _ := filepath.Glob(b.PkgBinDir(bpkg) + "/*.a")
+               for i, archiveName := range archiveNames {
+                       archiveNames[i] = filepath.ToSlash(archiveName)
+               }
                pkgNames = append(pkgNames, archiveNames...)
        }
 

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7f5e2594/newt/downloader/downloader.go
----------------------------------------------------------------------
diff --git a/newt/downloader/downloader.go b/newt/downloader/downloader.go
index 7b073bb..bd763f5 100644
--- a/newt/downloader/downloader.go
+++ b/newt/downloader/downloader.go
@@ -26,6 +26,7 @@ import (
        "net/http"
        "os"
        "os/exec"
+       "path/filepath"
 
        log "github.com/Sirupsen/logrus"
 
@@ -77,6 +78,7 @@ func checkout(repoDir string, commit string) error {
                return util.NewNewtError(fmt.Sprintf("Can't find git binary: 
%s\n",
                        err.Error()))
        }
+       gitPath = filepath.ToSlash(gitPath)
 
        if err := os.Chdir(repoDir); err != nil {
                return util.NewNewtError(err.Error())
@@ -184,6 +186,7 @@ func (gd *GithubDownloader) DownloadRepo(commit string) 
(string, error) {
                return "", util.NewNewtError(fmt.Sprintf("Can't find git 
binary: %s\n",
                        err.Error()))
        }
+       gitPath = filepath.ToSlash(gitPath)
 
        // Clone the repository.
        cmd := []string{

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7f5e2594/newt/pkg/localpackage.go
----------------------------------------------------------------------
diff --git a/newt/pkg/localpackage.go b/newt/pkg/localpackage.go
index fc26a90..2f0ad0b 100644
--- a/newt/pkg/localpackage.go
+++ b/newt/pkg/localpackage.go
@@ -88,7 +88,7 @@ func NewLocalPackage(r *repo.Repo, pkgDir string) 
*LocalPackage {
                PkgV:             viper.New(),
                SyscfgV:          viper.New(),
                repo:             r,
-               basePath:         filepath.Clean(pkgDir) + "/", // XXX: Remove 
slash.
+               basePath:         filepath.ToSlash(filepath.Clean(pkgDir)),
                deps:             map[string]*Dependency{},
                injectedSettings: map[string]string{},
        }
@@ -109,7 +109,7 @@ func (pkg *LocalPackage) FullName() string {
 }
 
 func (pkg *LocalPackage) BasePath() string {
-       return filepath.Clean(pkg.basePath)
+       return pkg.basePath
 }
 
 func (pkg *LocalPackage) RelativePath() string {
@@ -136,7 +136,7 @@ func (pkg *LocalPackage) SetName(name string) {
 }
 
 func (pkg *LocalPackage) SetBasePath(basePath string) {
-       pkg.basePath = basePath
+       pkg.basePath = filepath.ToSlash(filepath.Clean(basePath))
 }
 
 func (pkg *LocalPackage) SetType(packageType interfaces.PackageType) {
@@ -339,7 +339,7 @@ func (pkg *LocalPackage) Load() error {
        if err != nil {
                return err
        }
-       pkg.AddCfgFilename(pkg.basePath + PACKAGE_FILE_NAME)
+       pkg.AddCfgFilename(pkg.basePath + "/" + PACKAGE_FILE_NAME)
 
        // Set package name from the package
        pkg.name = pkg.PkgV.GetString("pkg.name")
@@ -369,7 +369,7 @@ func (pkg *LocalPackage) Load() error {
                if err != nil {
                        return err
                }
-               pkg.AddCfgFilename(pkg.basePath + SYSCFG_YAML_FILENAME)
+               pkg.AddCfgFilename(pkg.basePath + "/" + SYSCFG_YAML_FILENAME)
        }
 
        return nil

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7f5e2594/newt/project/project.go
----------------------------------------------------------------------
diff --git a/newt/project/project.go b/newt/project/project.go
index 988d650..cc68c30 100644
--- a/newt/project/project.go
+++ b/newt/project/project.go
@@ -24,6 +24,7 @@ import (
        "fmt"
        "os"
        "path"
+       "path/filepath"
        "strings"
 
        log "github.com/Sirupsen/logrus"
@@ -481,7 +482,7 @@ func (proj *Project) loadConfig() error {
 }
 
 func (proj *Project) Init(dir string) error {
-       proj.BasePath = dir
+       proj.BasePath = filepath.ToSlash(filepath.Clean(dir))
 
        // Only one project per system, when created, set it as the global 
project
        interfaces.SetProject(proj)

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7f5e2594/newt/repo/repo.go
----------------------------------------------------------------------
diff --git a/newt/repo/repo.go b/newt/repo/repo.go
index 099c1dd..a2331f7 100644
--- a/newt/repo/repo.go
+++ b/newt/repo/repo.go
@@ -623,9 +623,9 @@ func (r *Repo) Init(repoName string, rversreq string, d 
downloader.Downloader) e
        path := interfaces.GetProject().Path()
 
        if r.local {
-               r.localPath = filepath.Clean(path)
+               r.localPath = filepath.ToSlash(filepath.Clean(path))
        } else {
-               r.localPath = filepath.Clean(path + "/" + REPOS_DIR + "/" + 
r.name)
+               r.localPath = filepath.ToSlash(filepath.Clean(path + "/" + 
REPOS_DIR + "/" + r.name))
                r.minCommit = newtutil.RepoMinCommits[repoName]
 
                upToDate, err := r.HasMinCommit()

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/7f5e2594/newt/toolchain/compiler.go
----------------------------------------------------------------------
diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go
index 12606e4..710243b 100644
--- a/newt/toolchain/compiler.go
+++ b/newt/toolchain/compiler.go
@@ -180,7 +180,7 @@ func NewCompiler(compilerDir string, dstDir string,
                ObjPathList: map[string]bool{},
                baseDir:     project.GetProject().BasePath,
                srcDir:      "",
-               dstDir:      filepath.Clean(dstDir),
+               dstDir:      dstDir,
                extraDeps:   []string{},
        }
 
@@ -277,7 +277,7 @@ func (c *Compiler) DstDir() string {
 }
 
 func (c *Compiler) SetSrcDir(srcDir string) {
-       c.srcDir = srcDir
+       c.srcDir = filepath.ToSlash(filepath.Clean(srcDir))
 }
 
 func (c *Compiler) AddDeps(depFilenames ...string) {
@@ -316,7 +316,7 @@ func (c *Compiler) includesStrings() []string {
 
        tokens := make([]string, len(includes))
        for i, s := range includes {
-               s = strings.TrimPrefix(s, c.baseDir+"/")
+               s = strings.TrimPrefix(filepath.ToSlash(filepath.Clean(s)), 
c.baseDir + "/")
                tokens[i] = "-I" + s
        }
 
@@ -344,7 +344,7 @@ func (c *Compiler) depsString() string {
 }
 
 func (c *Compiler) dstFilePath(srcPath string) string {
-       relSrcPath := strings.TrimPrefix(srcPath, c.srcDir)
+       relSrcPath := strings.TrimPrefix(filepath.ToSlash(srcPath), c.srcDir + 
"/")
        relDstPath := strings.TrimSuffix(relSrcPath, filepath.Ext(srcPath))
        dstPath := fmt.Sprintf("%s/%s", c.dstDir, relDstPath)
        return dstPath
@@ -382,7 +382,7 @@ func (c *Compiler) CompileFileCmd(file string, compilerType 
int) (
                return nil, util.NewNewtError("Unknown compiler type")
        }
 
-       srcPath := strings.TrimPrefix(file, c.baseDir+"/")
+       srcPath := strings.TrimPrefix(file, c.baseDir + "/")
        cmd := []string{cmdName}
        cmd = append(cmd, flags...)
        cmd = append(cmd, c.includesStrings()...)
@@ -406,7 +406,7 @@ func (c *Compiler) GenDepsForFile(file string) error {
                os.MkdirAll(depDir, 0755)
        }
 
-       srcPath := strings.TrimPrefix(file, c.baseDir+"/")
+       srcPath := strings.TrimPrefix(file, c.baseDir + "/")
        cmd := []string{c.ccPath}
        cmd = append(cmd, c.cflagsStrings()...)
        cmd = append(cmd, c.includesStrings()...)
@@ -490,7 +490,7 @@ func (c *Compiler) CompileFile(file string, compilerType 
int) error {
                return err
        }
 
-       srcPath := strings.TrimPrefix(file, c.baseDir+"/")
+       srcPath := strings.TrimPrefix(file, c.baseDir + "/")
        switch compilerType {
        case COMPILER_TYPE_C:
                util.StatusMessage(util.VERBOSITY_DEFAULT, "Compiling %s\n", 
srcPath)
@@ -573,6 +573,8 @@ func (c *Compiler) CompileCpp() error {
        if err != nil {
                return err
        }
+       wd = filepath.ToSlash(filepath.Clean(wd))
+       log.Infof("Working in dir (%s)", wd)
 
        log.Infof("Compiling CC if outdated (%s/*.cc) %s", wd,
                strings.Join(files, " "))
@@ -610,17 +612,21 @@ func (c *Compiler) CompileCpp() error {
 //                                  to compile.
 func (c *Compiler) CompileAs() error {
        files, _ := filepath.Glob(c.srcDir + "/*.s")
-       Sfiles, _ := filepath.Glob(c.srcDir + "/*.S")
-       files = append(files, Sfiles...)
+       moreFiles, _ := filepath.Glob(c.srcDir + "/*.S")
+       files = append(files, moreFiles...)
 
        wd, err := os.Getwd()
        if err != nil {
                return err
        }
+       wd = filepath.ToSlash(filepath.Clean(wd))
+       log.Infof("Working in dir (%s)", wd)
 
        log.Infof("Compiling assembly if outdated (%s/*.s) %s", wd,
                strings.Join(files, " "))
        for _, file := range files {
+               file = filepath.ToSlash(file)
+
                if shouldIgnore := c.shouldIgnoreFile(file); shouldIgnore {
                        log.Infof("Ignoring %s because package dictates it.", 
file)
                        continue
@@ -654,6 +660,8 @@ func (c *Compiler) CopyArchive() error {
        log.Infof("Copying archive if outdated (%s/*.a) %s", c.srcDir,
                strings.Join(files, " "))
        for _, file := range files {
+               file = filepath.ToSlash(file)
+
                if shouldIgnore := c.shouldIgnoreFile(file); shouldIgnore {
                        log.Infof("Ignoring %s because package dictates it.", 
file)
                        continue
@@ -1141,7 +1149,7 @@ func (c *Compiler) CompileArchive(archiveFile string) 
error {
        util.StatusMessage(util.VERBOSITY_DEFAULT, "Archiving %s",
                path.Base(archiveFile))
        util.StatusMessage(util.VERBOSITY_VERBOSE, " with object files %s",
-               archiveFile, strings.Join(objList, " "))
+               strings.Join(objList, " "))
        util.StatusMessage(util.VERBOSITY_DEFAULT, "\n")
 
        if err != nil && !os.IsNotExist(err) {

Reply via email to