[Mud-builder-commits] r258 - trunk/lib/MUD trunk/lib/MUD/Fetch www www-src
jaffa at garage.maemo.org
jaffa at garage.maemo.org
Mon Jan 19 18:53:43 EET 2009
Author: jaffa
Date: 2009-01-19 18:53:42 +0200 (Mon, 19 Jan 2009)
New Revision: 258
Removed:
www/pod/
Modified:
trunk/lib/MUD/Build.pm
trunk/lib/MUD/Config.pm
trunk/lib/MUD/Fetch/Base.pm
trunk/lib/MUD/Fetch/Command.pm
trunk/lib/MUD/Fetch/Debian.pm
trunk/lib/MUD/Fetch/Tarball.pm
trunk/lib/MUD/Package.pm
www-src/build.sh
Log:
Move back to more standard POD-type documentation, instead of pdoc, and get a nicer HTML output in the process using standard tools. Implement MUD::Package->icon
Modified: trunk/lib/MUD/Build.pm
===================================================================
--- trunk/lib/MUD/Build.pm 2009-01-19 02:15:56 UTC (rev 257)
+++ trunk/lib/MUD/Build.pm 2009-01-19 16:53:42 UTC (rev 258)
@@ -16,6 +16,8 @@
=head1 METHODS
+=over 12
+
=cut
package MUD::Build;
@@ -41,7 +43,7 @@
$DPKG_BUILDPACKAGE = 'dpkg-buildpackage -d -rfakeroot -i -sa';
-=head2 new( OPTS )
+=item new( OPTS )
Create a new instance. OPTS is a hash containing name/value pairs:
@@ -67,7 +69,7 @@
}
-=head2 _init
+=item _init
Initialise a new instance. Private method.
@@ -97,7 +99,7 @@
}
-=head2 build
+=item build
Build the configured package and place the deb files ready for upload
in the C<uploads/> directory.
@@ -119,7 +121,7 @@
}
-=head2 fetch
+=item fetch
Download the source for the package and unpack it in the build directory.
@@ -182,7 +184,7 @@
}
-=head2 patch
+=item patch
Apply any patches for the given package and modify Debian control structures
to apply to the Maemo SDK.
@@ -239,7 +241,7 @@
}
-=head2 compile
+=item compile
Build the unpacked, and potentially patched, binaries.
@@ -283,7 +285,7 @@
}
-=head2 source
+=item source
Build the unpacked, and potentially patched, source packages ready
for upload to the autobuilder.
@@ -304,7 +306,7 @@
}
-=head2 clean
+=item clean
Remove the build directory and any temporary files used therein.
@@ -318,7 +320,7 @@
}
-=head2 copy
+=item copy
Copy output files - including debs, tarballs, dsc and changes files - to
the upload directory.
@@ -486,22 +488,9 @@
# -- Icon(s)...
#
- my $iconFile = $self->{data}->{data}->{deb}->{icon};
- if (! -f $iconFile) {
- foreach my $suffix (('-26.png', '-32.png', '-40.png', '-48.png', '-64.png', '')) {
- $iconFile = $self->{config}->directory('PACKAGES_DIR').'/icon/'.$self->{package}.$suffix;
- last if -f $iconFile;
- }
- }
-
- if (! -f $iconFile and ($self->{data}->{data}->{deb}->{icon} || '') =~ /^https?:.*?\.(\w+)(\?.*)?$/) {
- $iconFile = $self->{workdir}.'/'.$self->{package}.".$1";
- system('wget', '-O', $iconFile, $self->{data}->{data}->{deb}->{icon});
- }
-
- if (-f $iconFile and $control !~ /^XB-Maemo-Icon-26:/im) {
- system('convert', $iconFile, '-resize', '26x26', $iconFile);
- my $iconData = `uuencode -m icon <$iconFile`;
+ my $iconFile = $self->{data}->icon(26);
+ if ($iconFile and $control !~ /^XB-Maemo-Icon-26:/im) {
+ my $iconData = `uuencode -m icon <\Q${iconFile}\E`;
$iconData =~ s/^begin-base64 \d{3,4} icon[\s\r\n]+//m;
$iconData =~ s/^/ /mg;
if ($iconData) {
Modified: trunk/lib/MUD/Config.pm
===================================================================
--- trunk/lib/MUD/Config.pm 2009-01-19 02:15:56 UTC (rev 257)
+++ trunk/lib/MUD/Config.pm 2009-01-19 16:53:42 UTC (rev 258)
@@ -1,8 +1,10 @@
-#
-# MUD::Config (c) Andrew Flegg 2007
-# ~~~~~~~~~~~ Relased under the Artistic Licence
-# http://mud-builder.garage.maemo.org/
+=head1 NAME
+
+MUD::Config - Read and store MUD configuration.
+
+=cut
+
package MUD::Config;
use strict;
Modified: trunk/lib/MUD/Fetch/Base.pm
===================================================================
--- trunk/lib/MUD/Fetch/Base.pm 2009-01-19 02:15:56 UTC (rev 257)
+++ trunk/lib/MUD/Fetch/Base.pm 2009-01-19 16:53:42 UTC (rev 258)
@@ -1,8 +1,10 @@
-#
-# MUD::Fetch::Base (c) Andrew Flegg 2007
-# ~~~~~~~~~~~~~~~~ Relased under the Artistic Licence
-# http://mud-builder.garage.maemo.org/
+=head1 NAME
+
+MUD::Fetch::Base - Parent class for MUD fetch helpers.
+
+=cut
+
package MUD::Fetch::Base;
use strict;
@@ -39,3 +41,13 @@
warn "Unimplemented clean.\n";
}
+
+
+=head1 COPYRIGHT
+
+(c) Andrew Flegg 2007 - 2009. Released under the Artistic Licence:
+L<http://www.opensource.org/licenses/artistic-license-2.0.php>
+
+=head1 SEE ALSO
+
+L<http://mud-builder.garage.maemo.org/>
Modified: trunk/lib/MUD/Fetch/Command.pm
===================================================================
--- trunk/lib/MUD/Fetch/Command.pm 2009-01-19 02:15:56 UTC (rev 257)
+++ trunk/lib/MUD/Fetch/Command.pm 2009-01-19 16:53:42 UTC (rev 258)
@@ -1,8 +1,10 @@
-#
-# MUD::Fetch::Command (c) Andrew Flegg 2007
-# ~~~~~~~~~~~~~~~~~~~ Relased under the Artistic Licence
-# http://mud-builder.garage.maemo.org/
+=head1 NAME
+
+MUD::Fetch::Command - Execute a command to get the source to build.
+
+=cut
+
package MUD::Fetch::Command;
use strict;
@@ -75,3 +77,13 @@
}
}
+
+=head1 COPYRIGHT
+
+(c) Andrew Flegg 2007 - 2009. Released under the Artistic Licence:
+L<http://www.opensource.org/licenses/artistic-license-2.0.php>
+
+=head1 SEE ALSO
+
+L<MUD::Fetch::Base>
+L<http://mud-builder.garage.maemo.org/>
Modified: trunk/lib/MUD/Fetch/Debian.pm
===================================================================
--- trunk/lib/MUD/Fetch/Debian.pm 2009-01-19 02:15:56 UTC (rev 257)
+++ trunk/lib/MUD/Fetch/Debian.pm 2009-01-19 16:53:42 UTC (rev 258)
@@ -1,8 +1,10 @@
-#
-# MUD::Fetch::Debian (c) Andrew Flegg 2007
-# ~~~~~~~~~~~~~~~~~~ Relased under the Artistic Licence
-# http://mud-builder.garage.maemo.org/
+=head1 NAME
+
+MUD::Fetch::Debian - Fetch package source from upstream Debian
+
+=cut
+
package MUD::Fetch::Debian;
use strict;
@@ -156,3 +158,12 @@
}
+=head1 COPYRIGHT
+
+(c) Andrew Flegg 2007 - 2009. Released under the Artistic Licence:
+L<http://www.opensource.org/licenses/artistic-license-2.0.php>
+
+=head1 SEE ALSO
+
+L<MUD::Fetch::Base>
+L<http://mud-builder.garage.maemo.org/>
Modified: trunk/lib/MUD/Fetch/Tarball.pm
===================================================================
--- trunk/lib/MUD/Fetch/Tarball.pm 2009-01-19 02:15:56 UTC (rev 257)
+++ trunk/lib/MUD/Fetch/Tarball.pm 2009-01-19 16:53:42 UTC (rev 258)
@@ -1,8 +1,10 @@
-#
-# MUD::Fetch::Tarball (c) Andrew Flegg 2007
-# ~~~~~~~~~~~~~~~~~~~ Relased under the Artistic Licence
-# http://mud-builder.garage.maemo.org/
+=head1 NAME
+
+MUD::Fetch::Tarball - Fetch package source from upstream tarball
+
+=cut
+
package MUD::Fetch::Tarball;
use strict;
@@ -116,3 +118,14 @@
system @args;
croak "Failed to unpack [$file]: $@\n" if $@;
}
+
+
+=head1 COPYRIGHT
+
+(c) Andrew Flegg 2007 - 2009. Released under the Artistic Licence:
+L<http://www.opensource.org/licenses/artistic-license-2.0.php>
+
+=head1 SEE ALSO
+
+L<MUD::Fetch::Base>
+L<http://mud-builder.garage.maemo.org/>
Modified: trunk/lib/MUD/Package.pm
===================================================================
--- trunk/lib/MUD/Package.pm 2009-01-19 02:15:56 UTC (rev 257)
+++ trunk/lib/MUD/Package.pm 2009-01-19 16:53:42 UTC (rev 258)
@@ -45,6 +45,9 @@
use vars qw(@ISA $VERSION @PERMITTED_SECTIONS);
use XML::Simple;
use Text::Wrap;
+use File::Spec;
+use File::Temp qw(tempfile);
+use File::Copy;
use Carp;
@ISA = qw();
@@ -59,9 +62,8 @@
libdevel mail math misc net news oldlibs perl python
science shells sound tex text utils web x11);
+=item new( [ORIGINAL] )
-=head2 new( [ORIGINAL] )
-
Create a new package instance. This can be optionally
initialised by passing in an existing package as
C<ORIGINAL>.
@@ -78,7 +80,7 @@
}
-=head2 _init
+=item _init
Initialise a new instance. Private method.
@@ -91,7 +93,7 @@
}
-=head2 load( NAME )
+=item load( NAME )
Load information for the given package into this object.
This will load an XML file from C<PACKAGES_DIR/name.xml>,
@@ -140,7 +142,7 @@
}
-=head2 name
+=item name
Return the package's name.
@@ -153,7 +155,7 @@
}
-=head2 icon( SIZE )
+=item icon( SIZE )
Return a path to a file containing an icon of the specified
size. If L<ImageMagick> is installed, it will be used to convert
@@ -170,11 +172,36 @@
=cut
sub icon {
- return undef; # TODO icon()
+ my $self = shift;
+ my ($size) = @_;
+
+ my $iconFile = $self->{data}->{deb}->{icon};
+ if (! -f $iconFile) {
+ foreach my $suffix (('-26.png', '-32.png', '-40.png', '-48.png', '-64.png', '')) {
+ $iconFile = $self->{config}->directory('PACKAGES_DIR').'/icon/'.$self->{package}.$suffix;
+ last if -f $iconFile;
+ }
+ }
+
+ if (! -f $iconFile and ($self->{data}->{deb}->{icon} || '') =~ /^https?:.*?(\.\w+)(\?.*)?$/) {
+ (undef, $iconFile) = tempfile("mud-$self->{name}-XXXXX", SUFFIX => $1, UNLINK => 1, DIR => File::Spec->tmpdir);
+ system('wget', '-O', $iconFile, $self->{data}->{deb}->{icon});
+ }
+
+ if ($iconFile !~ /-$size\b/) {
+ my $sourceIcon = $iconFile;
+ (undef, $iconFile) = tempfile("mud-$self->{name}-XXXXX", SUFFIX => ".png", UNLINK => 1, DIR => File::Spec->tmpdir);
+ print "+++ Converting [$sourceIcon] to [$iconFile] at $size pixels WxH\n";
+ system('convert', $sourceIcon, '-resize', "${size}x${size}", $iconFile);
+ copy($sourceIcon, $iconFile) or die "copy failed: $!" unless -s $iconFile;
+ }
+
+ return undef unless -s $iconFile;
+ return $iconFile;
}
-=head2 description
+=item description
Return this package's description. This can be sourced
from a file, or directly embedded within the XML.
@@ -189,7 +216,7 @@
}
-=head2 upgradeDescription
+=item upgradeDescription
Return the short description of the reason this package has
been updated. This can be sourced from a file, or directly
@@ -205,7 +232,7 @@
}
-=head2 displayName
+=item displayName
Return the name which should be displayed as a human-readable,
user-friendly variant in Application Manager.
@@ -219,7 +246,7 @@
}
-=head2 patches
+=item patches
Return an array of patch files which should be applied against
the unpacked source before building. If no patches are to be
@@ -234,7 +261,7 @@
}
-=head2 controlFields
+=item controlFields
Return a hash reference of values which contain additional
C<debian/control> fields to set.
@@ -260,7 +287,7 @@
}
-=head2 section
+=item section
Return the section which this package should be in. If no
section is explicitly specified then, for I<non->libraries,
@@ -275,7 +302,7 @@
}
-=head2 version [( VERSION )]
+=item 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
@@ -294,7 +321,7 @@
}
-=head2 extraFiles
+=item extraFiles
Return a hash reference of extra files to be installed. These
take the form of C<TARGET =E<gt> SOURCE>, which allows multiple
@@ -313,7 +340,7 @@
}
-=head2 parseField( FIELD, DATA )
+=item parseField( FIELD, DATA )
Utility method for reading a field from a Debian control file and
returning the array of lines which makes it up.
@@ -336,7 +363,7 @@
}
-=head2 setField( DATA, FIELD, VALUE )
+=item setField( DATA, FIELD, VALUE )
Utility method for setting a field within a Debian control file.
The value of C<DATA> is changed in place; no value is returned.
@@ -388,7 +415,7 @@
}
-=head2 readFile( FILE )
+=item readFile( FILE )
Utility method for reading the contents of a file. (Any newlines
in the file are converted into C<\n>. - DISABLED)
Modified: www-src/build.sh
===================================================================
--- www-src/build.sh 2009-01-19 02:15:56 UTC (rev 257)
+++ www-src/build.sh 2009-01-19 16:53:42 UTC (rev 258)
@@ -46,10 +46,5 @@
# -- Re-generate Perl documentation...
#
-### Will only run if http://pdoc.sf.net/ is installed and
-### scripts/perlmod2www.pl is copied to /usr/local/bin/pdoc
-if [ -x /usr/local/bin/pdoc ]; then
- cd ${BIN_DIR}
- mkdir pod
- /usr/local/bin/pdoc -source ${SRC_DIR}/../trunk/lib -target ${BIN_DIR}/pod
-fi
+mkdir "${BIN_DIR}/pod"
+perl -MPod::Simple::HTMLBatch -e Pod::Simple::HTMLBatch::go "${BIN_DIR}/../trunk/lib" "${BIN_DIR}/pod/"
More information about the Mud-builder-commits
mailing list