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

Diff of /eclass/cvs.eclass

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

Revision 1.17 Revision 1.18
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.17 2002/09/10 16:59:26 danarmak Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.18 2002/09/15 14:15:54 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
51[ -z "$ECVS_BRANCH" ] && ECVS_BRANCH="HEAD" 51[ -z "$ECVS_BRANCH" ] && ECVS_BRANCH="HEAD"
52 52
53# Subdirectory in module to be fetched, default is not defined = whole module 53# Subdirectory in module to be fetched, default is not defined = whole module
54# DO NOT set default to "", if it's defined at all code will break! 54# DO NOT set default to "", if it's defined at all code will break!
55# don't uncomment following line! 55# don't uncomment following line!
56#[ -z "$ECVS_MODULE_SUBDIR" ] && ECVS_MODULE_SUBDIR="" 56#[ -z "$ECVS_SUBDIR" ] && ECVS_SUBDIR=""
57 57
58# --- end ebuild-configurable settings --- 58# --- end ebuild-configurable settings ---
59 59
60# add cvs to deps 60# add cvs to deps
61DEPEND="$DEPEND dev-util/cvs" 61DEPEND="$DEPEND dev-util/cvs"
72ECVS_TOP_DIR=$ECVS_TOP_DIR 72ECVS_TOP_DIR=$ECVS_TOP_DIR
73ECVS_SERVER=$ECVS_SERVER 73ECVS_SERVER=$ECVS_SERVER
74ECVS_USER=$ECVS_USER 74ECVS_USER=$ECVS_USER
75ECVS_PASS=$ECVS_PASS 75ECVS_PASS=$ECVS_PASS
76ECS_MODULE=$ECVS_MODULE 76ECS_MODULE=$ECVS_MODULE
77ECVS_MODULE_SUBDIR=$ECVS_SUBDIR 77ECVS_SUBDIR=$ECVS_SUBDIR
78ECVS_LOCAL=$ECVS_LOCAL 78ECVS_LOCAL=$ECVS_LOCAL
79DIR=$DIR" 79DIR=$DIR"
80 80
81 # a shorthand 81 # a shorthand
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 84
84 if [ "$ECVS_SERVER" == "offline" ]; then 85 if [ "$ECVS_SERVER" == "offline" ]; then
85 # 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
86 if [ -d "$DIR" ]; then 87 if [ -d "$DIR" ]; then
87 debug-print "$FUNCNAME: offline mode, exiting" 88 debug-print "$FUNCNAME: offline mode, exiting"
90 einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting." 91 einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting."
91 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"
92 return 1 93 return 1
93 fi 94 fi
94 fi 95 fi
95 DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}" 96
96 # create target directory as needed 97 # create target directory as needed
97 if [ ! -d "$DIR" ]; then 98 if [ ! -d "$DIR" ]; then
98 debug-print "$FUNCNAME: creating cvs directory $DIR" 99 debug-print "$FUNCNAME: creating cvs directory $DIR"
99 #export SANDBOX_WRITE="$SANDBOX_WRITE:/foobar:/" 100 #export SANDBOX_WRITE="$SANDBOX_WRITE:/foobar:/"
100 addwrite /foobar 101 addwrite /foobar
105 106
106 # in case ECVS_TOP_DIR is a symlink to a dir, get the real dir's path, 107 # in case ECVS_TOP_DIR is a symlink to a dir, get the real dir's path,
107 # otherwise addwrite() doesn't work. 108 # otherwise addwrite() doesn't work.
108 cd -P $ECVS_TOP_DIR > /dev/null 109 cd -P $ECVS_TOP_DIR > /dev/null
109 ECVS_TOP_DIR="`/bin/pwd`" 110 ECVS_TOP_DIR="`/bin/pwd`"
111 DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}/${ECVS_SUBDIR}"
110 cd $OLDPWD 112 cd $OLDPWD
113
114 debug-print "$FUNCNAME: now DIR=$DIR"
111 115
112 # disable the sandbox for this dir 116 # disable the sandbox for this dir
113 # not just $DIR because we want to create moduletopdir/CVS too 117 # not just $DIR because we want to create moduletopdir/CVS too
114 addwrite $ECVS_TOP_DIR/$ECVS_MODULE 118 addwrite $ECVS_TOP_DIR/$ECVS_MODULE
115 119
134 else 138 else
135 repository="${ECVS_MODULE}" 139 repository="${ECVS_MODULE}"
136 fi 140 fi
137 141
138 debug-print "$FUNCNAME: Root<-$newserver, Repository<-$repository" 142 debug-print "$FUNCNAME: Root<-$newserver, Repository<-$repository"
139 143 debug-print "$FUNCNAME: entering directory $DIR"
140 cd /$DIR 144 cd /$DIR
141 145
142 if [ ! -d "$DIR/CVS" ]; then 146 if [ ! -d "CVS" ]; then
143 # create a new CVS/ directory (checkout) 147 # create a new CVS/ directory (checkout)
144 debug-print "$FUNCNAME: creating new cvs directory" 148 debug-print "$FUNCNAME: creating new cvs directory"
145 149
146 mkdir CVS 150 mkdir CVS
147 echo $newserver > CVS/Root 151 echo $newserver > CVS/Root
188 # cvs auto-switches branches, how nice 192 # cvs auto-switches branches, how nice
189 # warning: if we do it this way we get multiple -rX options - harmless i think 193 # warning: if we do it this way we get multiple -rX options - harmless i think
190 [ -n "$ECVS_BRANCH" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -r$ECVS_BRANCH" 194 [ -n "$ECVS_BRANCH" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -r$ECVS_BRANCH"
191 195
192 # finally run the cvs update command 196 # finally run the cvs update command
197 debug-print "$FUNCNAME: is in dir `/bin/pwd`"
193 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for module $ECVS_MODULE subdir $ECVS_SUBDIR" 198 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for module $ECVS_MODULE subdir $ECVS_SUBDIR"
194 einfo "Running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for $ECVS_MODULE/$ECVS_SUBDIR..." 199 einfo "Running $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS with $ECVS_SERVER for $ECVS_MODULE/$ECVS_SUBDIR..."
195 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update" 200 $ECVS_CVS_COMMAND update $ECVS_CVS_OPTIONS || die "died running cvs update"
196 201
197} 202}

Legend:
Removed from v.1.17  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20