From: Andreas Barth Date: Wed, 30 Mar 2011 19:07:18 +0000 (+0000) Subject: add state auto-not-for-us: X-Git-Url: https://git.donarmstrong.com/?p=wannabuild.git;a=commitdiff_plain;h=82687dad4773036a4aa5100a6940758b6bcbf7ab add state auto-not-for-us: if a package shouldn't be built according to the sources file, and the package isn't marked in P-a-s, and isn't in the Failed or Dep-Wait-State (in which case the current state isn't touched) --- diff --git a/bin/wanna-build b/bin/wanna-build index e7befe3..8780000 100755 --- a/bin/wanna-build +++ b/bin/wanna-build @@ -160,7 +160,7 @@ my %options = die "Unknown state to list: $list_state\n" if !isin( $list_state, qw(needs-build building uploaded built build-attempted failed installed dep-wait - not-for-us all failed-removed + not-for-us auto-not-for-us all failed-removed install-wait reupload-wait bd-uninstallable));} }, # options with args dist => @@ -2319,7 +2319,7 @@ sub check_entry { 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 Dep-Wait-Removed - Failed Failed-Removed Not-For-Us BD-Uninstallable + Failed Failed-Removed Not-For-Us BD-Uninstallable Auto-Not-For-Us ) ); } @@ -3025,7 +3025,7 @@ sub parse_all_v3() { foreach my $name (keys %$srcs) { next if $name eq '_binary'; - # state = installed, out-of-date, uncompiled, not-for-us + # state = installed, out-of-date, uncompiled, not-for-us, auto-not-for-us my $pkgs = $srcs->{$name}; my $pkg = $db->{$name}; @@ -3094,6 +3094,17 @@ sub parse_all_v3() { next; } + if ($pkgs->{'status'} eq 'auto-not-for-us') { + next if isin( $pkg->{'state'}, qw(Not-For-Us Failed Failed-Removed Dep-Wait Dep-Wait-Removed)); + # if the package is currently current, the status is Installed, not not-for-us + + change_state( \$pkg, "Auto-Not-For-Us" ); + log_ta( $pkg, "--merge-v3: Auto-Not-For-Us" ) unless $simulate; + update_source_info($pkg) unless $simulate; + print "$logstr set to auto-not-for-us\n" if $verbose || $simulate; + next SRCS; + } + # only uncompiled / out-of-date are left, so check if anything new if (!(isin($pkgs->{'status'}, qw (uncompiled out-of-date)))) { print "$logstr package in unknown state: $pkgs->{'status'}\n"; diff --git a/lib/WB/QD.pm b/lib/WB/QD.pm index d5cefb3..25d2fb0 100644 --- a/lib/WB/QD.pm +++ b/lib/WB/QD.pm @@ -3,6 +3,7 @@ package WB::QD; use strict; use IO::Uncompress::AnyInflate qw(anyinflate); use Dpkg::Version qw(vercmp); +use Dpkg::Arch qw(debarch_is); use Data::Dumper; sub readsourcebins { @@ -42,7 +43,9 @@ sub readsourcebins { next unless $p->{'name'} and $p->{'version'}; next if $p->{'arch'} eq 'all'; - # TODO: respect the architecture - or not / we already respect it via P-a-s + foreach my $tarch (split(/\s+/, $p->{'arch'})) { + $p->{'for-us'} = 1 if debarch_is($arch, $tarch); + } delete $p->{'arch'}; # ignore if package already exists with higher version @@ -96,6 +99,11 @@ sub readsourcebins { } delete $srcs->{$k}->{'compiled'}; $srcs->{$k}->{'status'} = 'installed' if $srcs->{$k}->{'arch'} && $srcs->{$k}->{'arch'} eq 'all'; + + if (!$srcs->{$k}->{'for-us'} && $srcs->{$k}->{'status'} ne 'installed') { + $srcs->{$k}->{'status'} = 'auto-not-for-us'; + } + delete $srcs->{$k}->{'for-us'}; #my $p = $pas->{$k}; #$p ||= $pas->{'%'.$k}; diff --git a/tests/qd.pl b/tests/qd.pl index 9a4ceab..6ae5100 100755 --- a/tests/qd.pl +++ b/tests/qd.pl @@ -69,6 +69,20 @@ Build-Depends: debhelper (>= 7), docbook-xsl, ldp-docbook-xsl (>= 0.0.20040321-0 Build-Conflicts: dash Architecture: all i386 amd64 +Package: autonfu +Binary: autonfu +Version: 1.41.11-1 +Priority: required +Section: admin +Architecture: amd64 + +Package: autonfu1 +Binary: autonfu1 +Version: 1.41.11-1 +Priority: required +Section: admin +Architecture: linux-any + EOF ; @@ -168,6 +182,22 @@ is_deeply ($$srcs, { 'section' => 'shell', 'binary' => ['nfu'], }, + 'autonfu' => { + 'priority' => 'required', + 'status' => 'auto-not-for-us', + 'version' => '1.41.11-1', + 'name' => 'autonfu', + 'section' => 'admin', + 'binary' => ['autonfu'], + }, + 'autonfu1' => { + 'priority' => 'required', + 'status' => 'uncompiled', + 'version' => '1.41.11-1', + 'name' => 'autonfu1', + 'section' => 'admin', + 'binary' => ['autonfu1'], + }, 'pbuilder' => { 'priority' => 'extra', 'status' => 'not-for-us',