X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=daklib%2Futils.py;h=f2a790414e1b5028534f06acd851c4823bedc907;hb=cef9cea84f51cacb08d6096abe770527eba6865d;hp=fbe3b1a025c55ecaaeb2d881c81a708987154a9e;hpb=7b274dc7e257ca19d101b2529fd898a446964d1f;p=dak.git diff --git a/daklib/utils.py b/daklib/utils.py old mode 100755 new mode 100644 index fbe3b1a0..f2a79041 --- a/daklib/utils.py +++ b/daklib/utils.py @@ -42,6 +42,7 @@ import re import email as modemail import subprocess import ldap +import errno import daklib.config as config import daklib.daksubprocess @@ -358,7 +359,7 @@ def check_size(where, files): try: entry = os.stat(f) except OSError as exc: - if exc.errno == 2: + if exc.errno == errno.ENOENT: # TODO: This happens when the file is in the pool. continue raise @@ -720,7 +721,7 @@ def move (src, dest, overwrite = 0, perms = 0o664): dest_dir = dest else: dest_dir = os.path.dirname(dest) - if not os.path.exists(dest_dir): + if not os.path.lexists(dest_dir): umask = os.umask(00000) os.makedirs(dest_dir, 0o2775) os.umask(umask) @@ -728,7 +729,7 @@ def move (src, dest, overwrite = 0, perms = 0o664): if os.path.exists(dest) and os.path.isdir(dest): dest += '/' + os.path.basename(src) # Don't overwrite unless forced to - if os.path.exists(dest): + if os.path.lexists(dest): if not overwrite: fubar("Can't move %s to %s - file already exists." % (src, dest)) else: @@ -751,7 +752,7 @@ def copy (src, dest, overwrite = 0, perms = 0o664): if os.path.exists(dest) and os.path.isdir(dest): dest += '/' + os.path.basename(src) # Don't overwrite unless forced to - if os.path.exists(dest): + if os.path.lexists(dest): if not overwrite: raise FileExistsError else: @@ -762,14 +763,6 @@ def copy (src, dest, overwrite = 0, perms = 0o664): ################################################################################ -def where_am_i (): - res = socket.getfqdn() - database_hostname = Cnf.get("Config::" + res + "::DatabaseHostname") - if database_hostname: - return database_hostname - else: - return res - def which_conf_file (): if os.getenv('DAK_CONFIG'): return os.getenv('DAK_CONFIG') @@ -789,14 +782,6 @@ def which_conf_file (): return default_config -def which_alias_file(): - hostname = socket.getfqdn() - aliasfn = '/var/lib/misc/'+hostname+'/forward-alias' - if os.path.exists(aliasfn): - return aliasfn - else: - return None - ################################################################################ def TemplateSubst(subst_map, filename): @@ -894,7 +879,7 @@ def changes_compare (a, b): def find_next_free (dest, too_many=100): extra = 0 orig_dest = dest - while os.path.exists(dest) and extra < too_many: + while os.path.lexists(dest) and extra < too_many: dest = orig_dest + '.' + repr(extra) extra += 1 if extra >= too_many: @@ -1850,9 +1835,10 @@ def check_reverse_depends(removals, suite, arches=None, session=None, cruft=Fals .filter(Override.package == re.sub('/(contrib|non-free)$', '', source)) \ .join(Override.overridetype).filter(OverrideType.overridetype == 'dsc') \ .first() + key = source if component != "main": - source = "%s/%s" % (source, component) - all_broken.setdefault(source, set()).add(pp_deps(dep)) + key = "%s/%s" % (source, component) + all_broken.setdefault(key, set()).add(pp_deps(dep)) dep_problem = 1 if all_broken: