5 mock="mock -v -r fedora-rawhide-x86_64 --uniqueext=mass$$ --no-bootstrap-chroot --disable-plugin=yum_cache"
6 # https://bugzilla.redhat.com/show_bug.cgi?id=1869030 glibc 2.32.9000-1 snapshot build in rawhide breaks systemd-nspawn based chroots
7 mock="$mock --isolation=simple"
11 #dnf --disablerepo='*' --enablerepo=$repos repoquery --requires "$pkg"|egrep '^(gcc|clang)' || continue
13 if [ -e "$srcrpm" ];then
17 exec >>$srcrpm.log 2>&1
18 dnf --disablerepo='*' --enablerepo=$repos download --source "$pkg"
19 if [ ! -e $srcrpm ];then
20 touch $srcrpm.downloadfail
23 #rpm -q --requires -p $srcrpm|egrep '^(gcc|clang)' || continue
28 tar xzf ../$srcrpm.tgz
30 name=$(echo "$pkg"|sed 's/-[^-]*-[^-]*$//')
31 if [ ! -e $name.spec ];then
32 touch ../$srcrpm.specfail
35 (echo '%global _find_debuginfo_dwz_opts %{nil}'
36 # It removes -fcommon, use redhat-rpm-config.patch instead.
37 # echo '%global optflags %(echo %{optflags}|sed "s/ -g / -g -fdebug-types-section /")'
38 sed 's/^%\(\(define\|global\) *_find_debuginfo_dwz_opts\)/\1/'
39 ) <$name.spec >$name.spec.new
40 cp -p $name.spec ../$srcrpm.spec
41 cp -p $name.spec.new ../$srcrpm.spec.new
42 diff -u $name.spec $name.spec.new || :
43 mv -f $name.spec.new $name.spec
44 if ! $mock --resultdir=$PWD/resultdir --buildsrpm --spec $name.spec --sources $PWD;then
45 touch ../$srcrpm.bsmockfail
48 if [ $[$(find resultdir -name "*.src.rpm"|wc -l)] -ne 1 ];then
49 touch ../$srcrpm.bsmockefail
52 # if not pkg.endswith('.rpm'): log.error("%s doesn't appear to be an rpm - skipping", pkg)
53 mv -f resultdir/*.src.rpm ../$srcrpm.dt.rpm
55 test -e $srcrpm.dt.rpm
56 ln $srcrpm.dt.rpm $srcrpm.dt5.rpm
58 for ext in "" ".dt.rpm" ".dt5.rpm";do
59 resultdir=$PWD/$srcrpm$ext.resultdir
62 # --chain instead of --rebuild as otherwise -a does not work
63 $mock --resultdir=$resultdir --nocheck $(
64 if [ "$ext" = ".dt.rpm" ];then echo -a https://www.jankratochvil.net/t/rpmdts/ ;fi
65 if [ "$ext" = ".dt5.rpm" ];then echo -a https://www.jankratochvil.net/t/rpmdts5/;fi
66 ) --chain $srcrpm$ext &>$srcrpm$ext.mocklog
71 # --chain ignores --resultdir
72 resultdirsrc="$(sed -n 's/^INFO: Results out to: //p' $srcrpm$ext.mocklog)"
73 if [ ! -e $resultdirsrc/*/root.log ];then
74 touch $srcrpm$ext.mockfail
77 # With --chain $resultdir contains just some small *.log files.
79 mv `dirname $resultdirsrc/*/root.log` $resultdir
80 if [ $mockrc -ne 0 ];then
81 touch $srcrpm$ext.mockfail
84 echo >$srcrpm$ext.rpmsize $(du -sbc /dev/null $resultdir/*-debuginfo*.rpm|tail -n1|awk '{print $1}')
86 for i in $resultdir/*-debuginfo*.rpm;do
88 sizethis="$(rpm -q --qf '%{longsize}' -p $i)"
89 [[ "$sizethis" =~ ^[0-9]+$ ]]
90 size=$[$size+$sizethis]
93 echo >$srcrpm$ext.filesize $size
94 mkdir $srcrpm$ext.rpms
95 mv -f $resultdir/*-debuginfo*.rpm $srcrpm$ext.rpms || :