10 Nov
2010
10 Nov
'10
3:47 a.m.
Hi, I have implemented some basic disk space checking in pacman. The code is still a bit rough and there are some TODOs in there (especially related to output). But the basics are all there, so it seems time to get some comments. See my diskspace branch: http://projects.archlinux.org/users/allan/pacman.git/log/?h=diskspace Obviously I need to do some rebasing there, so it is probably easiest to look at the diff between that and my working branch: http://projects.archlinux.org/users/allan/pacman.git/diff/?h=diskspace&id2=working Here are some basic examples of what is implemented so far: > sudo src/pacman/pacman -S grub --dbpath /home/allan/tmp/db/ ... (1/1) checking for file conflicts [######################] 100% Partition: / - blocks needed: 112 - blocks free: 2635828 Partition: /boot - blocks needed: 1 - blocks free: 109046 (1/1) installing grub [######################] 100% > sudo src/pacman/pacman -S grub --dbpath /home/allan/tmp/db/ ... (1/1) checking for file conflicts [######################] 100% Partition: / - blocks needed: 0 - blocks free: 2635684 Partition: /boot - blocks needed: 0 - blocks free: 109044 (1/1) upgrading grub [######################] 100% It also handles the space freed by removing conflicts etc. Obviously the space calculations could be improved, e.g. - for /boot on installing grub, the /boot/grub directory should require a block in addition to the one used by the menu.lst file - directories get counted for removal even when they are not being removed... and that multiplies across packages - .PKGINFO etc count towards / (rather than to dbpath ???) - space for .pacnew/.pacsave files is ignored But it is close enough... In its current form the calculations should catch major stupidity. Allan