1Alien::Package(3) User Contributed Perl Documentation Alien::Package(3)
2
3
4
6 Alien::Package - an object that represents a package
7
9 This is a perl object class that represents a package in an internal
10 format usable by alien. The package may be a deb, a rpm, a tgz, or a
11 slp package, etc. Objects in this class hold various fields of metadata
12 from the actual packages they represent, as well as some fields
13 pointing to the actual contents of the package. They can also examine
14 an actual package on disk, and populate those fields. And they can
15 build the actual package using the data stored in the fields.
16
17 A typical use of this object class will be to instantiate an object
18 from a class derived from this one, such as Alien::Package::Rpm. Feed
19 the object a rpm file, thus populating all of its fields. Then rebless
20 the object into the destination class, such as Alien::Package::Deb.
21 Finally, ask the object to build a package, and the package has been
22 converted.
23
25 These fields are of course really just methods that all act similarly;
26 allowing a value to be passed in to set them, or simply returning the
27 value of the field if nothing is passed in. Child classes may override
28 these fields to process input data, or to format output data. The
29 general rule is that input data is modified to get things into a
30 package-independant form, which is how the data is stored in the
31 fields. When the value of a field is read, it too may be modified
32 before it is returned, to change things into a form more suitable for
33 the particular type of package.
34
35 name
36 The package's name.
37
38 version
39 The package's upstream version.
40
41 release
42 The package's distribution specific release number.
43
44 arch
45 The package's architecture, in the format used by Debian.
46
47 maintainer
48 The package's maintainer.
49
50 depends
51 The package's dependencies. Only dependencies that should exist on
52 all target distributions can be put in here though (ie: lsb).
53
54 group
55 The section the package is in.
56
57 summary
58 A one line description of the package.
59
60 description
61 A longer description of the package. May contain multiple
62 paragraphs.
63
64 copyright
65 A short statement of copyright.
66
67 origformat
68 What format the package was originally in.
69
70 distribution
71 What distribution family the package originated from.
72
73 binary_info
74 Whatever the package's package tool says when told to display info
75 about the package.
76
77 conffiles
78 A reference to a list of all the conffiles in the package.
79
80 files
81 A reference to a list of all the files in the package.
82
83 changelogtext
84 The text of the changelog
85
86 postinst
87 The postinst script of the package.
88
89 postrm
90 The postrm script of the package.
91
92 preinst
93 The preinst script of the package.
94
95 prerm
96 The prerm script of the package.
97
98 usescripts
99 Only use the above scripts fields when generating the package if
100 this is set to a true value.
101
102 unpacked_tree
103 Points to a directory where the package has been unpacked.
104
105 owninfo
106 If set this will be a reference to a hash, with filename as key,
107 that holds ownership/group information for files that cannot be
108 represented on the filesystem. Typically that is because the owners
109 or groups just don't exist yet. It will be set at unpack time.
110
111 modeinfo
112 If set this will be a reference to a hash, with filename as key,
113 that holds mode information for setuid files that have an entry in
114 owninfo. It will be set at unpack time.
115
117 init
118 This is called by new(). It's a handy place to set fields, etc,
119 without having to write your own new() method.
120
121 install
122 Simply installs a package file. The filename is passed. This has
123 to be overridden in child classes.
124
125 test
126 Test a package file. The filename is passed, should return an array
127 of lines of test results. Child classses may implement this.
128
129 filename
130 Set/get the filename of the package the object represents.
131
132 When it is set, it performs a scan of the file, populating most
133 other fields with data from it.
134
135 (This is just a stub; child classes should override it to actually
136 do something.)
137
138 scripts
139 Returns a list of all non-empty maintainer scripts in the package.
140
141 scan
142 This method scans the file associated with an object, and populates
143 as many other fields as it can with data from it.
144
145 unpack
146 This method unpacks the package into a temporary directory. It sets
147 unpacked_tree to point to that directory.
148
149 (This is just a stub method that makes a directory below the
150 current working directory, and sets unpacked_tree to point to it.
151 It should be overridden by child classes to actually unpack the
152 package as well.)
153
154 prep
155 This method causes the object to prepare a build tree to be used in
156 building the object. It expects that the unpack method has already
157 been called. It takes the tree generated by that method, and
158 mangles it somehow, to produce a suitable build tree.
159
160 (This is just a stub method that all child classes should
161 override.)
162
163 cleantree
164 This method should clean the unpacked_tree of any effects the prep
165 and build methods might have on it.
166
167 revert
168 This method should ensure that the object is in the same state it
169 was in before the prep method was called.
170
171 build
172 This method takes a prepped build tree, and simply builds a package
173 from it. It should put the package in the current directory, and
174 should return the filename of the generated package.
175
176 (This is just a stub method that all child classes should
177 override.)
178
179 incrementrelease
180 This method should increment the release field of the package by
181 the specified number.
182
183 DESTROY
184 When an object is destroyed, it cleans some stuff up. In
185 particular, if the package was unpacked, it is time now to wipe out
186 the temporary directory.
187
188 AUTOLOAD
189 Handles all fields, by creating accessor methods for them the first
190 time they are accessed.
191
193 $Alien::Package::verbose
194 If set to a nonzero value, the shell commands that are run should
195 be output. If set to a value greater than 1, any output of the
196 commands should also be output.
197
199 These methods can be called on either an object or on the class itself.
200
201 new Returns a new object of this class. Optionally, you can pass in
202 named parameters that specify the values of any fields in the
203 class.
204
205 checkfile
206 Pass it a filename, and it will return true if it looks like the
207 file is a package of the type handled by the class.
208
209 do Runs a shell command. Is verbose or not depending on the value of
210 $Alien::Package::verbose. Returns true if the command succeeds,
211 false on failure.
212
213 runpipe
214 This is similar to backticks, but honors $Alien::Package::verbose,
215 logging the command run if asked to. The output of the command is
216 returned.
217
218 The first parameter controls what to do on error. If it's true then
219 any errors from the command will be ignored (and $? will be set).
220 If it's false, errors will abort alien.
221
223 Joey Hess <joey@kitenet.net>
224
225
226
227perl v5.34.0 2021-07-21 Alien::Package(3)