summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
1fb2a3d)
depending on what kind of file we have we generate the checksums in
different ways. For the uncompressed sum we continue reading in all the
content and hand that as a variable to apt_pkg.*sum. Turns out this does
not work for the already compressed files, there we now go and just hand
the opened file_handle to apt_pkg.*sum.
def print_md5sha_files (tree, files, hashop):
path = Cnf["Dir::Root"] + tree + "/"
for name in files:
def print_md5sha_files (tree, files, hashop):
path = Cnf["Dir::Root"] + tree + "/"
for name in files:
+ hashvalue = ""
+ hashlen = 0
try:
if name[0] == "<":
j = name.index("/")
try:
if name[0] == "<":
j = name.index("/")
(cat, ext, name) = (name[1:j], name[j+1:k], name[k+1:])
file_handle = decompressors[ cat ]( "%s%s%s" % (path, name, ext) )
contents = file_handle.read()
(cat, ext, name) = (name[1:j], name[j+1:k], name[k+1:])
file_handle = decompressors[ cat ]( "%s%s%s" % (path, name, ext) )
contents = file_handle.read()
+ hashvalue = hashop(contents)
+ hashlen = len(contents)
else:
try:
file_handle = utils.open_file(path + name)
else:
try:
file_handle = utils.open_file(path + name)
- contents = file_handle.read()
+ hashvalue = hashop(file_handle)
+ hashlen = os.stat(path + name).st_size
except CantOpenError:
print "ALERT: Couldn't open " + path + name
else:
except CantOpenError:
print "ALERT: Couldn't open " + path + name
else:
- hash = hashop(contents)
- out.write(" %s %8d %s\n" % (hash, len(contents), name))
+ out.write(" %s %8d %s\n" % (hashvalue, hashlen, name))
def print_md5_files (tree, files):
print_md5sha_files (tree, files, apt_pkg.md5sum)
def print_md5_files (tree, files):
print_md5sha_files (tree, files, apt_pkg.md5sum)