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

gcobb at garage.maemo.org gcobb at garage.maemo.org
Sun Sep 27 15:04:04 EEST 2009


Author: gcobb
Date: 2009-09-27 15:04:01 +0300 (Sun, 27 Sep 2009)
New Revision: 326

Modified:
   trunk/lib/MUD/Build.pm
   trunk/lib/MUD/Package.pm
Log:
optify: add automatic inclusion of maemo-optify into build dependencies

Modified: trunk/lib/MUD/Build.pm
===================================================================
--- trunk/lib/MUD/Build.pm	2009-09-26 20:10:46 UTC (rev 325)
+++ trunk/lib/MUD/Build.pm	2009-09-27 12:04:01 UTC (rev 326)
@@ -228,7 +228,7 @@
     
     # -- Include maemo-optify...
     #
-    $rules =~ s/^\tdh_gencontrol$/$&\n\tmaemo-optify/mg if $self->{data}->optify;
+    $rules =~ s/^\tdh_gencontrol$/$&\n\tif which maemo-optify >\/dev\/null ; then maemo-optify ; fi/mg if $self->{data}->optify;
 
     # -- Append configure flags...
     #
@@ -308,7 +308,7 @@
     system("$dpkg_depcheck $DPKG_BUILDPACKAGE | tee ../log");
     
     # Modify debian/control with calculated build-depends if not explicitly set
-    unless (!$dpkg_depcheck || $self->{data}->{data}->{deb}->{'build-depends'}) {
+    unless (!$dpkg_depcheck || $self->{data}->buildDepends) {
       my @buildDeps = ();
       if (open(LOG, "<../build.deps")) {
           my $inNeeded = 0;
@@ -560,6 +560,17 @@
     #
     MUD::Package::setField($control, "Xsbc-Bugtracker", $self->{data}->bugTracker);
 
+    # -- Build depends...
+    # Note: the build dependencies are only added here if they are explicitly set
+    # in the package file.  If they are to be automatically calculated they are added later on.
+    my $bdeps = $self->{data}->buildDepends;
+    if ($bdeps) {
+	if ($self->{data}->optify) {
+	    $bdeps .= ', maemo-optify';
+	}
+	MUD::Package::setField($control, "Build-Depends", $bdeps);
+    }
+
     # -- Other control fields...
     #
     while (my ($k, $v) = each %{ $self->{data}->controlFields }) {

Modified: trunk/lib/MUD/Package.pm
===================================================================
--- trunk/lib/MUD/Package.pm	2009-09-26 20:10:46 UTC (rev 325)
+++ trunk/lib/MUD/Package.pm	2009-09-27 12:04:01 UTC (rev 326)
@@ -15,6 +15,8 @@
     my $upgradeDesc   = $pkg->upgradeDescription;
     my $displayName   = $pkg->displayName;
     my $bugTracker    = $pkg->bugTracker;
+    my $buildDepends  = $pkg->buildDepends;
+    my $optify        = $pkg->optify;
     my @patchFiles    = $pkg->patches;
     my $controlFields = $pkg->controlFields;
     my $section       = $pkg->section;
@@ -260,7 +262,19 @@
   return ref($desc) ? &readFile($desc->{file}) : $desc;
 }
 
+=item buildDepends
 
+Return the list of build dependencies if specified.
+
+=cut
+
+sub buildDepends {
+  my $self = shift;
+  
+  return $self->{data}->{deb}->{'build-depends'};
+}
+
+
 =item displayName
 
 Return the name which should be displayed as a human-readable,
@@ -348,7 +362,7 @@
   # -- Generate...
   #
   my %data = map { $_ => $self->{data}->{deb}->{$_} }
-             grep { $_ !~ /^(icon|prefix-section|optify|library|libdev|upgrade-description|description|display-name|version|bugtracker)$/ }
+             grep { $_ !~ /^(icon|prefix-section|optify|library|libdev|upgrade-description|description|display-name|version|bugtracker|build-depends)$/ }
              keys %{ $self->{data}->{deb} };
   $self->{controlFields} = \%data;
   return $self->{controlFields};



More information about the Mud-builder-commits mailing list