summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFathi Boudra <fabo@debian.org>2012-04-14 19:44:00 +0300
committerFathi Boudra <fabo@debian.org>2012-04-14 19:44:00 +0300
commit1a359c87a1cf2332603110b102ee503bd9981223 (patch)
tree78055b18344e72c538f8a22d4b744d8557e2bf66
parent9a29dc28229b2616790b370e9bf21af555ed9663 (diff)
downloadsnowball-binary-update-1a359c87a1cf2332603110b102ee503bd9981223.tar.gz
Initial snowball-binary-update script.
-rwxr-xr-xsnowball-binary-update.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/snowball-binary-update.py b/snowball-binary-update.py
new file mode 100755
index 0000000..8167756
--- /dev/null
+++ b/snowball-binary-update.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+
+import os
+import sys
+import subprocess
+import hashlib
+
+def main():
+ wget_cmd = os.environ.get("WGET_CMD")
+ if wget_cmd == None:
+ f = open('/var/run/linaro-binaries/snowball-binary-update')
+ wget_cmd = f.read().strip()
+ f.close()
+
+ timestamp = os.environ.get('TIMESTAMP', 'Undefined')
+ if timestamp == 'Undefined':
+ sys.exit('Timestamp is not defined.')
+
+ igloo_url = 'http://www.igloocommunity.org/download/android/ics/binaries/%s' % timestamp
+ md5sum_url = '%s/MD5SUM' % igloo_url
+ vendor_url = '%s/vendor.tar.bz2' % igloo_url
+
+ subprocess.call("%s %s %s" % (wget_cmd, md5sum_url, vendor_url), shell=True)
+
+ f = open('MD5SUM')
+ (md5, file) = f.read().strip().split(" ", 1)
+ f.close()
+
+ vendor_md5 = hashlib.md5(open('vendor.tar.bz2').read()).hexdigest()
+
+ if md5 == vendor_md5:
+ print 'vendor.tar.bz2: OK'
+ else:
+ print 'vendor.tar.bz2: FAILED'
+ sys.exit('checksum did NOT match.')
+
+if __name__ == "__main__":
+ main()