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