[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Size reporting by RPM



I know its a nit-picky little thing, but RPMs built on RedHat 9 (I haven't
checked older versions yet) report incorrect sizes depending on how files
are packaged in the %files section of the spec.

In particular, file sizes are added to the Size variable in these cases when
it shouldn't be :

* A file is listed twice in the same %files section, usually because a
  wildcard caught it once then it is listed explicity (the file size is
  added twice in this case).  It is reported by RPM as being there twice,
  just not handled properly.
* A file is excluded via %exclude, its size is still added, although the file
  is not

And finally, file sizes are NOT added to the Size variable for symbolic
links...  

I can see how the first two are "well write your spec files properly you idiot
and it will work fine", and I agree, I've fixed those, but the latter looks
like it should be fixed, not a big deal, but for accuracy's sake.

The following script will take an RPM as an argument and report
on the sum of the sizes listed in the file list and the size listed in
the Size variable in the RPM and put a * beside the result if they don't
match.

#!/bin/sh
file=$1
realsize=`rpm -qlvp $file | awk '{s+=$5} END {print s}'`;
reportedsize=`rpm -qp --queryformat "%{size}" $file`; 
if [ "$realsize" != "$reportedsize" ]; then 
   printf "* "
else 
   printf "  "
fi
printf "%10s %10s %s\n" $realsize $reportedsize $file;
exit 0

Andrew Schretter
Systems Programmer, Duke University
Dept. of Mathematics (919) 660-2866









[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []