}
}
-$dbh = DBI->connect("DBI:Pg:database=wanna-build") ||
- die "FATAL: Cannot open database: $DBI::errstr\n";
+my $schema_suffix = '';
+# TODO: Base this on something else, like an option that is passed.
+if ($real_user eq 'nobody') {
+ $dbh = DBI->connect("DBI:Pg:service=wanna-build") ||
+ die "FATAL: Cannot open database: $DBI::errstr\n";
+ $schema_suffix = '_public';
+}
+else
+{
+ $dbh = DBI->connect("DBI:Pg:service=wanna-build-privileged") ||
+ die "FATAL: Cannot open database: $DBI::errstr\n";
+}
# TODO: This shouldn't be needed, file a bug.
$dbh->{pg_server_prepare} = 0;
next if $category && $pkg->{'state'} eq "Failed" &&
$pkg->{'failed_category'} ne $category;
next if ($list_min_age > 0 &&
- ($ctime-parse_date($pkg->{'State-Change'})) < $list_min_age)||
+ ($ctime-parse_date($pkg->{'state_change'})) < $list_min_age)||
($list_min_age < 0 &&
- ($ctime-parse_date($pkg->{'State-Change'})) > -$list_min_age);
+ ($ctime-parse_date($pkg->{'state_change'})) > -$list_min_age);
push( @list, $pkg );
}
join("\n ",split("\n",$pkg->{'bd_problem'})), "\n"
if $pkg->{'state'} eq "BD-Uninstallable";
print " Previous state was $pkg->{'previous_state'} until ",
- "$pkg->{'State-Change'}\n"
+ "$pkg->{'state_change'}\n"
if $verbose && $pkg->{'previous_state'};
print " No previous state recorded\n"
if $verbose && !$pkg->{'previous_state'};
return if defined($$state) and $$state eq $newstate;
$pkg->{'previous_state'} = $$state if defined($$state);
- $pkg->{'State-Change'} = $curr_date;
+ $pkg->{'state_change'} = $curr_date;
if (defined($$state) and $$state eq 'Failed') {
$pkg->{'old_failed'} =
}
sub table_name {
- return '"' . $arch . '".packages';
+ return '"' . $arch . $schema_suffix . '".packages';
}
sub user_table_name {
- return '"' . $arch . '".users';
+ return '"' . $arch . $schema_suffix . '".users';
}
sub get_source_info {