Created attachment 389218 [details, diff] _ensure_dirs: ignore EEXIST from mkdir Creating a distfiles tarball snapshot (containing distfiles for all ebuilds with stable keywords in my Prefix-based distro, for offline install) using the command 'ebuild path-to/stable/stable-PVR.ebuild fetch' in parallel may fail with this backtrace with prefix-portage-2.2.10.1, leading me to attached patch: Thanks! Traceback (most recent call last): File "/opt/toolsbox/toolsbase-2015/usr/bin/ebuild", line 147, in <module> ebuild_portdir not in portage.portdb.porttrees: File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/proxy/objectproxy.py", line 22, in __getattribute__ result = object.__getattribute__(self, '_get_target')() File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/__init__.py", line 689, in _get_target return _get_legacy_global(name) File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/_legacy_globals.py", line 14, in _get_legacy_global portage.portdb = portage.db[portage.root]["porttree"].dbapi File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/util/__init__.py", line 1472, in __getitem__ result = lazy_item.func(*pargs, **kwargs) File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/dbapi/porttree.py", line 1089, in __init__ self.dbapi = portdbapi(mysettings=settings) File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/dbapi/porttree.py", line 240, in __init__ self.depcachedir, x, self._known_keys, **cache_kwargs) File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/cache/flat_hash.py", line 37, in __init__ self._ensure_dirs() File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/cache/fs_template.py", line 72, in _ensure_dirs os.mkdir(base, perms) File "/opt/toolsbox/toolsbase-2015/usr/lib/portage/pym/portage/__init__.py", line 260, in __call__ rval = self._func(*wrapped_args, **wrapped_kwargs) OSError: [Errno 17] File exists: '/opt/toolsbox/toolsbase-2015/var/cache/edb/dep/ftp/pub/portage/toolsbox-tree-20141112'
In the following branch I have an alternative patch which uses the util.ensure_dirs function to handle EEXIST: https://github.com/zmedico/portage/tree/bug_529120 I've posted it for review here: http://thread.gmane.org/gmane.linux.gentoo.portage.devel/4782
This is in git now: https://github.com/gentoo/portage/commit/9f6967dbc38ea55c0de5fbf5ad663ca676c54743
Fixed in 2.2.15.