Busybox 'rpm2cpio' fails

I have run into a problem with expanding Mageia RPM packages. The Busybox 'rpm2cpio' applet cannot expand these files. A quick search returned just one hit:
http://forum.tinycorelinux.net/index.php?topic=7681.new;topicseen

The problem seems to be that Mageia, and I presume Mandriva, is using XZ compression for the .rpm files. The Busybox 1.17.2 applets are supposed to support XZ. Hmmm, so I compiled the latest Busybox, 1.18.5, same problem.

Fortunately, the above link has a solution, to use the p7zip package. Downloading it right now.


Posted on 16 Jun 2011, 16:46


Comments:

Posted on 16 Jun 2011, 17:54 by BarryK
7z fails too
Hmmm, I compiled 7z, that doesn't work either:

# 7za x -so zip-3.0-4.mga1.i586.rpm | cpio -i -d -m


7-Zip (A) 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18
p7zip Version 9.20 (locale=en_US,Utf16=on,HugeFiles=on,1 CPU)

Processing archive: zip-3.0-4.mga1.i586.rpm

Error: Can not open file as archive




Posted on 16 Jun 2011, 18:48 by MHHP
rpm2cpio SL6
Hello,

when woofing up a SL6-pup, I just copied the busybox binary from SL6 to /bin.
hth/ MHHP


Posted on 16 Jun 2011, 21:37 by L18L
7z
To whom it may concern: Just donít use 7zr or 7za take 7z (package p7zip-full) instead.
quoted from BrotDasBernd, comment in:
http://openmtbmap.org/es/updates/enmap-updates-11062010-dekartenupdates-11062010/comment-page-1/#comment-2396
HTH


Posted on 16 Jun 2011, 24:19 by pemasu
7z uncompress
sh-4.1# 7z x -so zip-3.0-4.mga1.i586.rpm | cpio -i -d -m

7-Zip 9.04 beta Copyright (c) 1999-2009 Igor Pavlov 2009-05-30
p7zip Version 9.04 (locale=en_US,Utf16=on,HugeFiles=on,4 CPUs)

Processing archive: zip-3.0-4.mga1.i586.rpm

Extracting zip-3.0-4.mga1.i586.cpio

Everything is Ok

Size: 0
Compressed: 232268
1524 blocks



Posted on 17 Jun 2011, 4:43 by Dougal
7z??
Barry, why not use the actual xz util (from Lasse Colin's xz-utils)?

The way I found for extracting xz-compressed rpm packages is:
rpm2cpio $file | unxz - | cpio -i -d


Posted on 17 Jun 2011, 11:34 by 01micko
7zip
I compiled 7zip with "make all3", that builds the 7z exec. It then works how pemasu describes.


Posted on 18 Jun 2011, 8:50 by BarryK
Re unxz
Dougal,
No, that won't work, it is the first step, 'rpm2cpio' that complains of the "wrong magic" in the file. Besides, I'm not really sure that the Mandriva/Mageia .rpms are using xz.

01micko,
Thanks, I only tried 7za and 7zr. I'll give the full version a go.

Mageia is using RPM5. I downloaded version 5.3.5, but cannot compile it. I might try and get a precompiled binary of the rpm package.



Posted on 18 Jun 2011, 18:30 by BarryK
Using 7z in Woof
Yes, the full 7z works, thanks for the feedback on that.

I have modified script '2createpackages' in Woof so that if Mageia RPMs are being used then it requires 'p7zip' (and executable 7z) to be installed.

I'm running '2createpackages' right now. One thing, 7z is extremely slow in extracting from .rpm files. Incredibly slow.




Posted on 19 Jun 2011, 5:38 by Dougal
RPM in Mageia
Barry, this might explain the problem with Mageia RPM:
http://lwn.net/Articles/441085/


Posted on 19 Jun 2011, 8:54 by ttuuxxx
mageia rpms work on 2.14x
hi barry I downloaded http://distrib-coffee.ipsl.jussieu.fr/pub/linux/Mageia/distrib/1/i586/media/core/release/zip-3.0-4.mga1.i586.rpm and click on it in 2.14x and rox used /usr/local/bin/alienmanager to install it. Alienmanager in 2.14x was modified by the user clarf for 2.14x, here is a link to the used in 2.14x
http://www.smokey01.com/ttuuxxx/other/alienmanager-214x.tar.gz
also Fileroller can extract 7zip packages with the older 7zip being installed. just tested it.
If you have gconf installed than fileroller sources can be hacked to remove extra deps like GDU etc, but gconf is needed. Last time I check gconf/orbit/Fileroller was under 1MB combined.
ttuuxxx


Posted on 19 Jun 2011, 11:05 by 01micko
rpm2cpio
I went through the process of compiling rpm-4.8.1 from Mageia source
http://mirror.aarnet.edu.au/pub/mageia/distrib/1/SRPMS/core/release/rpm-4.8.1-10.mga1.src.rpm
There is heap of patches in the archive but they all apply cleanly, I did it in one loop.
I had to set CPPFLAGS to find nss/nspr.
export CPPFLAGS="-I/usr/include/seamonkey-2.1b3/nspr -I/usr/include/seamonkey-2.1b3"(a Slackware SM package, but it had some dummy libs failing in 'make' so transferred real libs from another SM package, so mainly used it for the headers)
I didn't have the 'file' headers installed (magic.h) so found that (this is in spup, so I need to fix that in my devx).
I kept getting "nss3" errors using configure so I used autogen.sh. That gets rid of all the 'nss3' references in configure too.
Then got lua error, so I just ran
./autogen.sh --with-lua=no.. didn't set --prefix=/usr because I didn't want to override stuff but it should really be set if you want the dev stuff, but if you were to use it I guess all the execs could be ditched except rpm2cpio, but then again it's the libs that make up the size. I split it up with new2dir (main package is 2580k uncompressed).
It works, probably faster than 7z. I grabbed a mageia abiword package to test and it extracted successfully with:
rpm2cpio abiword-2.8.6-2.mga1.i586.rpm| cpio -idm
So it's doable.



Posted on 19 Jun 2011, 17:43 by BarryK
Mageia vs Mandriva
Dougal,
Thanks for that link, that is a very interesting read. I made a bad assumption, I knew that Mandriva use RPM5, so I assumed Mageia does to -- so I downloaded the latest RPM5 and attempted to compile it -- and failed.

As Mageia is still using RPM4, I am puzzled that Busybox rpm2cpio can't handle it.

01micko,
Thanks for compiling mageia's RPM source. Ok, I'll give that a go, see if I can compile it in Wary.



Posted on 19 Jun 2011, 19:45 by ttuuxxx
Mageia
Hi Barry did you try clarf's code used in alienmanager-214x.tar.gz I posted above for rpms, it installs them without 7zip being installed.

The code is too long to post here, over 2000 words, so the tar.gz is above.
ttuuxxx


Posted on 19 Jun 2011, 21:22 by BarryK
exploderpm
Bingo! ttuuxxx, you have solved it! Alienmanager by clarf does the job.

However, alienmanager has modifications specific to Puppy 2.x. The original script is 'exploderpm' (also handles .debs):
http://distro.ibiblio.org/amigolinux/download/src2pkg/pasture/src2pkg-2.2/Resources/bin/exploderpm

Great, this is going into Woof, as a permanent script in all builds.

Dougal, you will find that script interesting, how it detects compression type, then uses 'unxz', 'gunzip' or 'bunzip2'.



Posted on 21 Jun 2011, 4:31 by Dougal
exploderpm
Interesting that the script was originally written by Amigo (from the forum)... then used by Lasse Colin.
Anyway... using object-dump is something I don't see the point in -- I presume what the script does is just what the "file" command does.