use Date::Parse;
use List::Util qw[max];
use Dpkg::Version qw(vercmp); # TODO: change this for running with squeeze dpkg
+use Dpkg::Deps; # TODO: same
our ($verbose, $mail_logs, $list_order, $list_state,
$curr_date, $op_mode, $user, $real_user, $distribution,
our $Pas = '/org/buildd.debian.org/etc/packages-arch-specific/Packages-arch-specific';
our $simulate = 0;
our $simulate_edos = 0;
-our $api = 0; # allow buildds to specify an different api
+our $api = undef; # allow buildds to specify an different api
+our $recorduser = undef;
# global vars
$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin:/org/wanna-build/bin/";
}
$list_order = $yamlmap->{"list-order"}{$list_state} if !$list_order and $list_state;
$list_order ||= $yamlmap->{"list-order"}{'default'};
+$api //= $yamlmap->{"api"};
+$api //= 0;
my $dbh;
}
my $schema_suffix = '';
-if (isin( $op_mode, qw(list info)) && $distribution !~ /security/ && !(not -t and $user =~ /buildd-/) && !($privmode eq 'yes')) {
+$recorduser //= (not -t and $user =~ /^buildd_/);
+if (isin( $op_mode, qw(list info)) && $distribution !~ /security/ && !$recorduser && !($privmode eq 'yes')) {
$dbh = DBI->connect("DBI:Pg:service=wanna-build") ||
die "FATAL: Cannot open database: $DBI::errstr\n";
$schema_suffix = '_public';
die "Unexpected operation mode $op_mode\n";
}
- if (not -t and $user =~ /buildd-/) {
+ if ($recorduser) {
my $userinfo = get_user_info($user);
if (!defined $userinfo)
{
}
print "$name: $ok\n" if $verbose;
} else {
- print "- $name:\n";
- print " - status: ok\n";
- print " - extra-depends: $pkg->{'extra_depends'}\n" if $pkg->{'extra_depends'};
- print " - extra-conflicts: $pkg->{'extra_conflicts'}\n" if $pkg->{'extra_conflicts'};
- if ($pkg->{'binary_nmu_version'}) {
- print " - binNMU:\n";
- print " - version: $pkg->{'binary_nmu_version'}\n";
- print " - changelog: $pkg->{'binary_nmu_changelog'}\n";
- }
+ print "- $name:\n";
+ print " - status: ok\n";
+ printf " - pkg-ver: %s_%s\n", $name, $version;
+ print " - binNMU: $pkg->{'binary_nmu_version'}\n" if $pkg->{'binary_nmu_version'};
+ print " - extra-changelog: $pkg->{'binary_nmu_changelog'}\n" if $pkg->{'binary_nmu_changelog'} && $pkg->{'binary_nmu_version'};
+ print " - extra-depends: $pkg->{'extra_depends'}\n" if $pkg->{'extra_depends'};
+ print " - extra-conflicts: $pkg->{'extra_conflicts'}\n" if $pkg->{'extra_conflicts'};
}
change_state( \$pkg, 'Building' );
$pkg->{'package'} = $name;
}
-sub greparch {
- my ($gapkglong, $gaarch) = @_;
- my ($gapkg, $gaarchs) = split(/ \[/, $gapkglong);
- if ($gaarchs) {
- $_ = $gapkg;
- chop($gaarchs); # take away the ]
- my @gaarches = split(/ /, $gaarchs);
- if (substr($gaarches[0], 0, 1) eq '!') {
- return 0 if grep /^!$gaarch$/, @gaarches;
- } else { # positive case
- return 0 unless grep /^$gaarch$/, @gaarches;
- }
- };
- return 1;
-}
sub filterarch {
- my $faarch = $_[1];
- return join(', ', grep { &greparch($_, $faarch) } split(/, ?/, $_[0]));
+ return "" unless $_[0];
+ return Dpkg::Deps::parse($_[0], ("reduce_arch" => 1, "host_arch" => $_[1]))->dump();
}
sub wb_edos_builddebcheck {
($pkg->{'binary_nmu_version'} ? ";b".$pkg->{'binary_nmu_version'} : "").
", $pkg->{'state'}):";
- if (isin($pkgs->{'status'}, qw (installed related)) && $pkg->{'binary_nmu_version'} && $pkgs->{'binnmu'} < int($pkg->{'binary_nmu_version'})) {
+ if (isin($pkgs->{'status'}, qw (installed related)) && $pkgs->{'version'} eq $pkg->{'version'} && $pkg->{'binary_nmu_version'} && $pkgs->{'binnmu'} < int($pkg->{'binary_nmu_version'})) {
$pkgs->{'status'} = 'out-of-date';
}
if (isin($pkgs->{'status'}, qw (installed related))) {