]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
Create all hash objects with hashlib's "new" function.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Jan 2013 01:41:26 +0000 (02:41 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 24 Jan 2013 01:41:26 +0000 (02:41 +0100)
python/pakfire/client/builder.py
python/pakfire/packages/file.py
python/pakfire/packages/packager.py
python/pakfire/server.py
python/pakfire/util.py

index 9798cc48e3e413d0ac2b929c59089306b5650e5c..9aefa1c4fd228d4dc9d2182655eac02358ffae7f 100644 (file)
@@ -408,7 +408,7 @@ class ClientBuilder(object):
 
                                # Check if the download checksum matches (if provided).
                                if self.build_source_hash512:
-                                       h = hashlib.sha512()
+                                       h = hashlib.new("sha512")
                                        f = open(tmpfile, "rb")
                                        while True:
                                                buf = f.read(BUFFER_SIZE)
index 55f9694505f63d1c1499d976258fc5455b96c7e2..990f6f7b341410e67f20816f199398b48f971424 100644 (file)
@@ -211,7 +211,7 @@ class FilePackage(base.Package):
                                                continue
 
                                        # Calc hash of the current configuration file.
-                                       config_hash1 = hashlib.sha512()
+                                       config_hash1 = hashlib.new("sha512")
                                        f = open(target)
                                        while True:
                                                buf = f.read(BUFFER_SIZE)
index a4566028e3ecd30f7260d8e2b8a31ab88be49331..c8e1c7814bccb9d9bbe3f3df1c18684687755f8a 100644 (file)
@@ -104,7 +104,7 @@ class Packager(object):
                        # Calculating the hash sum of the added file
                        # and store it in the chksums file.
                        f = open(filename)
-                       h = hashlib.sha512()
+                       h = hashlib.new("sha512")
                        while True:
                                buf = f.read(BUFFER_SIZE)
                                if not buf:
@@ -164,7 +164,7 @@ class Packager(object):
                        # Calculate SHA512 hash of regular files.
                        if m.isreg():
                                mobj = datafile.extractfile(m)
-                               h = hashlib.sha512()
+                               h = hashlib.new("sha512")
 
                                while True:
                                        buf = mobj.read(BUFFER_SIZE)
index 64e3dd5198b4a9bf222b8e44ecb2dbdfde85cc2c..edc070fd8cb44a68b4bb4aac8cb7a2a931967e9f 100644 (file)
@@ -82,7 +82,8 @@ class Source(object):
 
        @property
        def path(self):
-               h = hashlib.sha1(self.url)
+               h = hashlib.new("sha1")
+               h.update(self.url)
 
                # XXX path is to be changed
                return "/var/cache/pakfire/sources/%s" % h.hexdigest()
index 9fa011a279a710a493a64df7267da803fd2f6b03..84128cd9c7418e4afbadc39e969903a57f40cd23 100644 (file)
@@ -197,7 +197,7 @@ def format_speed(s):
        return "%sB/s" % format_size(s)
 
 def calc_hash1(filename=None, data=None):
-       h = hashlib.sha1()
+       h = hashlib.new("sha1")
 
        if filename:
                f = open(filename)