]> git.donarmstrong.com Git - wannabuild.git/blobdiff - bin/wanna-build
Do not Build-Conflict on the Build-Depends
[wannabuild.git] / bin / wanna-build
index d08da9386f3d967e46ca2b8d394f4fe52914d1c3..178688bec819aba3b8a619872cf101b4a72936bf 100755 (executable)
@@ -138,7 +138,7 @@ my %options =
                           if !isin( $list_state, qw(needs-build building uploaded
                                                 built build-attempted failed installed dep-wait
                                                 not-for-us all failed-removed
-                                                install-wait reupload-wait));} },
+                                                install-wait reupload-wait bd-uninstallable));} },
         # options with args
         dist           =>
         { short => "d", arg => \$distribution,
@@ -188,7 +188,7 @@ my %options =
         export         => { arg => \$export_to, mode => "export" },
         "lock-for"     => { arg => \$lock_for_pid, mode => "lock-for" },
         "unlock-for"   => { arg => \$lock_for_pid, mode => "unlock-for" },
-        "act-on-behalve-of" => { arg => \$lock_for_pid },
+        "act-on-behalf-of" => { arg => \$lock_for_pid },
         "start-transaction" => { mode => "start-transaction" },
         "commit-transaction" => { mode => "commit-transaction" },
         "transactional" => { flag => \$transactional },
@@ -1219,16 +1219,7 @@ sub parse_sources {
 
                next if (defined $srcver{$name} and version_less( $version, $srcver{$name} ));
                $srcver{$name} = $version;
-               if ($buildconf) {
-                   $buildconf = join( ", ", map { "!$_" } split( /\s*,\s*/, $buildconf ));
-                   if ($builddep) {
-                       $builddep .= "," . $buildconf;
-                   } else {
-                       $builddep = $buildconf;
-                   }
-               }
 
-               $pkgs{$name}{'dep'} = defined $builddep ? $builddep : "";
                $pkgs{$name}{'ver'} = $version;
                $pkgs{$name}{'bin'} = $binaries;
                my $pkg = $db{$name};
@@ -1258,6 +1249,13 @@ sub parse_sources {
 
                        $pkg->{'Section'} = $section, $change++
                                if defined $section and (not defined($pkg->{'Section'}) or $pkg->{'Section'} ne $section);
+
+                       # Store Build-Deps and Build-Conflicts for edos-debcheck later
+                       $pkg->{'Build-Depends'} = $builddep, $change++
+                               if ($pkg->{'Build-Depends'} ne $builddep);
+                       $pkg->{'Build-Conflicts'} = $buildconf, $change++
+                               if ($pkg->{'Build-Conflicts'} ne $buildconf);
+
                        $db{$name} = $pkg if $change;
                }
        }
@@ -2583,37 +2581,60 @@ sub call_edos_depcheck {
     #print "I would look at these sources with edos-depcheck:\n";
     #print join " ", keys %interesting_packages,"\n";
 
-    open(EDOS,"-|","wb-edos-builddebcheck", "-a", $arch, $packagesfile, $sourcesfile)
-       or die "Failed to run wb-edos-builddebcheck: $!\n";
+    my $tmpfile_pattern = "/tmp/wanna-build-interesting-sources-$distribution.$$-";
+    my ($tmpfile, $i);
+    for( $i = 0;; ++$i ) {
+           $tmpfile = $tmpfile_pattern . $i;
+           last if ! -e $tmpfile;
+    }
 
-    local($/) = ""; # read in paragraph mode
-    while( <EDOS> ) {
-           my( $key, $reason ) ;
-           s/\s*$//m;
-           /^Package:\s*(\S+)$/mi and $key = $1;
-           /^Failed-Why:(([^\n]|\n ([^\n]|\.))*)$/msi and $reason = $1;
-           $reason =~ s/^\s*//mg;
+    open SOURCES, '>', $tmpfile or die "Could not open temporary file $tmpfile\n";
+    for my $key (keys %interesting_packages) {
+       my $pkg = $db{$key};
+       print SOURCES "Package: $key\n";
+       print SOURCES "Version: $pkg->{'Version'}\n";
+       print SOURCES "Build-Depends: $pkg->{'Build-Depends'}\n" if $pkg->{'Build-Depends'};
+       print SOURCES "Build-Conflicts: $pkg->{'Build-Conflicts'}\n" if $pkg->{'Build-Conflicts'};
+       print SOURCES "Architecture: all\n";
+       print SOURCES "\n";
+    }
+    close SOURCES;
 
-           if (exists $interesting_packages{$key}) {
-               $interesting_packages{$key} = $reason;
-           } else {
-               print "TODO: edos reported a package we do not care about now" if $verbose;
-           }
+    if (open(EDOS,"-|","wb-edos-builddebcheck", "-a", $arch, $packagesfile, $tmpfile))
+    {
+       local($/) = ""; # read in paragraph mode
+       while( <EDOS> ) {
+               my( $key, $reason ) ;
+               s/\s*$//m;
+               /^Package:\s*(\S+)$/mi and $key = $1;
+               /^Failed-Why:(([^\n]|\n ([^\n]|\.))*)$/msi and $reason = $1;
+               $reason =~ s/^\s*//mg;
+               $reason ||= 'No reason given by edos-debcheck';
+
+               if (exists $interesting_packages{$key}) {
+                   $interesting_packages{$key} = $reason;
+               } else {
+                   #print "TODO: edos reported a package we do not care about now\n" if $verbose;
+               }
+       }
+       close EDOS;
+    } else {
+       print "ERROR: Could not run wb-edos-builddebcheck. I am continuing, assuming\n" .
+             "all packages have installable build-dependencies."
     }
-    close EDOS;
+    
+    unlink( $tmpfile );
 
     for my $key (keys %interesting_packages) {
        my $pkg = $db{$key};
        my $change = 
-           (defined $interesting_packages{$key} && $pkg->{'State'} eq 'Needs-Build') ||
-           (not defined $interesting_packages{$key} && $pkg->{'State'} eq 'BD-Uninstallable');
+           (defined $interesting_packages{$key} and $pkg->{'State'} eq 'Needs-Build') ||
+           (not defined $interesting_packages{$key} and $pkg->{'State'} eq 'BD-Uninstallable');
        if ($change) {
            if (defined $interesting_packages{$key}) {
-                   $pkg->{'State'} = 'BD-Uninstallable';
-                   $pkg->{'Reason'} = $interesting_packages{$key};
                    change_state( \$pkg, 'BD-Uninstallable' );
+                   $pkg->{'Reason'} = $interesting_packages{$key};
            } else {
-                   $pkg->{'State'} = 'Needs-Build';
                    change_state( \$pkg, 'Needs-Build' );
            }
            log_ta( $pkg, "--merge-all" );
@@ -2667,7 +2688,7 @@ Options:
     --export FILE: Export database to a ASCII file FILE
     --lock-for PID: Locks the database for the process with this pid
     --unlock-for PID: Unlocks the database for the process with this pid
-    --act-on-behalve-of PID: Ignores the log (if it is held by this pid)
+    --act-on-behalf-of PID: Ignores the log (if it is held by this pid)
     --start-transaction: Creates a copy of the state of the database, for
        use with --transactional. This overrides any previous uncommited
        transaction. Should only be used after --lock-for