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.4 by eulisse, Tue Jul 18 10:19:31 2006 UTC vs.
Revision 1.11 by eulisse, Wed Dec 6 22:38:06 2006 UTC

# Line 1 | Line 1
1   ### RPM cms cms-cvs-utils 1.0
2 < ## INITENV ALIAS_SH project source projch.sh
3 < ## INITENV ALIAS_SH cmscvsroot source cmscvsroot.sh
4 < ## INITENV ALIAS_CSH project source projch.csh
5 < ## INITENV ALIAS_CSH cmscvsroot source cmscvsroot.csh
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 28 | Line 29 | fi
29   export VERSIO
30   #CVS STUFF
31   cvsbase=":kserver:cmscvs.cern.ch:/cvs_server/repositories"
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}/$1"; export CVSROOT
44  
45   #SRT STUFF
# Line 55 | 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 + 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}/$argv[1]"
78  
79   #SRT STUFF
# Line 75 | Line 93 | else
93  
94   #CVS STUFF
95   cvsbase=":pserver:anonymous@cmscvs.cern.ch:/cvs_server/repositories"
96 + 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   CVSROOT="${cvsbase}/$1"; export CVSROOT
106  
107   fi
# Line 89 | Line 116 | else
116  
117   #CVS Stuff
118   set cvsbase = ":pserver:anonymous@cmscvs.cern.ch:/cvs_server/repositories"
119 + if ( $argv[1] != "CMSSW" ) then
120 +    set cvsbase=":pserver:anonymous@isscvs.cern.ch/local/reps"
121 + endif
122   setenv CVSROOT "${cvsbase}/$argv[1]"
123  
124   endif
125   EOF_CMSCVSROOT_CSH
126  
127 + cat << \EOF_CLCOMMIT > %i/bin/clcommit.sh
128 + #! /bin/sh
129 +
130 + # 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 + EOF_CLCOMMIT
394 +
395   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 + chmod +x %i/bin/clcommit.sh
400  
401   ln -sf %i/etc/profile.d/init.sh %instroot/%cmsplatf/etc/profile.d/S00cms-cvs-utils.sh
402   ln -sf %i/etc/profile.d/init.csh %instroot/%cmsplatf/etc/profile.d/S00cms-cvs-utils.csh
# Line 108 | Line 407 | ln -sf %i/etc/profile.d/init.csh %instro
407   %instroot/%cmsplatf/etc/profile.d/S00cms-cvs-utils.csh
408  
409   %post
410 + 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   ln -sf $RPM_INSTALL_PREFIX/%pkgrel/etc/profile.d/init.sh $RPM_INSTALL_PREFIX/%cmsplatf/etc/profile.d/S00cms-cvs-utils.sh
413   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