Make all walkers use a walker that understand v0.1 and v0.2 formats
This commit is contained in:
parent
c985dcb552
commit
9b27520212
1 changed files with 54 additions and 83 deletions
|
|
@ -893,31 +893,6 @@ class MetaInfo extends GISJsonSerialised {
|
|||
saveJsonSerialised(metafilepath)
|
||||
return artifactlist
|
||||
}
|
||||
|
||||
// Recurse tree of meta looking for release info and accumulate path - Pass by reference unavailable in Groovy/Java
|
||||
private ArrayList<RelatedMetaInfo> releasewalkerp(int maxdepth, ArrayList<RelatedMetaInfo> releasemetacollection, String pathsofar) {
|
||||
if (maxdepth > 0) {
|
||||
if (releaseinfo.releaserepoURL) {
|
||||
RelatedMetaInfo rmi = new RelatedMetaInfo_v0_1(script, pathsofar, this)
|
||||
releasemetacollection.add(rmi)
|
||||
}
|
||||
if (pathsofar) {
|
||||
pathsofar += "/"
|
||||
}
|
||||
for (relatedmetainfo in associatedmeta) {
|
||||
MetaInfo othermeta = relatedmetainfo.meta
|
||||
String newpathsofar = pathsofar + relatedmetainfo.offsetpath
|
||||
releasemetacollection = othermeta.releasewalkerp(maxdepth - 1, releasemetacollection, newpathsofar)
|
||||
}
|
||||
}
|
||||
return releasemetacollection
|
||||
}
|
||||
|
||||
ArrayList<RelatedMetaInfo> releasewalker(int maxdepth, String startpath = "") {
|
||||
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
||||
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
||||
return releasemetacollection
|
||||
}
|
||||
|
||||
String componentidentifier() {
|
||||
return productinfo.productname + "_" + productinfo.subcomponentname
|
||||
|
|
@ -939,44 +914,6 @@ class MetaInfo extends GISJsonSerialised {
|
|||
return buildstampinfo.buildstamp + "-" + jenkinsbuildinfo.buildnumber
|
||||
}
|
||||
|
||||
Map<String, RelatedMetaInfo> putwithshortestoffsetpath(Map<String, RelatedMetaInfo> releasemetacollection, String uniquestring, RelatedMetaInfo relatedmetainfo) {
|
||||
if (releasemetacollection.containsKey(uniquestring)) {
|
||||
def existingentry = releasemetacollection[uniquestring]
|
||||
if (existingentry.offsetpath.size() > relatedmetainfo.offsetpath.size()) {
|
||||
releasemetacollection.put(uniquestring, relatedmetainfo)
|
||||
}
|
||||
} else {
|
||||
releasemetacollection.put(uniquestring, relatedmetainfo)
|
||||
}
|
||||
return releasemetacollection
|
||||
}
|
||||
|
||||
Map<String, RelatedMetaInfo> releasewalkerunique(int maxdepth, String startpath = "") {
|
||||
def ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
||||
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
||||
|
||||
def Map<String, RelatedMetaInfo> releasemetauniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
|
||||
for (relatedmetainfo in releasemetacollection) {
|
||||
def String uniquestring = relatedmetainfo.meta.componentidentifier()
|
||||
releasemetauniquecollection = putwithshortestoffsetpath(releasemetauniquecollection, uniquestring, relatedmetainfo)
|
||||
}
|
||||
|
||||
return releasemetauniquecollection
|
||||
}
|
||||
|
||||
Map<String, RelatedMetaInfo> releasewalkerversionunique(int maxdepth, String startpath = "") {
|
||||
ArrayList<RelatedMetaInfo> releasemetacollection = new ArrayList<RelatedMetaInfo>()
|
||||
releasemetacollection = releasewalkerp(maxdepth, releasemetacollection, startpath)
|
||||
|
||||
def Map<String, RelatedMetaInfo> releasemetaversionuniquecollection = new LinkedHashMap<String, RelatedMetaInfo>()
|
||||
for (relatedmetainfo in releasemetacollection) {
|
||||
def String uniquestring = relatedmetainfo.meta.componentversionuniqueidentifier()
|
||||
releasemetaversionuniquecollection = putwithshortestoffsetpath(releasemetaversionuniquecollection, uniquestring, relatedmetainfo)
|
||||
}
|
||||
|
||||
return releasemetaversionuniquecollection
|
||||
}
|
||||
|
||||
def openchildmeta(String gatheredpath, RelatedMetaInfo relatedmetainfo) {
|
||||
def MetaInfo mi = new MetaInfo(script)
|
||||
|
||||
|
|
@ -1004,40 +941,44 @@ class MetaInfo extends GISJsonSerialised {
|
|||
return childmetainfo
|
||||
}
|
||||
|
||||
def walkrelated_v0_1(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0) {
|
||||
def walkrelated_v0_1(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0, boolean limiteddepth = false, int maxdepth = 0) {
|
||||
def results = [
|
||||
'metacollection' : metacollection,
|
||||
'comment': comment
|
||||
]
|
||||
results.metacollection.add(this)
|
||||
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
|
||||
for (relatedmetainfo in associatedmeta) {
|
||||
if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
|
||||
def MetaInfo othermeta = relatedmetainfo.meta
|
||||
results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1)
|
||||
} else {
|
||||
script.error("There is non v0.1 format related meta info under v0.1 related meta info")
|
||||
if (!limiteddepth || maxdepth > 0) {
|
||||
results.metacollection.add(this)
|
||||
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
|
||||
for (relatedmetainfo in associatedmeta) {
|
||||
if (!relatedmetainfo.format || relatedmetainfo.format == '0.1') {
|
||||
def MetaInfo othermeta = relatedmetainfo.meta
|
||||
results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, limiteddepth, maxdepth - 1)
|
||||
} else {
|
||||
script.error("There is non v0.1 format related meta info under v0.1 related meta info")
|
||||
}
|
||||
}
|
||||
}
|
||||
return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
|
||||
}
|
||||
|
||||
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0, String gatheredpath = '') {
|
||||
def walkrelated(ArrayList<MetaInfo> metacollection, String comment = '', int level = 0, String gatheredpath = '', boolean limiteddepth = false, int maxdepth = 0) {
|
||||
def results = [
|
||||
'metacollection' : metacollection,
|
||||
'comment': comment
|
||||
]
|
||||
results.metacollection.add(this)
|
||||
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
|
||||
for (relatedmetainfo in associatedmeta) {
|
||||
if (relatedmetainfo.format == '0.2') {
|
||||
def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo)
|
||||
if (childmetainfo.imported) {
|
||||
results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath)
|
||||
if (!limiteddepth || maxdepth > 0) {
|
||||
results.metacollection.add(this)
|
||||
results.comment += "${level} ".padRight(level * 4) + globalreleasetag() + '\n'
|
||||
for (relatedmetainfo in associatedmeta) {
|
||||
if (relatedmetainfo.format == '0.2') {
|
||||
def childmetainfo = openchildmeta(gatheredpath, relatedmetainfo)
|
||||
if (childmetainfo.imported) {
|
||||
results = childmetainfo.childmeta.walkrelated(results.metacollection, results.comment, level + 1, childmetainfo.nextpath, limiteddepth, maxdepth - 1)
|
||||
}
|
||||
} else if (relatedmetainfo.format == '0.1') {
|
||||
def MetaInfo othermeta = relatedmetainfo.meta
|
||||
results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1, limiteddepth, maxdepth - 1)
|
||||
}
|
||||
} else if (relatedmetainfo.format == '0.1') {
|
||||
def MetaInfo othermeta = relatedmetainfo.meta
|
||||
results = othermeta.walkrelated_v0_1(results.metacollection, results.comment, level + 1)
|
||||
}
|
||||
}
|
||||
return [ 'metacollection' : results.metacollection, 'comment': results.comment ]
|
||||
|
|
@ -1048,6 +989,36 @@ class MetaInfo extends GISJsonSerialised {
|
|||
return walkrelated(metacollection)
|
||||
}
|
||||
|
||||
ArrayList<MetaInfo> releasewalker(int maxdepth, String startpath = '') {
|
||||
def ArrayList<MetaInfo> metacollection = new ArrayList<MetaInfo>()
|
||||
def results = walkrelated(metacollection, '', 0, startpath, true, maxdepth)
|
||||
return results.metacollection
|
||||
}
|
||||
|
||||
Map<String, MetaInfo> releasewalkerversionunique(int maxdepth, String startpath = '') {
|
||||
def ArrayList<MetaInfo> metacollection = releasewalker(maxdepth, startpath)
|
||||
|
||||
def Map<String, MetaInfo> versionuniquecollection = new LinkedHashMap<String, MetaInfo>()
|
||||
for (metainfo in metacollection) {
|
||||
def String uniquestring = metainfo.componentversionuniqueidentifier()
|
||||
versionuniquecollection.put(uniquestring, metainfo)
|
||||
}
|
||||
|
||||
return versionuniquecollection
|
||||
}
|
||||
|
||||
Map<String, MetaInfo> releasewalkerunique(int maxdepth, String startpath = '') {
|
||||
def ArrayList<MetaInfo> metacollection = releasewalker(maxdepth, startpath)
|
||||
|
||||
def Map<String, MetaInfo> uniquecollection = new LinkedHashMap<String, MetaInfo>()
|
||||
for (metainfo in metacollection) {
|
||||
def String uniquestring = metainfo.componentidentifier()
|
||||
uniquecollection.put(uniquestring, metainfo)
|
||||
}
|
||||
|
||||
return uniquecollection
|
||||
}
|
||||
|
||||
MetaInfo getNewMetaObject(script) {
|
||||
return new MetaInfo(script)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue