Exemple #1
0
 def check_file(self, file_path, relpath, md5sums, associated_task=None):
     log.debug("  checking %s" % file_path)
     if associated_task:
         associated_task.description = _("Checking %s") % file_path
     relpath = relpath.replace("\\", "/")
     md5line = find_line_in_file(md5sums, "./%s" % relpath, endswith=True)
     if not md5line:
         raise Exception("Cannot find md5 in %s for %s" % (md5sums, relpath))
     reference_md5 = md5line.split()[0]
     md5  = get_file_md5(file_path, associated_task)
     log.debug("  %s md5 = %s %s %s" % (file_path, md5, md5 == reference_md5 and "==" or "!=", reference_md5))
     return md5 == reference_md5
Exemple #2
0
 def check_file(self, file_path, relpath, md5sums, associated_task=None):
     log.debug("  checking %s" % file_path)
     if associated_task:
         associated_task.description = _("Checking %s") % file_path
     relpath = relpath.replace("\\", "/")
     md5line = find_line_in_file(md5sums, "./%s" % relpath, endswith=True)
     if not md5line:
         raise Exception("Cannot find md5 in %s for %s" % (md5sums, relpath))
     reference_md5 = md5line.split()[0]
     md5  = get_file_md5(file_path, associated_task)
     log.debug("  %s md5 = %s %s %s" % (file_path, md5, md5 == reference_md5 and "==" or "!=", reference_md5))
     return md5 == reference_md5
Exemple #3
0
 def check_file(self, file_path, relpath, md5sums, associated_task=None):
     log.debug("  checking %s" % file_path)
     if associated_task:
         associated_task.description = _("Checking %s") % file_path
     relpath = relpath.replace("\\", "/")
     md5line = find_line_in_file(md5sums, "./%s" % relpath, endswith=True)
     if not md5line:
         raise Exception("Cannot find md5 in %s for %s" % (md5sums, relpath))
     reference_hash = md5line.split()[0]
     hash_len = len(reference_hash)*4
     if hash_len == 160:
         hash_name = 'sha1'
     elif hash_len in [224, 256, 384, 512]:
         hash_name = 'sha' + str(hash_len)
     else:
         hash_name = 'md5'
     hash_file = get_file_hash(file_path, hash_name, associated_task)
     log.debug("  %s %s = %s %s %s" % (file_path, hash_name, hash_file, hash_file == reference_hash and "==" or "!=", reference_hash))
     return hash_file == reference_hash
Exemple #4
0
 def check_file(self, file_path, relpath, md5sums, associated_task=None):
     log.debug("  checking %s" % file_path)
     if associated_task:
         associated_task.description = _("Checking %s") % file_path
     relpath = relpath.replace("\\", "/")
     md5line = find_line_in_file(md5sums, "./%s" % relpath, endswith=True)
     if not md5line:
         raise Exception("Cannot find md5 in %s for %s" % (md5sums, relpath))
     reference_hash = md5line.split()[0]
     hash_len = len(reference_hash)*4
     if hash_len == 160:
         hash_name = 'sha1'
     elif hash_len in [224, 256, 384, 512]:
         hash_name = 'sha' + str(hash_len)
     else:
         hash_name = 'md5'
     hash_file = get_file_hash(file_path, hash_name, associated_task)
     log.debug("  %s %s = %s %s %s" % (file_path, hash_name, hash_file, hash_file == reference_hash and "==" or "!=", reference_hash))
     return hash_file == reference_hash