OLD | NEW |
1 # Copyright 1998-2011 Gentoo Foundation | 1 # Copyright 1998-2011 Gentoo Foundation |
2 # Distributed under the terms of the GNU General Public License v2 | 2 # Distributed under the terms of the GNU General Public License v2 |
3 | 3 |
4 __all__ = [ | 4 __all__ = [ |
5 "vardbapi", "vartree", "dblink"] + \ | 5 "vardbapi", "vartree", "dblink"] + \ |
6 ["write_contents", "tar_contents"] | 6 ["write_contents", "tar_contents"] |
7 | 7 |
8 import portage | 8 import portage |
9 portage.proxy.lazyimport.lazyimport(globals(), | 9 portage.proxy.lazyimport.lazyimport(globals(), |
10 'portage.checksum:_perform_md5_merge@perform_md5', | 10 'portage.checksum:_perform_md5_merge@perform_md5', |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1288 return self._get_protect_obj().isprotected(obj) | 1288 return self._get_protect_obj().isprotected(obj) |
1289 | 1289 |
1290 def updateprotect(self): | 1290 def updateprotect(self): |
1291 self._get_protect_obj().updateprotect() | 1291 self._get_protect_obj().updateprotect() |
1292 | 1292 |
1293 def lockdb(self): | 1293 def lockdb(self): |
1294 if self._lock_vdb: | 1294 if self._lock_vdb: |
1295 raise AssertionError("Lock already held.") | 1295 raise AssertionError("Lock already held.") |
1296 # At least the parent needs to exist for the lock file. | 1296 # At least the parent needs to exist for the lock file. |
1297 ensure_dirs(self.dbroot) | 1297 ensure_dirs(self.dbroot) |
1298 » » if self._scheduler is None: | 1298 » » if os.environ.get("PORTAGE_LOCKS") != "false": |
1299 » » » self._lock_vdb = lockdir(self.dbroot) | 1299 » » » if self._scheduler is None: |
1300 » » else: | 1300 » » » » self._lock_vdb = lockdir(self.dbroot) |
1301 » » » async_lock = AsynchronousLock(path=self.dbroot, | 1301 » » » else: |
1302 » » » » scheduler=self._scheduler) | 1302 » » » » async_lock = AsynchronousLock(path=self.dbroot, |
1303 » » » async_lock.start() | 1303 » » » » » scheduler=self._scheduler) |
1304 » » » async_lock.wait() | 1304 » » » » async_lock.start() |
1305 » » » self._lock_vdb = async_lock | 1305 » » » » async_lock.wait() |
| 1306 » » » » self._lock_vdb = async_lock |
1306 | 1307 |
1307 def unlockdb(self): | 1308 def unlockdb(self): |
1308 if self._lock_vdb is not None: | 1309 if self._lock_vdb is not None: |
1309 if isinstance(self._lock_vdb, AsynchronousLock): | 1310 if isinstance(self._lock_vdb, AsynchronousLock): |
1310 self._lock_vdb.unlock() | 1311 self._lock_vdb.unlock() |
1311 else: | 1312 else: |
1312 unlockdir(self._lock_vdb) | 1313 unlockdir(self._lock_vdb) |
1313 self._lock_vdb = None | 1314 self._lock_vdb = None |
1314 | 1315 |
1315 def getpath(self): | 1316 def getpath(self): |
(...skipping 2843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4159 encoding=object.__getattribute__(os, '_e
ncoding'), | 4160 encoding=object.__getattribute__(os, '_e
ncoding'), |
4160 errors='strict'), 'rb') | 4161 errors='strict'), 'rb') |
4161 try: | 4162 try: |
4162 tar.addfile(tarinfo, f) | 4163 tar.addfile(tarinfo, f) |
4163 finally: | 4164 finally: |
4164 f.close() | 4165 f.close() |
4165 else: | 4166 else: |
4166 tar.addfile(tarinfo) | 4167 tar.addfile(tarinfo) |
4167 if onProgress: | 4168 if onProgress: |
4168 onProgress(maxval, curval) | 4169 onProgress(maxval, curval) |
OLD | NEW |