Denis Bilenko avatar Denis Bilenko committed be9cfbd

fetch_libevent.py: update link to libevent tarball.

better error reporting in case of digest mismatch

Comments (0)

Files changed (1)

fetch_libevent.py

 """download and extract the libevent source archive
 """
 
+url = 'http://github.com/downloads/libevent/libevent/libevent-1.4.14b-stable.tar.gz'
+hash = 'a00e037e4d3f9e4fe9893e8a2d27918c'
+
 import sys
 import os
 import urllib
         dirname = os.path.join(tmpdir, url.split("/")[-1][:-len(".tar.gz")])
         print "downloading libevent source from %s" % url
         tgz = urllib.urlopen(url).read()
-        if md5(tgz).hexdigest() != digest:
-            sys.exit("Error: wrong md5 sum")
+        tgz_digest = md5(tgz).hexdigest()
+        if tgz_digest != digest:
+            sys.exit("Error: wrong md5 sum: %r != %r" % (tgz_digest, digest))
 
         print "extracting to %s" % dst
         tf = tarfile.open("libevent-src.tar.gz",
     finally:
         shutil.rmtree(tmpdir)
 
+
+def main():
+    os.chdir(os.path.dirname(os.path.abspath(__file__)))
+    download_and_extract(url, hash)
+
+
 if __name__ == '__main__':
-    os.chdir(os.path.dirname(os.path.abspath(__file__)))
-    download_and_extract(
-        "http://monkey.org/~provos/libevent-1.4.14b-stable.tar.gz",
-        "a00e037e4d3f9e4fe9893e8a2d27918c")
+    main()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.