]> git.ipfire.org Git - pakfire.git/commitdiff
Fix issues with packaging/removing dead symlinks.
authorMichael Tremer <michael.tremer@ipfire.org>
Sun, 18 Mar 2012 17:03:57 +0000 (18:03 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Sun, 18 Mar 2012 17:03:57 +0000 (18:03 +0100)
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
python/pakfire/packages/packager.py

index 062bfaefb3a6b44b05ab52736fae8f351905515d..6f54fdb5b6a2046ce61677cf00db66211da68e9e 100644 (file)
@@ -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)
index 8cc873fa654be8b88e134957e8669329df8b1bf7..386a5ddf35108a6b13f82203048b222acf4fe569 100644 (file)
@@ -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