}
my $schema_suffix = '';
-# TODO: Base this on something else, like an option that is passed.
-if ($real_user eq 'nobody') {
+if (isin( $op_mode, qw(list info)) && $distribution !~ /security/) {
$dbh = DBI->connect("DBI:Pg:service=wanna-build") ||
die "FATAL: Cannot open database: $DBI::errstr\n";
$schema_suffix = '_public';
my $cnt = 0;
my %scnt;
my $ctime = time;
+ my $db;
- my $db = get_all_source_info();
+ if ($state ne "all") {
+ $db = get_all_source_info_state($state);
+ } else {
+ $db = get_all_source_info();
+ }
foreach $name (keys %$db) {
next if $name =~ /^_/;
$pkg = $db->{$name};
- next if $state ne "all" && $pkg->{'state'} !~ /^\Q$state\E$/i;
next if $user && (lc($state) ne 'needs-build' and $pkg->{'builder'} ne $user);
next if $category && $pkg->{'state'} eq "Failed" &&
$pkg->{'failed_category'} ne $category;
foreach $dist (@dists) {
my $pname = "$name" . ($info_all_dists ? "($dist)" : "");
- $pkg = get_source_info($name);
+ $pkg = get_readonly_source_info($name);
if (!defined( $pkg )) {
print "$pname: not registered\n";
next;
Usage: $prgname <options...> <package_version...>
Options:
-v, --verbose: Verbose execution.
+ -A arch: Architecture this operation is for.
--take: Take package for building [default operation]
-f, --failed: Record in database that a build failed due to
deficiencies in the package (that aren't fixable without a new
return '"' . $arch . $schema_suffix . '".users';
}
-sub get_source_info {
+sub get_readonly_source_info {
my $name = shift;
my $pkg = $dbh->selectrow_hashref('SELECT * FROM ' .
table_name() . ' WHERE package = ? AND distribution = ?',
return $pkg;
}
+sub get_source_info {
+ my $name = shift;
+ my $pkg = $dbh->selectrow_hashref('SELECT * FROM ' .
+ table_name() . ' WHERE package = ? AND distribution = ?' .
+ 'FOR UPDATE',
+ undef, $name, $distribution);
+ return $pkg;
+}
+
sub get_all_source_info {
my $db = $dbh->selectall_hashref('SELECT * FROM ' . table_name() .
' WHERE distribution = ?',
return $db;
}
+sub get_all_source_info_state {
+ my $state = shift;
+ my $db = $dbh->selectall_hashref('SELECT * FROM ' . table_name() .
+ ' WHERE distribution = ? and state = ?',
+ 'package', undef, $distribution, $state);
+ return $db;
+}
+
sub update_source_info {
my $pkg = shift;