]> git.ipfire.org Git - pakfire.git/commitdiff
util: Drop rm function
authorMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 May 2022 10:22:58 +0000 (10:22 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Fri, 27 May 2022 10:22:58 +0000 (10:22 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/pakfire/util.py

index 74d257ac3e656331c6b2e580b363712337ca0090..7a2c9b65aaa5c9bf44e8f7780c39189907eb5ccc 100644 (file)
@@ -19,9 +19,7 @@
 #                                                                             #
 ###############################################################################
 
-import os
 import platform
-import shutil
 
 def get_distro_name():
        """
@@ -53,26 +51,3 @@ def _read_os_release():
                        pass
 
                raise OSError("Could not find os-release")
-
-def rm(path, *args, **kargs):
-       """
-               version of shutil.rmtree that ignores no-such-file-or-directory errors,
-               and tries harder if it finds immutable files
-       """
-       tryAgain = 1
-       failedFilename = None
-       while tryAgain:
-               tryAgain = 0
-               try:
-                       shutil.rmtree(path, *args, **kargs)
-               except OSError as e:
-                       if e.errno == 2: # no such file or directory
-                               pass
-                       elif e.errno==1 or e.errno==13:
-                               tryAgain = 1
-                               if failedFilename == e.filename:
-                                       raise
-                               failedFilename = e.filename
-                               os.system("chattr -R -i %s" % path)
-                       else:
-                               raise