X-Git-Url: https://git.donarmstrong.com/?p=wannabuild.git;a=blobdiff_plain;f=bin%2Fwanna-build;h=5e84b6af0e57c80af7e699a05bc10c035eaee965;hp=1abf5dfc01911e69e30bdecfc6dc69ff30cb43ae;hb=a0990e04e79633f0f9e8bc27454a5ab9b433f395;hpb=421ee3642f21bce80b4318f6d5d027dc3453e116 diff --git a/bin/wanna-build b/bin/wanna-build index 1abf5df..5e84b6a 100755 --- a/bin/wanna-build +++ b/bin/wanna-build @@ -1187,10 +1187,8 @@ sub list_packages { @list = grep { !$_->{'extra_depends'} and !$_->{'extra_conflicts'} } @list if $api < 1 ; # filter out packages for needs-build in noautobuild state - same could exist for weaknoautobuild if buildds would tell us what they do if (($state eq 'needs-build') && ($yamlmap->{"restrict"}) && ($yamlmap->{"restrict"}{"noautobuild"})) { - foreach my $key (@{$yamlmap->{"restrict"}{"noautobuild"}}) { - foreach my $k (keys %$key) { - @list = grep { $_->{'package'} ne $k } @list; - } + foreach my $key (map {keys %$_} @{$yamlmap->{"restrict"}{"noautobuild"}}) { + @list = grep { $_->{'package'} ne $key } @list; } } @@ -1919,9 +1917,9 @@ sub get_readonly_source_info { sub get_source_info { my $name = shift; return get_readonly_source_info($name) if $simulate; + lock_table(); my $pkg = $dbh->selectrow_hashref('SELECT *, extract(days from date_trunc(\'days\', now() - state_change)) as state_days, floor(extract(epoch from now()) - extract(epoch from state_change)) as state_time FROM ' . - table_name() . ' WHERE package = ? AND distribution = ?' . - ' FOR UPDATE', + table_name() . ' WHERE package = ? AND distribution = ?', undef, $name, $distribution); return $pkg; } @@ -2116,8 +2114,10 @@ sub add_user_info { sub lock_table { return if $simulate; - $dbh->do('SELECT 1 FROM ' . table_name() . - ' WHERE distribution = ? FOR UPDATE', undef, $distribution) or die $dbh->errstr; + $q = 'SELECT 1 AS result FROM public.locks' . + ' WHERE architecture = ? AND distribution = ? FOR UPDATE'; + my $result = $dbh->selectrow_hashref($q, undef, $arch, $distribution) or die $dbh->errstr; + die unless $result->{'result'} == 1; } sub parse_argv { @@ -2154,7 +2154,8 @@ sub parse_all_v3 { # does at least one binary exist in the database and is more recent - if so, we're probably just outdated, ignore the source package for my $bin (@{$pkgs->{'binary'}}) { if ($binary->{$bin} and vercmp($pkgs->{'version'}, $binary->{$bin}->{'version'}) < 0) { - print "$logstr skipped because binaries (assumed to be) overwritten\n" if $verbose || $simulate; + print "$logstr skipped because binaries (assumed to be) overwritten (" . + $bin . ", " . $pkgs->{'version'} . " vs. " . $binary->{$bin}->{'version'} . ")\n" if $verbose || $simulate; next SRCS; } }