X-Git-Url: https://git.jankratochvil.net/?p=nethome.git;a=blobdiff_plain;f=bin%2Fmockupdate;h=fc22ef650810e87a64fb0e38d3a042f418a340a7;hp=820c8e643b73949b2bb97ec166f4024fedf7b96f;hb=a8e600e7fd904d45e73ef114d0ec791c510b207f;hpb=6679d43396020207ceb35078f397bf8d65287751 diff --git a/bin/mockupdate b/bin/mockupdate index 820c8e6..fc22ef6 100755 --- a/bin/mockupdate +++ b/bin/mockupdate @@ -7,6 +7,16 @@ if [ "$1" = "-v" ];then shift fi +quick=false +if [ "$1" = "-q" ];then + quick=true + shift +fi + +if [ -z "$HOME" -o "$HOME" = "/" ];then + export HOME=/root +fi + for i in "$@";do if [ "$i" = "${i#/var/lib/mock/}" ];then echo >&2 "$i not /var/lib/mock/*" @@ -36,9 +46,28 @@ for i in "$@";do continue fi + r="$(basename $i|sed 's/\(-x86_64\|-i.86\)-.*$/\1/')" + r="$r$(basename $i|sed -n 's/^.*\(-x86_64\|-i.86\)-\(.*\)$/ --uniqueext=\2/p')" /usr/local/sbin/mocksetup -u `basename $i` - mock $opts -r `basename $i` --update - mock $opts -r `basename $i` --install `cat ~/src/INSTALL` + if ! $quick;then + rm -f $i/root/var/lib/rpm/__db.* + mock $opts -r $r --update + mock $opts -r $r --install `cat $HOME/src/INSTALL` + # Otherwise: error: cannot open Packages index using db3 - Invalid argument (22) + if [ "${i#*/epel-[45]-}" = "$i" ];then + rm -f $i/root/var/lib/rpm/__db.* + mock $opts -r $r --shell 'package-cleanup --cleandupes' + rm -f $i/root/var/lib/rpm/__db.* + mock $opts -r $r --update + mock $opts -r $r --install `cat $HOME/src/INSTALL` + fi + fi + # Otherwise: error: cannot open Packages index using db3 - Invalid argument (22) + if [ "${i#*/epel-[45]-}" = "$i" ];then + rm -f $i/root/var/lib/rpm/__db.* + mock $opts -r $r --shell 'package-cleanup --cleandupes' + fi + rm -f $i/root/var/lib/rpm/__db.* # Run: yum groupinstall buildsys-build # Cleaning would undo the changes above. # file /lib/libnssutil3.so conflicts between attempted installs of nss-3.12.3.99.3-10.fc12.i686 and nss-util-3.12.3.99.3-9.fc12.i686 @@ -50,6 +79,10 @@ for i in "$@";do # Just rpmbuild would error with: # error: cannot open Packages index using db3 - Invalid argument (22) rpm -r $i/root --rebuilddb + # Leftover usually just removing vital system packages: + rm -f $i/root/var/lib/yum/transaction-* + # Print duplicates: + rpm -r $i/root --qf '%{name}.%{arch}\n' -qa|sort|uniq -d|grep -v '^kernel\.'|sed -e '1s/^/ror duplicity:\n/' -e '1s/^/mockupdate er/' done - echo done mockupdate "$*" +echo done mockupdate "$*"