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

Contents of /eclass/cvs.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Wed Jul 17 20:25:16 2002 UTC (12 years, 5 months ago) by danarmak
Branch: MAIN
changes and eclasses for upcomnig kde cvs ebuilds. they won't live in portage but there's no reason for the eclasses not to live here, makes it much more comfortable

1 # Copyright 1999-2000 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License, v2 or later
3 # Author Dan Armak <danarmak@gentoo.org>
4 # $Header: /home/cvsroot/gentoo-x86/eclass/kde-dist.eclass,v 1.6 2001/12/23 21:35:15 danarmak Exp $
5 # This eclass provides the generic cvs fetching functions.
6
7 ECLASS=cvs
8 INHERITED="$INHERITED $ECLASS"
9
10 # You shouldn't change these settings yourself! The ebuild/eclass inheriting this eclass
11 # will take care of that. If you want to set the global KDE cvs ebuilds' settings,
12 # see the comments in kde-source.eclass.
13
14 # --- begin ebuild-configurable settings
15
16 # cvs command to run. you can set fex. "cvs -t" for extensive debug information
17 # on the cvs onnection. the default of "cvs -q -f -z4" means to be quiet, to disregard
18 # the ~/.cvsrc config file and to use maximum compression.
19 [ -z "$ECVS_CVS_COMMAND" ] && ECVS_CVS_COMMAND="cvs -q -f -z4"
20
21 # Where the cvs modules are stored/accessed
22 [ -z "$ECVS_TOP_DIR" ] && ECVS_TOP_DIR="/usr/src"
23
24 # Name of cvs server, set to "" to disable fetching
25 # (i.e. to assume module is checked out already and don't update it).
26 # Format is server:/dir e.g. "anoncvs.kde.org:/home/kde". remove the other
27 # parts of the full CVSROOT (which looks like
28 # ":pserver:anonymous@anoncvs.kde.org:/home/kde"); these are added from
29 # other settings
30 [ -z "$ECVS_SERVER" ] && ECVS_SERVER=""
31
32 # Username to use
33 [ -z "$ECVS_USER" ] && ECVS_USER="anonymous"
34
35 # Password to use (NOT (YET) SUPPORTED, because cvs doesn't store passwords in plaintext in .cvspass)
36 [ -z "$ECVS_PASS" ] && ECVS_PASS=""
37
38 # Module to be fetched, must be set explicitly -
39 # I don't like the former ="$NP" default setting
40 [ -z "$ECVS_MODULE" ] && die "$ECLASS: error: ECVS_MODULE not set, cannot continue"
41
42 # Subdirectory in module to be fetched, default is root "/" = whole module (NOT YET IMPLEMENTED)
43 [ -z "$ECVS_MODULE_SUBDIR" ] && ECVS_MODULE_SUBDIR="/"
44
45 # --- end ebuild-configurable settings ---
46
47 debug-print "$ECLASS: init: ECVS_CVS_COMMAND=$ECVS_CVS_COMMAND
48 ECVS_TOP_DIR=$ECVS_TOP_DIR
49 ECVS_SERVER=$ECVS_SERVER
50 ECVS_USER=$ECVS_USER
51 ECVS_PASS=$ECVS_PASS
52 ECS_MODULE=$ECVS_MODULE
53 ECVS_MODULE_SUBDIR=$ECVS_MODULE_SUBDIR"
54
55 # since we now longer have src_fetch as a redefinable ebuild function,
56 # we are forced to call this function from cvs_src_unpack
57 cvs_fetch() {
58
59 debug-print-function $FUNCNAME $*
60
61 # disable the sandbox for this dir
62 addread ${ECVS_TOP_DIR}
63 addwrite ${ECVS_TOP_DIR}
64
65 # prepare a cvspass file just for this session so that cvs thinks we're logged
66 # in at the cvs server. we don't want to mess with ~/.cvspass.
67 echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass
68 export CVS_PASSFILE="${T}/cvspass"
69
70 cd $ECVS_TOP_DIR
71
72 if [ -z "$ECVS_SERVER" ]; then
73 # we're not required to fetch anything, the module already exists and shouldn't be updated
74 if [ -d "$ECVS_MODULE" ]; then
75 debug-print "$FUNCNAME: offline mode, exiting"
76 return 0
77 else
78 einfo "ERROR: Offline mode specified, but module not found. Aborting."
79 debug-print "$FUNCNAME: offline mode specified but module not found, exiting with error"
80 return 1
81 fi
82 fi
83
84 if [ -d "${ECVS_MODULE}" ]; then
85 #update existing module
86
87 cd ${ECVS_MODULE}
88
89 # Switch servers if needed
90 # cvs keeps the server info in th CVS/Root file in every checked-out dir;
91 # we can fix those files to point to the new server
92 newserver=":pserver:anonymous@${ECVS_SERVER}"
93 oldserver="`cat CVS/Root`"
94 if [ "$newserver" != "$oldserver" ]; then
95
96 einfo "Changing CVS server from $oldserver to $newserver:"
97 debug-print "$FUNCNAME: Changing CVS server from $oldserver to $newserver:"
98
99 einfo "Searching for CVS dirs..."
100 cvsdirs="`find . -iname CVS -print`"
101 debug-print "$FUNCNAME: CVS dirs found:"
102 debug-print "$cvsdirs"
103
104 einfo "Modifying CVS dirs..."
105 for x in $cvsdirs; do
106 debug-print "In $x"
107 echo $newserver > $x/Root
108 done
109
110 fi
111
112 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update with $ECVS_SERVER for module $ECVS_MODULE"
113 einfo "Running $ECVS_CVS_COMMAND update with $ECVS_SERVER for module $ECVS_MODULE..."
114 $ECVS_CVS_COMMAND update -dP || die "died running cvs update"
115
116 else
117 # checkout module
118
119 export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER}
120 debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE with $CVSROOT..."
121 einfo "Running $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE with $CVSROOT..."
122 $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE || die "died running cvs checkout"
123
124 fi
125
126 }
127
128 cvs_src_unpack() {
129
130 debug-print-function $FUNCNAME $*
131 cvs_fetch || die "died running cvs_fetch"
132
133 einfo "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
134 debug-print "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
135 # the reason this lives here and not in kde-source_src_unpack
136 # is that in the future after copying the sources we might need to
137 # delete them, so this has to be self-contained
138 cp -Rf ${ECVS_TOP_DIR}/${ECVS_MODULE} $WORKDIR
139
140 # typically for kde cvs, the admin subdir lives in the kde-common module
141 # which is also needed
142 if [ ! -d "${WORKDIR}/${ECVS_MODULE}/admin" ]; then
143 ECVS_MODULE="kde-common" cvs_fetch
144 einfo "Copying admin/ subdir from module kde-common, $ECVS_TOP_DIR..."
145 debug-print "Copying admin/ subdir from module kde-common, $ECVS_TOP_DIR..."
146 cp -Rf ${ECVS_TOP_DIR}/${ECVS_MODULE} $WORKDIR
147 fi
148
149 }
150
151 EXPORT_FUNCTIONS src_unpack

  ViewVC Help
Powered by ViewVC 1.1.20