• Arch PKGBUILDs
  • Downloads
  • Get in touch
  • Hardware
  • Screenshots
  • The name
Home

Pacman meets LZMA - finally

B — Mon, 06/04/2009 - 20:18

Some of you might know LZMA as the default compression algorhythm of 7zip. *nix counterparts had support through LZMA utils. GNU Tar could be patched to support it, but there was no way for libarchive to support it - until recently. A new spec, a new name (xz) and a future change of license allowed for xz support in the codebase. Since pacman and makepkg rely on libarchive for compression handling, that makes it possible to build and install packages with xz.

For those unfamiliar with LZMA/xz, in the realm of compression formats it stands between gzip and bzip2 for compression and decompression speed, and it tops the list when you talk package size. Now let's have a look at how to get this going.

There are quite a few packages you need to rebuild or install to get your system to handle xz compressed packages, though. A short overview, in chronological order:

  • file
  • shared-mime-info
  • xz-utils
  • libarchive (2.6.990a at least)
  • pacman (does not need to be rebuilt per se, but it's cleaner this way

Props go to Zeqadious for most of the patches and files. He runs his own Arch-inspired distro - called 'Zizzy' - and, true to his hacker nature, already set up his system to support xz packages. He's not my slave, nor is he my codiing monkey - we just happen to share a common interest in package manager and their supporting xz/LZMA. Back in our Zenwalk days we had netpkg happily eating LZMA-compressed packages - and it involved more or less the same procedures: building the utilities, fixing up the (de)compression utilities, and subduing Netpkg, Zenwalk's package manager. Now, Pacman's time has finally come.

For file, you can find a here. shared-mime-info does not need to be rebuilt - you can just drop the data file in /usr/share/mime/packages/, or rebuild the package if you like.

Xz-utils can be installed through the AUR (see link above). Libarchive just needs a rebuild with xz-utils installed - it should pick it up automatically:
checking lzma.h usability... yes
checking lzma.h presence... yes

Pacman requires some more work (well, if you read this, it has already been done for you ;-)). You'll need to change the makepkg script as well as /etc/makepkg.conf. Make sure, when rebuilding and re-installing pacman, that you either replace or adapt /etc/makepkg.conf. Apart from setting xz as the default compression format, the modified makepkg also needs the PKG_COMPRESSION variable defined. Don't ask me why - libarchive already handles bzip2 and gzip in its stable releases - but pacman devs chose to hardcode makepkg to compress with gzip - and gzip only. The patch can be downloaded here.

When all that is done, you can sit back and actually enjoy it:

root@hermes stijn pacman -U packages/pacman-3.2.2-2-i686.pkg.tar.xz
loading package data...
checking dependencies...
(1/1) checking for file conflicts [###############################################################################################################] 100%
(1/1) upgrading pacman [###############################################################################################################] 100%
Optional dependencies for pacman
fakeroot: for makepkg usage as normal user
python: for rankmirrors script usage
root@hermes stijn file packages/pacman-3.2.2-2-i686.pkg.tar.xz
packages/pacman-3.2.2-2-i686.pkg.tar.xz: xz compressed data
root@hermes stijn ll packages/pacman-3.2.2-2-i686.pkg.tar.*
-rw-r--r-- 1 stijn users 491K apr 6 20:02 packages/pacman-3.2.2-2-i686.pkg.tar.gz
-rw-r--r-- 1 stijn users 279K apr 6 20:15 packages/pacman-3.2.2-2-i686.pkg.tar.xz

Looks quite nice, doesn't it?

  • Arch Linux
  • Open Source
  • Add new comment
  • 1159 reads

Blog posts

  • Drupal (1)
  • Embedded Linux (5)
  • OpenWrt (5)
  • Hardware (3)
  • Linux (9)
  • Arch Linux (4)
  • Icadyptes (0)
  • Miscellaneous (2)
  • Music (3)
  • Open Source (4)
  • Politics (1)

Fellow nutcases

Avarus
Ks1
Sega01

Recommended links

Arch Linux
Drupal
Glasnost ISP Bittorrent test
Heise Online
Icadyptes (aka "The Penguin")
Kwort Linux
OpenWrt
Salix (The Bonsai OS)
Zenwalk Linux

All copyright by B unless stated otherwise. Linking and/or copying information is allowed as long as the source is properly credited.