MUD::Package - Define a MUD package, and the data/definitions contained within.
use MUD::Package; my $pkg = MUD::Package->new(); $pkg->load('vim'); my $name = $pkg->name; my $iconFile = $pkg->icon(26); my $description = $pkg->description; my $upgradeDesc = $pkg->upgradeDescription; my $displayName = $pkg->displayName; my $bugTracker = $pkg->bugTracker; my @patchFiles = $pkg->patches; my $controlFields = $pkg->controlFields; my $section = $pkg->section; my $version = $pkg->version; my @extras = $pkg->extras; MUD::Package::setField($controlData, 'Section', 'user/network'); my @values = MUD::Package::parseField($controlData, 'Section');
This class abstracts MUD::Build from the underlying container format for MUD packages. This allows for future expansion in changing the disk structure etc. by changing this class alone. Given a package name, it will find the various artifacts: XML definition, icons etc.
There are also convenience methods for dealing with Debian control files, see "setField" and "parseField".
Create a new package instance. This can be optionally initialised by passing in an existing package as ORIGINAL
.
Initialise a new instance. Private method.
Load information for the given package into this object. This will load an XML file from PACKAGES_DIR/name.xml
, run any SDK-specific XSLT and initialise any environment variables defined for the build.
Return the package's name.
Return a path to a file containing an icon of the specified size. If ImageMagick is installed, it will be used to convert any icon found to the given size (as both width and height). If multiple icons are available, the one with a filename containing a number closest to SIZE
is used either directly, or as the resize source.
The file returned will not be within the build directory, and so cannot be directly used as a reference within debian/rules
.
If no appropriate icon can be found, undef
is returned.
Return this package's description. This can be sourced from a file, or directly embedded within the XML.
Return the short description of the reason this package has been updated. This can be sourced from a file, or directly embedded within the XML.
Return the name which should be displayed as a human-readable, user-friendly variant in Application Manager.
Return the URL of the bug tracker.
Return an array of patch files which should be applied against the unpacked source before building. If no patches are to be applied, returns an empty list.
my @values = $pkg->patches;
Return true if the package should be automatically "optified". This will introduce a build-dependency on 'maemo-optify' and ensure the optification happens after the package has been built.
Return a hash reference of values which contain additional debian/control
fields to set.
my $values = $pkg->controlFields;
Return the section which this package should be in. If no section is explicitly specified then, for non-libraries, user/
is prefixed.
Set or return the version number which should be used for this package. Setting the version number can be done by sub-classes of MUD::Fetch, if they have managed to work out the version number from (say) an upstream URL. However, this can always be overridden by specifying the version in the deb
section of the package XML.
Return an array of MUD::ExtrasEntrys which should be copied into mud-extras
in the source tree, and made available to the build scripts.
Files in the package's extras
directory will be returned here, with (optional) metadata loaded from extras.xml
.
If the package is the .pkg
directory format, the following special files in the directory - if present - are automatically added to the returned list:
/usr/share/icons/hicolor/26x26/hildon/package.png
/usr/share/icons/hicolor/48x48/hildon/package.png
/usr/share/icons/hicolor/scalable/hildon/package.png
/usr/share/applications/hildon/package.desktop
/usr/share/applications/hildon/package.desktop
If no extra files are to be installed, an empty list is returned.
Utility method for reading a field from a Debian control file and returning the array of lines which makes it up.
my ($value) = MUD::Package::parseField('Version', $controlData);
Utility method for setting a field within a Debian control file. The value of DATA
is changed in place; no value is returned.
MUD::Package::setField($controlData, 'Version', $value);
If VALUE
is undefined, no change is made to DATA
.
Utility method for reading the contents of a file. (Any newlines in the file are converted into \n
. - DISABLED)
(c) Andrew Flegg 2007 - 2009. Released under the Artistic Licence: http://www.opensource.org/licenses/artistic-license-2.0.php