Bug 245231 - sys-apps/portage-2.2_rc13 waits for lockfile with -fOp
Bug#: 245231 Product:  Portage Development Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: dev-portage@gentoo.org Reported By: vaeth@mathematik.uni-wuerzburg.de
Component: Core - External Interaction
URL: 
Summary: sys-apps/portage-2.2_rc13 waits for lockfile with -fOp
Keywords:  
Status Whiteboard: 
Opened: 2008-11-02 06:33 0000
Description:   Opened: 2008-11-02 06:33 0000
With sys-apps/portage-2.2_rc13, getdelta.sh waits forever, because it calls
  GENTOO_MIRRORS="" emerge -fOp =category/package-version
to get the non-mirrored address which then (because it is called from emerge
via FETCHOMMAND) sees a lockfile and waits for the mother process to
finish...

This did not happen with =sys-apps/portage-2.2_rc12 or earlier versions,
and indeed it seems that there should not be a reason to wait for a lockfile.
If this is technically too hard, perhaps another command could be provided
which app-portage/getdelta could use, or - even better - the non-mirrored
address could be passed in an environment variable to FETCHOMMAND
(which would speed up gedelta quite a bit and perhaps also has other uses).

------- Comment #1 From Zac Medico 2008-11-02 07:14:30 0000 -------
(In reply to comment #0)
> This did not happen with =sys-apps/portage-2.2_rc12 or earlier versions,
> and indeed it seems that there should not be a reason to wait for a lockfile.

It's only needed for cases when the pkg_nofetch() phase has to be executed (bug
#241118). In this case, the locked directory is used to collect elog messages
and to provide a safe working directory for bug #239560.

In order to avoid the need to lock the directory, we can use mkdtemp() to
allocate a temporary directory. 

> If this is technically too hard, perhaps another command could be provided
> which app-portage/getdelta could use, or - even better - the non-mirrored
> address could be passed in an environment variable to FETCHOMMAND
> (which would speed up gedelta quite a bit and perhaps also has other uses).

I'm not sure exactly what's required here. In some cases there are multiple
non-mirrored URIs available, and in other cases only mirrored URIs are
available.

------- Comment #2 From Martin Väth 2008-11-02 08:16:42 0000 -------
(In reply to comment #1)
> I'm not sure exactly what's required here. In some cases there are multiple
> non-mirrored URIs available, and in other cases only mirrored URIs are
> available.

I am not an author of getdelta and can only guess what happens on the server
side. However, the script simply considers the words (space or newline
separated) output by
  GENTOO_MIRRORS="" emerge -fOp =category/package-version
and uses the last of those word which is an address and contains the
filename to be fetched.

So I guess just putting the output which you would get with GENTOO_MIRRORS=""
into some variable (optionally eliminating those entries which do not end
with the name for the current file to be fetched) would be sufficient for
getdelta.

------- Comment #3 From Zac Medico 2008-11-02 09:07:51 0000 -------
Created an attachment (id=170521) [details]
use a private temp directory instead of the main one

If this patch is saved as /tmp/fetch_tmp.patch, then it can be applied as
follows:

  patch /usr/lib/portage/pym/_emerge/__init__.py /tmp/fetch_tmp.patch

------- Comment #4 From Martin Väth 2008-11-02 18:49:05 0000 -------
Thanks. The patch works smoothly.

------- Comment #5 From Zac Medico 2008-11-11 22:21:06 0000 -------
This is fixed in 2.2_rc14.