X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bin%2Fwanna-build;h=0d8bd1ad0777a1f117eaaad270a6ff3c6705a30e;hb=44802d376dd36e53c019dc95a38618e693fd795e;hp=26456b6d540e2e311c6ee6900f3235be12a29717;hpb=ac24b12e9b42c8c1b3c4430185a2b696aa7e4f17;p=wannabuild.git diff --git a/bin/wanna-build b/bin/wanna-build index 26456b6..0d8bd1a 100755 --- a/bin/wanna-build +++ b/bin/wanna-build @@ -1185,6 +1185,12 @@ sub list_packages { @list = grep { my $i = $_->{'component'}; grep { $i eq $_ } split /[, ]+/, $yamlmap->{"restrict"}{'component'} } @list; # extra depends / conflicts only from api 1 on @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 (map {keys %$_} @{$yamlmap->{"restrict"}{"noautobuild"}}) { + @list = grep { $_->{'package'} ne $key } @list; + } + } # first adjust ownprintformat, then set printformat accordingly $printformat ||= $yamlmap->{"format"}{$ownprintformat} if $ownprintformat; @@ -1911,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; } @@ -2108,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 {