+
+ my $pkg = get_source_info($name);
+ if (!($actions->{$op_mode}) || !($actions->{$op_mode}->{'nopkgdef'})) {
+ if (!defined($pkg)) {
+ print "$name: not registered yet.\n";
+ next;
+ }
+ }
+ if ($actions->{$op_mode} && $actions->{$op_mode}->{'builder'}) {
+ if (($pkg->{'builder'} && $user ne $pkg->{'builder'}) &&
+ !($pkg->{'builder'} =~ /^(\w+)-\w+/ && $1 eq $user) &&
+ !$opt_override) {
+ print "$pkg->{'package'}: not taken by you, but by $pkg->{'builder'}. Skipping.\n";
+ next;
+ }
+ }
+ if (!($actions->{$op_mode}) || !($actions->{$op_mode}->{'noversion'})) {
+ my $nmuver = binNMU_version($pkg->{version}, $pkg->{'binary_nmu_version'});
+ if ((!pkg_version_eq($pkg,$version) || $actions->{$op_mode}->{'binversion'}) && !version_eq( $nmuver, $version )) {
+ print "$pkg->{package}: version mismatch ($nmuver";
+ print " by $pkg->{'builder'}" if $pkg->{'builder'};
+ print ")\n";
+ next;
+ }
+ }
+
+ if ($actions->{$op_mode} && $actions->{$op_mode}->{'from'}) {
+ if (!isin($pkg->{'state'}, @{$actions->{$op_mode}->{'from'}}, @{$actions->{$op_mode}->{'warnfrom'}})) {
+ print "$name: skiping: state is $pkg->{'state'}, not in ".join(", ",@{$actions->{$op_mode}->{'from'}}, @{$actions->{$op_mode}->{'warnfrom'}})."\n";
+ next;
+ }
+ }
+ if ($actions->{$op_mode} && $actions->{$op_mode}->{'warnfrom'}) {
+ if (isin($pkg->{'state'}, @{$actions->{$op_mode}->{'warnfrom'}})) {
+ print "$name: warning: state is $pkg->{'state'}, processing anyways.\n";
+ }
+ }
+
+ if ($op_mode eq "set-building") {
+ add_one_building( $name, $version, $pkg );
+ }
+ elsif ($op_mode eq "set-failed") {
+ print "$pkg->{'package'}: already registered as failed; will append new message\n" if $pkg->{'state'} eq "Failed";
+ $pkg->{'builder'} = $user;
+ $pkg->{'failed'} .= "\n" if $pkg->{'failed'};
+ $pkg->{'failed'} .= $fail_reason;
+ }
+ elsif ($op_mode eq "set-not-for-us") {
+ add_one_notforus( $pkg );
+ }
+ elsif ($op_mode eq "set-needs-build") {
+ my $state = $pkg->{'state'};
+
+ 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";
+
+ change_state( \$pkg, 'Needs-Build' );
+ delete $pkg->{'builder'};
+ delete $pkg->{'depends'};
+ log_ta( $pkg, "--give-back" );
+ update_source_info($pkg);
+ print "$name: given back\n" if $verbose;
+ next;
+ }
+ else {
+ print "$name: has uninstallable build-dependencies. Skipping\n (use --override to clear dependency list and give back anyway)\n";
+ next;
+ }
+ }
+ elsif ($state eq "Dep-Wait") {
+ if ($opt_override) {
+ print "$name: Forcing source dependency list to be cleared\n";
+ }
+ else {
+ print "$name: waiting for source dependencies. Skipping\n (use --override to clear dependency list and give back anyway)\n";
+ next;
+ }
+ }
+ elsif (!isin( $state, qw(Building Built Build-Attempted))) {
+ print "$name: not taken for building (state is $state).";
+ if ($opt_override) {
+ print "\n$name: Forcing give-back\n";
+ }
+ else {
+ print " Skipping.\n";
+ next;
+ }
+ }
+ $pkg->{'builder'} = undef;
+ $pkg->{'depends'} = undef;
+ }
+ elsif ($op_mode eq "set-dep-wait") {
+ add_one_depwait( $pkg );
+ }
+ elsif ($op_mode eq "set-build-priority") {
+ set_one_buildpri( 'buildpri', $pkg );
+ }
+ elsif ($op_mode eq "set-permanent-build-priority") {
+ set_one_buildpri( 'permbuildpri', $pkg );
+ }
+ elsif ($op_mode eq "set-binary-nmu") {
+ set_one_binnmu( $name, $version, $pkg );
+ }
+ elsif ($op_mode eq "set-update") {
+ $pkg->{'version'} =~ s/\+b[0-9]+$//;
+
+ log_ta( $pkg, "--update" );
+ update_source_info($pkg);
+ }
+
+ if ($actions->{$op_mode} && $actions->{$op_mode}->{'action'} && $actions->{$op_mode}->{'to'}) {
+ change_state( \$pkg, $actions->{$op_mode}->{'to'} );
+ log_ta( $pkg, "--".$actions->{$op_mode}->{'action'} );
+ update_source_info($pkg);
+ print "$name: registered as ".$actions->{$op_mode}->{'action'}."\n" if $verbose;
+ }
+ }