Created Friday 10/7/2009
Alien is a perl module which can be used to convert debian archives (.deb) into other (alien) formats like .rpm and .tgz. The contents of a .deb typically contains a control component (control.tar.gz) and a data component (which can be data.tar.gz or sometimes data.tar.lzma). Older versions of Alien (e.g., 8.64 and less) do not support LZMA, although changing the Perl module to support this compression type is trivial.
Assuming the .deb archive does not include a data component compressed via lzma, then conversion to rpm is trivial. Alien includes the --to-rpm (or -r) option to specify conversion to rpm. A futher option --scripts should be supplied as this will extract any pre-install and post-install scripts bundled into the package. Invocation of alien must be via priviledged user as the script invokes fakeroot(1)
bash # alien --scripts --to-rpm some-debian-package.deb
Some newer debian packages use LZMA (Lempel-Ziv-Markov chain Algorithm) for the data component. The alien perl module (for alien 8.64 and less) makes an assumption that the data component is a gz archive (data.tar.gz). This assumption is encoded in Package/Deb.pm (e.g., /usr/local/lib/perl5/site_perl/5.10.0/Alien/Package/Deb.pm) in the sub procedure scan (about line 216) and in sub procedure unpack (about line 264). Supporting lzma requires the lzma utils (specifically lzcat), which can be installed (in FC Linux using yum).
bash # yum install lzma-utils
If lzcat(1) is installed, then the Alien perl module Package/Deb.pm can be changed so that the data archive name reflects the LZMA archive name and the decompressor pipeline is changed to lzcat. E.g., for sub procedure scan, change the command:
$this->runpipe(0, "ar -p $file data.tar.gz | gzip -dc | tar tf -");
To:
$this->runpipe(0, "ar -p $file data.tar.lzma | lzcat | tar tf -");
A similar change is required for the unpack sub procedure
Stuart Moorfoot © 10 July 2009 foo@bund.com.au