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