#! /bin/bash set -ex repos=$1 shift mock="mock -v -r fedora-rawhide-x86_64 --uniqueext=mass$$ --no-bootstrap-chroot --disable-plugin=yum_cache" # https://bugzilla.redhat.com/show_bug.cgi?id=1869030 glibc 2.32.9000-1 snapshot build in rawhide breaks systemd-nspawn based chroots mock="$mock --isolation=simple" # (1) inaccessible plugin file plugin/annobin.so expanded from short plugin name annobin # (2) -a gets ignored. mock="$mock --disable-plugin=root_cache" mkdir -p build cd build for pkg in "$@";do #dnf --disablerepo='*' --enablerepo=$repos repoquery --requires "$pkg"|egrep '^(gcc|clang)' || continue srcrpm="$pkg.src.rpm" if [ -e "$srcrpm" ];then continue fi rm -rf $srcrpm* exec >>$srcrpm.log 2>&1 dnf --disablerepo='*' --enablerepo=$repos download --source "$pkg" if [ ! -e $srcrpm ];then touch $srcrpm.downloadfail continue fi #rpm -q --requires -p $srcrpm|egrep '^(gcc|clang)' || continue if true;then rpm2archive $srcrpm rm -rf $srcrpm.d mkdir $srcrpm.d cd $srcrpm.d tar xzf ../$srcrpm.tgz rm -f ../$srcrpm.tgz name=$(echo "$pkg"|sed 's/-[^-]*-[^-]*$//') if [ ! -e $name.spec ];then touch ../$srcrpm.specfail continue fi (echo '%global _find_debuginfo_dwz_opts %{nil}' # It removes -fcommon, use redhat-rpm-config.patch instead. # echo '%global optflags %(echo %{optflags}|sed "s/ -g / -g -fdebug-types-section /")' sed 's/^%\(\(define\|global\) *_find_debuginfo_dwz_opts\)/\1/' ) <$name.spec >$name.spec.new cp -p $name.spec ../$srcrpm.spec cp -p $name.spec.new ../$srcrpm.spec.new diff -u $name.spec $name.spec.new || : mv -f $name.spec.new $name.spec if ! $mock --resultdir=$PWD/resultdir --buildsrpm --spec $name.spec --sources $PWD;then touch ../$srcrpm.bsmockfail continue fi if [ $[$(find resultdir -name "*.src.rpm"|wc -l)] -ne 1 ];then touch ../$srcrpm.bsmockefail continue fi # if not pkg.endswith('.rpm'): log.error("%s doesn't appear to be an rpm - skipping", pkg) mv -f resultdir/*.src.rpm ../$srcrpm.no.rpm cd .. test -e $srcrpm.no.rpm rm -rf $srcrpm.d else ln $srcrpm $srcrpm.nc.rpm fi for ext in "" ".no.rpm";do resultdir=$PWD/$srcrpm$ext.resultdir test ! -e $resultdir set +e $mock --resultdir=$resultdir --nocheck $( if [ "$ext" = ".nc.rpm" ];then echo -a https://www.jankratochvil.net/t/nocommon/;fi if [ "$ext" = ".dt.rpm" ];then echo -a https://www.jankratochvil.net/t/rpmdts/ ;fi if [ "$ext" = ".dt5.rpm" ];then echo -a https://www.jankratochvil.net/t/rpmdts5/ ;fi ) --rebuild $srcrpm$ext &>$srcrpm$ext.mocklog mockrc=$? set -e test -e $resultdir if [ $mockrc -ne 0 ];then touch $srcrpm$ext.mockfail break fi echo >$srcrpm$ext.rpmsize $(du -sbc /dev/null $resultdir/*-debuginfo*.rpm|tail -n1|awk '{print $1}') size=0 for i in $resultdir/*-debuginfo*.rpm;do if [ -e "$i" ];then sizethis="$(rpm -q --qf '%{longsize}' -p $i)" [[ "$sizethis" =~ ^[0-9]+$ ]] size=$[$size+$sizethis] fi done echo >$srcrpm$ext.filesize $size mkdir $srcrpm$ext.rpms mv -f $resultdir/*-debuginfo*.rpm $srcrpm$ext.rpms || : # rm -rf $resultdir rm -f $resultdir/*.rpm done touch $srcrpm.done done