--- /dev/null
+FROM fedora:23
+
+RUN dnf install -y mock rpm-build
+
+COPY rpmbuild /home/mock/rpmbuild
+COPY rpmbuild/rpmmacros /home/mock/.rpmmacros
+
+RUN mkdir -p /home/mock/rpmbuild && \
+ chmod +x /home/mock/rpmbuild/run.sh && \
+ useradd -r -d /home/mock -g mock mock && \
+ chown -R mock.mock /home/mock/rpmbuild
+
+USER mock
+
+WORKDIR /home/mock
+
+# ENTRYPOINT ["/bin/sh", "-c"]
fi
if test "$CENTOS_DIST"; then
- echo "CentOS not yet supported"
- exit 1
+ RNAME=`awk '/Name:/ {print $2}' *.spec`
+ if test "$NAME" -a "$NAME" != "$RNAME"; then
+ echo "NAME in IDMETA ($NAME) does not match RPM spec NAME ($RNAME)"
+ exit 1
+ fi
+ PRODUCT=$RNAME
centos=true
else
centos=false
debian=false
fi
+TAR=${PRODUCT}-${VERSION}.tar.gz
+
if $upload; then
UPLOAD_URI=${UPLOAD_HOST}:${UPLOAD_PATH}/${PRODUCT}
echo "Uploading to ${UPLOAD_URI}"
exit 0
fi
+if $centos; then
+ mkdir -p rpmbuild/BUILD
+ mkdir -p rpmbuild/BUILDROOT
+ mkdir -p rpmbuild/RPMS/noarch
+ mkdir -p rpmbuild/RPMS/x86_64
+ mkdir -p rpmbuild/SOURCES
+ mkdir -p rpmbuild/SPECS
+ mkdir -p rpmbuild/SRPMS
+
+ echo "%_topdir /home/mock/rpmbuild" >rpmbuild/rpmmacros
+ echo "%_source_filedigest_algorithm 0" >>rpmbuild/rpmmacros
+ echo "%_binary_filedigest_algorithm 0" >>rpmbuild/rpmmacros
+
+ cp ${ID_DEB_BUILD}/Dockerfile.mock rpmbuild
+ cp ${TAR} rpmbuild/SOURCES
+ SPEC=${PRODUCT}.spec
+ cat ${SPEC}|sed "s/%define idmetaversion.*/%define idmetaversion ${VERSION}/" >rpmbuild/SPECS/${SPEC}
+
+ if true; then
+ for dist in ${CENTOS_DIST}; do
+ case $dist in
+ centos5)
+ r=epel-5-x86_64 ;;
+ centos6)
+ r=epel-6-x86_64 ;;
+ centos7)
+ r=epel-7-x86_64 ;;
+ *)
+ r=$dist ;;
+ esac
+ echo -n "$r"
+
+ rm -f rpmbuild/run.sh
+ echo '#!/bin/sh' >rpmbuild/run.sh
+ echo "rpmbuild -bs rpmbuild/SPECS/${SPEC}" >>rpmbuild/run.sh
+ echo "/usr/bin/mock --resultdir=rpmbuild -r $r rpmbuild/SRPMS/${PRODUCT}-${VERSION}*src.rpm" >>rpmbuild/run.sh
+
+ docker build -t indexdata-fedora-mock -f rpmbuild/Dockerfile.mock .
+ docker run --privileged -it --rm indexdata-fedora-mock rpmbuild/run.sh
+ echo "done"
+ done
+ fi
+fi
if $debian; then
MKDEBSRC=${ID_DEB_BUILD}/id-mk-deb-src.sh
if test ! -x $MKDEBSRC; then