Alien::Package(3pm)
π Alien::Package(3pm) π
okay bestie, welcome to the User Contributed Perl Documentation page for Alien::Package, and lemme tell you, this one is a whole vibe π¦
β¨ NAME β¨
Alien::Package β it's an object that represents a package, and yes that's the entire name, no notes π
πΈ DESCRIPTION πΈ
okay so picture this: it's a perl object class, right? and it represents a package in an internal format that alien can actually work with. the package in question could be a deb, a rpm, a tgz, or a slp package, etc. like, the whole squad π«Ά
objects in this class hold a bunch of metadata fields from the actual packages they represent, plus some fields that point at the actual contents of the package. and they can do three iconic things:
- examine an actual package sitting on disk and populate those fields from it
- build the actual package using the data stored in the fields
and honestly? a typical use of this object class is genuinely giving main character energy:
- instantiate an object from a class derived from this one, like
Alien::Package::Rpmβ - feed the object an rpm file, which populates all of its fields
- rebless the object into the destination class, like
Alien::Package::Debπ₯ - ask the object to build a package
and boom π₯ the package has been converted. slay.
π FIELDS π
so these fields are of course really just methods that all act the same way: you can pass a value in to set them, or just get the value of the field back if you pass nothing in. child classes may override these fields to process input data or to format output data. the general rule (iykyk) is that input data gets modified to get things into a package-independent form, which is how the data is stored in the fields. and when the value of a field is read, it too may be modified before it's returned, to change things into a form that's more suitable for that particular type of package. cute, right? π
nameβ the package's name.versionβ the package's upstream version.releaseβ the package's distribution specific release number.archβ the package's architecture, in the format used by Debian.maintainerβ the package's maintainer.dependsβ the package's dependencies. β οΈ only dependencies that should exist on all target distributions can go in here tho (ie:lsb).groupβ the section the package is in.summaryβ a one line description of the package.descriptionβ a longer description of the package. may contain multiple paragraphs.copyrightβ a short statement of copyright.origformatβ what format the package was originally in.distributionβ what distribution family the package originated from.binary_infoβ whatever the package's package tool says when told to display info about the package.conffilesβ a reference to a list of all the conffiles in the package.filesβ a reference to a list of all the files in the package.changelogtextβ the text of the changelogpostinstβ the postinst script of the package.postrmβ the postrm script of the package.preinstβ the preinst script of the package.prermβ the prerm script of the package.usescriptsβ only use the above scripts fields when generating the package if this is set to a true value.unpacked_treeβ points to a directory where the package has been unpacked.owninfoβ if set this will be a reference to a hash, with filename as key, that holds ownership/group information for files that cannot be represented on the filesystem. typically that's because the owners or groups just don't exist yet π it will be set at unpack time.modeinfoβ if set this will be a reference to a hash, with filename as key, that holds mode information for setuid files that have an entry inowninfo. it will be set at unpack time.
π METHODS π
initβ this is called bynew(). it's a handy place to set fields, etc, without having to write your ownnew()method. lowkey a lifesaver.installβ simply installs a package file. the filename is passed. β οΈ this has to be overridden in child classes.testβ test a package file. the filename is passed, and it should return an array of lines of test results. child classes may implement this.filenameβ set/get the filename of the package the object represents. when it's set, it performs a scan of the file, populating most other fields with data from it. (this is just a stub; child classes should override it to actually do something.) πscriptsβ returns a list of all non-empty maintainer scripts in the package.scanβ this method scans the file associated with an object, and populates as many other fields as it can with data from it.unpackβ this method unpacks the package into a temporary directory. it setsunpacked_treeto point to that directory. (this is just a stub method that makes a directory below the current working directory, and setsunpacked_treeto point to it. it should be overridden by child classes to actually unpack the package as well.)prepβ this method causes the object to prepare a build tree to be used in building the object. it expects that theunpackmethod has already been called. it takes the tree generated by that method, and mangles it somehow, to produce a suitable build tree. (this is just a stub method that all child classes should override.) π§cleantreeβ this method should clean theunpacked_treeof any effects theprepandbuildmethods might have on it.revertβ this method should ensure that the object is in the same state it was in before theprepmethod was called.buildβ this method takes a prepped build tree, and simply builds a package from it. it should put the package in the current directory, and should return the filename of the generated package. (this is just a stub method that all child classes should override.) π₯incrementreleaseβ this method should increment thereleasefield of the package by the specified number.DESTROYβ when an object is destroyed, it cleans some stuff up. in particular, if the package was unpacked, it's time now to wipe out the temporary directory. bye bestie πAUTOLOADβ handles all fields, by creating accessor methods for them the first time they are accessed. magical tbh β¨
π CLASS DATA π
$Alien::Package::verboseβ if set to a nonzero value, the shell commands that are run should be output. if set to a value greater than1, any output of the commands should also be output.
π CLASS METHODS π
these methods can be called on either an object or on the class itself. flexible queen π
newβ returns a new object of this class. optionally, you can pass in named parameters that specify the values of any fields in the class.checkfileβ pass it a filename, and it will return true if it looks like the file is a package of the type handled by the class.doβ runs a shell command. is verbose or not depending on the value of$Alien::Package::verbose. returns true if the command succeeds, false on failure.runpipeβ this is similar to backticks, but honors$Alien::Package::verbose, logging the command run if asked to. the output of the command is returned. the first parameter controls what to do on error. if it's true then any errors from the command will be ignored (and$?will be set). if it's false, errors will abort alien. π«£ so yeah, choose wisely.
π AUTHOR π
Joey Hess <joey@kitenet.net>
and that's the whole page bestie, no cap π this was perl v5.40.1, dated 2025-10-08, and it's the Alien::Package(3pm) page β go forth and convert some packages, you absolute icon πβ¨π¦
π¦ where this page comes from
- ubuntu resolute: alien 8.95.9-1 Β· GPL-2.0-or-later
- ubuntu stonking: alien 8.95.9-1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms