[Mud-builder-commits] r262 - trunk/lib/MUD

jaffa at garage.maemo.org jaffa at garage.maemo.org
Tue Jan 20 02:53:15 EET 2009


Author: jaffa
Date: 2009-01-20 02:53:15 +0200 (Tue, 20 Jan 2009)
New Revision: 262

Modified:
   trunk/lib/MUD/Build.pm
   trunk/lib/MUD/Package.pm
Log:
Move patch determination to MUD::Package from MUD::Build

Modified: trunk/lib/MUD/Build.pm
===================================================================
--- trunk/lib/MUD/Build.pm	2009-01-19 20:57:31 UTC (rev 261)
+++ trunk/lib/MUD/Build.pm	2009-01-20 00:53:15 UTC (rev 262)
@@ -197,12 +197,11 @@
     chdir $self->{data}->{build} || croak "Build dir not set.\n";
 
     # -- Apply any patches...
-    # 
-    my $patch = $self->{config}->directory('PACKAGES_DIR').'/patch/'.$self->{package}.'.patch';
-    print "+++ Checking patch file [$patch]\n";
-    if (-f $patch) {
-        system("patch -p0 <$patch");
-        croak "Failed to apply patch [$?]\n" if $?;
+    #
+    foreach my $patch ($self->{data}->patches) { 
+      print "+++ Applying patch file [$patch]\n";
+      system("patch -p0 <$patch");
+      croak "Failed to apply patch [$?]\n" if $?;
     }
 
     # -- Remove documentation...

Modified: trunk/lib/MUD/Package.pm
===================================================================
--- trunk/lib/MUD/Package.pm	2009-01-19 20:57:31 UTC (rev 261)
+++ trunk/lib/MUD/Package.pm	2009-01-20 00:53:15 UTC (rev 262)
@@ -76,7 +76,7 @@
 
   my $self = bless { @_ }, $that;
   $self->_init();
-return $self;
+  return $self;
 }
 
 
@@ -178,7 +178,7 @@
   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->{name}.$suffix;
+      $iconFile = $self->{config}->directory('PACKAGES_DIR').'/icon/'.$self->name.$suffix;
       last if -f $iconFile;
     }
   }
@@ -191,9 +191,11 @@
   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";
+    print "+++ Converting [$sourceIcon] to [$iconFile] at ${size}px WxH\n";
     system('convert', $sourceIcon, '-resize', "${size}x${size}", $iconFile);
     copy($sourceIcon, $iconFile) or die "copy failed: $!" unless -s $iconFile;
+  } else {
+    print "+++ Found icon [$iconFile] at ${size} pixels WxH\n";
   }
   
   return undef unless -s $iconFile;
@@ -257,7 +259,14 @@
 =cut
 
 sub patches {
-  return (); # TODO
+  my $self = shift;
+  
+  my @patches = ();
+  
+  my $patch = $self->{config}->directory('PACKAGES_DIR').'/patch/'.$self->name.'.patch';
+  push @patches, $patch if -f $patch;
+
+  return @patches;
 }
 
 



More information about the Mud-builder-commits mailing list