From: Michael Tremer Date: Sun, 18 Mar 2012 17:03:57 +0000 (+0100) Subject: Fix issues with packaging/removing dead symlinks. X-Git-Tag: 0.9.21~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=e70f166b397214d704740bef191a213250c7aaec;p=pakfire.git Fix issues with packaging/removing dead symlinks. It was checked if files did exists which does not work for symlinks where the destination file was already removed. --- diff --git a/python/pakfire/packages/base.py b/python/pakfire/packages/base.py index 062bfaefb..6f54fdb5b 100644 --- a/python/pakfire/packages/base.py +++ b/python/pakfire/packages/base.py @@ -509,10 +509,6 @@ class Package(object): else: file = _file.name - # If the file was removed by the user, we can skip it. - if not os.path.exists(file): - continue - # Rename configuration files. if _file.is_config(): file_save = "%s%s" % (file, CONFIG_FILE_SUFFIX_SAVE) diff --git a/python/pakfire/packages/packager.py b/python/pakfire/packages/packager.py index 8cc873fa6..386a5ddf3 100644 --- a/python/pakfire/packages/packager.py +++ b/python/pakfire/packages/packager.py @@ -305,7 +305,10 @@ class BinaryPackager(Packager): _patterns = [pattern,] for pattern in _patterns: - if not os.path.exists(pattern): + # Try to stat the pattern. If that is not successful, we cannot go on. + try: + os.lstat(pattern) + except OSError: continue # Add directories recursively but skip those symlinks