(version)
| 159 | reVersion2 = re.compile(r'-(\d+)\.(\d+)\.(\d+)(-alpha|-beta)?\.zip<', re.IGNORECASE) |
| 160 | reDoapRevision = re.compile(r'(\d+)\.(\d+)(?:\.(\d+))?(-alpha|-beta)?', re.IGNORECASE) |
| 161 | def 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 | |
| 198 | def normalizeVersion(tup): |
| 199 | suffix = '' |
no test coverage detected
searching dependent graphs…