ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-cvs-utils.spec
Revision: 1.13
Committed: Wed Apr 18 23:46:01 2007 UTC (18 years ago) by ratnik
Branch: MAIN
CVS Tags: pe20070428a-ports, pe20070423b-ports, pe20070423a-ports
Changes since 1.12: +2 -0 lines
Log Message:
Changes for building  externals in 64/32 mode: added gcc-wrapper .

File Contents

# Content
1 ### RPM cms cms-cvs-utils 1.0
2 Requires: gcc-wrapper
3 ## INITENV ALIAS_SH project source %i/bin/projch.sh
4 ## INITENV ALIAS_SH cmscvsroot source %i/bin/cmscvsroot.sh
5 ## INITENV ALIAS_CSH project source %i/bin/projch.csh
6 ## INITENV ALIAS_CSH cmscvsroot source %i/bin/cmscvsroot.csh
7 ## INITENV ALIAS clcommit %i/bin/clcommit.sh
8 Source: none
9
10 %prep
11 %build
12 ## IMPORT gcc-wrapper
13 %install
14 mkdir -p %instroot/%cmsplatf/etc/profile.d/
15 mkdir -p %i/bin
16
17 cat << \EOF_PROJCH_SH > %i/bin/projch.sh
18 # Check if theres any argument
19 #
20 if [ $# -gt 2 ]; then
21 echo "Usage : project project_name [version]";
22 else
23
24 version="current"
25 VERSIO="current"
26 if [ $# = 2 ]; then
27 version=$2
28 VERSIO=$2
29 fi
30
31 export VERSIO
32 #CVS STUFF
33 cvsbase=":kserver:cmscvs.cern.ch:/cvs_server/repositories"
34 projectname=$1
35 case $projectname in
36 CMSSW )
37 cvsbase=":kserver:cmscvs.cern.ch:/cvs_server/repositories"
38 ;;
39 * )
40 cvsbase=":kserver:isscvs.cern.ch/local/reps"
41 projectname=`echo $projectname | tr "[A-Z]" "[a-z]"`
42 ;;
43 esac
44
45 CVSROOT="${cvsbase}/$projectname"; export CVSROOT
46
47 #SRT STUFF
48 #if [ -f $CMS_PATH/OO/Software/$1/releases/$version/SoftRelTools/SRTstartup.sh ]; then
49 # BFCURRENT=$version
50 # export BFCURRENT
51 # . $CMS_PATH/OO/Software/$1/releases/$version/SoftRelTools/SRTstartup.sh
52 #fi
53 fi
54 EOF_PROJCH_SH
55
56 cat << \EOF_PROJCH_CSH > %{i}/bin/projch.csh
57 # Check if theres any argument
58 #
59 # if ( ($# > 1) | ($# < 1) ) then
60 if ( ($# > 2) | ($# < 1) ) then
61 echo "Usage : project project_name [version]"
62 else
63
64 set version="current"
65 setenv VERSIO current
66 if ( $# == 2 ) then
67 set version=$argv[2]
68 setenv VERSIO $argv[2]
69 endif
70
71 #CVS Stuff
72 set projectname = $argv[1]
73 set cvsbase = ":kserver:cmscvs.cern.ch:/cvs_server/repositories"
74 if ( $argv[1] != "CMSSW" ) then
75 set cvsbase=":kserver:isscvs.cern.ch/local/reps"
76 set projectname=`echo $projectname | tr "[A-Z]" "[a-z]"`
77 endif
78
79 setenv CVSROOT "${cvsbase}/$projectname"
80
81 #SRT STUFF
82 #if ( -f $CMS_PATH/OO/Software/$argv[1]/releases/${version}/SoftRelTools/SRTstartup.csh ) then
83 # setenv BFCURRENT $version
84 # source $CMS_PATH/OO/Software/$argv[1]/releases/${version}/SoftRelTools/SRTstartup.csh
85 #endif
86 endif
87 EOF_PROJCH_CSH
88
89 cat << \EOF_CMSCVSROOT_SH > %i/bin/cmscvsroot.sh
90 # Check if theres any argument
91 #
92 if [ $# -gt 2 ]; then
93 echo "Usage : cmscvsroot project_name";
94 else
95
96 #CVS STUFF
97 cvsbase=":pserver:anonymous@cmscvs.cern.ch:/cvs_server/repositories"
98 projectname=$1
99 case $1 in
100 CMSSW )
101 cvsbase=":pserver:anonymous@cmscvs.cern.ch:/cvs_server/repositories"
102 ;;
103 * )
104 cvsbase=":pserver:anonymous@isscvs.cern.ch/local/reps"
105 projectname=`echo $projectname | tr "[A-Z]" "[a-z]"`
106 ;;
107 esac
108
109 CVSROOT="${cvsbase}/$1"; export CVSROOT
110
111 fi
112 EOF_CMSCVSROOT_SH
113
114 cat << \EOF_CMSCVSROOT_CSH > %i/bin/cmscvsroot.csh
115 # Check if theres any argument
116 #
117 if ( ($# > 1) | ($# < 1) ) then
118 echo "Usage : cmscvsroot project_name"
119 else
120
121 #CVS Stuff
122 set projectname = $argv[1]
123 set cvsbase = ":pserver:anonymous@cmscvs.cern.ch:/cvs_server/repositories"
124 if ( $argv[1] != "CMSSW" ) then
125 set cvsbase=":pserver:anonymous@isscvs.cern.ch/local/reps"
126 set projectname=`echo $projectname | tr "[A-Z]" "[a-z]"`
127 endif
128 setenv CVSROOT "${cvsbase}/$argv[1]"
129
130 endif
131 EOF_CMSCVSROOT_CSH
132
133 cat << \EOF_CLCOMMIT > %i/bin/clcommit.sh
134 #! /bin/sh
135
136 # commit version 0.9.4
137
138 # Copyright (C) 1999, 2000, Free Software Foundation
139
140 # This script is Free Software, and it can be copied, distributed and
141 # modified as defined in the GNU General Public License. A copy of
142 # its license can be downloaded from http://www.gnu.org/copyleft/gpl.html
143
144 # Originally by Gary V. Vaughan <gvaughan@oranda.demon.co.uk>
145 # Heavily modified by Alexandre Oliva <oliva@dcc.unicamp.br>
146
147 # This scripts eases checking in changes to CVS-maintained projects
148 # with ChangeLog files. It will check that there have been no
149 # conflicting commits in the CVS repository and print which files it
150 # is going to commit to stderr. A list of files to compare and to
151 # check in can be given in the command line. If it is not given, all
152 # files in the current directory (and below, unless `-l' is given) are
153 # considered for check in.
154
155 # The commit message will be extracted from the differences between a
156 # file named ChangeLog* in the commit list, or named after -C, and the
157 # one in the repository (unless a message was specified with `-m' or
158 # `-F'). An empty message is not accepted (but a blank line is). If
159 # the message is acceptable, it will be presented for verification
160 # (and possible edition) using the $PAGER environment variable (or
161 # `more', if it is not set, or `cat', if the `-f' switch is given).
162 # If $PAGER exits successfully, the modified files (at that moment)
163 # are checked in, unless `-n' was specified, in which case nothing is
164 # checked in.
165
166 # usage: commit [-v] [-h] [-f] [-l] [-n] [-q] [-z N] [-C ChangeLog_file]
167 # [-m msg|-F msg_file] [--] [file|dir ...]
168
169 # -f --fast don't check (unless *followed* by -n), and just
170 # --force display commit message instead of running $PAGER
171 # -l --local don't descend into subdirectories
172 # -m msg --message=msg set commit message
173 # --msg=msg same as -m
174 # -F file --file=file read commit message from file
175 # -C file --changelog=file extract commit message from specified ChangeLog
176 # -n --dry-run don't commit anything
177 # -q --quiet run cvs in quiet mode
178 # -zN --compress=N set compression level (0-9, 0=none, 9=max)
179 # -v --version print version information
180 # -h,-? --help print short or long help message
181
182 name=commit
183 : ${CVS=cvs}
184 cvsopt=
185 updateopt=
186 commitopt=
187 dry_run=false
188 commit=:
189 update=:
190 log_file="${TMPDIR-/tmp}/commitlog.$$"
191
192 rm -f "$log_file"
193 trap 'rm -f "$log_file"; exit 1' 1 2 15
194
195 # this just eases exit handling
196 main_repeat=":"
197 while $main_repeat; do
198
199 repeat="test $# -gt 0"
200 while $repeat; do
201 case "$1" in
202 -f|--force|--fast)
203 update=false
204 PAGER=cat
205 shift
206 ;;
207 -l|--local)
208 updateopt="$updateopt -l"
209 commitopt="$commitopt -l"
210 shift
211 ;;
212 -m|--message|--msg)
213 if test $# = 1; then
214 echo "$name: missing argument for $1" >&2
215 break
216 fi
217 if test -f "$log_file"; then
218 echo "$name: you can have at most one of -m and -F" >&2
219 break
220 fi
221 shift
222 echo "$1" > "$log_file"
223 shift
224 ;;
225 -F|--file)
226 if test -f "$log_file"; then
227 echo "$name: you can have at most one of -m and -F" >&2
228 break
229 fi
230 if test $# = 1; then
231 echo "$name: missing argument for $1" >&2
232 break
233 fi
234 shift
235 if cat < "$1" > "$log_file"; then :; else
236 break
237 fi
238 shift
239 ;;
240 -C|--[cC]hange[lL]og)
241 if test $# = 1; then
242 echo "$name: missing argument for $1" >&2
243 break
244 fi
245 shift
246 if test ! -f "$1"; then
247 echo "$name: ChangeLog file \`$1' does not exist" >&2
248 break
249 fi
250 ChangeLog="$1"
251 ;;
252 -n|--dry-run)
253 PAGER=cat
254 commit=false
255 update=true
256 shift
257 ;;
258 -q|--quiet)
259 cvsopt="$cvsopt -q"
260 shift
261 ;;
262 -z|--compress)
263 if test $# = 1; then
264 echo "$name: missing argument for $1" >&2
265 break
266 fi
267 case "$2" in
268 [0-9]) :;;
269 *) echo "$name: invalid argument for $1" >&2
270 break
271 ;;
272 esac
273 cvsopt="$cvsopt -z$2"
274 shift
275 shift
276 ;;
277
278 -m*|-F*|-C*|-z*)
279 opt=`echo "$1" | sed '1s/^\(..\).*$/\1/;q'`
280 arg=`echo "$1" | sed '1s/^-[a-zA-Z0-9]//'`
281 shift
282 set -- "$opt" "$arg" ${1+"$@"}
283 ;;
284 --message=*|--msg=*|--file=*|--[Cc]hange[Ll]og=*|--compress=*)
285 opt=`echo "$1" | sed '1s/^\(--[^=]*\)=.*/\1/;q'`
286 arg=`echo "$1" | sed '1s/^--[^=]*=//'`
287 shift
288 set -- "$opt" "$arg" ${1+"$@"}
289 ;;
290
291 -v|--version)
292 sed '/^# '$name' version /,/^# Heavily modified by/ { s/^# //; p; }; d' < $0
293 exit 0
294 ;;
295 -\?|-h)
296 sed '/^# usage:/,/# -h/ { s/^# //; p; }; d' < $0 &&
297 echo
298 echo "run \`$name --help | more' for full usage"
299 exit 0
300 ;;
301 --help)
302 sed '/^# '$name' version /,/^[^#]/ { /^[^#]/ d; s/^# //; p; }; d' < $0
303 exit 0
304 ;;
305 --)
306 shift
307 repeat=false
308 ;;
309 -*)
310 echo "$name: invalid flag $1" >&2
311 break
312 ;;
313 *)
314 repeat=false
315 ;;
316 esac
317 done
318 # might have used break 2 within the previous loop, but so what
319 $repeat && break
320
321 $update && \
322 if echo "$name: checking for conflicts..." >&2
323 ($CVS $cvsopt -q -n update $updateopt ${1+"$@"} 2>/dev/null \
324 | while read line; do
325 echo "$line"
326 echo "$line" >&3
327 done | grep '^C') 3>&1 >/dev/null; then
328 echo "$name: some conflicts were found, aborting..." >&2
329 break
330 fi
331
332 if test ! -f "$log_file"; then
333 if test -z "$ChangeLog"; then
334 for f in ${1+"$@"}; do
335 case "$f" in
336 ChangeLog* | */ChangeLog*)
337 if test -z "$ChangeLog"; then
338 ChangeLog="$f"
339 else
340 echo "$name: multiple ChangeLog files: $ChangeLog and $f" >&2
341 break
342 fi
343 ;;
344 esac
345 done
346 fi
347
348 echo "$name: checking commit message..." >&2
349 $CVS $cvsopt diff -u ${ChangeLog-ChangeLog} \
350 | while read line; do
351 case "$line" in
352 "--- "*) :;;
353 "-"*)
354 echo "$name: *** Warning: the following line in ChangeLog diff is suspicious:" >&2
355 echo "$line" | sed 's/^.//' >&2;;
356 "+ "*)
357 echo "$name: *** Warning: lines should start with tabs, not spaces; ignoring line:" >&2
358 echo "$line" | sed 's/^.//' >&2;;
359 "+") echo;;
360 "+ "*) echo "$line";;
361 esac
362 done \
363 | sed -e 's,\+ ,,' -e '/./p' -e '/./d' -e '1d' -e '$d' > "$log_file" \
364 || break
365 # The sed script above removes "+TAB" from the beginning of a line, then
366 # deletes the first and/or the last line, when they happen to be empty
367 fi
368
369 if grep '[^ ]' < "$log_file" > /dev/null; then :; else
370 echo "$name: empty commit message, aborting" >&2
371 break
372 fi
373
374 if grep '^$' < "$log_file" > /dev/null; then
375 echo "$name: *** Warning: blank lines should not appear within a commit messages." >&2
376 echo "$name: *** They should be used to separate distinct commits." >&2
377 fi
378
379 ${PAGER-more} "$log_file" || break
380
381 sleep 1 # give the user some time for a ^C
382
383 # Do not check for empty $log_file again, even though the user might have
384 # zeroed it out. If s/he did, it was probably intentional.
385
386 if $commit; then
387 echo " $CVS $cvsopt commit $commitopt -F $log_file ${1+"$@"} || break"
388 $CVS $cvsopt commit $commitopt -F $log_file ${1+"$@"} || break
389 fi
390
391 main_repeat=false
392 done
393
394 rm -f "$log_file"
395
396 # if main_repeat was not set to `false', we failed
397 $main_repeat && exit 1
398 exit 0
399 EOF_CLCOMMIT
400
401 chmod +x %i/bin/projch.sh
402 chmod +x %i/bin/projch.csh
403 chmod +x %i/bin/cmscvsroot.sh
404 chmod +x %i/bin/cmscvsroot.csh
405 chmod +x %i/bin/clcommit.sh
406
407 ln -sf %i/etc/profile.d/init.sh %instroot/%cmsplatf/etc/profile.d/S00cms-cvs-utils.sh
408 ln -sf %i/etc/profile.d/init.csh %instroot/%cmsplatf/etc/profile.d/S00cms-cvs-utils.csh
409
410 %files
411 %i
412 %instroot/%cmsplatf/etc/profile.d/S00cms-cvs-utils.sh
413 %instroot/%cmsplatf/etc/profile.d/S00cms-cvs-utils.csh
414
415 %post
416 perl -p -i -e 's|(.*setenv.*)|#$1|' $RPM_INSTALL_PREFIX/%pkgrel/etc/profile.d/init.csh
417 perl -p -i -e 's|(.*export.*)|#$1|' $RPM_INSTALL_PREFIX/%pkgrel/etc/profile.d/init.sh
418 ln -sf $RPM_INSTALL_PREFIX/%pkgrel/etc/profile.d/init.sh $RPM_INSTALL_PREFIX/%cmsplatf/etc/profile.d/S00cms-cvs-utils.sh
419 ln -sf $RPM_INSTALL_PREFIX/%pkgrel/etc/profile.d/init.csh $RPM_INSTALL_PREFIX/%cmsplatf/etc/profile.d/S00cms-cvs-utils.csh