Skip to content
This repository has been archived by the owner on Jan 8, 2020. It is now read-only.

Commit

Permalink
Merge pull request #151 from buildoop/buildoop-v1-dev
Browse files Browse the repository at this point in the history
New buildoop ready to work - merging with buildoop-v1-master branch
  • Loading branch information
mvalleavila committed Dec 15, 2014
2 parents 71b3801 + 616da5d commit 59f5261
Show file tree
Hide file tree
Showing 468 changed files with 692 additions and 31,378 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ cscope.out
tags
.vagrant
*~
remote
recipes
conf/bom
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
Javi Roman <[email protected]>
Marcelo Valle <[email protected]>
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Buildoop v0.0.1-alpha-build-08172014-122
Buildoop v1.0
Empty file removed buildoop/.gitignore
Empty file.
4 changes: 2 additions & 2 deletions buildoop/bin/buildoop
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ class Buildoop {
}

def displayBanner() {
userMessage("INFO", "Buildoop: Hadoop Ecosystem Builder\n\n")
println userMessage("INFO", "Buildoop: Hadoop Ecosystem Builder\n\n")
}

def createLogfolder() {
Expand Down Expand Up @@ -103,7 +103,7 @@ class Buildoop {
"WARNING":ANSI_YELLOW,
"INFO":ANSI_BLUE]

print CSI + colors[type] + msg + CSI + ANSI_RESET
return CSI + colors[type] + msg + CSI + ANSI_RESET
}

static def main(args) {
Expand Down
2 changes: 1 addition & 1 deletion buildoop/conf/buildoop.conf
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ buildoop.bomdeploysrc = "build/deploy/%DIST/%VER/src"
buildoop.bomdeploybin = "build/deploy/%DIST/%VER/bin"
buildoop.remoterepodata = "remote"
buildoop.version="Buildoop v1.0.0-alpha"
buildoop.buildRetries = 2
buildoop.buildRetries = 3
4 changes: 2 additions & 2 deletions buildoop/lib/FileDownloader.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,14 @@ class FileDownloader {
new AntBuilder().delete(dir: repository_folder)

println "cloning repository: " + command
runCommand.runCommand(["bash", "-c", command])
println runCommand.runCommand(["bash", "-c", command])

command = "git " + "--work-tree " + repository + " --git-dir " + repository +
"/.git" + " checkout " +
git_hash

println "checking out hash: " + command
runCommand.runCommand(["bash", "-c", command])
println runCommand.runCommand(["bash", "-c", command])

new AntBuilder().tar(destfile: outFile,
basedir: repository_folder,
Expand Down
87 changes: 66 additions & 21 deletions buildoop/lib/MainController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ class MainController {
def packageBuilder
def repositoryDownloader
def hasDoPackage
def buildSummary

def MainController(buildoop) {
_buildoop = buildoop
Expand All @@ -49,6 +50,7 @@ class MainController {
globalConfig = buildoop.globalConfig
// custom package by default
hasDoPackage = true
buildSummary = []

String[] roots = [globalConfig.buildoop.classfolder]
def engine = new GroovyScriptEngine(roots)
Expand Down Expand Up @@ -81,10 +83,8 @@ class MainController {
break

case "-info":
if ((wo["bom"] == "") && (wo["pkg"] == "")) {
// info for the buildoop in general
getInfo()
} else if ((wo["bom"] != "") && (wo["pkg"] == "")) {
case "-i":
if ((wo["bom"] != "") && (wo["pkg"] == "")) {
// info for the BOM file
getBomInfo(wo["bom"])
} else {
Expand All @@ -94,6 +94,7 @@ class MainController {
break

case "-build":
case "-b":
def maxRetries = globalConfig.buildoop.buildRetries
def retries = 0
def success = 0
Expand All @@ -110,12 +111,32 @@ class MainController {
}
} else {
def pkgList = getPkgList(wo["bom"])
def packageName
for (i in pkgList) {
makePhases(i)
retries = 0
success = 0
packageName = (i.split("/")[-1]).split("\\.bd")[0]
while (!success && retries < maxRetries) {
try {
makePhases(i)
success = 1
}
catch (e){
println e
retries++
}
}
if (success){
buildSummaryOk(packageName)
} else {
buildSummaryError(packageName)
}
}
printSummary()
}
break
case "-clean":
case "-c":
if (wo["pkg"]) {
clean(wo["pkg"])
} else {
Expand All @@ -137,6 +158,10 @@ class MainController {
break
case "-remoterepo":
showRepoVersions(wo["url"])
break
case "-downloadrepo":
downloadRepo(wo["url"], wo["ver"])
break
default:
break
}
Expand All @@ -162,9 +187,10 @@ class MainController {
case {line.contains("#")}:
break
case {line.contains("VERSION")}:
def capitalname = line.split("_VERSION")[0]
def name = capitalname.toLowerCase()
list << globalConfig.buildoop.recipes + "/" + name + "/" + name +
def name = line.split("_VERSION")[0].toLowerCase()
def version = bom.split(".bom")[0]
//def name = capitalname.toLowerCase()
list << globalConfig.buildoop.recipes + "/" + version + "/" + name + "/" + name +
"-" + line.split("=")[1].trim() + ".bd"
break
default:
Expand Down Expand Up @@ -375,7 +401,7 @@ class MainController {
println "Downloaded: $size bytes"
long end = System.currentTimeMillis()

_buildoop.userMessage("OK", "[OK] ")
println _buildoop.userMessage("OK", "[OK] ")
println "Elapsed time: " + ((end - start) / 1000) + " seconds ";

switch (jsonRecipe.do_fetch.download_cmd) {
Expand All @@ -392,13 +418,13 @@ class MainController {
LOG.error "[makePhases] md5sum fails!!!"
LOG.error "[makePhases] md5sum calculated: $md5Calculated"
LOG.error "[makePhases] md5sum from recipe: $jsonRecipe.do_download.src_md5sum"
_buildoop.userMessage("ERROR",
println _buildoop.userMessage("ERROR",
"ERROR: md5sum for $jsonRecipe.do_download.src_uri failed:\n")
_buildoop.userMessage("ERROR",
println _buildoop.userMessage("ERROR",
"Calculated : $md5Calculated\n")
_buildoop.userMessage("ERROR",
println _buildoop.userMessage("ERROR",
"From recipe: $jsonRecipe.do_download.src_md5sum\n")
_buildoop.userMessage("ERROR", "Aborting program!\n")
println _buildoop.userMessage("ERROR", "Aborting program!\n")
throw new Exception()
}
break
Expand All @@ -408,7 +434,7 @@ class MainController {
}

} else {
_buildoop.userMessage("OK", "[OK]")
println _buildoop.userMessage("OK", "[OK]")
println " Recipe: " + outFile.tokenize('/').last() + " ready to build "
LOG.info "[makePhases] download .done file exits skipped"
}
Expand Down Expand Up @@ -436,10 +462,11 @@ class MainController {
if (!hasDoPackage) {
// defalt build package
def baseFolders = ["src":"", "dest":"", "srcpkg":""]

def s = pkg.split('.bd')[0].split("/")

baseFolders["src"] = globalConfig.buildoop.recipes + "/" +
s[-2] + "/" + s[-1]
s[-3] + "/" + s[-2] + "/" + s[-1]

baseFolders["dest"] = globalConfig.buildoop.work + "/" +
jsonRecipe.do_info.filename.split('.bd')[0]
Expand All @@ -459,13 +486,10 @@ class MainController {
packageBuilder.createRepo(baseFolders, _buildoop)
f.createNewFile()
}
_buildoop.userMessage("OK", "[OK]")
println " Package built with success"
println _buildoop.userMessage("OK", "[OK]") + " Package built with success"
} else {
println "Custom package building processing"
}

println "TODO .................."
}

def clean(pkg) {
Expand All @@ -479,7 +503,6 @@ class MainController {

def cleanall(pkg) {
clean(pkg)

def jsonRecipe = loadJsonRecipe(pkg)

def downloadFile = globalConfig.buildoop.downloads + "/" +
Expand All @@ -499,6 +522,28 @@ class MainController {
}

def showRepoVersions(url) {
return repositoryDownloader.showVersions(url)
repositoryDownloader.showVersions(url)
}

def downloadRepo(url, ver) {
repositoryDownloader.downloadRepo(url, ver)
}

def buildSummaryOk(packageName){
buildSummary.add(_buildoop.userMessage("OK", "[OK]") + "\tPackage '" + packageName + "' build succes")
}

def buildSummaryError(packageName){
LOG.error "Package " + packageName + " build process fails"
buildSummary.add(_buildoop.userMessage("ERROR", "[ERROR]") + "\tPackage '" + packageName + "' build fails")
}

def printSummary(){
println _buildoop.userMessage("INFO", "\nBuild Summary: ")
buildSummary.each {
line ->
println "${line}"
}
}

}
1 change: 1 addition & 0 deletions buildoop/lib/PackageBuilder.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import groovy.util.logging.*
*
*
* @author Javi Roman <[email protected]>
* @author Marcelo Valle <[email protected]>
*
*/
class PackageBuilder {
Expand Down
Loading

0 comments on commit 59f5261

Please sign in to comment.