| 1 | # Copyright 1999-2000 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2000 Gentoo Technologies, Inc. |
| 2 | # Distributed under the terms of the GNU General Public License, v2 or later |
2 | # Distributed under the terms of the GNU General Public License, v2 or later |
| 3 | # Author Dan Armak <danarmak@gentoo.org> |
3 | # Author Dan Armak <danarmak@gentoo.org> |
| 4 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.18 2002/09/15 14:15:54 danarmak Exp $ |
4 | # $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.21 2002/10/24 18:38:32 danarmak Exp $ |
| 5 | # This eclass provides the generic cvs fetching functions. |
5 | # This eclass provides the generic cvs fetching functions. |
| 6 | |
6 | |
| 7 | ECLASS=cvs |
7 | ECLASS=cvs |
| 8 | INHERITED="$INHERITED $ECLASS" |
8 | INHERITED="$INHERITED $ECLASS" |
| 9 | |
9 | |
| … | |
… | |
| 82 | DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}/${ECVS_SUBDIR}" |
82 | DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}/${ECVS_SUBDIR}" |
| 83 | debug-print "$FUNCNAME: now DIR=$DIR" |
83 | debug-print "$FUNCNAME: now DIR=$DIR" |
| 84 | |
84 | |
| 85 | if [ "$ECVS_SERVER" == "offline" ]; then |
85 | if [ "$ECVS_SERVER" == "offline" ]; then |
| 86 | # we're not required to fetch anything, the module already exists and shouldn't be updated |
86 | # we're not required to fetch anything, the module already exists and shouldn't be updated |
| 87 | if [ -d "$DIR" ]; then |
87 | if [ -d "$DIR" ]; then |
| 88 | debug-print "$FUNCNAME: offline mode, exiting" |
88 | debug-print "$FUNCNAME: offline mode, exiting" |
| 89 | return 0 |
89 | return 0 |
| 90 | else |
90 | else |
| 91 | einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting." |
91 | einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting." |
| 92 | debug-print "$FUNCNAME: offline mode specified but module/subdir not found, exiting with error" |
92 | debug-print "$FUNCNAME: offline mode specified but module/subdir not found, exiting with error" |
| 93 | return 1 |
93 | return 1 |
| 94 | fi |
94 | fi |
| 95 | fi |
95 | fi |
| 96 | |
96 | |
| 97 | # create target directory as needed |
97 | # create target directory as needed |
| 98 | if [ ! -d "$DIR" ]; then |
98 | if [ ! -d "$DIR" ]; then |
| 99 | debug-print "$FUNCNAME: creating cvs directory $DIR" |
99 | debug-print "$FUNCNAME: creating cvs directory $DIR" |
| … | |
… | |
| 123 | # prepare a cvspass file just for this session so that cvs thinks we're logged |
123 | # prepare a cvspass file just for this session so that cvs thinks we're logged |
| 124 | # in at the cvs server. we don't want to mess with ~/.cvspass. |
124 | # in at the cvs server. we don't want to mess with ~/.cvspass. |
| 125 | echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass |
125 | echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass |
| 126 | export CVS_PASSFILE="${T}/cvspass" |
126 | export CVS_PASSFILE="${T}/cvspass" |
| 127 | #export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER} |
127 | #export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER} |
| 128 | |
128 | |
| 129 | # Note: cvs update and checkout commands are unified. |
129 | # Note: cvs update and checkout commands are unified. |
| 130 | # we make sure a CVS/ dir exists in our module subdir with the right |
130 | # we make sure a CVS/ dir exists in our module subdir with the right |
| 131 | # Root and Repository entries in it and cvs update. |
131 | # Root and Repository entries in it and cvs update. |
| 132 | |
132 | |
| 133 | newserver=":pserver:${ECVS_USER}@${ECVS_SERVER}" |
133 | newserver=":pserver:${ECVS_USER}@${ECVS_SERVER}" |
| … | |
… | |
| 201 | |
201 | |
| 202 | } |
202 | } |
| 203 | |
203 | |
| 204 | cvs_src_unpack() { |
204 | cvs_src_unpack() { |
| 205 | |
205 | |
| 206 | debug-print-function $FUNCNAME $* |
206 | debug-print-function $FUNCNAME $* |
| 207 | cvs_fetch || die "died running cvs_fetch" |
207 | cvs_fetch || die "died running cvs_fetch" |
| 208 | |
208 | |
| 209 | einfo "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..." |
209 | einfo "Copying $ECVS_MODULE/$ECVS_SUBDIR from $ECVS_TOP_DIR..." |
| 210 | debug-print "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..." |
210 | debug-print "Copying module $ECVS_MODULE subdir $ECVS_SUBDIR local_mode=$ECVS_LOCAL from $ECVS_TOP_DIR..." |
|
|
211 | |
|
|
212 | # probably redundant, but best to make sure |
|
|
213 | mkdir -p $WORKDIR/$ECVS_MODULE/$ECVS_SUBDIR |
| 211 | |
214 | |
| 212 | if [ -n "$ECVS_SUBDIR" ]; then |
215 | if [ -n "$ECVS_SUBDIR" ]; then |
| 213 | mkdir -p $WORKDIR/$ECVS_MODULE/$ECVS_SUBDIR |
216 | if [ -n "$ECVS_LOCAL" ]; then |
| 214 | cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE/$ECVS_SUBDIR/* $WORKDIR/$ECVS_MODULE/$ECVS_SUBDIR/ |
217 | cp -f $ECVS_TOP_DIR/$ECVS_MODULE/$ECVS_SUBDIR/* $WORKDIR/$ECVS_MODULE/$ECVS_SUBDIR |
|
|
218 | else |
|
|
219 | cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE/$ECVS_SUBDIR $WORKDIR/$ECVS_MODULE/$ECVS_SUBDIR/.. |
|
|
220 | fi |
| 215 | else |
221 | else |
| 216 | if [ -n "$ECVS_LOCAL" ]; then |
222 | if [ -n "$ECVS_LOCAL" ]; then |
| 217 | cp -f $ECVS_TOP_DIR/$ECVS_MODULE/* $WORKDIR/$ECVS_MODULE |
223 | cp -f $ECVS_TOP_DIR/$ECVS_MODULE/* $WORKDIR/$ECVS_MODULE |
| 218 | else |
224 | else |
| 219 | cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE $WORKDIR |
225 | cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE $WORKDIR |
| … | |
… | |
| 226 | if [ "`ls -A $DIR`" == "CVS" ]; then |
232 | if [ "`ls -A $DIR`" == "CVS" ]; then |
| 227 | debug-print "$FUNCNAME: removing cvs-empty directory $ECVS_MODULE/$ECVS_SUBDIR" |
233 | debug-print "$FUNCNAME: removing cvs-empty directory $ECVS_MODULE/$ECVS_SUBDIR" |
| 228 | rm -rf $DIR |
234 | rm -rf $DIR |
| 229 | fi |
235 | fi |
| 230 | |
236 | |
| 231 | # implement some of base_src_unpack's functionality; |
237 | # implement some of base_src_unpack's functionality; |
| 232 | # note however that base.eclass may not have been inherited! |
238 | # note however that base.eclass may not have been inherited! |
| 233 | if [ -n "$PATCHES" ]; then |
239 | if [ -n "$PATCHES" ]; then |
| 234 | debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" |
240 | debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" |
| 235 | cd $S |
241 | cd $S |
| 236 | for x in $PATCHES; do |
242 | for x in $PATCHES; do |
| 237 | debug-print "patching from $x" |
243 | debug-print "patching from $x" |
| 238 | patch -p0 < $x |
244 | patch -p0 < $x |
| 239 | done |
245 | done |
| 240 | # make sure we don't try to apply patches more than once, since |
246 | # make sure we don't try to apply patches more than once, since |
| 241 | # cvs_src_unpack is usually called several times from e.g. kde-source_src_unpack |
247 | # cvs_src_unpack is usually called several times from e.g. kde-source_src_unpack |
| 242 | export PATCHES="" |
248 | export PATCHES="" |
| 243 | fi |
249 | fi |
| 244 | |
250 | |
| 245 | } |
251 | } |
| 246 | |
252 | |
| 247 | EXPORT_FUNCTIONS src_unpack |
253 | EXPORT_FUNCTIONS src_unpack |
| 248 | |
|
|
| 249 | |
|
|