MCPcopy Create free account
hub / github.com/apache/solr / checkDOAPfiles

Function checkDOAPfiles

dev-tools/scripts/buildAndPushRelease.py:161–196  ·  view source on GitHub ↗
(version)

Source from the content-addressed store, hash-verified

159reVersion2 = re.compile(r'-(\d+)\.(\d+)\.(\d+)(-alpha|-beta)?\.zip<', re.IGNORECASE)
160reDoapRevision = re.compile(r'(\d+)\.(\d+)(?:\.(\d+))?(-alpha|-beta)?', re.IGNORECASE)
161def checkDOAPfiles(version):
162 # In Solr DOAP file, verify presence of all releases less than the one being produced.
163 errorMessages = []
164 distpage_lucene_solr = load('https://archive.apache.org/dist/lucene/solr')
165 distpage_solr = load('https://archive.apache.org/dist/solr')
166 releases = set()
167 for regex in reVersion1, reVersion2:
168 for tup in regex.findall(distpage_lucene_solr):
169 if tup[0] in ('1', '2'): # Ignore 1.X and 2.X releases
170 continue
171 releases.add(normalizeVersion(tup))
172 for tup in regex.findall(distpage_solr):
173 if tup[0] in ('1', '2'): # Ignore 1.X and 2.X releases
174 continue
175 releases.add(normalizeVersion(tup))
176 doapNS = '{http://usefulinc.com/ns/doap#}'
177 xpathRevision = '{0}Project/{0}release/{0}Version/{0}revision'.format(doapNS)
178 doapFile = "dev-tools/doap/solr.rdf"
179 treeRoot = ET.parse(doapFile).getroot()
180 doapRevisions = set()
181 for revision in treeRoot.findall(xpathRevision):
182 match = reDoapRevision.match(revision.text)
183 if (match is not None):
184 if (match.group(1) not in ('0', '1', '2')): # Ignore 0.X, 1.X and 2.X revisions
185 doapRevisions.add(normalizeVersion(match.groups()))
186 else:
187 errorMessages.append('ERROR: Failed to parse revision: %s in %s' % (revision.text, doapFile))
188 missingDoapRevisions = set()
189 for release in releases:
190 if release not in doapRevisions and release < version: # Ignore releases greater than the one being produced
191 missingDoapRevisions.add(release)
192 if len(missingDoapRevisions) > 0:
193 errorMessages.append('ERROR: Missing revision(s) in %s: %s' % (doapFile, ', '.join(sorted(missingDoapRevisions))))
194 if (len(errorMessages) > 0):
195 raise RuntimeError('\n%s\n(Hint: copy/paste from the stable branch version of the file(s).)'
196 % '\n'.join(errorMessages))
197
198def normalizeVersion(tup):
199 suffix = ''

Callers 1

prepareFunction · 0.85

Calls 9

normalizeVersionFunction · 0.85
loadFunction · 0.70
addMethod · 0.65
appendMethod · 0.65
setFunction · 0.50
formatMethod · 0.45
parseMethod · 0.45
matchMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…