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

Diff of /eclass/darcs.eclass

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

Revision 1.1 Revision 1.5
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.1 2006/05/22 23:05:24 kosmikus Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/darcs.eclass,v 1.5 2007/06/17 21:33:57 kolmodin 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#
28# --- begin ebuild-configurable settings 28# --- begin ebuild-configurable settings
29 29
30# darcs command to run 30# darcs command to run
31[ -z "$EDARCS_DARCS_CMD" ] && EDARCS_DARCS_CMD="darcs" 31[ -z "$EDARCS_DARCS_CMD" ] && EDARCS_DARCS_CMD="darcs"
32 32
33# darcs commands with options 33# darcs commands with command-specific options
34[ -z "$EDARCS_GET_CMD" ] && EDARCS_GET_CMD="get" 34[ -z "$EDARCS_GET_CMD" ] && EDARCS_GET_CMD="get --partial"
35[ -z "$EDARCS_UPDATE_CMD" ] && EDARCS_UPDATE_CMD="pull" 35[ -z "$EDARCS_UPDATE_CMD" ] && EDARCS_UPDATE_CMD="pull"
36
37# options to pass to both the "get" and "update" commands
38[ -z "$EDARCS_OPTIONS" ] && EDARCS_OPTIONS="--set-scripts-executable"
36 39
37# Where the darcs repositories are stored/accessed 40# Where the darcs repositories are stored/accessed
38[ -z "$EDARCS_TOP_DIR" ] && EDARCS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src" 41[ -z "$EDARCS_TOP_DIR" ] && EDARCS_TOP_DIR="${PORTAGE_ACTUAL_DISTDIR-${DISTDIR}}/darcs-src"
39 42
40# The URI to the repository. 43# The URI to the repository.
41[ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY="" 44[ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY=""
42 45
43# The local directory to store the repository (useful to ensure a 46# The local directory to store the repository (useful to ensure a
44# unique local name); relative to EDARCS_TOP_DIR 47# unique local name); relative to EDARCS_TOP_DIR
45[ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \ 48[ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \
46 && EDARCS_LOCALREPO="`basename $EDARCS_REPOSITORY`" 49 && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \
50 && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/}
47 51
48# EDARCS_CLEAN: set this to something to get a clean copy when updating 52# EDARCS_CLEAN: set this to something to get a clean copy when updating
49# (removes the working directory, then uses $EDARCS_GET_CMD to 53# (removes the working directory, then uses $EDARCS_GET_CMD to
50# re-download it.) 54# re-download it.)
51 55
77 export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}" 81 export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}"
78 fi 82 fi
79 83
80 # in case EDARCS_DARCS_DIR is a symlink to a dir, get the real 84 # in case EDARCS_DARCS_DIR is a symlink to a dir, get the real
81 # dir's path, otherwise addwrite() doesn't work. 85 # dir's path, otherwise addwrite() doesn't work.
86 pushd .
82 cd -P "$EDARCS_TOP_DIR" > /dev/null 87 cd -P "$EDARCS_TOP_DIR" > /dev/null
83 EDARCS_TOP_DIR="`/bin/pwd`" 88 EDARCS_TOP_DIR="`/bin/pwd`"
84 89
85 # disable the sandbox for this dir 90 # disable the sandbox for this dir
86 addwrite "$EDARCS_TOP_DIR" 91 addwrite "$EDARCS_TOP_DIR"
93 mode=update 98 mode=update
94 cd "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO" 99 cd "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"
95 fi 100 fi
96 101
97 # commands to run 102 # commands to run
98 local cmdget="${EDARCS_DARCS_CMD} ${EDARCS_GET_CMD} --repo-name=${EDARCS_LOCALREPO} ${EDARCS_REPOSITORY}" 103 local cmdget="${EDARCS_DARCS_CMD} ${EDARCS_GET_CMD} ${EDARCS_OPTIONS} --repo-name=${EDARCS_LOCALREPO} ${EDARCS_REPOSITORY}"
99 local cmdupdate="${EDARCS_DARCS_CMD} ${EDARCS_UPDATE_CMD} --all ${EDARCS_REPOSITORY}" 104 local cmdupdate="${EDARCS_DARCS_CMD} ${EDARCS_UPDATE_CMD} --all ${EDARCS_OPTIONS} ${EDARCS_REPOSITORY}"
100 105
101 if [ "${mode}" == "get" ]; then 106 if [ "${mode}" == "get" ]; then
102 einfo "Running $cmdget" 107 einfo "Running $cmdget"
103 eval $cmdget || die "darcs get command failed" 108 eval $cmdget || die "darcs get command failed"
104 elif [ "${mode}" == "update" ]; then 109 elif [ "${mode}" == "update" ]; then
105 einfo "Running $cmdupdate" 110 einfo "Running $cmdupdate"
106 eval $cmdupdate || die "darcs update command failed" 111 eval $cmdupdate || die "darcs update command failed"
107 fi 112 fi
108 113
114 popd
109} 115}
110 116
111 117
112darcs_src_unpack() { 118darcs_src_unpack() {
119 local EDARCS_SHOPT
113 120
114 debug-print-function $FUNCNAME $* 121 debug-print-function $FUNCNAME $*
115 122
116 debug-print "$FUNCNAME: init: 123 debug-print "$FUNCNAME: init:
117 EDARCS_DARCS_CMD=$EDARCS_DARCS_CMD 124 EDARCS_DARCS_CMD=$EDARCS_DARCS_CMD
118 EDARCS_GET_CMD=$EDARCS_GET_CMD 125 EDARCS_GET_CMD=$EDARCS_GET_CMD
119 EDARCS_UPDATE_CMD=$EDARCS_UPDATE_CMD 126 EDARCS_UPDATE_CMD=$EDARCS_UPDATE_CMD
127 EDARCS_OPTIONS=$EDARCS_OPTIONS
120 EDARCS_TOP_DIR=$EDARCS_TOP_DIR 128 EDARCS_TOP_DIR=$EDARCS_TOP_DIR
121 EDARCS_REPOSITORY=$EDARCS_REPOSITORY 129 EDARCS_REPOSITORY=$EDARCS_REPOSITORY
122 EDARCS_LOCALREPO=$EDARCS_LOCALREPO 130 EDARCS_LOCALREPO=$EDARCS_LOCALREPO
123 EDARCS_CLEAN=$EDARCS_CLEAN" 131 EDARCS_CLEAN=$EDARCS_CLEAN"
124 132
130 138
131 # probably redundant, but best to make sure 139 # probably redundant, but best to make sure
132 # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside. 140 # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside.
133 mkdir -p "${WORKDIR}/${P}" 141 mkdir -p "${WORKDIR}/${P}"
134 142
143 EDARCS_SHOPT=$(shopt -p dotglob)
135 shopt -s dotglob # get any dotfiles too. 144 shopt -s dotglob # get any dotfiles too.
136 cp -Rf "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}" 145 cp -Rf "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}"
146 eval ${EDARCS_SHOPT} # reset shopt
137 147
138 einfo "Darcs repository contents are now in ${WORKDIR}/${P}" 148 einfo "Darcs repository contents are now in ${WORKDIR}/${P}"
139 149
140} 150}
141 151

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

  ViewVC Help
Powered by ViewVC 1.1.20