forked from Azure/azure-sdk-for-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
validate_version_dates.py
31 lines (23 loc) · 1.03 KB
/
validate_version_dates.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import re
from util import get_xml_root
def main():
root = get_xml_root('./pom.xml')
dependencies = root.findall("dependencies/dependency[groupId='com.azure']")
reference_date = ''
for dependency in dependencies:
version = dependency.find('version').text
artifact_id = dependency.find('artifactId').text
print(f'Inspecting {artifact_id}@{version}')
# Match the dev.yyyymmdd expression
match = re.search("dev\.(\d{8})", version)
# There is no matching date portion, skip this entry in the loop (used
# for packages that are not released to the dev feed)
if not match or not match.group(1):
continue
if not reference_date:
reference_date = match.group(1)
print(f'Found reference_date: {reference_date}')
continue
if match.group(1) != reference_date:
raise ValueError(f'Dependency version dev date mismatch for {artifact_id} (expected: {reference_date}, actual: {match.group(1)} )')
main()