ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-cvs-utils.spec
Revision: 1.8
Committed: Tue Aug 22 16:30:54 2006 UTC (18 years, 8 months ago) by eulisse
Branch: MAIN
Changes since 1.7: +265 -0 lines
Log Message:
clcommit body added to the file.

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