1 |
diff -Nur smeserver-mock-1.0.old/root/usr/bin/change-log smeserver-mock-1.0/root/usr/bin/change-log |
2 |
--- smeserver-mock-1.0.old/root/usr/bin/change-log 2018-03-10 23:38:48.000000000 -0500 |
3 |
+++ smeserver-mock-1.0/root/usr/bin/change-log 2020-05-19 00:09:55.749000000 -0400 |
4 |
@@ -22,7 +22,7 @@ |
5 |
rele=0; |
6 |
release=`cat $specfile|egrep '^%define (main_)?release'|cut -d " " -f3|cut -d% -f1`; |
7 |
if [[ ! $release ]]; then |
8 |
- release=`cat $specfile|egrep '^Release:'|cut -d " " -f2|cut -d% -f1`; |
9 |
+ release=`cat $specfile|egrep '^Release:'|cut -d ":" -f2| tr -d "[:space:]"|cut -d% -f1`; |
10 |
rele=1; |
11 |
fi |
12 |
|
13 |
@@ -31,7 +31,7 @@ |
14 |
#Version: 23 |
15 |
version=`cat $specfile|grep -i '%define version'|cut -d " " -f3|cut -d% -f1`; |
16 |
if [[ ! $version ]]; then |
17 |
- version=`cat $specfile|egrep '^Version:'|cut -d " " -f2|cut -d% -f1`; |
18 |
+ version=`cat $specfile|egrep '^Version:'|cut -d ":" -f2| tr -d "[:space:]"`; |
19 |
fi |
20 |
|
21 |
|
22 |
diff -Nur smeserver-mock-1.0.old/root/usr/bin/cleantree smeserver-mock-1.0/root/usr/bin/cleantree |
23 |
--- smeserver-mock-1.0.old/root/usr/bin/cleantree 1969-12-31 19:00:00.000000000 -0500 |
24 |
+++ smeserver-mock-1.0/root/usr/bin/cleantree 2020-05-19 00:08:22.509000000 -0400 |
25 |
@@ -0,0 +1,13 @@ |
26 |
+#!/bin/sh |
27 |
+ |
28 |
+#find . -regex .*patch|cut -f2 -d/>~filetoremove |
29 |
+ |
30 |
+for f in `find . -regex .*patch |cut -f2 -d/` |
31 |
+do |
32 |
+ echo "Processing $f" |
33 |
+ # do something on $f |
34 |
+ rm -f $f |
35 |
+ cvs remove $f |
36 |
+done |
37 |
+ |
38 |
+cvs commit -m "cleaning tree from patchs" |
39 |
diff -Nur smeserver-mock-1.0.old/root/usr/bin/importNew smeserver-mock-1.0/root/usr/bin/importNew |
40 |
--- smeserver-mock-1.0.old/root/usr/bin/importNew 1969-12-31 19:00:00.000000000 -0500 |
41 |
+++ smeserver-mock-1.0/root/usr/bin/importNew 2020-05-19 00:08:22.516000000 -0400 |
42 |
@@ -0,0 +1,211 @@ |
43 |
+#!/bin/bash |
44 |
+ |
45 |
+if [ $# -eq 0 ] |
46 |
+ then |
47 |
+ echo "No arguments supplied" |
48 |
+fi |
49 |
+if [ $# -lt 3 ] |
50 |
+ then |
51 |
+ echo "Usage: |
52 |
+importNew type version pkgname [rpmpath] |
53 |
+examples: |
54 |
+# importNew contribs 10 smeserver-mycontrib [~/smeserver-mycontribs-1.0-1.src.rpm] |
55 |
+# importNew sme 10 smeserver-package [~/smeserver-package-1.0-1.src.rpm] |
56 |
+This script is intended to create a new tree, if needed,and a new branch to import a provided srpm. |
57 |
+It will then run cvs-import.sh script for you if you provided a srpm location. If not provided you can populate the branch |
58 |
+with what you want. If you only intend to copy the content of a branch to another, you might search for newbranch script. |
59 |
+ |
60 |
+" |
61 |
+ exit |
62 |
+fi |
63 |
+ |
64 |
+sme=$1 |
65 |
+if [[ "$sme" != "sme" && "$sme" != "contribs" ]] |
66 |
+then |
67 |
+ echo "wrong first parameter should be either 'sme' or 'contribs'" |
68 |
+ exit |
69 |
+fi |
70 |
+re='^[0-9]+$' |
71 |
+if ! [[ $2 =~ $re ]] ; then |
72 |
+ echo "Error: Second argument should be a version number (e.g.: 10) for the branch ((e.g.: contribs10) where you want to put the SRPM content if provided." >&2; exit 1 |
73 |
+fi |
74 |
+ver=$2 |
75 |
+pkgname=$3 |
76 |
+rpmpath=$4 |
77 |
+curpwd=`pwd` |
78 |
+packageroot='smecontribs' |
79 |
+CVSROOT=":ext:shell.koozali.org:/cvs/smecontribs" |
80 |
+if [[ "$sme" == "sme" ]] |
81 |
+then |
82 |
+ packageroot='smeserver' |
83 |
+ CVSROOT=":ext:shell.koozali.org:/cvs/smeserver" |
84 |
+fi |
85 |
+ |
86 |
+ |
87 |
+#this one is directly from commons/Makefile.common |
88 |
+CreateBranchMakefile() { |
89 |
+ cat >Makefile <<EOF |
90 |
+# Makefile for source rpm: $NAME |
91 |
+# \$Id\$ |
92 |
+NAME := $NAME |
93 |
+SPECFILE = \$(firstword \$(wildcard *.spec)) |
94 |
+ |
95 |
+define find-makefile-common |
96 |
+for d in common ../common ../../common ; do if [ -f \$\$d/Makefile.common ] ; then if [ -f \$\$d/CVS/Root -a -w \$\$/Makefile.common ] ; then cd \$\$d ; cvs -Q update ; fi ; echo "\$\$d/Makefile.common" ; break ; fi ; done |
97 |
+endef |
98 |
+ |
99 |
+MAKEFILE_COMMON := \$(shell \$(find-makefile-common)) |
100 |
+ |
101 |
+ifeq (\$(MAKEFILE_COMMON),) |
102 |
+# attept a checkout |
103 |
+define checkout-makefile-common |
104 |
+test -f CVS/Root && { cvs -Q -d \$\$(cat CVS/Root) checkout common && echo "common/Makefile.common" ; } || { echo "ERROR: I can't figure out how to checkout the 'common' module." ; exit -1 ; } >&2 |
105 |
+endef |
106 |
+ |
107 |
+MAKEFILE_COMMON := \$(shell \$(checkout-makefile-common)) |
108 |
+endif |
109 |
+ |
110 |
+include \$(MAKEFILE_COMMON) |
111 |
+EOF |
112 |
+} |
113 |
+ |
114 |
+ |
115 |
+ |
116 |
+# update modules files |
117 |
+cd ~/$packageroot/CVSROOT |
118 |
+cvs -Q update -dPA 1>/dev/null |
119 |
+if [ -d ~/$packageroot/rpms ] |
120 |
+ then |
121 |
+ # update current tree |
122 |
+ cd ~/$packageroot/rpms |
123 |
+ cvs -Q update -dPA 1>/dev/null |
124 |
+else |
125 |
+ # checkout rpms |
126 |
+ cd ~/$packageroot |
127 |
+ cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P rpms 1>/dev/null |
128 |
+fi |
129 |
+ |
130 |
+ |
131 |
+newmodule=true; |
132 |
+# better test would be to actually grep module file! |
133 |
+#if [ -d ~/$packageroot/rpms/$pkgname ] |
134 |
+cd ~/$packageroot/CVSROOT |
135 |
+cvs -Q update -dPA 1>/dev/null |
136 |
+grep -Eq "^$pkgname\s+rpms/$pkgnames.*" ~/$packageroot/CVSROOT/modules |
137 |
+if (( $? == 0 )) |
138 |
+then |
139 |
+ echo "package exists already" |
140 |
+ newmodule=false; |
141 |
+fi |
142 |
+change=0 |
143 |
+cd ~/$packageroot/rpms |
144 |
+#if [ -d ~/$packageroot/rpms/$pkgname ] |
145 |
+if ( cvs status -l $pkgname 2>/dev/null|grep -q 'Unknown' ) |
146 |
+then |
147 |
+ echo "creating $pkgname tree ..." |
148 |
+ mkdir -p $pkgname |
149 |
+ cvs add $pkgname |
150 |
+ change=1 |
151 |
+fi |
152 |
+#if [ -d ~/$packageroot/rpms/$pkgname/$sme$ver ] |
153 |
+if ( cvs status -l $pkgname/$sme$ver 2>/dev/null|grep -q 'Unknown' ) |
154 |
+then |
155 |
+ echo "creating $pkgname/$sme$ver branch with content..." |
156 |
+ mkdir -p $pkgname/$sme$ver |
157 |
+ cvs add $pkgname/$sme$ver |
158 |
+ change=1 |
159 |
+fi |
160 |
+#if [ -f ~/$packageroot/rpms/$pkgname/$sme$ver/.cvsignore ] |
161 |
+if ( cvs status $pkgname/$sme$ver/.cvsignore 2>/dev/null|grep -q 'Unknown' ) |
162 |
+then |
163 |
+ touch $pkgname/$sme$ver/.cvsignore |
164 |
+ cvs add $pkgname/$sme$ver/.cvsignore |
165 |
+ change=1 |
166 |
+fi |
167 |
+#if [ -f ~/$packageroot/rpms/$pkgname/$sme$ver/import.log ] |
168 |
+if ( cvs status $pkgname/$sme$ver/import.log 2>/dev/null|grep -q 'Unknown' ) |
169 |
+then |
170 |
+ touch $pkgname/$sme$ver/import.log |
171 |
+ cvs add $pkgname/$sme$ver/import.log |
172 |
+ change=1 |
173 |
+fi |
174 |
+#create Makefile here |
175 |
+pushd $pkgname/$sme$ver >/dev/null |
176 |
+#if [ ! -f Makefile ] |
177 |
+if ( cvs status Makefile 2>/dev/null|grep -q 'Unknown' ) |
178 |
+then |
179 |
+ NAME=$pkgname |
180 |
+ CreateBranchMakefile |
181 |
+ cvs -Q add Makefile |
182 |
+ change=1 |
183 |
+fi |
184 |
+popd >/dev/null |
185 |
+ |
186 |
+if [ "$change" == "1" ] |
187 |
+then |
188 |
+echo "commit..." |
189 |
+cvs -Q commit -m "Prep for $pkgname import" $pkgname |
190 |
+fi |
191 |
+ |
192 |
+if ( $newmodule ) |
193 |
+then |
194 |
+ cd ~/$packageroot/CVSROOT |
195 |
+ cvs -Q update -dPA 1>/dev/null |
196 |
+ echo "$pkgname rpms/$pkgname &common" >> modules |
197 |
+ linenumb=`cat modules |grep -n "#Start Auto-Maintenance" | grep -Eo '^[^:]+'` |
198 |
+ # "#Start Auto-Maintenance" |
199 |
+ #(head -n $linenumb; sort -nk$linenumb) < sample.txt 1<> sample.txt |
200 |
+ (head -n $linenumb; sort) < modules 1<> modules |
201 |
+ #echo "cvs commit -m \"adding $pkgname to modules\"" |
202 |
+ cvs commit -m "adding $pkgname to modules" |
203 |
+fi |
204 |
+ |
205 |
+if [[ "$HOSTNAME" == "shell.koozali.org" ]] |
206 |
+then |
207 |
+ if [ $# -eq 3 ] |
208 |
+ then |
209 |
+ echo "importing the srpm for you" |
210 |
+ cd ~/$packageroot; |
211 |
+ cd CVSROOT/; |
212 |
+ cvs -Q update -dPA 1>/dev/null; |
213 |
+ cd ../rpms/; |
214 |
+ cvs -Q update -dPA 1>/dev/null ; |
215 |
+ cd ~/$packageroot; |
216 |
+ ./common/cvs-import.sh -b $sme$ver -m 'Initial import' /tmp/$(basename $rpmpath) |
217 |
+ else |
218 |
+ echo "no srpm provided" |
219 |
+ fi |
220 |
+ |
221 |
+else |
222 |
+ echo "##########################" |
223 |
+ echo "sending $rpmpath to shell.koozali.org ..." |
224 |
+ if [[ $rpmpath != "" ]] |
225 |
+ then |
226 |
+ echo "scp $rpmpath shell.koozali.org:/tmp/" |
227 |
+ cd $curpwd |
228 |
+ scp $rpmpath shell.koozali.org:/tmp/ |
229 |
+ echo "now trying to push this on shell.koozali.org and run ./common/cvs-import.sh" |
230 |
+ echo "this could fails if your srpm was not initially on ~/smecontrib/ and if you have not ForwardAgent yes and user set in your .ss/config file for shell.koozali.org" |
231 |
+ ssh shell.koozali.org "cd ~/$packageroot;cd CVSROOT/; cvs -Q update -dPA 1>/dev/null; cd ../rpms/; cvs -Q update -dPA $pkgname 1>/dev/null ;cd ~/$packageroot; ./common/cvs-import.sh -b $sme$ver -m 'Initial import' /tmp/$(basename $rpmpath)" |
232 |
+ fi |
233 |
+ cd ~/$packageroot/rpms/$pkgname/$sme$ver |
234 |
+ cvs update -dPA; make prep |
235 |
+ echo "in case of failure do:" |
236 |
+ echo "scp $rpmpath shell.koozali.org:/tmp/" |
237 |
+ echo "ssh shell.koozali.org" |
238 |
+ echo "cd ~/$packageroot" |
239 |
+ if [ $# -eq 3 ] |
240 |
+ then |
241 |
+ echo "./common/cvs-import.sh -b $sme$ver -m 'Initial import' /tmp/$(basename $rpmpath)" |
242 |
+ else |
243 |
+ echo "./common/cvs-import.sh -b $sme$ver -m 'Initial import' YOURSRPM " |
244 |
+ fi |
245 |
+ echo "exit" |
246 |
+ echo "cd ~/$packageroot/rpms/$pkgname/$sme$ver ; cvs update -dPA; make prep" |
247 |
+fi |
248 |
+ |
249 |
+echo "##########################" |
250 |
+echo "now you can:" |
251 |
+echo "cd ~/$packageroot/rpms/$pkgname/$sme$ver" |
252 |
+ |
253 |
+unset CVSROOT |
254 |
diff -Nur smeserver-mock-1.0.old/root/usr/bin/newbranch smeserver-mock-1.0/root/usr/bin/newbranch |
255 |
--- smeserver-mock-1.0.old/root/usr/bin/newbranch 1969-12-31 19:00:00.000000000 -0500 |
256 |
+++ smeserver-mock-1.0/root/usr/bin/newbranch 2020-05-19 00:08:22.498000000 -0400 |
257 |
@@ -0,0 +1,105 @@ |
258 |
+#!/bin/bash |
259 |
+ |
260 |
+if [ $# -eq 0 ] |
261 |
+ then |
262 |
+ echo "No arguments supplied" |
263 |
+fi |
264 |
+if [ $# -lt 4 ] |
265 |
+ then |
266 |
+ echo "Usage: |
267 |
+newbranch type versionOri versionDest pkgname |
268 |
+examples: |
269 |
+# newbranch contribs 9 10 smeserver-mycontrib |
270 |
+# newbranch sme 9 10 smeserver-package |
271 |
+This script is intended to create a new branch of an existing tree by copying the content of another branch in it. You can then alter the new branch content as you want. |
272 |
+If you need to create the tree for the package then you should use importNew script. It will also allow you to import a srpm content. |
273 |
+ |
274 |
+" |
275 |
+ exit |
276 |
+fi |
277 |
+ |
278 |
+sme=$1 |
279 |
+if [[ "$sme" != "sme" && "$sme" != "contribs" ]] |
280 |
+then |
281 |
+ echo "wrong first parameter should be either 'sme' or 'contribs'" |
282 |
+ exit |
283 |
+fi |
284 |
+re='^[0-9]+$' |
285 |
+if ! [[ $2 =~ $re ]] ; then |
286 |
+ echo "Error: Second argument should be a version number (e.g.: 9) with an existing branch (e.g.: sme9)." >&2; exit 1 |
287 |
+fi |
288 |
+if ! [[ $3 =~ $re ]] ; then |
289 |
+ echo "Error: Third argument should be a version number (e.g.: 10) needing a new branch (e.g.: sme10)." >&2; exit 1 |
290 |
+fi |
291 |
+#verd=$(($2 + 1));# rem we might want to go down too |
292 |
+vero=$2 |
293 |
+verd=$3 |
294 |
+pkgname=$4 |
295 |
+curpwd=`pwd` |
296 |
+packageroot='smecontribs' |
297 |
+if [[ "$sme" == "sme" ]] |
298 |
+then |
299 |
+ packageroot='smeserver' |
300 |
+fi |
301 |
+ |
302 |
+cd ~/$packageroot/CVSROOT |
303 |
+cvs -Q update -dPA 1>/dev/null |
304 |
+grep -Eq "^$pkgname\s+rpms/$pkgnames.*" ~/$packageroot/CVSROOT/modules |
305 |
+if (( $? != 0 )) |
306 |
+then |
307 |
+ echo "Package $pkgname does not exists in modules, please create the proper tree in cvs and add it to modules. You might consider using importNew script." |
308 |
+ exit |
309 |
+fi |
310 |
+ |
311 |
+ |
312 |
+# if does not exist we test if it is in cvs |
313 |
+# if not we fail |
314 |
+if [ ! -d ~/$packageroot/rpms/$pkgname ] |
315 |
+then |
316 |
+ cd ~/$packageroot/rpms |
317 |
+ # rem to test |
318 |
+ cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P $pkgname #1>/dev/null |
319 |
+ |
320 |
+ if [ ! -d ~/$packageroot/rpms/$pkgname ] |
321 |
+ then |
322 |
+ echo "no such module $pkgname" |
323 |
+ exho "use instead importNew script" |
324 |
+ exit; |
325 |
+ fi |
326 |
+fi |
327 |
+ |
328 |
+cd ~/$packageroot/rpms; |
329 |
+cvs update -dPA $pkgname >/dev/null |
330 |
+ |
331 |
+if [ ! -d ~/$packageroot/rpms/$pkgname/$sme$vero ] |
332 |
+ then |
333 |
+ echo "Branch $sme$vero does not exist. Nothing to do."; |
334 |
+ exit; |
335 |
+ fi |
336 |
+ |
337 |
+if [ -d ~/$packageroot/rpms/$pkgname/$sme$verd ] |
338 |
+ then |
339 |
+ echo "Branch $sme$verd exists. Nothing to do."; |
340 |
+ else |
341 |
+ cd ~/$packageroot/rpms |
342 |
+ rm -rf ~/$packageroot/rpms/$pkgname |
343 |
+ cd ~/$packageroot/rpms |
344 |
+ cvs -Q co $pkgname |
345 |
+ cd $pkgname |
346 |
+ # then you can copy |
347 |
+ cp -a $sme$vero $sme$verd |
348 |
+ rm -rf $sme$verd/CVS |
349 |
+ cvs add $sme$verd |
350 |
+ cd $sme$verd |
351 |
+ find ./ -name CVS -prune -o -print | xargs cvs add |
352 |
+ cvs commit -m 'Initial import' |
353 |
+ echo "# then you have to do:" |
354 |
+ echo "cd ~/$packageroot/rpms/$pkgname/$sme$verd/" |
355 |
+ echo "make local" |
356 |
+ echo "make tag ;make build" |
357 |
+ echo "# Alternatively you can do:" |
358 |
+ echo "# make mockbuild" |
359 |
+ echo "# make tag ;make build" |
360 |
+ fi |
361 |
+ |
362 |
+ |
363 |
diff -Nur smeserver-mock-1.0.old/root/usr/bin/prepa smeserver-mock-1.0/root/usr/bin/prepa |
364 |
--- smeserver-mock-1.0.old/root/usr/bin/prepa 2018-03-10 23:36:52.000000000 -0500 |
365 |
+++ smeserver-mock-1.0/root/usr/bin/prepa 2020-05-19 00:10:50.214000000 -0400 |
366 |
@@ -1,3 +1,16 @@ |
367 |
+#!/bin/bash |
368 |
cvs update -dPA |
369 |
make clean |
370 |
make prep |
371 |
+if [ -f 'sources' ] ; then |
372 |
+folder=`sed -rn 's/^[a-z0-9]{32}\s+(.+)\.(tar|t)\.?(gz|xz|bz)*$/\1/p' sources` |
373 |
+oldy="$folder.old" |
374 |
+if [ -d $folder ] ; then |
375 |
+ echo "$folder exist" |
376 |
+ if [ -d $oldy ] ; then |
377 |
+ rm -rf $oldy && echo "removing $oldy" |
378 |
+ fi |
379 |
+ cp -a $folder $oldy && echo "creating $oldy as fresh copy of $folder" |
380 |
+fi |
381 |
+fi |
382 |
+ |
383 |
diff -Nur smeserver-mock-1.0.old/root/usr/bin/refresh smeserver-mock-1.0/root/usr/bin/refresh |
384 |
--- smeserver-mock-1.0.old/root/usr/bin/refresh 1969-12-31 19:00:00.000000000 -0500 |
385 |
+++ smeserver-mock-1.0/root/usr/bin/refresh 2020-05-19 00:08:22.526000000 -0400 |
386 |
@@ -0,0 +1,57 @@ |
387 |
+#!/bin/bash |
388 |
+ |
389 |
+if [ $# -eq 0 ] |
390 |
+ then |
391 |
+ echo "No arguments supplied" |
392 |
+ echo "Usage: |
393 |
+refresh [sme|contribs] |
394 |
+examples: |
395 |
+# refresh sme |
396 |
+This script will refresh or create the tree for smeserver (sme) or smecontribs (contribs). |
397 |
+ |
398 |
+" |
399 |
+ exit |
400 |
+fi |
401 |
+sme=$1 |
402 |
+if [[ "$sme" != "sme" && "$sme" != "contribs" ]] |
403 |
+then |
404 |
+ echo "Wrong first parameter should be either 'sme' or 'contribs'" |
405 |
+ exit |
406 |
+fi |
407 |
+ |
408 |
+packageroot='smecontribs' |
409 |
+if [[ "$sme" == "sme" ]] |
410 |
+then |
411 |
+ packageroot='smeserver' |
412 |
+fi |
413 |
+ |
414 |
+#create if missing |
415 |
+if [ ! -d ~/$packageroot ] |
416 |
+ then |
417 |
+ "creating ~/$packageroot and populating..." |
418 |
+ mkdir -p ~/$packageroot |
419 |
+ cd ~/$packageroot |
420 |
+ cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P CVSROOT rpms common 1>/dev/null |
421 |
+ exit |
422 |
+fi |
423 |
+ |
424 |
+if [[ "$2" == "force" ]] |
425 |
+ then |
426 |
+ "Forcing checkout for ~/$packageroot and populating with CVSROOT rpms common..." |
427 |
+ mkdir -p ~/$packageroot |
428 |
+ cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P CVSROOT rpms common 1>/dev/null |
429 |
+ exit |
430 |
+fi |
431 |
+ |
432 |
+# check if module rpms exist and populate it if necessary or update it |
433 |
+if [ -d ~/$packageroot/rpms ] |
434 |
+ then |
435 |
+ # update current tree |
436 |
+ cd ~/$packageroot/rpms |
437 |
+ cvs -Q update -dPA 1>/dev/null |
438 |
+else |
439 |
+ # checkout rpms |
440 |
+ cd ~/$packageroot |
441 |
+ cvs -Q -z3 -d:ext:shell.koozali.org:/cvs/$packageroot co -P rpms 1>/dev/null |
442 |
+fi |
443 |
+ |