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

Commit

Permalink
Security Commit, new option remoterepo in development
Browse files Browse the repository at this point in the history
  • Loading branch information
mvalleavila committed Dec 10, 2014
1 parent 2bf30d5 commit 71b3801
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 7 deletions.
3 changes: 2 additions & 1 deletion buildoop/conf/buildoop.conf
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ buildoop.bomfiles = "conf/bom"
buildoop.bomdeploy = "build/deploy"
buildoop.bomdeploysrc = "build/deploy/%DIST/%VER/src"
buildoop.bomdeploybin = "build/deploy/%DIST/%VER/bin"
buildoop.version="Buildoop v0.0.1-alpha-build-08172014-122"
buildoop.remoterepodata = "remote"
buildoop.version="Buildoop v1.0.0-alpha"
buildoop.buildRetries = 2
10 changes: 10 additions & 0 deletions buildoop/lib/MainController.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class MainController {
def globalConfig
def fileDownloader
def packageBuilder
def repositoryDownloader
def hasDoPackage

def MainController(buildoop) {
Expand All @@ -59,6 +60,9 @@ class MainController {
def PackageBuilderClass = engine.loadScriptByName('PackageBuilder.groovy')
packageBuilder = PackageBuilderClass.newInstance(buildoop)

def RepositoryDownloaderClass = engine.loadScriptByName('RepositoryDownloader.groovy')
repositoryDownloader = RepositoryDownloaderClass.newInstance(buildoop)

switch (wo["arg"]) {
case "-version":
getVersion()
Expand Down Expand Up @@ -131,6 +135,8 @@ class MainController {
}
}
break
case "-remoterepo":
showRepoVersions(wo["url"])
default:
break
}
Expand Down Expand Up @@ -491,4 +497,8 @@ class MainController {

new AntBuilder().delete(dir: workPath)
}

def showRepoVersions(url) {
return repositoryDownloader.showVersions(url)
}
}
12 changes: 6 additions & 6 deletions buildoop/lib/ParseOptions.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ Package Options:
if (domain == "https://github.com/") {
return true
}
else
else {
return false
}
}
Expand Down Expand Up @@ -204,7 +204,7 @@ Package Options:
if (!arguments.contains(i)) {
if (bomFile(i)) {
validArgs["bom"] = i + ".bom"
break;
break
}
}
}
Expand Down Expand Up @@ -234,7 +234,7 @@ Package Options:
if (validArgs["bom"] == "" && validArgs["pkg"] == "") {
parseError("You have to put BOM file and/or package name file")
}
break;
break
case "-remoterepo":
// remote url validation
for (i in args) {
Expand All @@ -247,17 +247,17 @@ Package Options:
if (validArgs["url"] == "") {
parseError("You have to put a github.com repository url")
}
break;
break
case "-checkenv":
case "-i":
case "-info":
case "-bom":
case "-targets":
case "-help":
case "-version":
break;
break
default:
break;
break
}

return validArgs
Expand Down
72 changes: 72 additions & 0 deletions buildoop/lib/RepositoryDownloader.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/* vim:set ts=4:sw=4:et:sts=4:ai:tw=80
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import org.apache.log4j.*
import groovy.util.logging.*
import java.security.MessageDigest

/**
* Class for download the source files
*
* This class implements methods for HTTP, FTP,
* GIT, SVN source code downloads.
*
* @author Javi Roman <[email protected]>
*
*/
class RepositoryDownloader {
def BDROOT
def LOG
def globalConfig
def runCommand

def RepositoryDownloader(buildoop) {
LOG = buildoop.log
BDROOT = buildoop.ROOT
globalConfig = buildoop.globalConfig
LOG.info "[RepositoryDownloader] constructor, checking enviroment"

String[] roots = [globalConfig.buildoop.classfolder]
def engine = new GroovyScriptEngine(roots)
def RunCommandClass = engine.loadScriptByName('RunCommand.groovy')
runCommand = RunCommandClass.newInstance(buildoop.log)
}

def showVersions(url) {
def repositoryFolder = BDROOT + "/" + globalConfig.buildoop.remoterepodata +
"/" + url.split('/')[-2] + "/" + url.split('/')[-1]

//downloadMetadata(url, repositoryFolder)

println "YEEEEEEEHAAA --> " + repositoryFolder
}

def downloadMetada(url, repositoryFolder) {

new File(repositoryFolder).mkdir()

def command = "git clone -n " + url + " " + repositoryFolder

//new AntBuilder().delete(dir: repositoryFolder)

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

return 0
}
}

0 comments on commit 71b3801

Please sign in to comment.