Running rpmlint within mock

Jason L Tibbitts III tibbs at math.uh.edu
Sat Jul 15 05:49:53 UTC 2006


OK, here's a first pass hack.  This could be better written in Python
and could extract some bits from the mock configuration, but this does
at least work.  It builds the package, installs rpmlint and all of the
newly-built binary RPMs and (hopefully) their dependencies into the
chroot.  It then runs rpmlint on the SRPM, the binary RPMs and the
installed package names.  I have tested this against packages which
show different warnings for each and it seems to actually work.

You'll have to edit to taste, and try not to hurl as some of the
quoting is nasty.

 - J<

#!/bin/sh
MOCKDIR=/var/lib/mock/fedora-development-x86_64-core
MOCKCFG=fedora-6-x86_64-core.cfg
time mock --autocache --debug -r $MOCKCFG $*
echo =======
mock-helper yum --installroot $MOCKDIR/root install rpmlint
echo =======
mock-helper yum --installroot $MOCKDIR/root localinstall $MOCKDIR/result/*{i386,x86_64,noarch}.rpm
echo =======
echo rpmlint of SRPM:
mock -r $MOCKCFG --debug -- chroot ls -l /builddir/build/SRPMS/\*.rpm \
  | grep -E -v '^(init$|ending$|done$|DEBUG:)' \
  | tee $MOCKDIR/result/rpmlint
mock -r $MOCKCFG --debug -- chroot rpmlint /builddir/build/SRPMS/\*.rpm \
  | grep -E -v '^(init$|ending$|done$|DEBUG:)' \
  | tee -a $MOCKDIR/result/rpmlint
echo ======
echo rpmlint of RPMs:
mock -r $MOCKCFG --debug -- chroot ls -l /builddir/build/RPMS/\*.rpm \
  | grep -E -v '^(init$|ending$|done$|DEBUG:)' \
  | tee -a $MOCKDIR/result/rpmlint
mock -r $MOCKCFG --debug -- chroot rpmlint /builddir/build/RPMS/\*.rpm \
  | grep -E -v '^(init$|ending$|done$|DEBUG:)' \
  | tee -a $MOCKDIR/result/rpmlint
echo ======
echo rpmlint of installed RPMs:
mock -r $MOCKCFG --debug -- chroot rpmlint \\\`rpm -qp /builddir/build/RPMS/\*.rpm --qf \\\"%{NAME} \\\"\\\` \
  | grep -E -v '^(init$|ending$|done$|DEBUG:)' \
  | tee -a $MOCKDIR/result/rpmlint
echo ======
echo Results in $MOCKDIR/result




More information about the Fedora-buildsys-list mailing list