/[gentoo-x86]/eclass/mercurial.eclass
Gentoo

Diff of /eclass/mercurial.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.6 Revision 1.9
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2006 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# $Header: /var/cvsroot/gentoo-x86/eclass/mercurial.eclass,v 1.6 2009/03/11 18:56:28 nelchael Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/mercurial.eclass,v 1.9 2010/01/17 11:21:12 nelchael Exp $
4 4
5# @ECLASS: mercurial.eclass 5# @ECLASS: mercurial.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# nelchael@gentoo.org 7# nelchael@gentoo.org
8# @BLURB: This eclass provides generic mercurial fetching functions 8# @BLURB: This eclass provides generic mercurial fetching functions
23# Mercurial repository URI. 23# Mercurial repository URI.
24 24
25# @ECLASS-VARIABLE: EHG_REVISION 25# @ECLASS-VARIABLE: EHG_REVISION
26# @DESCRIPTION: 26# @DESCRIPTION:
27# Create working directory for specified revision, defaults to tip. 27# Create working directory for specified revision, defaults to tip.
28#
29# EHG_REVISION is passed as a value for --rev parameter, so it can be more than
30# just a revision, please consult `hg help revisions' for more details.
28[[ -z "${EHG_REVISION}" ]] && EHG_REVISION="tip" 31[[ -z "${EHG_REVISION}" ]] && EHG_REVISION="tip"
29 32
30# @ECLASS-VARIABLE: EHG_PROJECT 33# @ECLASS-VARIABLE: EHG_PROJECT
31# @DESCRIPTION: 34# @DESCRIPTION:
32# Project name. 35# Project name.
33# 36#
34# This variable default to $PN, but can be changed to allow repository sharing 37# This variable default to $PN, but can be changed to allow repository sharing
35# between several ebuilds. 38# between several ebuilds.
36[[ -z "${EHG_PROJECT}" ]] && EHG_PROJECT="${PN}" 39[[ -z "${EHG_PROJECT}" ]] && EHG_PROJECT="${PN}"
37 40
41# @ECLASS-VARIABLE: EHG_QUIET
42# @DESCRIPTION:
43# Suppress some extra noise from mercurial, set it to 'OFF' to be louder.
44: ${EHG_QUIET:="ON"}
45[[ "${EHG_QUIET}" == "ON" ]] && EHG_QUIET_CMD_OPT="--quiet"
46
38# @ECLASS-VARIABLE: EHG_CLONE_CMD 47# @ECLASS-VARIABLE: EHG_CLONE_CMD
39# @DESCRIPTION: 48# @DESCRIPTION:
40# Command used to perform initial repository clone. 49# Command used to perform initial repository clone.
41[[ -z "${EHG_CLONE_CMD}" ]] && EHG_CLONE_CMD="hg clone --quiet --pull --noupdate" 50[[ -z "${EHG_CLONE_CMD}" ]] && EHG_CLONE_CMD="hg clone ${EHG_QUIET_CMD_OPT} --pull --noupdate"
42 51
43# @ECLASS-VARIABLE: EHG_PULL_CMD 52# @ECLASS-VARIABLE: EHG_PULL_CMD
44# @DESCRIPTION: 53# @DESCRIPTION:
45# Command used to update repository. 54# Command used to update repository.
46[[ -z "${EHG_PULL_CMD}" ]] && EHG_PULL_CMD="hg pull --quiet" 55[[ -z "${EHG_PULL_CMD}" ]] && EHG_PULL_CMD="hg pull ${EHG_QUIET_CMD_OPT}"
56
57# @ECLASS-VARIABLE: EHG_OFFLINE
58# @DESCRIPTION:
59# Set this variable to a non-empty value to disable the automatic updating of
60# a mercurial source tree. This is intended to be set outside the ebuild by
61# users.
62EHG_OFFLINE="${EHG_OFFLINE:-${ESCM_OFFLINE}}"
47 63
48# @FUNCTION: mercurial_fetch 64# @FUNCTION: mercurial_fetch
49# @USAGE: [repository_uri] [module] 65# @USAGE: [repository_uri] [module]
50# @DESCRIPTION: 66# @DESCRIPTION:
51# Clone or update repository. 67# Clone or update repository.
86 ${EHG_CLONE_CMD} "${EHG_REPO_URI}" "${module}" || { 102 ${EHG_CLONE_CMD} "${EHG_REPO_URI}" "${module}" || {
87 rm -rf "${module}" 103 rm -rf "${module}"
88 die "failed to clone ${EHG_REPO_URI}" 104 die "failed to clone ${EHG_REPO_URI}"
89 } 105 }
90 cd "${module}" 106 cd "${module}"
91 else 107 elif [[ -z "${EHG_OFFLINE}" ]]; then
92 einfo "Updating ${hg_src_dir}/${EHG_PROJECT}/${module} from ${EHG_REPO_URI}" 108 einfo "Updating ${hg_src_dir}/${EHG_PROJECT}/${module} from ${EHG_REPO_URI}"
93 cd "${module}" || die "failed to cd to ${module}" 109 cd "${module}" || die "failed to cd to ${module}"
94 ${EHG_PULL_CMD} || die "update failed" 110 ${EHG_PULL_CMD} || die "update failed"
95 fi 111 fi
96 112
97 # Checkout working copy: 113 # Checkout working copy:
98 einfo "Creating working directory in ${WORKDIR}/${module} (revision: ${EHG_REVISION})" 114 einfo "Creating working directory in ${WORKDIR}/${module} (revision: ${EHG_REVISION})"
99 hg clone \ 115 hg clone \
100 --quiet \ 116 ${EHG_QUIET_CMD_OPT} \
101 --rev="${EHG_REVISION}" \ 117 --rev="${EHG_REVISION}" \
102 "${hg_src_dir}/${EHG_PROJECT}/${module}" \ 118 "${hg_src_dir}/${EHG_PROJECT}/${module}" \
103 "${WORKDIR}/${module}" || die "hg clone failed" 119 "${WORKDIR}/${module}" || die "hg clone failed"
104} 120}
105 121

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20