Tuesday, May 19, 2009

Unpack just what you need

The other day I thought it would be interesting to emerge mtree. mtree is an application that generates a detailed file listing, but that's not the interesting part of today's post. I typed emerge mtree and I see 18 MB need to be downloaded. That sounds funny, should be a small utility. Then I saw it was downloading a big pkgsrc archive from BSD. Okay, that figures they distribute everything in one big archive.

So I let it download, now it's in the unpack phase... and still unpacking... and still unpacking. Hey, what's going on? It's already unpacked 500 MB (kudos bzip2!). I know disk space is cheap today and maybe blackbird is showing its age, but unpacking hundreds of megs for this utility seems really inefficient.

I figured I could modify the ebuild to unpack only the relevant directories of the archive. I was right - a small change to the ebuild (well, fix a typo and then try again) and it works... Hardly any disk space used and I also shaved some time off the emerge.

I don't know if this would be accepted as a bug but I decided to share my optimized ebuild anyway in this bug.

No comments:

Post a Comment