summaryrefslogtreecommitdiff
path: root/common.go
diff options
context:
space:
mode:
Diffstat (limited to 'common.go')
-rw-r--r--common.go26
1 files changed, 26 insertions, 0 deletions
diff --git a/common.go b/common.go
index 31c2e37..bc518be 100644
--- a/common.go
+++ b/common.go
@@ -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
+}