[Notes] [Git][BuildStream/buildstream][jmac/make_writable_combination] element.py: Use _force_rmtree instead of custom code.



Title: GitLab

Jim MacArthur pushed to branch jmac/make_writable_combination at BuildStream / buildstream

Commits:

1 changed file:

Changes:

  • buildstream/element.py
    ... ... @@ -86,7 +86,7 @@ from . import _yaml
    86 86
     from ._variables import Variables
    
    87 87
     from ._versions import BST_CORE_ARTIFACT_VERSION
    
    88 88
     from ._exceptions import BstError, LoadError, LoadErrorReason, ImplError, ErrorDomain
    
    89
    -from .utils import UtilError
    
    89
    +from .utils import UtilError, _force_rmtree
    
    90 90
     from . import Plugin, Consistency, Scope
    
    91 91
     from . import SandboxFlags
    
    92 92
     from . import utils
    
    ... ... @@ -1411,16 +1411,9 @@ class Element(Plugin):
    1411 1411
     
    
    1412 1412
                 finally:
    
    1413 1413
                     # Staging may produce directories with less than 'rwx' permissions
    
    1414
    -                # for the owner, which will break tempfile, so we need to use chmod
    
    1415
    -                # occasionally.
    
    1416
    -                def make_dir_writable(fn, path, excinfo):
    
    1417
    -                    os.chmod(os.path.dirname(path), 0o777)
    
    1418
    -                    if os.path.isdir(path):
    
    1419
    -                        os.rmdir(path)
    
    1420
    -                    else:
    
    1421
    -                        os.remove(path)
    
    1422
    -                shutil.rmtree(temp_staging_directory, onerror=make_dir_writable)
    
    1423
    -
    
    1414
    +                # for the owner, which breaks tempfile. _force_rmtree will deal
    
    1415
    +                # with these.
    
    1416
    +                _force_rmtree(temp_staging_directory)
    
    1424 1417
             # Ensure deterministic mtime of sources at build time
    
    1425 1418
             vdirectory.set_deterministic_mtime()
    
    1426 1419
             # Ensure deterministic owners of sources at build time
    



  • [Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]