]> git.donarmstrong.com Git - wannabuild.git/blobdiff - bin/wanna-build
wanna-build: ignore partial package overwrite with arch:all
[wannabuild.git] / bin / wanna-build
index 78e80ba119b75fe8c2837c00db31dc105eddd0a3..6845901f17ad360e79e793d4df690732b9a20cc7 100755 (executable)
@@ -1917,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;
 }
@@ -2114,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 {
@@ -2151,8 +2153,10 @@ 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;
+                if ($binary->{$bin} and $binary->{$bin}->{'arch'} ne 'all' and vercmp($pkgs->{'version'}, $binary->{$bin}->{'version'}) < 0) {
+                   print Dumper($binary->{$bin}) . "\n";
+                    print "$logstr skipped because binaries (assumed to be) overwritten (" .
+                       $bin . ", " . $pkgs->{'version'} . " vs. " . $binary->{$bin}->{'version'} . ")\n" if $verbose || $simulate;
                     next SRCS;
                 }
             }