NAME
Archive::Ipkg - Module for manipulation of iPKG archives
SYNOPSIS
use Archive::Ipkg;
my $ipkg = Archive::Ipkg->new(
name => 'foo',
version => '0.1');
$ipkg->add_files(@filenames);
$ipkg->add_file($filename, $name_in_archive);
$ipkg->add_file_by_data($filename, $data);
$ipkg->name("changedmymind");
$ipkg->description("Useless package of mine\nDon't use it!");
$ipkg->version("0.0");
$ipkg->write;
my $data = $ipkg->data;
DESCRIPTION
This module aids in the construction of iPKG packages (See links below for description of the implemented package format). The interface is somewhat similar to that of Archive::Tar, but with a couple differences. I consider the module to be in a beta stage.
The typical workflow is as follows: Create a new object, add files to it, set the properties of the iPKG package and write it to a file (or get the data as a scalar). There are a number of properties, and many of them are compulsory and need to be in a certain format. The module only generates the final package if the specs are meet. See below for a description of all properties and how to circumvent some of the checks.
CLASS METHODS
CONSTRUCTOR
$ipkg = Archive::Ipkg->new(...)
-
The
new
constructor creates a new object. You can pass any property to the constructor, if you want, or set the properties later.
ADDING FILES
The following functions add files to the internal data archive. All return undef on failure.
$ipkg->add_files(@filenames)
-
Is directly passed through to Archive::Tar to add several files.
$ipkg->add_file_by_data($filename, $data [, $properties_hash]);
-
Is directly passed through to Archive::Tar to add a file given its name, contents and optionally some properties. See Archive::Tar for a description of the properties available.
$ipkg-
add_file($filename, $name_in_archive)>-
A convenience function that lets you add a file with a new name. Reads the file's content and uses Archive::Tar's
add_data
to add the file.
WRITING THE PACKAGE
$ctl = $ipkg->control()
-
Returns the text of the control file that will be written. You just need this if you want to check the file.
$errmsg = $ipkg->verify()
-
Verifies whether the archive can be written by checking whether at least the required properties are set (see below). Returns an error message if unsuccessful, else undef (!).
$ipkg->write()
-
Writes the archive to disk, in the current directory. If no filename is given, it uses the internally generated default filename (see filename property). You can either set a filename of your own before writing or combine the default filename and a directory name to save the package in the directory of your choice. Returns undef on failure.
$ipkg->data()
-
Returns the archive data as a scalar. Unlike Archive::Tar's
data
, this does not return the internal data structures, but rather the archive's contents as they would be written to disk. Returns undef on failure.
PROPERTIES
The following properties are obligatory: name, version, architecture, maintainer, section and description. Some of them have defaults set by the module, though, so you don't need to set all of them. If a property needs to be in a certain format, the accessor function will set the value to undef to make your write
fail if you set an invalid value.
Except of sloppy_checks
and strict_checks
, all the following functions will return undef if a new value is set and the syntax check fails, else the properties (new) value.
$ipkg->sloppy_checks
-
Will switch of all syntax checks in accessor functions.
verify
will still check whether all required properties are set. $ipkg->strict_checks
-
Re-enables syntax checks in accessor functions (this is the default).
$ipkg->architecture("arch")
-
The architecture the module is supposed to work on. Currently either
arm
orall
Default:
arm
$ipkg->config_files($array_ref)
-
Marks a number of files (names contained in
$array_ref
) as configuration files, so ipkg will not automatically overwrite them. Note that you still need to add the files. Will not check whether the files are actually contained in the archive.Default: No config files
$ipkg->depends("pkg1,pkg2")
-
The packages this package depends on, as a comma-separated list of package names (ie, matching /^[a-z0-9.+-]+(,[a-z0-9.+-]+)*$/ ).
Default: No depends
$ipkg->description("text, even on\nmultiple lines")
-
A short description of the module. Note that
data
andwrite
will take appropriate care of newlines, so you don't have to do it yourself. Just write\n
, as you normally would The description should be non-empty.Default: No description, you need to set one.
$ipkg->filename("../foo.ipk")
-
The filename (including directory) of the module.
Default:
$name_$version_$arch.ipkg
$ipkg->maintainer("Bozo the Clown, bozo@clowns.org")
-
The maintainer's name and e-mail address (ie, matches /@/).
$ipkg->name("foo")
-
The package name. Matches /^[a-z0-9.+-]+$/.
Default: No name, you need to set one.
$ipkg->priority("optional")
-
The package's priority. One of required, standard, important, optional, extra.
Default:
optional
$ipkg->section("misc")
-
The package's section. Currently, the sections given in the Zaurus and in the Familiar documentation are allowed. These are the following:
Zaurus: Games Multimedia Communcations Settings Utilities Applications Console Misc
Familiar: admin base comm editors extras graphics libs misc net text web x11
Default:
misc
$ipkg->version("1.2")
-
The package's version, matching /^[a-zA-Z0-9.+]*$/ and having at least one digit.
Default: No version, you need to set one.
$ipkg->preinst_script($script_text)
-
(Shell) script to be executed before installation.
Default: No script
$ipkg->postinst_script($script_text)
-
(Shell) script to be executed after installation.
Default: No script
$ipkg->prerm_script($script_text)
-
(Shell) script to be executed before removal.
Default: No script
$ipkg->postrm_script($script_text)
-
(Shell) script to be executed after removal.
Default: No script
DEFAULTS METHODS
The following methods return the default values for the properties above.
my $val = $ipkg->default_architecture
my $val = $ipkg->default_priority
my $val = $ipkg->default_section
my $val = $ipkg->default_version
BUGS
Can't read archives (yet).
AUTHOR
Christian Renz <crenz@web42.com>
LICENSE
Copyright 2003 Christian Renz <crenz@web42.com>
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
http://handhelds.org/moin/moin.cgi/Ipkg?action=highlight&value=iPKG
http://handhelds.org/moin/moin.cgi/BuildingIpkgs?action=highlight&value=iPKG