def emit_checksum(out, relpath, abspath): if os.path.islink(abspath) or not os.path.isfile(abspath): # Do not checksum symlinks, if they are not dangling / external we # will checksum their target anyhow. Do not check special files # either; they shouldn't be there per policy, but they might be # (and they are in old releases) return sha256 = hashutil.sha256sum(abspath) out.write('%s %s\n' % (sha256, relpath))
def emit_checksum(out, relpath, abspath): if abspath.is_symlink() or not abspath.is_file(): # Do not checksum symlinks, if they are not dangling / external we # will checksum their target anyhow. Do not check special files # either; they shouldn't be there per policy, but they might be # (and they are in old releases) return sha256 = hashutil.sha256sum(bytes(abspath)) out.write(sha256.encode("ascii") + b" " + bytes(relpath) + b"\n")
def emit_checksum(out, relpath, abspath): if os.path.islink(abspath) or not os.path.isfile(abspath): # Do not checksum symlinks, if they are not dangling / external we # will checksum their target anyhow. Do not check special files # either; they shouldn't be there per policy, but they might be # (and they are in old releases) return sha256 = hashutil.sha256sum(abspath) out.write("%s %s\n" % (sha256, relpath))
def assertSha256Sum(self): self.assertEqual( sha256sum(make_path('main/libc/libcaca/0.99.beta18-1/COPYING')), 'd10f0447c835a590ef137d99dd0e3ed29b5e032e7434a87315b30402bf14e7fd')
def assertSha256Sum(self): path = Path("main") / "libc" / "libcaca" / "0.99.beta18-1" / "COPYING" self.assertEqual( sha256sum(make_path(path)), "d10f0447c835a590ef137d99dd0e3ed29b5e032e7434a87315b30402bf14e7fd", )