summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorTeemu Suo-Anttila <teemusa@vaadin.com>2015-06-10 19:04:58 +0300
committerTeemu Suo-Anttila <teemusa@vaadin.com>2015-06-11 16:02:48 +0300
commit60f76f01c6961f6aceb3b67643057798aed056c7 (patch)
tree177b62dc80f02b770dcb4823caaa7a043d105c31 /scripts
parente4d7e2d500d9bb966279a6b986f65316d6b5e3d4 (diff)
downloadvaadin-framework-60f76f01c6961f6aceb3b67643057798aed056c7.tar.gz
vaadin-framework-60f76f01c6961f6aceb3b67643057798aed056c7.zip
Add python script for validating version files on vaadin.com
Change-Id: Idcdacb7559ed9f05019dbced97b74fd7ae4bd11d
Diffstat (limited to 'scripts')
-rw-r--r--scripts/ValidateVaadinDownload.py66
1 files changed, 66 insertions, 0 deletions
diff --git a/scripts/ValidateVaadinDownload.py b/scripts/ValidateVaadinDownload.py
new file mode 100644
index 0000000000..78d9b99daa
--- /dev/null
+++ b/scripts/ValidateVaadinDownload.py
@@ -0,0 +1,66 @@
+#coding=UTF-8
+
+import argparse, sys
+from urllib.request import urlopen
+
+parse = argparse.ArgumentParser(description="Check vaadin.com version lists")
+parse.add_argument("version", help="Released Vaadin version number")
+
+args = parse.parse_args()
+if hasattr(args, "echo"):
+ print(args.echo)
+ sys.exit(1)
+
+prerelease = None
+(major, minor, maintenance) = args.version.split(".", 2)
+
+if "." in maintenance:
+ (maintenance, prerelease) = maintenance.split(".", 1)
+
+# Version without prerelease tag
+version = "%s.%s.%s" % (major, minor, maintenance)
+isPrerelease = prerelease is not None
+
+failed = False
+
+vaadin7Latest = "http://vaadin.com/download/LATEST7"
+vaadin7Versions = "http://vaadin.com/download/VERSIONS_7"
+vaadin6Latest = "http://vaadin.com/download/LATEST"
+vaadinPrerelease = "http://vaadin.com/download/PRERELEASES"
+
+try:
+ latest = urlopen(vaadin7Latest).read().decode().split("\n")
+ releaseRow = "release/%s.%s/%s" % (major, minor, version)
+
+ assert (version in latest[0]) ^ isPrerelease, "Latest version mismatch. %s: %s, was: %s" % ("should not be" if isPrerelease else "should be", args.version, latest[0])
+ assert (releaseRow in latest[1]) ^ isPrerelease, "Release row mismatch; %s: %s, was %s" % ("should not be" if isPrerelease else "should be", releaseRow, latest[1])
+except Exception as e:
+ failed = True
+ print("Latest version was not correctly updated: %s" % (e))
+
+try:
+ assert "%s," % (args.version) in urlopen(vaadin7Versions).read().decode().split("\n"), "Released version not in version list"
+except Exception as e:
+ if isPrerelease:
+ print("Prerelease version needs to be added manually to versions!")
+ else:
+ failed = True
+ print(e)
+
+try:
+ latest = urlopen(vaadin6Latest).read().decode().split("\n")
+ releaseRow = "release/6.8/6.8."
+
+ assert ("6.8." in latest[0]), "Latest version mismatch; should be: %sX, was: %s" % ("6.8.", latest[0])
+ assert (releaseRow in latest[1]), "Release row mismatch; should be: %sX, was %s" % (releaseRow, latest[1])
+except Exception as e:
+ failed = True
+ print("Latest Vaadin 6 version was updated by release. %s" % (e))
+
+try:
+ latest = urlopen(vaadinPrerelease).read().decode().split("\n")
+ assert (args.version in latest[0]) or not isPrerelease, "%s: %s, was: %s" % ("should be", args.version, latest[0])
+except Exception as e:
+ print("Prerelease file was not correctly updated: %s" % (e))
+
+sys.exit(1 if failed else 0)