Perform installer file (ISM) checking
This commit is contained in:
parent
6a80613f97
commit
ad00620c74
1 changed files with 44 additions and 1 deletions
|
|
@ -30,4 +30,47 @@ def placeBinaries(artifactDetails, installerDetails) {
|
|||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
def checkISMfile(String ISMfile) {
|
||||
def xmlFile = new File(ISMfile)
|
||||
|
||||
def parsedxml = new XmlParser().parse(xmlFile)
|
||||
def pathvariableinfo = [:]
|
||||
def exitcode = 0
|
||||
// Load up a map of path variable and path pairs
|
||||
// Ignore blank path definitions
|
||||
// Ignore the workspace definition which should have the only absolute path
|
||||
parsedxml.each{ table ->
|
||||
if (table.@name == "ISPathVariable") {
|
||||
table.row.each{ row ->
|
||||
def pathname = row.td[0].value()[0]
|
||||
def path = row.td[1].value()[0]
|
||||
if (path && pathname != "WORKSPACE") {
|
||||
pathvariableinfo[pathname] = path
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Check that each path variable is defined beginning with a path variable or the WORKSPACE one
|
||||
pathvariableinfo.each{ pair ->
|
||||
println "pair key: ${pair.key} value: ${pair.value}"
|
||||
def path = pair.value
|
||||
def pathvarmatcher = path =~ /<(.*)>.*/
|
||||
if (pathvarmatcher.matches()) {
|
||||
def pathvarfound = pathvarmatcher.group(1)
|
||||
if (pathvarfound != 'WORKSPACE') {
|
||||
if (!pathvariableinfo.containsKey(pathvarfound)) {
|
||||
println "Undefined path variable ${pathvarfound} found"
|
||||
exitcode = 1
|
||||
}
|
||||
}
|
||||
} else {
|
||||
println "Path: ${path} does not begin with a path variable"
|
||||
exitcode = 1
|
||||
}
|
||||
}
|
||||
if (exitcode > 0) {
|
||||
error "The ISM file: ${ISMfile} contains a path that is either absolute or does not begin with another path variable definition"
|
||||
}
|
||||
}
|
||||
|
||||
return this;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue