Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 343993 - mercurial.eclass v 1.14 should use standard "${WORKDIR}/${P}" build directory
Summary: mercurial.eclass v 1.14 should use standard "${WORKDIR}/${P}" build directory
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Eclasses (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Krzysztof Pawlik (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-03 16:32 UTC by W. Trevor King
Modified: 2013-04-03 12:07 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
mercurial.eclass-workdir.patch (mercurial.eclass-workdir.patch,2.28 KB, patch)
2010-11-06 09:10 UTC, Krzysztof Pawlik (RETIRED)
Details | Diff
mercurial.eclass-workdir.patch (mercurial.eclass-workdir.patch,2.09 KB, patch)
2010-11-07 23:08 UTC, Krzysztof Pawlik (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description W. Trevor King 2010-11-03 16:32:59 UTC
mercurial_src_unpack() unpacks the source into ${WORKDIR}/${module}, where ${module} defaults to the basename of EHG_REPO_URI.  This is in contrast with the git eclass, whose git_fetch() unpacks the repository to ${S}.  The mercurial_src_unpack() behavior means that a post-unpack `cd ${S}` can fail if ${module} is not equal to ${P}.


Reproducible: Always

Steps to Reproduce:
The following ebuild:

<snip hooke-9999.ebuild>
EAPI="2"
PYTHON_DEPEND="2:2.6"
SUPPORT_PYTHON_ABIS="1"
RESTRICT_PYTHON_ABIS="3.*"

inherit eutils distutils scons-utils

inherit mercurial
EHG_REPO_URI="http://www.physics.drexel.edu/~wking/code/hg/hooke"
EHG_REVISION="wtk"
SRC_URI=""

DESCRIPTION="Force spectroscopy data analysis."
HOMEPAGE="http://code.google.com/p/hooke/"

LICENSE="LGPL-3"
SLOT="0"

src_unpack() {
  mercurial_src_unpack
  # mercurial eclass doesn't unpack to ${S}, see their use of
  # ${module}.  Uncomment the following line to fix
  # mv "${WORKDIR}/hooke" "${S}" || die "couldn't rename workdir"
  cd "${S}"
}
</snip>

Fails with

<snip failing commands>
$ sudo ebuild ./hooke-9.ebuild digest
Appending /home/wking/src/wtk-overlay to PORTDIR_OVERLAY...
>>> Creating Manifest for /home/wking/src/wtk-overlay/sci-physics/hooke
$ sudo ebuild ./hooke-9.ebuild merge
</snip>

Actual Results:  
Disabling noauto in features... merge disables it. (qmerge doesn't)
Appending /home/wking/src/wtk-overlay to PORTDIR_OVERLAY...
 * checking ebuild checksums ;-) ... [ ok ]
 * checking auxfile checksums ;-) ... [ ok ]
 * checking miscfile checksums ;-) ... [ ok ]
 * CPV:  sci-physics/hooke-9999
 * REPO: 
 * USE:  elibc_glibc kernel_linux userland_GNU x86
>>> Unpacking source...
 * Updating /usr/portage/distfiles/hg-src/hooke/hooke from http://www.physics.drexel.edu/~wking/code/hg/hooke
 * Creating working directory in /var/tmp/portage/sci-physics/hooke-9999/work/hooke (target revision: wtk)
 * Work directory: /var/tmp/portage/sci-physics/hooke-9999/work/hooke global id: d70b29fb2eeb branch: wtk
/var/tmp/portage/sci-physics/hooke-9/temp/environment: line 4802: cd: /var/tmp/portage/sci-physics/hooke-9/work/hooke-9999: No such file or directory
 * ERROR: sci-physics/hooke-9 failed:
 *   no source directory?
 * 
 * Call stack:
 *     ebuild.sh, line  54:  Called src_unpack
 *   environment, line 4802:  Called die
 * The specific snippet of code:
 *       cd "${S}" || die "no source directory?"
...


Expected Results:  
Disabling noauto in features... merge disables it. (qmerge doesn't)
Appending /home/wking/src/wtk-overlay to PORTDIR_OVERLAY...
 * checking ebuild checksums ;-) ... [ ok ]
 * checking auxfile checksums ;-) ... [ ok ]
 * checking miscfile checksums ;-) ... [ ok ]
 * CPV:  sci-physics/hooke-9999
 * REPO: 
 * USE:  elibc_glibc kernel_linux userland_GNU x86
>>> Unpacking source...
 * Updating /usr/portage/distfiles/hg-src/hooke/hooke from http://www.physics.drexel.edu/~wking/code/hg/hooke
 * Creating working directory in /var/tmp/portage/sci-physics/hooke-9999/work/hooke-9999 (target revision: wtk)
 * Work directory: /var/tmp/portage/sci-physics/hooke-9999/work/hooke-9999 global id: d70b29fb2eeb branch: wtk
...


The benefit of the current approach is that you can check out several mercurial repositories with mercurial_fetch() while building a single package.  To preserve that, I suggest we only change function mercurial_src_unpack() to use

  mercurial_fetch "${EHG_REPO_URI}" "${P}"

which assumes S="${WORKDIR}/${P}" (its default value).  If that assumption is too risky, then mercurial_fetch should get a third "target directory" option, and the call from mercurial_src_unpack() would be

  local module="$(basename "${EHG_REPO_URI}")"
  mercurial_fetch "${EHG_REPO_URI}" "$module" "${S}"
Comment 1 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-11-06 09:10:12 UTC
Created attachment 253373 [details, diff]
mercurial.eclass-workdir.patch

I'll send an e-mail to gentoo-dev to start a discussion and ask for comments about this patch. It has a nasty side effect of breaking every existing ebuild that uses mercurial.eclass currently, fortunately there are only a few of them in main portage tree and a fix is quite trivial: just remove definition of S.
Comment 2 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-11-07 23:08:43 UTC
Created attachment 253567 [details, diff]
mercurial.eclass-workdir.patch

Improved version.
Comment 3 Krzysztof Pawlik (RETIRED) gentoo-dev 2010-11-17 18:42:55 UTC
I've committed the improved version.