diff options
Diffstat (limited to 'common.go')
| -rw-r--r-- | common.go | 26 |
1 files changed, 26 insertions, 0 deletions
@@ -82,3 +82,29 @@ func (rs *RepoStatus) RepoType() string { log.Info("package is: unknown", err) return "" } + +func (rs *RepoStatus) BinaryName() string { + // get the package name from the repo name + path := rs.String() + parts := strings.Split(path, "/") + name := parts[len(parts)-1] + return name +} + +func (rs *RepoStatus) Build() bool { + name := rs.BinaryName() + // removes the binary if it already exists + rs.RunCmd([]string{"rm", "-f", name}) + if rs.Exists(name) { + log.Warn("file could not be removed filename =", name) + return false + } + log.Info("need to build here", rs.String()) + rs.RunCmd([]string{"go", "build", "-v", "-x"}) + if rs.Exists(name) { + log.Warn("build worked", name) + return true + } + log.Warn("build failed", name) + return false +} |
