gitian-updater - remove dep on sha256sum binary

This commit is contained in:
devrandom 2011-10-10 20:21:00 -07:00
parent 46a10a675c
commit 5a2986fd17
2 changed files with 14 additions and 2 deletions

View File

@ -31,6 +31,8 @@ def info(str)
end
def build_one_configuration(suite, arch, build_desc, reference_datetime)
FileUtils.rm_f("var/build.log")
bits = @bitness[arch] or raise "unknown architecture ${arch}"
suitearch = "#{suite}-#{arch}"

View File

@ -26,6 +26,7 @@ import urllib2
import libxml2
import argparse
import yaml
from hashlib import sha256
from zipfile import ZipFile
from distutils.version import LooseVersion
@ -35,6 +36,16 @@ have_injected_config = injected_config != inject_config_string
quiet = 0
def sha256sum(path):
h = sha256()
f = open(path)
while True:
buf = f.read(10240)
if buf == "":
break
h.update(buf)
return h.hexdigest()
def sanitize_path(dir_name, name, where):
if re.search(r'[^/\w.-]', name):
raise ValueError, "unsanitary path in %s"%(where)
@ -94,8 +105,7 @@ def get_assertions(temp_dir, unpack_dir, file_names):
release = None
to_check = {}
for file_name in file_names:
shasum = subprocess.Popen(["sha256sum", '-b', os.path.join(unpack_dir, file_name)], stdout=subprocess.PIPE).communicate()[0][0:64]
sums[file_name] = shasum
sums[file_name] = sha256sum(os.path.join(unpack_dir, file_name))
to_check[file_name] = 1
out_manifest = False