git doesn’t really take up 100MB

Valent’s post on finding the largest installed rpms sparked my interest.  I’m almost obsessive about reducing my set of installed packages.  But when I saw this output, I was a bit shocked.

  87599107-java-1.6.0-openjdk-1.6.0.0
  97552966-glibc-common-2.10.1
 100008386-git-1.6.2.5
 106080469-java-1.6.0-sun-1.6.0.11
 112425640-texlive-texmf-fonts-2007
 227731461-openoffice.org-core-3.1.0

While I’m not surprised the openoffice.org and java take up huge amounts of disk space, I was amazed that git does.  After all, most of git is hard linked to /usr/bin/git.  I whipped up a quick awk script to add based on unique inodes.

#!/usr/bin/awk -f
BEGIN { s = 0; lasti = 0 }
{ if ( lasti != $1 ) { s += $6; lasti = $1 } }
END { print s }

Then ran it on git like so:

[nstraz@tin ~]$ rpm -ql git | xargs ls -lid | sort -n | ./countsize.awk
15956998

Roughly 16MB vs 100MB.  That makes more sense.

Advertisements

3 Comments

  1. Posted August 10, 2009 at 12:04 pm | Permalink

    This is what you want:

    rpm -q –qf ‘%{archivesize}’ git

  2. Panu Matilainen
    Posted August 11, 2009 at 5:43 am | Permalink

    The rpmbuild version used to build that git package miscalculated hardlinked files, see https://bugzilla.redhat.com/show_bug.cgi?id=503020. The bug has been fixed but git hasn’t been rebuilt so the size still appears crazy.

  3. Posted August 11, 2009 at 7:57 am | Permalink

    Right, this was reported at:
    https://bugzilla.redhat.com/show_bug.cgi/?id=503020

    I noticed in when testing my fslint package as it has a function for listing packages by installed size which you may be interested in.
    You can get it at http://www.pixelbeat.org/fslint/ or
    yum install fslint

%d bloggers like this: