On 11/07/10 13:07, Mike Auty wrote:
> On 07/11/10 02:40, Donnie Berkholz wrote:
>> I read it more closely and realized I was a little confused by the way 
>> you listed all the bullet points mixing together benefits and problems.
> 
>> So I'll try again: if you really want to do this change, you might want 
>> to consider adding a mercurial-2.eclass instead. Eclasses of this nature 
>> (svn, git, hg, etc) tend to be broadly used outside the tree as well as 
>> within, so breaking backwards compatibility can be a real problem. A new 
>> versioned eclass allows for a much more gradual transition.
> 
> 
> I've only just jumped into the conversation, but the obvious question
> is, why not just use ${S} as the location of the working directory
> (rather than "${WORKDIR}/${workdir}")?  That way, if it's set old
> ebuilds still work, and if it's not set, new ebuilds get the benefit of
> using ${S}?  I can only see a problem with this if there's somewhere
> that the value of the working directory needs to be known before any of
> the phases...

Hm.. good idea :) I'm attaching modified patch that uses ${S} by default, so it
will improve the situation and at the same time it won't break existing ebuilds.
Thanks Mike for this suggestion.

-- 
Krzysztof Pawlik  <nelchael at gentoo.org>  key id: 0xF6A80E46
desktop-misc, java, vim, kernel, python, apache...
Index: mercurial.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/mercurial.eclass,v
retrieving revision 1.14
diff -u -r1.14 mercurial.eclass
--- mercurial.eclass    26 Oct 2010 19:04:44 -0000      1.14
+++ mercurial.eclass    7 Nov 2010 23:05:22 -0000
@@ -68,12 +68,12 @@
 EHG_OFFLINE="${EHG_OFFLINE:-${ESCM_OFFLINE}}"
 
 # @FUNCTION: mercurial_fetch
-# @USAGE: [repository_uri] [module]
+# @USAGE: [repository_uri] [module] [sourcedir]
 # @DESCRIPTION:
 # Clone or update repository.
 #
-# If not repository URI is passed it defaults to EHG_REPO_URI, if module is
-# empty it defaults to basename of EHG_REPO_URI.
+# If repository URI is not passed it defaults to EHG_REPO_URI, if module is
+# empty it defaults to basename of EHG_REPO_URI, sourcedir defaults to S.
 function mercurial_fetch {
        debug-print-function ${FUNCNAME} ${*}
 
@@ -81,6 +81,7 @@
        [[ -z "${EHG_REPO_URI}" ]] && die "EHG_REPO_URI is empty"
 
        local module="${2-$(basename "${EHG_REPO_URI}")}"
+       local sourcedir="${3-${S}}"
 
        # Should be set but blank to prevent using $HOME/.hgrc
        export HGRCPATH=
@@ -116,19 +117,19 @@
        fi
 
        # Checkout working copy:
-       einfo "Creating working directory in ${WORKDIR}/${module} (target 
revision: ${EHG_REVISION})"
+       einfo "Creating working directory in ${sourcedir} (target revision: 
${EHG_REVISION})"
        hg clone \
                ${EHG_QUIET_CMD_OPT} \
                --rev="${EHG_REVISION}" \
                "${EHG_STORE_DIR}/${EHG_PROJECT}/${module}" \
-               "${WORKDIR}/${module}" || die "hg clone failed"
+               "${sourcedir}" || die "hg clone failed"
        # An exact revision helps a lot for testing purposes, so have some 
output...
        # id           num  branch
        # fd6e32d61721 6276 default
-       local HG_REVDATA=($(hg identify -b -i "${WORKDIR}/${module}"))
+       local HG_REVDATA=($(hg identify -b -i "${sourcedir}"))
        export HG_REV_ID=${HG_REVDATA[0]}
        local HG_REV_BRANCH=${HG_REVDATA[1]}
-       einfo "Work directory: ${WORKDIR}/${module} global id: ${HG_REV_ID} 
branch: ${HG_REV_BRANCH}"
+       einfo "Work directory: ${sourcedir} global id: ${HG_REV_ID} branch: 
${HG_REV_BRANCH}"
 }
 
 # @FUNCTION: mercurial_src_unpack

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to