I just wrote about a program I crafted some time ago... in Perl. Happy reading if you're interested into producing smarter tarballs! The article is here.