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

Diff of /eclass/cvs.eclass

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

Revision 1.16 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.16 2002/09/08 21:23:03 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 addwrite $ECVS_TOP_DIR
86 [ ! -d $ECVS_TOP_DIR -a ! -L $ECVS_TOP_DIR ] && mkdir -p $ECVS_TOP_DIR
87 cd -P $ECVS_TOP_DIR
88 ECVS_TOP_DIR="`pwd`"
89 cd $OLDPWD
90 fi
91
92 # a shorthand 81 # a shorthand
93 [ -n "$ECVS_SUBDIR" ] && DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}/${ECVS_SUBDIR}" || \
94 DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}" 82 DIR="${ECVS_TOP_DIR}/${ECVS_MODULE}/${ECVS_SUBDIR}"
95 83
96 [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l"
97
98 addread $DIR
99
100 if [ "$ECVS_SERVER" == "offline" ]; then 84 if [ "$ECVS_SERVER" == "offline" ]; then
101 # 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
102 if [ -d "$DIR" ]; then 86 if [ -d "$DIR" ]; then
103 debug-print "$FUNCNAME: offline mode, exiting" 87 debug-print "$FUNCNAME: offline mode, exiting"
104 return 0 88 return 0
106 einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting." 90 einfo "ERROR: Offline mode specified, but module/subdir not found. Aborting."
107 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"
108 return 1 92 return 1
109 fi 93 fi
110 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
111 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
112 # disable the sandbox for this dir 112 # disable the sandbox for this dir
113 # not just $DIR because we want to create moduletopdir/CVS too 113 # not just $DIR because we want to create moduletopdir/CVS too
114 addwrite $ECVS_TOP_DIR/$ECVS_MODULE 114 addwrite $ECVS_TOP_DIR/$ECVS_MODULE
115
116 if [ ! -d "$DIR" ]; then
117 debug-print "$FUNCNAME: creating cvs directory $DIR"
118 einfo "Creating directory $DIR"
119 export SANDBOX_WRITE="$SANDBOX_WRITE:/foo:/"
120 mkdir -p /$DIR
121 export SANDBOX_WRITE=${SANDBOX_WRITE//:\/foo:\/}
122 fi
123 115
116 # add option for local (non-recursive) fetching
117 [ -n "$ECVS_LOCAL" ] && ECVS_CVS_OPTIONS="$ECVS_CVS_OPTIONS -l"
118
124 # 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
125 # 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.
126 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass 121 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass
127 export CVS_PASSFILE="${T}/cvspass" 122 export CVS_PASSFILE="${T}/cvspass"
128 #export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER} 123 #export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER}
139 else 134 else
140 repository="${ECVS_MODULE}" 135 repository="${ECVS_MODULE}"
141 fi 136 fi
142 137
143 debug-print "$FUNCNAME: Root<-$newserver, Repository<-$repository" 138 debug-print "$FUNCNAME: Root<-$newserver, Repository<-$repository"
144 139
145 cd $DIR 140 cd /$DIR
141
146 if [ ! -d "$DIR/CVS" ]; then 142 if [ ! -d "$DIR/CVS" ]; then
147 # create a new CVS/ directory (checkout) 143 # create a new CVS/ directory (checkout)
148 debug-print "$FUNCNAME: creating new cvs directory" 144 debug-print "$FUNCNAME: creating new cvs directory"
149 145
150 mkdir CVS 146 mkdir CVS

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

  ViewVC Help
Powered by ViewVC 1.1.20