MDV::Packdrakeng man page on OpenMandriva

Man page or keyword search:  
man Server   8135 pages
apropos Keyword Search (all sections)
Output format
OpenMandriva logo
[printable version]

MDV::Packdrakeng(3)   User Contributed Perl Documentation  MDV::Packdrakeng(3)

NAME
       MDV::Packdrakeng - Simple Archive Extractor/Builder

SYNOPSIS
	   use MDV::Packdrakeng;

	   # creating an archive
	   $pack = MDV::Packdrakeng->new(archive => "myarchive.cz");
	   # Adding a few files
	   $pack->add("/path/", "file1", "file2");
	   # Adding an unamed file
	   open($handle, "file");
	   $pack->add_virtual("filename", $handle);
	   close($handle);

	   $pack = undef;

	   # extracting an archive
	   $pack = MDV::Packdrakeng->open(archive => "myarchive.cz");
	   # listing files
	   $pack->list();
	   # extracting few files
	   $pack->extract("/path/", "file1", "file2");
	   # extracting data into a file handle
	   open($handle, "file");
	   $pack->extract_virtual($handle, "filename");
	   close($handle);

DESCRIPTION
       "MDV::Packdrakeng" is a simple indexed archive builder and extractor
       using standard compression methods.

IMPLEMENTATION
       Compressed data are stored by block. For example,

	UncompresseddatA1UncompresseddatA2 UncompresseddatA3UncompresseddatA4
	|--- size  1 ---||--- size  2 ---| |--- size  3 ---||--- size  4 ---|
	|<-offset1	 |<-offset2	   |<-offset3	    |<-offset4

       gives:

	CompresseD1CompresseD2 CompresseD3CompresseD4
	|--- c. size 1, 2 ---| |--- c. size 3, 4 ---|
	|<-c. offset 1, 2      |<-c. offset 3, 4

       A new block is started when its size exceeds the "block_size" value.

       Compressed data are followed by the table of contents (toc), that is, a
       simple list of packed files. Each file name is terminated by the "\n"
       character:

	   dir1
	   dir2
	   ...
	   dirN
	   symlink1
	   point_file1
	   symlink2
	   point_file2
	   ...
	   ...
	   symlinkN
	   point_fileN
	   file1
	   file2
	   ...
	   fileN

       The file sizes follows, 4 values are stored for each file: offset into
       archive of compressed block, size of compressed block, offset into
       block of the file and the file's size.

       Finally the archive contains a 64-byte trailer, about the toc and the
       archive itself:

	   'cz[0', strings 4 bytes
	   number of directory, 4 bytes
	   number of symlinks, 4 bytes
	   number of files, 4 bytes
	   the toc size, 4 bytes
	   the uncompression command, string of 40 bytes length
	   '0]cz', string 4 bytes

FUNCTIONS
       new(%options)
	 Creates a new archive.	 Options:

	 archive
	     The file name of the archive. If the file doesn't exist, it will
	     be created, else it will be owerwritten. See "open".

	 compress
	     The application to use to compress, if unspecified, gzip is used.

	 uncompress
	     The application used to extract data from archive. This option is
	     useless if you're opening an existing archive (unless you want to
	     force it).	 If unset, this value is based on compress command
	     followed by '-d' argument.

	 extern
	     If you're using gzip, by default MDV::Packdrakeng will use perl-
	     zlib to save system ressources. This option forces
	     MDV::Packdrakeng to use the external gzip command. This has no
	     meaning with other compress programs as internal functions are
	     not implemented yet.

	 comp_level
	     The compression level passed as an argument to the compression
	     program. By default, this is set to 6.

	 block_size
	     The limit size after which we start a new compressed block. The
	     default value is 400KB. Set it to 0 to be sure a new block will
	     be started for each packed files, and -1 to never start a new
	     block. Be aware that a big block size will slow down the file
	     extraction.

	 quiet
	     Do not output anything, shut up.

	 debug
	     Print debug messages.

       open(%options)
	 Opens an existing archive for extracting or adding files.

	 The uncompression command is found into the archive, and the
	 compression command is deduced from it.

	 If you add files, a new compressed block will be started even if the
	 last block is smaller than the value of the "block_size" option. If
	 some compression options can't be found in the archive, the new
	 preference will be applied.

	 Options are the same than for the "new()" function.

       MDV::Packdrakeng->add_virtual($type, $filename, $data)
	 Adds a file into archive according passed information.	 $type gives
	 the type of the file:

	   - 'd', the file will be a directory, store as '$filename'. $data is not used.
	   - 'l', the file will be a symlink named $filename, pointing to the file whose path
	     is given by the string $data.
	   - 'f', the file is a normal file, $filename will be its name, $data is either
		  an handle to open file, data will be read from current position to the
		  end of file, either a string to push as the content of the file.

       MDV::Packdrakeng->add($prefix, @files)
	 Adds @files into archive located into $prefix. Only directory, files
	 and symlink will be added. For each file, the path should be relative
	 to $prefix and is stored as is.

       MDV::Packdrakeng->extract_virtual(*HANDLE, $filename)
	 Extracts $filename data from archive into the *HANDLE. $filename
	 should be a normal file.

       MDV::Packdrakeng->extract($destdir, @files)
	 Extracts @files from the archive into $destdir prefix.

       MDV::Packdrakeng->getcontent()
	 Returns three arrayrefs describing files files into archive,
	 respectively directory list, files list and symlink list.

       MDV::Packdrakeng->infofile($file)
	 Returns type and information about a given file into the archive;
	 that is:

	   - 'f' and the the size of the file for a plain file
	   - 'l' and the linked file for a symlink
	   - 'd' and undef for a directory
	   - undef if the file can't be found into archive.

       MDV::Packdrakeng->infofile($handle)
	 Print to $handle (STDOUT if not specified) the content of the
	 archive.

       MDV::Packdrakeng->dumptoc($handle)
	 Print to $handle (STDOUT if not specified) the table of content of
	 the archive.

CHANGELOG
   1.10
       use an oo code
       add_virtual() now accept a string as file content

AUTHOR
       Olivier Thauvin <nanardon@mandriva.org>, Rafael Garcia-Suarez
       <rgarciasuarez@mandriva.com>

       Copyright (c) 2005 Mandriva

       This module is a from scratch-rewrite of the original "packdrake"
       utility. Its format is fully compatible with the old packdrake.

LICENSE
       This program is free software; you can redistribute it and/or modify it
       under the terms of GNU General Public License as published by the Free
       Software Foundation; either version 2 of the License, or (at your
       option) any later version.

       This program is distributed in the hope that it will be useful, but
       WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
       General Public License for more details.

       If you do not have a copy of the GNU General Public License write to
       the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
       USA.

perl v5.16.3			  2012-01-24		   MDV::Packdrakeng(3)
[top]

List of man pages available for OpenMandriva

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net