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

Contents of /eclass/cvs.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations) (download)
Thu Jul 18 17:37:32 2002 UTC (12 years, 2 months ago) by danarmak
Branch: MAIN
Changes since 1.3: +1 -10 lines
fix handling of modules that don't have an admin/ subdir and have to use the one from kde-common, like kdenetwork

1 danarmak 1.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 danarmak 1.4 # $Header: /home/cvsroot/gentoo-x86/eclass/cvs.eclass,v 1.3 2002/07/18 14:07:15 danarmak Exp $
5 danarmak 1.1 # 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 danarmak 1.3 if [ ! -d "$ECVS_TOP_DIR" ]; then
63     addwrite $ECVS_TOP_DIR/..
64     mkdir -p $ECVS_TOP_DIR
65     adddeny $ECVS_TOP_DIR/..
66     fi
67 danarmak 1.1 addread ${ECVS_TOP_DIR}
68     addwrite ${ECVS_TOP_DIR}
69    
70     # prepare a cvspass file just for this session so that cvs thinks we're logged
71     # in at the cvs server. we don't want to mess with ~/.cvspass.
72     echo ":pserver:${ECVS_SERVER} A" > ${T}/cvspass
73     export CVS_PASSFILE="${T}/cvspass"
74    
75     cd $ECVS_TOP_DIR
76    
77     if [ -z "$ECVS_SERVER" ]; then
78     # we're not required to fetch anything, the module already exists and shouldn't be updated
79     if [ -d "$ECVS_MODULE" ]; then
80     debug-print "$FUNCNAME: offline mode, exiting"
81     return 0
82     else
83     einfo "ERROR: Offline mode specified, but module not found. Aborting."
84     debug-print "$FUNCNAME: offline mode specified but module not found, exiting with error"
85     return 1
86     fi
87     fi
88    
89     if [ -d "${ECVS_MODULE}" ]; then
90     #update existing module
91    
92     cd ${ECVS_MODULE}
93    
94     # Switch servers if needed
95     # cvs keeps the server info in th CVS/Root file in every checked-out dir;
96     # we can fix those files to point to the new server
97     newserver=":pserver:anonymous@${ECVS_SERVER}"
98     oldserver="`cat CVS/Root`"
99     if [ "$newserver" != "$oldserver" ]; then
100    
101     einfo "Changing CVS server from $oldserver to $newserver:"
102     debug-print "$FUNCNAME: Changing CVS server from $oldserver to $newserver:"
103    
104     einfo "Searching for CVS dirs..."
105     cvsdirs="`find . -iname CVS -print`"
106     debug-print "$FUNCNAME: CVS dirs found:"
107     debug-print "$cvsdirs"
108    
109     einfo "Modifying CVS dirs..."
110     for x in $cvsdirs; do
111     debug-print "In $x"
112     echo $newserver > $x/Root
113     done
114    
115     fi
116    
117     debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND update with $ECVS_SERVER for module $ECVS_MODULE"
118     einfo "Running $ECVS_CVS_COMMAND update with $ECVS_SERVER for module $ECVS_MODULE..."
119     $ECVS_CVS_COMMAND update -dP || die "died running cvs update"
120    
121     else
122     # checkout module
123    
124     export CVSROOT=:pserver:${ECVS_USER}@${ECVS_SERVER}
125     debug-print "$FUNCNAME: running $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE with $CVSROOT..."
126     einfo "Running $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE with $CVSROOT..."
127     $ECVS_CVS_COMMAND checkout -P $ECVS_MODULE || die "died running cvs checkout"
128    
129     fi
130    
131     }
132    
133     cvs_src_unpack() {
134    
135     debug-print-function $FUNCNAME $*
136     cvs_fetch || die "died running cvs_fetch"
137    
138     einfo "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
139     debug-print "Copying module $ECVS_MODULE from $ECVS_TOP_DIR..."
140     # the reason this lives here and not in kde-source_src_unpack
141     # is that in the future after copying the sources we might need to
142     # delete them, so this has to be self-contained
143     cp -Rf ${ECVS_TOP_DIR}/${ECVS_MODULE} $WORKDIR
144    
145     }
146    
147     EXPORT_FUNCTIONS src_unpack

  ViewVC Help
Powered by ViewVC 1.1.20