ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/COMP/CMSDIST/cms-cvs-utils.spec
(Generate patch)

Comparing COMP/CMSDIST/cms-cvs-utils.spec (file contents):
Revision 1.1 by eulisse, Thu Jun 22 15:03:45 2006 UTC vs.
Revision 1.14 by elmer, Tue May 1 11:31:21 2007 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines