|
Archive::Ipkg - Module for manipulation of iPKG archives |
Archive::Ipkg - Module for manipulation of iPKG archives
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;
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 the Archive::Tar manpage, 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.
$ipkg = Archive::Ipkg->new(...)new constructor creates a new object. You can pass any property to the
constructor, if you want, or set the properties later.
The following functions add files to the internal data archive. All return undef on failure.
$ipkg->add_files(@filenames)$ipkg->add_file_by_data($filename, $data [, $properties_hash]);$ipkg-add_file($filename, $name_in_archive)>add_data to add the file.
$ctl = $ipkg->control()$errmsg = $ipkg->verify()$ipkg->write()$ipkg->data()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.
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_checksverify will still
check whether all required properties are set.
$ipkg->strict_checks$ipkg->architecture("arch")arm
or all
Default: arm
$ipkg->config_files($array_ref)$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")Default: No depends
$ipkg->description("text, even on\nmultiple lines")data and write 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")Default: $name_$version_$arch.ipkg
$ipkg->maintainer("Bozo the Clown, bozo@clowns.org")$ipkg->name("foo")Default: No name, you need to set one.
$ipkg->priority("optional")Default: optional
$ipkg->section("misc")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")Default: No version, you need to set one.
$ipkg->preinst_script($script_text)Default: No script
$ipkg->postinst_script($script_text)Default: No script
$ipkg->prerm_script($script_text)Default: No script
$ipkg->postrm_script($script_text)Default: No script
The following methods return the default values for the properties above.
my $val = $ipkg->default_architecturemy $val = $ipkg->default_prioritymy $val = $ipkg->default_sectionmy $val = $ipkg->default_version
Can't read archives (yet).
Christian Renz <crenz@web42.com>
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.
http://handhelds.org/moin/moin.cgi/Ipkg?action=highlight&value=iPKG
http://handhelds.org/moin/moin.cgi/BuildingIpkgs?action=highlight&value=iPKG
|
Archive::Ipkg - Module for manipulation of iPKG archives |