| 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.3 2006/12/18 11:51:06 kosmikus Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/darcs.eclass,v 1.8 2010/03/14 12:31:41 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 | # |
| … | |
… | |
| 41 | [ -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" |
| 42 | |
42 | |
| 43 | # The URI to the repository. |
43 | # The URI to the repository. |
| 44 | [ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY="" |
44 | [ -z "$EDARCS_REPOSITORY" ] && EDARCS_REPOSITORY="" |
| 45 | |
45 | |
| 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 | |
46 | |
| 52 | # EDARCS_CLEAN: set this to something to get a clean copy when updating |
47 | # EDARCS_CLEAN: set this to something to get a clean copy when updating |
| 53 | # (removes the working directory, then uses $EDARCS_GET_CMD to |
48 | # (removes the working directory, then uses $EDARCS_GET_CMD to |
| 54 | # re-download it.) |
49 | # re-download it.) |
| 55 | |
50 | |
| 56 | # --- end ebuild-configurable settings --- |
51 | # --- end ebuild-configurable settings --- |
| 57 | |
52 | |
| 58 | # add darcs to deps |
53 | # add darcs to deps |
| 59 | DEPEND="dev-util/darcs" |
54 | DEPEND="dev-vcs/darcs" |
| 60 | |
55 | |
| 61 | # is called from darcs_src_unpack |
56 | # is called from darcs_src_unpack |
| 62 | darcs_fetch() { |
57 | darcs_fetch() { |
|
|
58 | |
|
|
59 | # The local directory to store the repository (useful to ensure a |
|
|
60 | # unique local name); relative to EDARCS_TOP_DIR |
|
|
61 | [ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \ |
|
|
62 | && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \ |
|
|
63 | && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/} |
| 63 | |
64 | |
| 64 | debug-print-function $FUNCNAME $* |
65 | debug-print-function $FUNCNAME $* |
| 65 | |
66 | |
| 66 | if [ -n "$EDARCS_CLEAN" ]; then |
67 | if [ -n "$EDARCS_CLEAN" ]; then |
| 67 | rm -rf $EDARCS_TOP_DIR/$EDARCS_LOCALREPO |
68 | rm -rf $EDARCS_TOP_DIR/$EDARCS_LOCALREPO |
| … | |
… | |
| 81 | export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}" |
82 | export SANDBOX_WRITE="${SANDBOX_WRITE//:\/foobar:\/}" |
| 82 | fi |
83 | fi |
| 83 | |
84 | |
| 84 | # in case EDARCS_DARCS_DIR is a symlink to a dir, get the real |
85 | # in case EDARCS_DARCS_DIR is a symlink to a dir, get the real |
| 85 | # dir's path, otherwise addwrite() doesn't work. |
86 | # dir's path, otherwise addwrite() doesn't work. |
|
|
87 | pushd . |
| 86 | cd -P "$EDARCS_TOP_DIR" > /dev/null |
88 | cd -P "$EDARCS_TOP_DIR" > /dev/null |
| 87 | EDARCS_TOP_DIR="`/bin/pwd`" |
89 | EDARCS_TOP_DIR="`/bin/pwd`" |
| 88 | |
90 | |
| 89 | # disable the sandbox for this dir |
91 | # disable the sandbox for this dir |
| 90 | addwrite "$EDARCS_TOP_DIR" |
92 | addwrite "$EDARCS_TOP_DIR" |
| … | |
… | |
| 108 | elif [ "${mode}" == "update" ]; then |
110 | elif [ "${mode}" == "update" ]; then |
| 109 | einfo "Running $cmdupdate" |
111 | einfo "Running $cmdupdate" |
| 110 | eval $cmdupdate || die "darcs update command failed" |
112 | eval $cmdupdate || die "darcs update command failed" |
| 111 | fi |
113 | fi |
| 112 | |
114 | |
|
|
115 | popd |
| 113 | } |
116 | } |
| 114 | |
117 | |
| 115 | |
118 | |
| 116 | darcs_src_unpack() { |
119 | darcs_src_unpack() { |
|
|
120 | # The local directory to store the repository (useful to ensure a |
|
|
121 | # unique local name); relative to EDARCS_TOP_DIR |
|
|
122 | [ -z "$EDARCS_LOCALREPO" ] && [ -n "$EDARCS_REPOSITORY" ] \ |
|
|
123 | && EDARCS_LOCALREPO=${EDARCS_REPOSITORY%/} \ |
|
|
124 | && EDARCS_LOCALREPO=${EDARCS_LOCALREPO##*/} |
|
|
125 | local EDARCS_SHOPT |
| 117 | |
126 | |
| 118 | debug-print-function $FUNCNAME $* |
127 | debug-print-function $FUNCNAME $* |
| 119 | |
128 | |
| 120 | debug-print "$FUNCNAME: init: |
129 | debug-print "$FUNCNAME: init: |
| 121 | EDARCS_DARCS_CMD=$EDARCS_DARCS_CMD |
130 | EDARCS_DARCS_CMD=$EDARCS_DARCS_CMD |
| … | |
… | |
| 135 | |
144 | |
| 136 | # probably redundant, but best to make sure |
145 | # probably redundant, but best to make sure |
| 137 | # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside. |
146 | # Use ${WORKDIR}/${P} rather than ${S} so user can point ${S} to something inside. |
| 138 | mkdir -p "${WORKDIR}/${P}" |
147 | mkdir -p "${WORKDIR}/${P}" |
| 139 | |
148 | |
|
|
149 | EDARCS_SHOPT=$(shopt -p dotglob) |
| 140 | shopt -s dotglob # get any dotfiles too. |
150 | shopt -s dotglob # get any dotfiles too. |
| 141 | cp -Rf "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}" |
151 | rsync -rlpgo --exclude="_darcs/" "$EDARCS_TOP_DIR/$EDARCS_LOCALREPO"/* "${WORKDIR}/${P}" |
|
|
152 | eval ${EDARCS_SHOPT} # reset shopt |
| 142 | |
153 | |
| 143 | einfo "Darcs repository contents are now in ${WORKDIR}/${P}" |
154 | einfo "Darcs repository contents are now in ${WORKDIR}/${P}" |
| 144 | |
155 | |
| 145 | } |
156 | } |
| 146 | |
157 | |