X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=651e13ae7b6ac507ef468bda804df4f047a0b51c;hb=425e44739cd77ffa01294f23e94ae7eabd5f5ec8;hp=c6300539791d6c3811c6bad0a0431244cc67fe9b;hpb=dab0414eff3741bbdf9f9e294292f20fb2a4d129;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py index c6300539..651e13ae 100755 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -37,7 +37,6 @@ import stat import apt_pkg import database import time -import tarfile import re import string import email as modemail @@ -261,6 +260,7 @@ def create_hash(where, files, hashname, hashfunc): file_handle = open_file(f) except CantOpenError: rejmsg.append("Could not open file %s for checksumming" % (f)) + continue files[f][hash_key(hashname)] = hashfunc(file_handle) @@ -1485,6 +1485,20 @@ def temp_filename(directory=None, prefix="dak", suffix=""): ################################################################################ +def temp_dirname(parent=None, prefix="dak", suffix=""): + """ + Return a secure and unique directory by pre-creating it. + If 'parent' is non-null, it will be the directory the directory is pre-created in. + If 'prefix' is non-null, the filename will be prefixed with it, default is dak. + If 'suffix' is non-null, the filename will end with it. + + Returns a pathname to the new directory + """ + + return tempfile.mkdtemp(suffix, prefix, parent) + +################################################################################ + def is_email_alias(email): """ checks if the user part of the email is listed in the alias file """ global alias_cache