[Mud-builder-commits] r240 - in trunk: . lib/MUD

jaffa at garage.maemo.org jaffa at garage.maemo.org
Tue Jul 15 15:02:51 EEST 2008


Author: jaffa
Date: 2008-07-15 15:02:43 +0300 (Tue, 15 Jul 2008)
New Revision: 240

Modified:
   trunk/lib/MUD/Build.pm
   trunk/mud
Log:
Add source command to allow separate compile & source builds when developing (suggested by Graham Cobb)

Modified: trunk/lib/MUD/Build.pm
===================================================================
--- trunk/lib/MUD/Build.pm	2008-07-12 19:45:34 UTC (rev 239)
+++ trunk/lib/MUD/Build.pm	2008-07-15 12:02:43 UTC (rev 240)
@@ -23,7 +23,7 @@
 use strict;
 use utf8;
 use locale;
-use vars qw(@ISA $VERSION @PREVENT_INSTALL); 
+use vars qw(@ISA $VERSION @PREVENT_INSTALL $DPKG_BUILDPACKAGE); 
 use Carp;
 use File::Basename;
 use File::Path;
@@ -37,7 +37,10 @@
 $VERSION = '0.10';
 @PREVENT_INSTALL = qw(changelogs docs examples info man);
 
+# Use -i to ignore .svn directories(among others)
+$DPKG_BUILDPACKAGE = 'dpkg-buildpackage -d -rfakeroot -i -sa';
 
+
 =item new( OPTS )
 
 Create a new instance. OPTS is a hash containing name/value pairs:
@@ -107,6 +110,7 @@
     $self->fetch();
     $self->patch();
     $self->compile();
+    $self->source();
 }
 
 
@@ -229,7 +233,7 @@
 
 =item compile
 
-Build the unpacked, and potentially patched, source.
+Build the unpacked, and potentially patched, binaries.
 
 =cut
 
@@ -241,12 +245,9 @@
     # -- Tweak for Maemo compatibility...
     #
     $self->patchDebControl();
-
-    # Use -i to ignore .svn directories(among others)
-    my $dpkgBuildpackage = 'dpkg-buildpackage -d -rfakeroot -i -sa';
     
     # First build: build binaries and get build-deps
-    system("dpkg-depcheck -m -o ../build.deps $dpkgBuildpackage | tee ../log");
+    system("dpkg-depcheck -m -o ../build.deps $DPKG_BUILDPACKAGE | tee ../log");
     
     # Modify debian/control with calculated build-depends if not explicitly set
     unless ($self->{data}->{data}->{deb}->{'build-depends'}) {
@@ -268,9 +269,27 @@
           $self->writeDebControl($control);
       }
     }
+}
 
+
+=item source
+
+Build the unpacked, and potentially patched, source packages ready
+for upload to the autobuilder.
+
+At the moment, no check is made that a compile step is done previously,
+however this is seriously recommended to ensure that the auto-calculation
+of C<Build-Depends> is done correctly.
+
+=cut
+
+sub source {
+    my $self = shift;
+
+    chdir $self->{data}->{build} || croak "Build dir not set.\n";
+
     # Now build source package for upload
-    system("$dpkgBuildpackage -S | tee -a ../log"); 
+    system("$DPKG_BUILDPACKAGE -S | tee -a ../log"); 
 }
 
 

Modified: trunk/mud
===================================================================
--- trunk/mud	2008-07-12 19:45:34 UTC (rev 239)
+++ trunk/mud	2008-07-15 12:02:43 UTC (rev 240)
@@ -26,14 +26,14 @@
 
 use vars qw(%ACTIONS %OPTS $config);
 
-%ACTIONS = map { $_ => 1 } qw( build get compile clean diff show );
+%ACTIONS = map { $_ => 1 } qw( build get compile clean diff show source );
 %OPTS = ();
 GetOptions(\%OPTS, 'help',
-		   'config=s',
-	           'all',
-	   	   'depend-nobuild',
-	           'sdk=s',
-	           'xsl=s');
+                   'config=s',
+                   'all',
+                   'depend-nobuild',
+                   'sdk=s',
+                   'xsl=s');
 
 if ($OPTS{help} or !@ARGV or !$ACTIONS{$ARGV[0]}) {
     print <<EOM;
@@ -44,21 +44,24 @@
     mud [<options>] <action> [<package> ...]
 
 Options:
-    -h, --help                Usage instructions
-    -a, --all                 Run <action> on all packages
-    -c, --config=FILE         Use FILE for configuration rather than 'config'
-    -d, --depend-nobuild      Do not build any dependencies, assume they are up to date
-    -s, --sdk=CODENAME        Use CODENAME as the SDK name when processing packages
-    -x, --xsl=FILE            Use FILE as XSL Transformation for package files
+    -h, --help                Usage instructions.
+    -a, --all                 Run <action> on all packages.
+    -c, --config=FILE         Use FILE for configuration rather than 'config'.
+    -d, --depend-nobuild      Do not build any dependencies, assume they are
+                              up to date.
+    -s, --sdk=CODENAME        Use CODENAME as the SDK name when processing
+                              packages.
+    -x, --xsl=FILE            Use FILE as XSL Transformation for package files.
 
 Actions:
-    build                     Build the given package(s) from upstream
-    show                      Show information on the given package(s)
+    build                     Build the given package(s) for upload.
+    show                      Show information on the given package(s).
 
-    get                       Fetch and unpack the source in <build_dir>
-    compile                   Build from previously downloaded source
-    diff                      Save a diff from upstream to current source
-    clean                     Remove downloaded source
+    get                       Fetch and unpack the source in <build_dir>.
+    compile                   Build from previously downloaded source.
+    source                    Build source packages for upload.
+    diff                      Save a diff from upstream to current source.
+    clean                     Remove downloaded source.
 
 Please contact <andrew\@bleb.org> with any bugs or comments.
 EOM
@@ -87,9 +90,9 @@
 }
 
 if ($action eq "build") {
-# Clean packages which were built
+    # Clean packages which were built
     foreach my $n (@pkgs) {
-	clean($n);
+        clean($n);
     }
 }
     
@@ -224,11 +227,30 @@
     print "+++ Trying to build package [$pkg]\n";
     my $builder = new MUD::Build( package => $pkg, config => $config);
     $builder->build();
+    $builder->source();
     $builder->copy();
 #    $builder->clean();
 }
 
 
+=item source($)
+
+Build the given package as a source tarball ready to upload to the
+autobuilder.
+
+=cut
+
+sub source {
+    my ($pkg) = @_;
+
+    my $builder = new MUD::Build( package => $pkg, config => $config);
+    croak "No available source, use <get>\n" unless $builder->{data}->{build};
+
+    $builder->source();
+    $builder->copy();
+}    
+
+
 =item show($)
 
 Show the information used to build the package given. This is sourced from



More information about the Mud-builder-commits mailing list