}
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';
}
$state = $pkg->{'state'};
- if ($state eq "Needs-Build")
- {
- print "$name: Already in Needs-Build.\n";
- return;
- }
-
if ($state eq "BD-Uninstallable") {
if ($opt_override) {
print "$name: Forcing uninstallability mark to be removed. This is not permanent and might be reset with the next trigger run\n";
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;
return '"' . $arch . $schema_suffix . '".users';
}
+sub get_readonly_source_info {
+ my $name = shift;
+ my $pkg = $dbh->selectrow_hashref('SELECT * FROM ' .
+ table_name() . ' WHERE package = ? AND distribution = ?',
+ undef, $name, $distribution);
+ return $pkg;
+}
+
sub get_source_info {
my $name = shift;
my $pkg = $dbh->selectrow_hashref('SELECT * FROM ' .
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;