parse_quinn_diff(0);
@ARGV = ( $ARGS[2] );
my $build_deps = parse_sources(1);
- auto_dep_wait( $build_deps, $pkgs );
+ call_edos_depcheck( $ARGS[0], $ARGS[2] );
clean_db();
last SWITCH;
};
$ok = 0;
$reason = "not all source dependencies available yet";
}
+ elsif ($pkg->{'State'} =~ /^BD-Uninstallable/) {
+ $ok = 0;
+ $reason = "source dependencies are not installable";
+ }
elsif ($pkg->{'State'} eq "Uploaded" &&
(version_lesseq($version, $pkg->{'Version'}))) {
$ok = 0;
print "$name: Warning: marked as waiting for dependencies, ".
"but processing anyway.\n";
}
+ elsif ($state eq "BD-Uninstallable") {
+ print "$name: Warning: marked as having uninstallable build-dependencies, ".
+ "but processing anyway.\n";
+ }
elsif ($state eq "Failed") {
print "$name: already registered as failed; will append new message\n"
if $fail_reason;
return;
}
}
+ if ($state eq "BD-Uninstallable") {
+ if ($opt_override) {
+ print "$name: Forcing uninstallability mark to be removed\n";
+ }
+ else {
+ print "$name: has uninstallable build-dependencies. Skipping\n",
+ " (use --override to clear dependency list and ",
+ "give back anyway)\n";
+ return;
+ }
+ }
elsif (!isin( $state, qw(Building Built Build-Attempted))) {
print "$name: not taken for building (state is $state).";
if ($opt_override) {
print "$name: merging with previously registered dependencies\n";
}
- if (isin( $state, qw(Needs-Build Failed))) {
+ if (isin( $state, qw(Needs-Build Failed BD-Uninstallable))) {
print "$name: Warning: not registered for building previously, ".
"but processing anyway.\n";
}
}
# Now re-check the DB for packages in states Needs-Build, Failed,
- # or Dep-Wait and remove them if they're not listed anymore by quinn-diff.
+ # Dep-Wait or BD-Uninstallable and remove them if they're not listed
+ # anymore by quinn-diff.
if ( !$partial ) {
my $name;
foreach $name (keys %db) {
my $pkg = $db{$name};
next if defined $pkg->{'Binary-NMU-Version'};
next if !isin( $pkg->{'State'},
- qw(Needs-Build Building Built Build-Attempted Uploaded Failed Dep-Wait) );
+ qw(Needs-Build Building Built Build-Attempted Uploaded Failed Dep-Wait BD-Uninstallable) );
my $virtual_delete = $pkg->{'State'} eq 'Failed';
if (!$quinn_pkgs{$name}) {
if $pkg->{'State'} =~ /^Failed/;
print " Dependencies: $pkg->{'Depends'}\n"
if $pkg->{'State'} eq "Dep-Wait";
+ print " Reason: $pkg->{'Reason'}\n"
+ if $pkg->{'State'} eq "BD-Uninstallable";
print " Previous state was $pkg->{'Previous-State'} until ",
"$pkg->{'State-Change'}\n"
if $verbose && $pkg->{'Previous-State'};
die "Bad state $pkg->{'State'} of package $pkg->{Package}\n"
if !isin( $pkg->{'State'},
qw(Needs-Build Building Built Build-Attempted Uploaded Installed Dep-Wait
- Failed Failed-Removed Not-For-Us
+ Failed Failed-Removed Not-For-Us BD-Uninstallable
) );
}
delete $pkg->{'Failed'};
delete $pkg->{'Failed-Category'};
}
+ if (defined($$state) and $$state eq 'BD-Uninstallable') {
+ delete $pkg->{'Reason'};
+ }
$$state = $newstate;
}
return "";
}
-sub auto_dep_wait {
- my $bd = shift;
- my $pkgs = shift;
+sub call_edos_depcheck {
+ my $packagesfile = shift;
+ my $sourcesfile = shift;
my $key;
return if defined ($conf::distributions{$distribution}{noadw});
- # We need to walk all of needs-build, as any new upload could make
+ # We need to check all of needs-build, as any new upload could make
# something in needs-build have uninstallable deps
+ # We also check everything in bd-uninstallable, as any new upload could
+ # make that work again
+ my %interesting_packages;
foreach $key (keys %db) {
my $pkg = $db{$key};
- next
- if not defined $pkg or $pkg->{'State'} ne "Needs-Build";
- my $srcdeps = parse_srcdeplist($key,$bd->{$key}{'dep'},$arch);
- foreach my $srcdep (@$srcdeps) {
- next if $srcdep->{'Neg'} != 0; # we ignore conflicts atm
- my $rc = get_unsatisfied_dep($bd,$pkgs,$srcdep,0);
- if ($rc ne "") {
- # set dep-wait
- my $deplist = parse_deplist( $pkg->{'Depends'} );
- my $newdeps = parse_deplist( $rc );
- my $change = 0;
- foreach (%$newdeps) {
- my $dep = $$newdeps{$_};
- # ensure we're not waiting on ourselves, or a package that has been removed
- next if (not defined($merge_binsrc{$dep->{'Package'}})) or ($merge_binsrc{$dep->{'Package'}} eq $key);
- if ($dep->{'Rel'} =~ '^>') {
- $deplist->{$dep->{'Package'}} = $dep;
- $change++;
- }
- }
- if ($change) {
- $pkg->{'Depends'} = build_deplist($deplist);
- change_state( \$pkg, 'Dep-Wait' );
- log_ta( $pkg, "--merge-all" );
- $db{$key} = $pkg;
- print "Auto-Dep-Waiting ${key}_$pkg->{'Version'} to $pkg->{'Depends'}\n" if $verbose;
- }
- last;
- }
+ if (defined $pkg and isin($pkg->{'State'}, qw/Needs-Build BD-Uninstallable/)) {
+ $interesting_packages{$key} = undef;
+ }
+ }
+
+ #print "I would look at these sources with edos-depcheck:\n";
+ #print join " ", keys %interesting_packages,"\n";
+
+ if (open(EDOS,"-|","wb-edos-builddebcheck", "-a", $arch, $packagesfile, $sourcesfile)) {
+ 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;
+
+ if (exists $interesting_packages{$key}) {
+ $interesting_packages{$key} = $reason;
+ } else {
+ print "TODO: edos reported a package we do not care about now" if $verbose;
+ }
+ }
+ close EDOS;
+ } else {
+ print "ERROR: Could not run wb-edos-builddebcheck. I am continuing, assuming\n" .
+ "all packages have installable build-dependencies."
+ }
+
+ 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');
+ if ($change) {
+ if (defined $interesting_packages{$key}) {
+ change_state( \$pkg, 'BD-Uninstallable' );
+ $pkg->{'Reason'} = $interesting_packages{$key};
+ } else {
+ change_state( \$pkg, 'Needs-Build' );
+ }
+ log_ta( $pkg, "--merge-all" );
+ $db{$key} = $pkg;
+ print "edos-builddebchange changed state of ${key}_$pkg->{'Version'} to $pkg->{'State'}\n" if $verbose;
}
}
}
--- /dev/null
+#!/usr/bin/perl -w
+
+# Copyright (C) 2008 Ralf Treinen <treinen@debian.org>
+# This program is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free Software
+# Foundation, version 2 of the License.
+
+$debug=0;
+
+# the prefix used to encode source packages
+$sourceprefix="source---";
+
+$architecture="";
+$binexplain=0;
+$edosoptions = "-failures -explain -quiet";
+while ( $arg = shift @ARGV ) {
+ if ( $arg eq '-a' || $arg eq '--architecture' ) {
+ if ($#ARGV == -1) {
+ die "-a option needs a value";
+ } else {
+ $architecture = shift @ARGV;
+ }
+ } elsif ( $arg =~ "--binexplain" || $arg =~ "-be" ) {
+ $binexplain = 1;
+ } elsif ( $arg =~ /^-.*/ ) {
+ die "unrecognized option: $arg";
+ } else {
+ last;
+ }
+}
+
+if ($#ARGV != 0) {
+ die "Usage: edos-debbuildcheck [options] Packages Sources"
+} else {
+ $packagefile = $arg;
+ $sourcesfile = shift(@ARGV);
+}
+
+if ($debug) {
+ print "Arch: $architecture\n";
+ print "Packages: $packagefile\n";
+ print "Sources: $sourcesfile\n";
+ print "Edos options: $edosoptions\n";
+}
+
+$packagearch="";
+open(P,$packagefile);
+while (<P>) {
+ next unless /^Architecture/;
+ next if /^Architecture:\s*all/;
+ /Architecture:\s*([^\s]*)/;
+ if ($packagearch eq "") {
+ $packagearch = $1;
+ } elsif ( $packagearch ne $1) {
+ die "Package file contains different architectures: $packagearch, $1";
+ }
+}
+close P;
+
+if ( $architecture eq "" ) {
+ if ( $packagearch eq "" ) {
+ die "No architecture option given, " .
+ "and no non-all architecture found in the Packages file";
+ } else {
+ $architecture = $packagearch;
+ }
+} else {
+ if ( $packagearch ne "" & $architecture ne $packagearch) {
+ die "Architecture option is $architecture ".
+ "but the package file contains architecture $packagearch";
+ }
+}
+
+open(RESULT,"python /usr/share/edos-distcheck/add-sources.py ".
+ "--prefix \"$sourceprefix\" < $packagefile $sourcesfile $architecture ".
+ "| edos-debcheck $edosoptions|");
+
+$sourcestanza=0;
+$explanation="";
+$binpackage="";
+
+while (<RESULT>) {
+ if (/^\s+/) {
+ if ($sourcestanza) {
+ s/^(\s*)$sourceprefix(.*)(depends on|conflicts with)/$1$2build-$3/o;
+ s/>/>/;
+ s/</</;
+ print;
+ if (/depends on ([^\s]*) .*\{.*\}/) {
+ push(@binqueue,$1);
+ }
+ } else {
+ $explanation .= $_;
+ }
+ } else {
+ if ($sourcestanza) {
+ print "\n";
+ $sourcestanza=0;
+ }
+ if ($binpackage ne ""){
+ $binfailures{$binpackage} = $explanation;
+ $binpackage="";
+ }
+ if (/^$sourceprefix(.*) \(.*\): FAILED/o) {
+ print "Package: $1\n";
+ print "Failed-Why:\n";
+ $sourcestanza=1;
+ } elsif (/^([^\s]*) .*: FAILED/) {
+ $binpackage=$1;
+ $explanation=$_;
+ $explanation.=<RESULT>;
+ $sourcestanza=0;
+ } else {
+ # we have someting strange here
+ $sourcestanza=0;
+ }
+ }
+}
+
+close RESULT;
+
+if ($binexplain) {
+ while (@binqueue) {
+ $p=pop(@binqueue);
+ $v=$binfailures{$p};
+ next unless defined $v;
+ $binfailures{$p}="";
+ print "$v" if $v ne "";
+ if ($v=~/depends on ([^\s]*) .*\{.*\}/) {
+ push(@binqueue,$1);
+ }
+ }
+}
+