05d86902d5
While we have migration of perestroika to Python implementation we need to have friendly and open way to share and fix issues in current perestroika code Change-Id: I7fced52ddadc81d4d8a52659358936f6e68cc3e4 Closes-bug: #1489470
44 lines
1.9 KiB
Bash
Executable File
44 lines
1.9 KiB
Bash
Executable File
#!/bin/bash -ex
|
|
. $(dirname $(readlink -f $0))/config
|
|
CONTAINERNAME=mockbuild:latest
|
|
CACHEPATH=/var/cache/docker-builder/mock
|
|
DIST_VERSION=`echo $DIST | sed 's|centos||'`
|
|
[ -z "${DIST_VERSION}" ] && DIST_VERSION=7
|
|
|
|
EXTRACMD=":"
|
|
if [ -n "$EXTRAREPO" ] ; then
|
|
EXTRACMD="sed -i"
|
|
OLDIFS="$IFS"
|
|
IFS='|'
|
|
for repo in $EXTRAREPO ; do
|
|
IFS="$OLDIFS"
|
|
reponame=${repo%%,*}
|
|
repourl=${repo##*,}
|
|
EXTRACMD="$EXTRACMD -e \"$ i[${reponame}]\nname=${reponame}\nbaseurl=${repourl}\ngpgcheck=0\nenabled=1\nskip_if_unavailable=1\""
|
|
IFS='|'
|
|
done
|
|
IFS="$OLDIFS"
|
|
EXTRACMD="$EXTRACMD /etc/mock/centos-${DIST_VERSION}-x86_64.cfg"
|
|
fi
|
|
|
|
docker run ${DNSPARAM} --privileged --rm -v ${CACHEPATH}:/srv/mock:ro \
|
|
-v $(pwd):/home/abuild/rpmbuild ${CONTAINERNAME} \
|
|
bash -x -c "mkdir -p /srv/tmpfs/cache
|
|
mount -t tmpfs overlay /srv/tmpfs/cache
|
|
mount -t aufs -o br=/srv/tmpfs/cache/:/srv/mock/cache none /var/cache/mock/
|
|
$EXTRACMD
|
|
su - abuild -c 'mock -r centos-${DIST_VERSION}-x86_64 --verbose --update'
|
|
chown -R abuild.mock /home/abuild
|
|
[[ \$(ls /home/abuild/rpmbuild/*.src.rpm | wc -l) -eq 0 ]] \
|
|
&& su - abuild -c 'mock -r centos-${DIST_VERSION}-x86_64 --no-clean --no-cleanup-after --buildsrpm --verbose \
|
|
--sources=/home/abuild/rpmbuild --resultdir=/home/abuild/rpmbuild --buildsrpm \
|
|
--spec=\$(ls /home/abuild/rpmbuild/*.spec)'
|
|
rm -rf /home/abuild/rpmbuild/build
|
|
su - abuild -c 'mock -r centos-${DIST_VERSION}-x86_64 --no-clean --no-cleanup-after --verbose \
|
|
--resultdir=/home/abuild/rpmbuild/build \$(ls /home/abuild/rpmbuild/*.src.rpm)'
|
|
echo \$? > /home/abuild/rpmbuild/build/exitstatus.mock
|
|
umount -f /var/cache/mock /srv/tmpfs/cache
|
|
rm -rf /srv/tmpfs
|
|
rm -f /home/abuild/rpmbuild/\*.src.rpm /home/abuild/rpmbuild/{build,root,state}.log
|
|
chown -R `id -u`:`id -g` /home/abuild"
|