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

Calculation of cd sizes implemented and tested, should I commit?



Hi!

It is two weeks since we started using at gluck the code I made to try to
estimate the sizes of the cd parts that debian-cd was not controling, it
seems to be working ok, so I was wondering if I should commit it :-?

What I did is an script tools/calc which gets info from the last full or
partial cd build, so that it gets the sizes of the boot files and other
stuff on the cds which is not packages and then builds a .calc file
containing this.

So, this is all standard, I mean, if one wants to use tools/calc to update
the .calc files for an arch, he can, if not, he uses the last estimations
stored in .calc files and given that things hadn't changed a lot since they
were estimated, they should still work ok.

The resulting .calc files are like this one (boot-powerpc.calc):

BOOT_SIZE_1=65
BOOT_SIZE_10=2
BOOT_SIZE_11=2
BOOT_SIZE_12=2
BOOT_SIZE_13=2
BOOT_SIZE_14=2
BOOT_SIZE_2=2
BOOT_SIZE_3=2
BOOT_SIZE_4=2
BOOT_SIZE_5=2
BOOT_SIZE_6=2
BOOT_SIZE_7=2
BOOT_SIZE_8=2
BOOT_SIZE_9=2
SIZE_MULT_1=93

The SIZE_MULT stuff is calculated by hand, as there is no way to easily
estimate the filesystem overhead, so far only m68k for all cds and powerpc
for the first cd need this.

I can try to remove the 2 megs of maximum overhead that is being added and
remove a lot of those entries if people finds any problem with this data.

This is the code that generates it:

#!/bin/sh

# Directory of the previous build, this doesn't need to be a full build,
# you can get the needed stuff by running a build.sh with something like:
# IMAGETARGET="ok bootable upgrade bin-infos bin-list"
BDIR="$TDIR/$CODENAME-$ARCH"

#Get info from older build if it exists
if [ -d "$BDIR" ];
then
  echo Estimated sizes:
  rm -f "boot/sarge/boot-$ARCH.calc"
  for i in `du -sm "$BDIR"/CD[0123456789]* |
              sed -n 's/^\([0-9]\+\).*CD\([0-9]\+\)/\2=\1/p'`
  do
    #space used by boot images in megs (this has an error of up to a mega)
    if [ -d "$BDIR/boot${i%=*}" ]
    then
      imgdu=`du -sm "$BDIR/boot${i%=*}" |
               sed -n 's/^\([0-9]\+\).*/\1/p'`
    else
      imgdu=1
    fi
    #add it all up and write it to the .calc file
    echo BOOT_SIZE_${i%=*}=${i#*=}+$imgdu
    echo BOOT_SIZE_${i%=*}=$((${i#*=}+$imgdu)) >> "boot/sarge/boot-$ARCH.calc"
    case "$ARCH" in
      m68k)	echo SIZE_MULT_${i%=*}=97 >> "boot/sarge/boot-$ARCH.calc";;
    esac
  done
fi
case "$ARCH" in
  powerpc)     echo SIZE_MULT_1=93 >> "boot/sarge/boot-$ARCH.calc";;
esac

Well, comments, new ideas, patches, ... :-?

Should I commit it like that and then let people do changes?

Regards...
-- 
Manty/BestiaTester -> http://manty.net



Reply to: