示例#1
0
 def __enter__(self):
     assert not self._joined, "cannot join environment twice"
     for directory in ['/dev', '/sys', '/proc']:
         execute_command('mount', '--bind', directory,
                         joinpaths(self.root, directory[1:]))
     execute_command('mount', '--bind', config.GLOBAL_PACMAN_CACHE,
                     joinpaths(self.root, 'var/cache/pacman'))
     self._joined = True
示例#2
0
 def __exit__(self, *exc_info):
     for directory in ['dev', 'sys', 'proc', 'var/cache/pacman']:
         execute_command('umount', joinpaths(self.root, directory))
     self._joined = False
示例#3
0
 def execute(self, *command):
     assert self._joined, "join first"
     execute_command('chroot', self.root, *command)
示例#4
0
 def execute(self, *args):
     execute_command(*self._get_command(*args))