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

Diff of /eclass/darcs.eclass

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

Revision 1.5 Revision 1.10
1# Copyright 2004 Gentoo Technologies, Inc. 1# Copyright 2004 Gentoo Technologies, Inc.
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/darcs.eclass,v 1.5 2007/06/17 21:33:57 kolmodin Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/darcs.eclass,v 1.10 2010/11/01 20:54:46 slyfox Exp $
4# 4#
5# darcs eclass author: Andres Loeh <kosmikus@gentoo.org> 5# darcs eclass author: Andres Loeh <kosmikus@gentoo.org>
6# tla eclass author: <rphillips@gentoo.org> 6# tla eclass author: <rphillips@gentoo.org>
7# Original Author: Jeffrey Yasskin <jyasskin@mail.utexas.edu> 7# Original Author: Jeffrey Yasskin <jyasskin@mail.utexas.edu>
8# 8#
16 16
17# Most of the time, you will define only $EDARCS_REPOSITORY in your 17# Most of the time, you will define only $EDARCS_REPOSITORY in your
18# ebuild. 18# ebuild.
19 19
20# TODO: support for tags, ... 20# TODO: support for tags, ...
21
22inherit eutils # eshopts_{push,pop}
21 23
22# Don't download anything other than the darcs repository 24# Don't download anything other than the darcs repository
23SRC_URI="" 25SRC_URI=""
24 26
25# You shouldn't change these settings yourself! The ebuild/eclass inheriting 27# You shouldn't change these settings yourself! The ebuild/eclass inheriting
41[ -z "$EDARCS_TOP_DIR" ] && EDARCS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src" 43[ -z "$EDARCS_TOP_DIR" ] && EDARCS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src"
42 44
43# The URI to the repository. 45# The URI to the repository.
44[ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY="" 46[ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY=""
45 47
46# The local directory to store the repository (useful to ensure a
47# unique local name); relative to EDARCS_TOP_DIR
48[ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \
49 && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
50 && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
51 48
52# EDARCS_CLEAN: set this to something to get a clean copy when updating 49# EDARCS_CLEAN: set this to something to get a clean copy when updating
53# (removes the working directory, then uses $EDARCS_GET_CMD to 50# (removes the working directory, then uses $EDARCS_GET_CMD to
54# re-download it.) 51# re-download it.)
55 52
56# --- end ebuild-configurable settings --- 53# --- end ebuild-configurable settings ---
57 54
58# add darcs to deps 55# add darcs to deps
59DEPEND="dev-util/darcs" 56DEPEND="dev-vcs/darcs"
57
58darcs_patchcount() {
59 set -- $(${EDARCS_DARCS_CMD} show repo | grep "Num Patches")
60 # handle string like: " Num Patches: 3860"
61 echo ${3}
62}
60 63
61# is called from darcs_src_unpack 64# is called from darcs_src_unpack
62darcs_fetch() { 65darcs_fetch() {
66
67 # The local directory to store the repository (useful to ensure a
68 # unique local name); relative to EDARCS_TOP_DIR
69 [ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \
70 && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
71 && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
63 72
64 debug-print-function $FUNCNAME $* 73 debug-print-function $FUNCNAME $*
65 74
66 if [ -n "$EDARCS_CLEAN" ]; then 75 if [ -n "$EDARCS_CLEAN" ]; then
67 rm -rf $EDARCS_TOP_DIR/$EDARCS_LOCALREPO 76 rm -rf $EDARCS_TOP_DIR/$EDARCS_LOCALREPO
109 elif [ "${mode}" == "update" ]; then 118 elif [ "${mode}" == "update" ]; then
110 einfo "Running $cmdupdate" 119 einfo "Running $cmdupdate"
111 eval $cmdupdate || die "darcs update command failed" 120 eval $cmdupdate || die "darcs update command failed"
112 fi 121 fi
113 122
123 export EDARCS_PATCHCOUNT=$(darcs_patchcount)
124 einfo " patches in repo: ${EDARCS_PATCHCOUNT}"
125
114 popd 126 popd
115} 127}
116 128
117 129
118darcs_src_unpack() { 130darcs_src_unpack() {
119 local EDARCS_SHOPT 131 # The local directory to store the repository (useful to ensure a
132 # unique local name); relative to EDARCS_TOP_DIR
133 [ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \
134 && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
135 && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
120 136
121 debug-print-function $FUNCNAME $* 137 debug-print-function $FUNCNAME $*
122 138
123 debug-print "$FUNCNAME: init: 139 debug-print "$FUNCNAME: init:
124 EDARCS_DARCS_CMD=$EDARCS_DARCS_CMD 140 EDARCS_DARCS_CMD=$EDARCS_DARCS_CMD
138 154
139 # probably redundant, but best to make sure 155 # probably redundant, but best to make sure
140 # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside. 156 # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside.
141 mkdir -p "${WORKDIR}/${P}" 157 mkdir -p "${WORKDIR}/${P}"
142 158
143 EDARCS_SHOPT=$(shopt -p dotglob)
144 shopt -s dotglob # get any dotfiles too. 159 eshopts_push -s dotglob # get any dotfiles too.
145 cp -Rf "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}" 160 rsync -rlpgo --exclude="_darcs/" "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}"
146 eval ${EDARCS_SHOPT} # reset shopt 161 eshopts_pop
147 162
148 einfo "Darcs repository contents are now in ${WORKDIR}/${P}" 163 einfo "Darcs repository contents are now in ${WORKDIR}/${P}"
149 164
150} 165}
151 166

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20