<<

NAME

MUD::Package - Define a MUD package, and the data/definitions contained within.

SYNOPSIS

    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');

DESCRIPTION

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".

METHODS

new( [ORIGINAL] )

Create a new package instance. This can be optionally initialised by passing in an existing package as ORIGINAL.

_init

Initialise a new instance. Private method.

load( NAME )

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.

name

Return the package's name.

icon( SIZE )

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.

description

Return this package's description. This can be sourced from a file, or directly embedded within the XML.

upgradeDescription

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.

displayName

Return the name which should be displayed as a human-readable, user-friendly variant in Application Manager.

bugTracker

Return the URL of the bug tracker.

patches

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;
optify

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.

controlFields

Return a hash reference of values which contain additional debian/control fields to set.

    my $values = $pkg->controlFields;
section

Return the section which this package should be in. If no section is explicitly specified then, for non-libraries, user/ is prefixed.

version [( VERSION )]

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.

extras

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:

package-26.png => /usr/share/icons/hicolor/26x26/hildon/package.png
package-48.png => /usr/share/icons/hicolor/48x48/hildon/package.png
package-64.png => /usr/share/icons/hicolor/scalable/hildon/package.png
package.desktop => /usr/share/applications/hildon/package.desktop
package.service => /usr/share/applications/hildon/package.desktop

If no extra files are to be installed, an empty list is returned.

parseField( FIELD, DATA )

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);
setField( DATA, FIELD, VALUE )

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.

readFile( FILE )

Utility method for reading the contents of a file. (Any newlines in the file are converted into \n. - DISABLED)

COPYRIGHT

(c) Andrew Flegg 2007 - 2009. Released under the Artistic Licence: http://www.opensource.org/licenses/artistic-license-2.0.php

SEE ALSO

http://mud-builder.garage.maemo.org/

<<