firmware_tools/check/do_meta.groovy

77 lines
2.3 KiB
Groovy

markunstable = false
unstablereason = ""
summaryfolder = "${WORKSPACE}/summary"
summaryfile = "${summaryfolder}/summary.txt"
summarystring = ""
releaserepofolder = "${WORKSPACE}/releaserepos"
sourcerepofolder = "${WORKSPACE}/sourcerepos"
tempfolder = "${WORKSPACE}/temp"
gitrevparseoutputfile = "${tempfolder}/gitrevparse.out"
metascript = autobuilder.getmetafolderscript()
def resetfolders() {
dir(summaryfolder) {
deleteDir()
}
dir(releaserepofolder) {
deleteDir()
}
dir(tempfolder) {
deleteDir()
}
}
def preconditions() {
markunstable = false
unstablereason = ""
summarystring = ""
writeFile(file: summaryfile, text: "Release summary: \n")
}
def setunstable(String reason) {
markunstable = true
unstablereason += reason + "\n"
echo "Marked build as unstable: Reason: ${reason}"
}
def summaryappend(String summary) {
def String currentsummarycontents = readFile(file: summaryfile)
writeFile(file: summaryfile, text: currentsummarycontents + summary)
summarystring += summary
}
def checkhierarchy(buildmeta, String maxdepth, String buildpathroot) {
int md = maxdepth.toInteger()
resetfolders()
preconditions()
// Walk the meta information to a max depth
def buildinfo = buildmeta.releasewalker(md)
echo "All components:"
def String componentinfo = ""
for (entry in buildinfo) {
def name = entry.metainfo.componentversionuniqueidentifier()
def offsetpath = entry.accumulatedpath
def abspath = "${buildpathroot}/${offsetpath}"
componentinfo += "Name: ${name} \t\t\t\tPath: ${offsetpath} \t\t\t\tFile exists in import: ${fileExists(abspath)}\n"
}
echo componentinfo
// Walk the meta information to a max depth
def componentReleaseInfo = buildmeta.releasewalkerunique(md)
echo "Unique components:"
def String versioncomponent = ""
for (key in componentReleaseInfo.keySet()) {
def buildinfo2 = componentReleaseInfo[key]
def offsetpath = buildinfo2.accumulatedpath
def abspath = "${buildpathroot}/${offsetpath}"
versioncomponent += "Key: ${key} \t\t\tPath: ${offsetpath} \t\t\tFile exists in import: ${fileExists(abspath)}\n"
}
echo versioncomponent
return [summarystring, markunstable, unstablereason]
}
return this;