summaryrefslogtreecommitdiffstats
path: root/getmock
blob: ebd35159b262079f61a56bc39b4e9cabc669ab32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
#!/bin/bash

cd /home/rpmbuild/site/rpms

function getOneMock() {
case $1 in
*i)	dep=${1%i}
	;;
*x)	dep=${1%x}
	;;
*)	dep=$1
	;;
esac

rep=${2-remi}

case $dep in 
scl74el*)	dep=${dep#scl74el}
	type=enterprise
	;;
scl73el*)	dep=${dep#scl73el}
	type=enterprise
	;;
scl72el*)	dep=${dep#scl72el}
	type=enterprise
	;;
scl71el*)	dep=${dep#scl71el}
	type=enterprise
	;;
scl70el*)	dep=${dep#scl70el}
	type=enterprise
	;;
scl56el*)	dep=${dep#scl56el}
	type=enterprise
	;;
scl55el*)	dep=${dep#scl55el}
	type=enterprise
	;;
scl54el*)	dep=${dep#scl54el}
	type=enterprise
	;;
el8x72)
	dep=8
    if [ "$2" == "php72" -o "$2" == "test72" ]
    then	rep=$rep
	elif [ "$2" == "remi" ]
	then	rep=php72
	else	rep=${2}72
	fi
	type=enterprise
	;;
el8x73)
	dep=8
    if [ "$2" == "php73" -o "$2" == "test73" ]
    then	rep=$rep
	elif [ "$2" == "remi" ]
	then	rep=php73
	else	rep=${2}73
	fi
	type=enterprise
	;;
el8x74)
	dep=8
    if [ "$2" == "php74" -o "$2" == "test74" ]
    then	rep=$rep
	elif [ "$2" == "remi" ]
	then	rep=php74
	else	rep=${2}74
	fi
	type=enterprise
	;;
el*)	dep=${dep#el}
	type=enterprise
	;;
fc*)	dep=${dep#fc}
	type=fedora
	;;
scl74fc*)	dep=${dep#scl74fc}
	type=fedora
	;;
scl73fc*)	dep=${dep#scl73fc}
	type=fedora
	;;
scl72fc*)	dep=${dep#scl72fc}
	type=fedora
	;;
scl71fc*)	dep=${dep#scl71fc}
	type=fedora
	;;
scl70fc*)	dep=${dep#scl70fc}
	type=fedora
	;;
scl56fc*)	dep=${dep#scl56fc}
	type=fedora
	;;
scl55fc*)	dep=${dep#scl55fc}
	type=fedora
	;;
scl54fc*)	dep=${dep#scl54fc}
	type=fedora
	;;
*)	echo Connais pas $dep
	;;
esac


if [ -d $type/$dep/$rep/x86_64 ]
then
	cible=$type/$dep/$rep/
	debug=$type/$dep/debug-$rep/
else 
	echo "$1 n'est pas un dépôt ($type/$dep/$rep)"
	exit 2
fi

if   [ -d /var/lib/mock/${1}/repodata ]; then
	src=/var/lib/mock/${1}

elif   [ -d /var/lib/mock/${1}i/result ]; then
	src=/var/lib/mock/${1}i/result

elif [ -d /var/lib/mock/$1/result ]; then
	src=/var/lib/mock/$1/result
else
	echo "$1 n'est pas un dossier mock"
	exit 2
fi

echo Copie de $src vers $cible
for i in $src/${3-*}.rpm
do
	j=$(basename $i)
	case $j in 
		*.src.rpm)	echo " " $i ignored
			;;
		xulrunner-last-debuginfo*)	echo " " $i ignored
			;;
		mozilla-crashreporter*)		echo " " $i ignored
			;;
		firefox-debuginfo*)		echo " " $i ignored
			;;
		thunderbird-debuginfo*)	echo " " $i ignored
			;;
		*-debuginfo-*x86_64.rpm|*-debugsource-*x86_64.rpm)
			if [ -f ${debug}x86_64/$j ]; then
				echo " " $i already there
			elif [ -d ${debug}x86_64 ]; then
				cp $i ${debug}x86_64 && echo + $i copied debuginfo x86_64
			else
				echo " " $i ignored
			fi
			;;
		*-debuginfo-*86.rpm|*-debugsource-*86.rpm)
			if [ -f ${debug}i386/$j ]; then
				echo " " $i already there
			elif [ -d ${debug}i386 ]; then
				cp $i ${debug}i386 && echo + $i copied debuginfo i386
			else
				echo " " $i ignored
			fi
			;;
		*.noarch.rpm)	
			if [ -f ${cible}x86_64/$j ]; then
				echo " " $i already there
			else
				cp $i ${cible}x86_64 && echo + $i copied x86_64
				[ -d ${cible}ppc    -a ! -f ${cible}ppc/.closed ]  \
					&& ln ${cible}x86_64/$j ${cible}ppc/$j \
					&& echo + $i linked ppc
				[ -d ${cible}ppc64  -a ! -f ${cible}ppc64/.closed ] \
					&& ln ${cible}					/$j ${cible}ppc64/$j  \
					&& echo + $i linked ppc64
				[ -d ${cible}i386 ] \
					&& ln ${cible}x86_64/$j ${cible}i386/$j \
					&& echo + $i linked x86_64
				[ -d ${cible}armhfp ] \
					&& ln ${cible}x86_64/$j ${cible}armhfp/$j \
					&& echo + $i linked armhfp
			fi
			;;
		*.i?86.rpm)	
			if [ -f ${cible}i386/$j ]; then
				echo " " $i already there
			else
				cp $i ${cible}i386 && echo + $i copied i686
			fi
			;;
		*.x86_64.rpm)	
			if [ -f ${cible}x86_64/$j ]; then
				echo " " $i already there
			else
				cp $i ${cible}x86_64 && echo + $i copied x86_64
			fi
			;;
		*)		echo Aucun RPM disponible
			;;
	esac
done
}

if [ $# = 0 ]; then
	echo usage $0 nomdépôt  [ prefix ]
	exit 1
fi

opt=remi
if [ $1 = test ]; then
	opt=test
	shift
fi
if [ $1 = test70 ]; then
	opt=test70
	shift
fi
if [ $1 = test71 ]; then
	opt=test71
	shift
fi
if [ $1 = test72 ]; then
	opt=test72
	shift
fi
if [ $1 = test72 ]; then
	opt=test72
	shift
fi
if [ $1 = php55 ]; then
	opt=php55
	shift
fi
if [ $1 = php56 ]; then
	opt=php56
	shift
fi
if [ $1 = php70 ]; then
	opt=php70
	shift
fi
if [ $1 = php71 ]; then
	opt=php71
	shift
fi
if [ $1 = php72 ]; then
	opt=php72
	shift
fi
if [ $1 = php73 ]; then
	opt=php73
	shift
fi
if [ $1 = glpi91 ]; then
	opt=glpi91
	shift
fi
if [ $1 = glpi92 ]; then
	opt=glpi92
	shift
fi
if [ $1 = glpi93 ]; then
	opt=glpi93
	shift
fi
if [ $1 = glpi94 ]; then
	opt=glpi94
	shift
fi
if [ $1 = devs -o $1 = dev ]; then
	opt=devs
	shift
fi

if [ $1 = all ]; then
	for i in 29 30 31
	do
		getOneMock fc${i}i $opt
	done
	for i in 6
	do
		getOneMock el${i}i $opt
	done
elif [ $1 = all55 ]; then
	for n in 6
	do
		getOneMock el${n}i php55 '*5.5*'
		getOneMock el${n}x php55 '*5.5*'
	done
	n=7
		getOneMock el${n}x php55 '*5.5*'

elif [ $1 = all56 ]; then
	for n in 6
	do
		getOneMock el${n}i php56 '*5.6*'
		getOneMock el${n}x php56 '*5.6*'
	done
	n=7
		getOneMock el${n}x php56 '*5.6*'

elif [ $1 = all70 ]; then
	[ $opt = remi ] && opt=php70
	[ $opt = test ] && opt=test70
	n=6
		getOneMock el${n}i $opt '*7.0*'
		getOneMock el${n}x $opt '*7.0*'
	n=7
		getOneMock el${n}x $opt '*7.0*'

elif [ $1 = all71 ]; then
	[ $opt = remi ] && opt=php71
	[ $opt = test ] && opt=test71
	n=6
		getOneMock el${n}i $opt '*7.1*'
		getOneMock el${n}x $opt '*7.1*'
	n=7
		getOneMock el${n}x $opt '*7.1*'

elif [ $1 = all72 ]; then
	[ $opt = remi ] && opt=php72
	[ $opt = test ] && opt=test72
	n=6
		getOneMock el${n}i $opt '*7.2*'
		getOneMock el${n}x $opt '*7.2*'
		getOneMock el7x    $opt '*7.2*'
		getOneMock el8x72  $opt '*7.2*'

elif [ $1 = all73 ]; then
	[ $opt = remi ] && opt=php73
	[ $opt = test ] && opt=test73
	for n in 29
	do
		getOneMock fc${n}i $opt '*7.3*'
		getOneMock fc${n}x $opt '*7.3*'
	done
	n=6
		getOneMock el${n}i $opt '*7.3*'
		getOneMock el${n}x $opt '*7.3*'
		getOneMock el7x    $opt '*7.3*'
		getOneMock el8x73  $opt '*7.3*'

elif [ $1 = all74 ]; then
	[ $opt = remi ] && opt=php74
	[ $opt = test ] && opt=test74
	for n in 29 30 31
	do
		getOneMock fc${n}i $opt '*7.4*'
		getOneMock fc${n}x $opt '*7.4*'
	done
		getOneMock el7x    $opt '*7.4*'
		getOneMock el8x74  $opt '*7.4*'

elif [ $1 = all54 ]; then
	for n in 6
	do
		getOneMock el${n}i remi '*5.4*'
		getOneMock el${n}x remi '*5.4*'
	done
	n=7
		getOneMock el${n}x remi '*5.4*'

elif [ $1 = for56 ]; then
	for i in 6 7
	do
		getOneMock el${i}x test
	done

elif [ $1 = for55 ]; then
	for i in 6 7
	do
		getOneMock el${i}x test
	done

elif [ $1 = allx ]; then
	for i in 29 30 31
	do
		getOneMock fc${i}x $opt
	done
	for i in 6 7 8
	do
		getOneMock el${i}x $opt
	done

elif [ $1 = scl54 ]; then
	for i in 6 7
	do
		getOneMock scl54el${i}x $opt
	done

elif [ $1 = scl55 ]; then
	for i in 6 7
	do
		getOneMock scl55el${i}x $opt
	done

elif [ $1 = scl56 ]; then
	for i in 29 30 31
	do
		getOneMock scl56fc${i}x $opt
	done
	for i in 6 7 8
	do
		getOneMock scl56el${i}x $opt
	done

elif [ $1 = scl70 ]; then
	for i in 29 30 31
	do
		getOneMock scl70fc${i}x $opt
	done
	for i in 6 7 8
	do
		getOneMock scl70el${i}x $opt
	done

elif [ $1 = scl71 ]; then
	for i in 29 30 31
	do
		getOneMock scl71fc${i}x $opt
	done
	for i in 6 7 8
	do
		getOneMock scl71el${i}x $opt
	done

elif [ $1 = scl74 ]; then
	for i in 29 30 31
	do
		getOneMock scl74fc${i}x $opt
	done
	for i in 7 8
	do
		getOneMock scl74el${i}x $opt
	done

elif [ $1 = scl73 ]; then
	for i in 29 30 31
	do
		getOneMock scl73fc${i}x $opt
	done
	for i in 6 7 8
	do
		getOneMock scl73el${i}x $opt
	done

elif [ $1 = scl72 ]; then
	for i in 29 30 31
	do
		getOneMock scl72fc${i}x $opt
	done
	for i in 6 7 8
	do
		getOneMock scl72el${i}x $opt
	done

else
	for i in $*
	do
		getOneMock $i $opt
	done
fi