Need help extracting deb (ar) archive
Posted: Tue Apr 28, 2009 6:51 pm
Hello, I am somewhat new to php but am trying to learn as much as I can.
A project I am currently working on will need to extract a file from a .deb file which is an ar archive. Unlike tar or zip php does not seem to have any sort of built in function for doing so.
After doing much searching all I found in the way of extraction an ar archive in php was http://poocl.la-grotte.org/ This seems to have he ability. But I only want to have a single function for extracting an ar archive and not the rest.
Can anyone help me figure out how to do this? What I really want is the control file located in file.deb/control.tar.gz/control But I know how to extract the tar.gz, unless there is some way to do it all at once.
Even though I do not want to include the dependency of the File_Archive software I linked to above I gave it a try following an example on their website. (which required php-pear to be installed, another dependency I would prefer to do without) Using the following code:
I get the following error:
So, if there is no simple way to extract the ar, or just use the ar code from this project. How can I get the above test to work?
Thanks in advance!
A project I am currently working on will need to extract a file from a .deb file which is an ar archive. Unlike tar or zip php does not seem to have any sort of built in function for doing so.
After doing much searching all I found in the way of extraction an ar archive in php was http://poocl.la-grotte.org/ This seems to have he ability. But I only want to have a single function for extracting an ar archive and not the rest.
Can anyone help me figure out how to do this? What I really want is the control file located in file.deb/control.tar.gz/control But I know how to extract the tar.gz, unless there is some way to do it all at once.
Even though I do not want to include the dependency of the File_Archive software I linked to above I gave it a try following an example on their website. (which required php-pear to be installed, another dependency I would prefer to do without) Using the following code:
Code: Select all
<?php
require_once "File/Archive.php";
//Note as the archives appear as folders
File_Archive::extract(
// $src = "archive.tar/inner.tgz/file.txt",
// File_Archive::toOutput()
$src = "./file.deb/control.tar.gz/control",
$conout = "./out.txt"
);
?>Code: Select all
Warning: require_once(MIME/Type.php) [function.require-once]: failed to open stream: No such file or directory in /data/web/test/File/Archive/Reader/File.php on line 33
Fatal error: require_once() [function.require]: Failed opening required 'MIME/Type.php' (include_path='.:/usr/share/php:/usr/share/pear') in /data/web/test/File/Archive/Reader/File.php on line 33Thanks in advance!