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

Diff of /eclass/cvs.eclass

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

Revision 1.15 Revision 1.17
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.15 2002/09/08 21:21:06 azarah Exp $ 4# $Header: /var/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.17 2002/09/10 16:59:26 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
76ECS_MODULE=$ECVS_MODULE 76ECS_MODULE=$ECVS_MODULE
77ECVS_MODULE_SUBDIR=$ECVS_SUBDIR 77ECVS_MODULE_SUBDIR=$ECVS_SUBDIR
78ECVS_LOCAL=$ECVS_LOCAL 78ECVS_LOCAL=$ECVS_LOCAL
79DIR=$DIR" 79DIR=$DIR"
80 80
81 # if ECVS_TOP_DIR is a symlink to a dir, get the real dir's path,
82 # otherwise addwrite() doesn't work
83 if [ -n "$ECVS_TOP_DIR" ]; then
84 # create $ECVS_TOP_DIR if missing
85 [ ! -d $ECVS_TOP_DIR -a ! -L $ECVS_TOP_DIR ] && mkdir -p $ECVS_TOP_DIR
86 cd -P $ECVS_TOP_DIR
87 ECVS_TOP_DIR="`pwd`"
88 cd $OLDPWD
89 fi
90
91 # a shorthand 81 # a shorthand
92 [ -n "$ECVS_SUBDIR" ] && DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}/${ECVS_SUBDIR}" || \
93 DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}" 82 DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}/${ECVS_SUBDIR}"
94 83
95 [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l"
96
97 addread $DIR
98
99 if [ "$ECVS_SERVER" == "offline" ]; then 84 if [ "$ECVS_SERVER" == "offline" ]; then
100 # we're not required to fetch anything, the module already exists and shouldn't be updated 85 # we're not required to fetch anything, the module already exists and shouldn't be updated
101 if [ -d "$DIR" ]; then 86 if [ -d "$DIR" ]; then
102 debug-print "$FUNCNAME: offline mode, exiting" 87 debug-print "$FUNCNAME: offline mode, exiting"
103 return 0 88 return 0
105 einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting." 90 einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting."
106 debug-print "$FUNCNAME: offline mode specified but module/subdir not found, exiting with error" 91 debug-print "$FUNCNAME: offline mode specified but module/subdir not found, exiting with error"
107 return 1 92 return 1
108 fi 93 fi
109 fi 94 fi
95 DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}"
96 # create target directory as needed
97 if [ ! -d "$DIR" ]; then
98 debug-print "$FUNCNAME: creating cvs directory $DIR"
99 #export SANDBOX_WRITE="$SANDBOX_WRITE:/foobar:/"
100 addwrite /foobar
101 addwrite /
102 mkdir -p /$DIR
103 export SANDBOX_WRITE=${SANDBOX_WRITE//:\/foobar:\/}
104 fi
110 105
106 # in case ECVS_TOP_DIR is a symlink to a dir, get the real dir's path,
107 # otherwise addwrite() doesn't work.
108 cd -P $ECVS_TOP_DIR > /dev/null
109 ECVS_TOP_DIR="`/bin/pwd`"
110 cd $OLDPWD
111
111 # disable the sandbox for this dir 112 # disable the sandbox for this dir
112 # not just $DIR because we want to create moduletopdir/CVS too 113 # not just $DIR because we want to create moduletopdir/CVS too
113 addwrite $ECVS_TOP_DIR/$ECVS_MODULE 114 addwrite $ECVS_TOP_DIR/$ECVS_MODULE
114
115 if [ ! -d "$DIR" ]; then
116 debug-print "$FUNCNAME: creating cvs directory $DIR"
117 einfo "Creating directory $DIR"
118 export SANDBOX_WRITE="$SANDBOX_WRITE:/foo:/"
119 mkdir -p /$DIR
120 export SANDBOX_WRITE=${SANDBOX_WRITE//:\/foo:\/}
121 fi
122 115
116 # add option for local (non-recursive) fetching
117 [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l"
118
123 # prepare a cvspass file just for this session so that cvs thinks we're logged 119 # 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. 120 # in at the cvs server. we don't want to mess with ~/.cvspass.
125 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass 121 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass
126 export CVS_PASSFILE="${T}/cvspass" 122 export CVS_PASSFILE="${T}/cvspass"
127 #export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER} 123 #export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER}
138 else 134 else
139 repository="${ECVS_MODULE}" 135 repository="${ECVS_MODULE}"
140 fi 136 fi
141 137
142 debug-print "$FUNCNAME: Root<-$newserver, Repository<-$repository" 138 debug-print "$FUNCNAME: Root<-$newserver, Repository<-$repository"
143 139
144 cd $DIR 140 cd /$DIR
141
145 if [ ! -d "$DIR/CVS" ]; then 142 if [ ! -d "$DIR/CVS" ]; then
146 # create a new CVS/ directory (checkout) 143 # create a new CVS/ directory (checkout)
147 debug-print "$FUNCNAME: creating new cvs directory" 144 debug-print "$FUNCNAME: creating new cvs directory"
148 145
149 mkdir CVS 146 mkdir CVS

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

  ViewVC Help
Powered by ViewVC 1.1.20