1MDV::Packdrakeng(3)   User Contributed Perl Documentation  MDV::Packdrakeng(3)
2
3
4

NAME

6       MDV::Packdrakeng - Simple Archive Extractor/Builder
7

SYNOPSIS

9           use MDV::Packdrakeng;
10
11           # creating an archive
12           $pack = MDV::Packdrakeng->new(archive => "myarchive.cz");
13           # Adding a few files
14           $pack->add("/path/", "file1", "file2");
15           # Adding an unamed file
16           open($handle, "file");
17           $pack->add_virtual("filename", $handle);
18           close($handle);
19
20           $pack = undef;
21
22           # extracting an archive
23           $pack = MDV::Packdrakeng->open(archive => "myarchive.cz");
24           # listing files
25           $pack->list();
26           # extracting few files
27           $pack->extract("/path/", "file1", "file2");
28           # extracting data into a file handle
29           open($handle, "file");
30           $pack->extract_virtual($handle, "filename");
31           close($handle);
32

DESCRIPTION

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

IMPLEMENTATION

38       Compressed data are stored by block. For example,
39
40        UncompresseddatA1UncompresseddatA2 UncompresseddatA3UncompresseddatA4
41        |--- size  1 ---||--- size  2 ---| |--- size  3 ---||--- size  4 ---|
42        |<-offset1       |<-offset2        |<-offset3       |<-offset4
43
44       gives:
45
46        CompresseD1CompresseD2 CompresseD3CompresseD4
47        |--- c. size 1, 2 ---| |--- c. size 3, 4 ---|
48        |<-c. offset 1, 2      |<-c. offset 3, 4
49
50       A new block is started when its size exceeds the "block_size" value.
51
52       Compressed data are followed by the table of contents (toc), that is, a
53       simple list of packed files. Each file name is terminated by the "\n"
54       character:
55
56           dir1
57           dir2
58           ...
59           dirN
60           symlink1
61           point_file1
62           symlink2
63           point_file2
64           ...
65           ...
66           symlinkN
67           point_fileN
68           file1
69           file2
70           ...
71           fileN
72
73       The file sizes follows, 4 values are stored for each file: offset into
74       archive of compressed block, size of compressed block, offset into
75       block of the file and the file's size.
76
77       Finally the archive contains a 64-byte trailer, about the toc and the
78       archive itself:
79
80           'cz[0', strings 4 bytes
81           number of directory, 4 bytes
82           number of symlinks, 4 bytes
83           number of files, 4 bytes
84           the toc size, 4 bytes
85           the uncompression command, string of 40 bytes length
86           '0]cz', string 4 bytes
87

FUNCTIONS

89       new(%options)
90         Creates a new archive.  Options:
91
92         archive
93             The file name of the archive. If the file doesn't exist, it will
94             be created, else it will be owerwritten. See "open".
95
96         compress
97             The application to use to compress, if unspecified, gzip is used.
98
99         uncompress
100             The application used to extract data from archive. This option is
101             useless if you're opening an existing archive (unless you want to
102             force it).  If unset, this value is based on compress command
103             followed by '-d' argument.
104
105         extern
106             If you're using gzip, by default MDV::Packdrakeng will use perl-
107             zlib to save system ressources. This option forces
108             MDV::Packdrakeng to use the external gzip command. This has no
109             meaning with other compress programs as internal functions are
110             not implemented yet.
111
112         comp_level
113             The compression level passed as an argument to the compression
114             program. By default, this is set to 6.
115
116         block_size
117             The limit size after which we start a new compressed block. The
118             default value is 400KB. Set it to 0 to be sure a new block will
119             be started for each packed files, and -1 to never start a new
120             block. Be aware that a big block size will slow down the file
121             extraction.
122
123         quiet
124             Do not output anything, shut up.
125
126         debug
127             Print debug messages.
128
129       open(%options)
130         Opens an existing archive for extracting or adding files.
131
132         The uncompression command is found into the archive, and the
133         compression command is deduced from it.
134
135         If you add files, a new compressed block will be started even if the
136         last block is smaller than the value of the "block_size" option. If
137         some compression options can't be found in the archive, the new
138         preference will be applied.
139
140         Options are the same than for the "new()" function.
141
142       MDV::Packdrakeng->add_virtual($type, $filename, $data)
143         Adds a file into archive according passed information.  $type gives
144         the type of the file:
145
146           - 'd', the file will be a directory, store as '$filename'. $data is not used.
147           - 'l', the file will be a symlink named $filename, pointing to the file whose path
148             is given by the string $data.
149           - 'f', the file is a normal file, $filename will be its name, $data is either
150                  an handle to open file, data will be read from current position to the
151                  end of file, either a string to push as the content of the file.
152
153       MDV::Packdrakeng->add($prefix, @files)
154         Adds @files into archive located into $prefix. Only directory, files
155         and symlink will be added. For each file, the path should be relative
156         to $prefix and is stored as is.
157
158       MDV::Packdrakeng->extract_virtual(*HANDLE, $filename)
159         Extracts $filename data from archive into the *HANDLE. $filename
160         should be a normal file.
161
162       MDV::Packdrakeng->extract($destdir, @files)
163         Extracts @files from the archive into $destdir prefix.
164
165       MDV::Packdrakeng->getcontent()
166         Returns three arrayrefs describing files files into archive,
167         respectively directory list, files list and symlink list.
168
169       MDV::Packdrakeng->infofile($file)
170         Returns type and information about a given file into the archive;
171         that is:
172
173           - 'f' and the the size of the file for a plain file
174           - 'l' and the linked file for a symlink
175           - 'd' and undef for a directory
176           - undef if the file can't be found into archive.
177
178       MDV::Packdrakeng->infofile($handle)
179         Print to $handle (STDOUT if not specified) the content of the
180         archive.
181
182       MDV::Packdrakeng->dumptoc($handle)
183         Print to $handle (STDOUT if not specified) the table of content of
184         the archive.
185

CHANGELOG

187   1.10
188       use an oo code
189       add_virtual() now accept a string as file content
190

AUTHOR

192       Olivier Thauvin <nanardon@mandriva.org>, Rafael Garcia-Suarez
193       <rgarciasuarez@mandriva.com>
194
195       Copyright (c) 2005 Mandriva
196
197       This module is a from scratch-rewrite of the original "packdrake"
198       utility. Its format is fully compatible with the old packdrake.
199

LICENSE

201       This program is free software; you can redistribute it and/or modify it
202       under the terms of GNU General Public License as published by the Free
203       Software Foundation; either version 2 of the License, or (at your
204       option) any later version.
205
206       This program is distributed in the hope that it will be useful, but
207       WITHOUT ANY WARRANTY; without even the implied warranty of
208       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
209       General Public License for more details.
210
211       If you do not have a copy of the GNU General Public License write to
212       the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139,
213       USA.
214
215
216
217perl v5.32.0                      2020-07-28               MDV::Packdrakeng(3)
Impressum