only print the srpm/source file name again if it differs
just use print, not sys.stdout.write
try to deal with buffering issues