From e70f166b397214d704740bef191a213250c7aaec Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Sun, 18 Mar 2012 18:03:57 +0100 Subject: [PATCH] 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. --- python/pakfire/packages/base.py | 4 ---- python/pakfire/packages/packager.py | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) 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 -- 2.39.5