-sub add_one_uploaded {
- my $name = shift;
- my $version = shift;
- my $pkg = shift;
-
- if ($pkg->{'state'} eq "Uploaded" &&
- pkg_version_eq($pkg,$version)) {
- print "$name: already uploaded\n";
- return;
- }
- if (!isin( $pkg->{'state'}, qw(Building Built Build-Attempted))) {
- print "$name: not taken for building (state is $pkg->{'state'}). ",
- "Skipping.\n";
- return;
- }
- # strip epoch -- buildd-uploader used to go based on the filename.
- # (to remove at some point)
- my $pkgver;
- ($pkgver = $pkg->{'version'}) =~ s/^\d+://;
- $version =~ s/^\d+://; # for command line use
- if ($pkg->{'binary_nmu_version'} ) {
- my $nmuver = binNMU_version($pkgver, $pkg->{'binary_nmu_version'});
- if (!version_eq( $nmuver, $version )) {
- print "$name: version mismatch ($nmuver registered). ",
- "Skipping.\n";
- return;
- }
- } elsif (!version_eq($pkgver, $version)) {
- print "$name: version mismatch ($pkg->{'version'} registered). ",
- "Skipping.\n";
- return;
- }
-
- change_state( \$pkg, 'Uploaded' );
- log_ta( $pkg, "--uploaded" );
- update_source_info($pkg);
- print "$name: registered as uploaded\n" if $verbose;
-}
-
-sub add_one_failed {
- my $pkg = shift;
- my $state = $pkg->{'state'};
- my $name = $pkg->{'package'};
-
- if ($state eq "Not-For-Us") {
- print "$name: not suitable for this architecture anyway. Skipping.\n";
- return;
- }
- elsif ($state eq "Failed-Removed") {
- print "$name: failed previously and doesn't need building. Skipping.\n";
- return;
- }
- elsif ($state eq "Installed") {
- print "$name: Is already installed in archive. Skipping.\n";
- return;
- }
- elsif ($pkg->{'builder'} &&
- (($user ne $pkg->{'builder'}) &&
- !($pkg->{'builder'} =~ /^(\w+)-\w+/ && $1 eq $user))) {
- print "$name: not taken by you, but by ".
- "$pkg->{'builder'}. Skipping.\n";
- return;
- }
-
- if (isin($state, qw<Needs-Build Uploaded Dep-Wait BD-Uninstallable>)) {
- print "add_one_failed: $name: Warning: not registered for building previously (but $state), processing anyway.\n";
- }
- elsif ($state eq "Failed") {
- print "$name: already registered as failed; will append new message\n"
- if $fail_reason;
- }
-
- change_state( \$pkg, 'Failed' );
- $pkg->{'builder'} = $user;
- $pkg->{'failed'} .= "\n" if $pkg->{'failed'};
- $pkg->{'failed'} .= $fail_reason;
- log_ta( $pkg, "--failed" );
- update_source_info($pkg);
- print "$name: registered as failed\n" if $verbose;
-}
-