ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-cvs-utils.spec
Revision: 1.11
Committed: Wed Dec 6 22:38:06 2006 UTC (18 years, 4 months ago) by eulisse
Branch: MAIN
Changes since 1.10: +5 -1 lines
Log Message:
Update so that repository name is now case insensitive (apart from CMSSW).

File Contents

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