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

Diff of /eclass/cvs.eclass

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

Revision 1.8 Revision 1.12
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.8 2002/08/02 09:44:35 danarmak Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.12 2002/08/18 23:54:59 danarmak Exp $
5# This eclass provides the generic cvs fetching functions. 5# This eclass provides the generic cvs fetching functions.
6 6
7ECLASS=cvs 7ECLASS=cvs
8INHERITED="$INHERITED $ECLASS" 8INHERITED="$INHERITED $ECLASS"
9 9
26#[ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l" 26#[ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l"
27 27
28# Where the cvs modules are stored/accessed 28# Where the cvs modules are stored/accessed
29[ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="/usr/src" 29[ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="/usr/src"
30 30
31# Name of cvs server, set to "" to disable fetching 31# Name of cvs server, set to "offline" to disable fetching
32# (i.e. to assume module is checked out already and don't update it). 32# (i.e. to assume module is checked out already and don't update it).
33# Format is server:/dir e.g. "anoncvs.kde.org:/home/kde". remove the other 33# Format is server:/dir e.g. "anoncvs.kde.org:/home/kde". remove the other
34# parts of the full CVSROOT (which looks like 34# parts of the full CVSROOT (which looks like
35# ":pserver:anonymous@anoncvs.kde.org:/home/kde"); these are added from 35# ":pserver:anonymous@anoncvs.kde.org:/home/kde"); these are added from
36# other settings 36# other settings
37[ -z "$ECVS_SERVER" ] && ECVS_SERVER="" 37[ -z "$ECVS_SERVER" ] && ECVS_SERVER="offline"
38 38
39# Username to use 39# Username to use
40[ -z "$ECVS_USER" ] && ECVS_USER="anonymous" 40[ -z "$ECVS_USER" ] && ECVS_USER="anonymous"
41 41
42# Password to use (NOT (YET) SUPPORTED, because cvs doesn't store passwords in plaintext in .cvspass) 42# Password to use (NOT (YET) SUPPORTED, because cvs doesn't store passwords in plaintext in .cvspass)
43[ -z "$ECVS_PASS" ] && ECVS_PASS="" 43[ -z "$ECVS_PASS" ] && ECVS_PASS=""
44 44
45# Module to be fetched, must be set explicitly - 45# Module to be fetched, must be set explicitly -
46# I don't like the former ="$NP" default setting 46# I don't like the former ="$PN" default setting
47[ -z "$ECVS_MODULE" ] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue" 47[ -z "$ECVS_MODULE" ] && debug-print "$ECLASS: error: ECVS_MODULE not set, cannot continue"
48 48
49# Subdirectory in module to be fetched, default is not defined = whole module 49# Subdirectory in module to be fetched, default is not defined = whole module
50# DO NOT set default to "", if it's defined at all code will break! 50# DO NOT set default to "", if it's defined at all code will break!
51# don't uncomment following line! 51# don't uncomment following line!
52#[ -z "$ECVS_MODULE_SUBDIR" ] && ECVS_MODULE_SUBDIR="" 52#[ -z "$ECVS_MODULE_SUBDIR" ] && ECVS_MODULE_SUBDIR=""
80 80
81 [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l" 81 [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l"
82 82
83 addread $DIR 83 addread $DIR
84 84
85 if [ -z "$ECVS_SERVER" ]; 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
100 addwrite $ECVS_TOP_DIR/$ECVS_MODULE 100 addwrite $ECVS_TOP_DIR/$ECVS_MODULE
101 101
102 if [ ! -d "$DIR" ]; then 102 if [ ! -d "$DIR" ]; then
103 debug-print "$FUNCNAME: creating cvs directory $DIR" 103 debug-print "$FUNCNAME: creating cvs directory $DIR"
104 einfo "Creating directory $DIR" 104 einfo "Creating directory $DIR"
105 export SANDBOX_WRITE="$SANDBOX_WRITE:/foo:/"
105 mkdir -p /$DIR 106 mkdir -p /$DIR
107 export SANDBOX_WRITE=${SANDBOX_WRITE//:\/foo:\/}
106 fi 108 fi
107 109
108 # prepare a cvspass file just for this session so that cvs thinks we're logged 110 # prepare a cvspass file just for this session so that cvs thinks we're logged
109 # in at the cvs server. we don't want to mess with ~/.cvspass. 111 # in at the cvs server. we don't want to mess with ~/.cvspass.
110 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass 112 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass
187 189
188 einfo "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..." 190 einfo "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
189 debug-print "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..." 191 debug-print "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
190 192
191 if [ -n "$ECVS_SUBDIR" ]; then 193 if [ -n "$ECVS_SUBDIR" ]; then
192 mkdir $WORKDIR/$ECVS_MODULE 194 mkdir -p $WORKDIR/$ECVS_MODULE/$ECVS_SUBDIR
193 cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE/$ECVS_SUBDIR $WORKDIR/$ECVS_MODULE 195 cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE/$ECVS_SUBDIR/* $WORKDIR/$ECVS_MODULE/$ECVS_SUBDIR/
194 else 196 else
195 if [ -n "$ECVS_LOCAL" ]; then 197 if [ -n "$ECVS_LOCAL" ]; then
196 cp -f $ECVS_TOP_DIR/$ECVS_MODULE/* $WORKDIR/$ECVS_MODULE 198 cp -f $ECVS_TOP_DIR/$ECVS_MODULE/* $WORKDIR/$ECVS_MODULE
197 else 199 else
198 cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE $WORKDIR 200 cp -Rf $ECVS_TOP_DIR/$ECVS_MODULE $WORKDIR
199 fi 201 fi
200 fi 202 fi
201 203
204 # if the directory is empty, remove it; empty directories cannot exist in cvs.
205 # this happens when fex. kde-source requests module/doc/subdir which doesn't exist.
206 # still create the empty directory in workdir though.
207 if [ "`ls -A $DIR`" == "CVS" ]; then
208 debug-print "$FUNCNAME: removing cvs-empty directory $ECVS_MODULE/$ECVS_SUBDIR"
209 rm -rf $DIR
210 fi
211
202 # implement some of base_src_unpack's functionality; 212 # implement some of base_src_unpack's functionality;
203 # note however that base.eclass may not have been inherited! 213 # note however that base.eclass may not have been inherited!
204 if [ -n "$PATCHES" ]; then 214 if [ -n "$PATCHES" ]; then
205 debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching" 215 debug-print "$FUNCNAME: PATCHES=$PATCHES, S=$S, autopatching"
206 cd $S 216 cd $S
207 for x in $PATCHES; do 217 for x in $PATCHES; do
208 debug-print "patching from $x" 218 debug-print "patching from $x"
209 patch -p0 < $x 219 patch -p0 < $x
210 done 220 done
221 # make sure we don't try to apply patches more than once, since
222 # cvs_src_unpack is usually called several times from e.g. kde-source_src_unpack
223 export PATCHES=""
211 fi 224 fi
212 225
213} 226}
214 227
215EXPORT_FUNCTIONS src_unpack 228EXPORT_FUNCTIONS src_unpack

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.12

  ViewVC Help
Powered by ViewVC 1.1.20