tools/userland-fetch
changeset 800 2ad056ed89ec
parent 212 8a66c0c0e8dc
child 832 d0946a4ddb78
--- a/tools/userland-fetch	Wed Apr 25 10:26:28 2012 -0700
+++ b/tools/userland-fetch	Fri Apr 27 13:23:29 2012 -0700
@@ -19,7 +19,7 @@
 #
 # CDDL HEADER END
 #
-# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
 #
 #
 # fetch.py - a file download utility
@@ -45,6 +45,10 @@
 	
 def validate(file, hash):
 	algorithm, hashvalue = hash.split(':')
+
+	# force migration away from sha1
+	if algorithm == "sha1":
+		algorithm = "sha256"
 	try:
 		m = hashlib.new(algorithm)
 	except ValueError:
@@ -79,12 +83,15 @@
 
 	expr_bz = re.compile('.+\.bz2$', re.IGNORECASE)
 	expr_gz = re.compile('.+\.gz$', re.IGNORECASE)
+	expr_tgz = re.compile('.+\.tgz$', re.IGNORECASE)
 
 	try:
 		if expr_bz.match(filename):
 			file = bz2.BZ2File(filename, 'r')
 		elif expr_gz.match(filename):
 			file = gzip.GzipFile(filename, 'r')
+		elif expr_tgz.match(filename):
+			file = gzip.GzipFile(filename, 'r')
 		else:
 			return False
 	except IOError as e: