X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bin%2Fwanna-build;h=ba9af8499d90b2cc00e53de16d07e79c66ef629b;hb=855139a22236ef3381d91e13dc6986f116f6d97e;hp=6bddff24bc8b325ae73b839429666d6a4ceebc5c;hpb=2176a4da244356f95fc5ff810609c3705d4e5068;p=wannabuild.git diff --git a/bin/wanna-build b/bin/wanna-build index 6bddff2..ba9af84 100755 --- a/bin/wanna-build +++ b/bin/wanna-build @@ -64,11 +64,10 @@ use Dpkg::Deps; # TODO: same our ($verbose, $mail_logs, $list_order, $list_state, $curr_date, $op_mode, $user, $real_user, $distribution, - $fail_reason, $opt_override, $import_from, $export_to, $opt_create_db, + $fail_reason, $opt_override, $import_from, $export_to, %prioval, %sectval, $info_all_dists, $arch, - $category, %catval, %short_category, - $short_date, $list_min_age, $dbbase, @curr_time, + $short_date, $list_min_age, $list_max_age, $dbbase, @curr_time, $build_priority, %new_vers, $binNMUver, %merge_srcvers, %merge_binsrc, $printformat, $ownprintformat, $privmode, $extra_depends, $extra_conflicts, %distributions, %distribution_aliases @@ -89,16 +88,6 @@ $curr_date = strftime("%Y %b %d %H:%M:%S",@curr_time); $short_date = strftime("%m/%d/%y",@curr_time); $| = 1; -%short_category = ( u => "uploaded-fixed-pkg", - f => "fix-expected", - r => "reminder-sent", - n => "nmu-offered", - e => "easy", - m => "medium", - h => "hard", - c => "compiler-error", - "" => "none" ); - # set mode of operation based on command line switch. Should be used # by GetOptions below. sub _set_mode_set { $op_mode = "set-$_[0]" } @@ -117,7 +106,6 @@ GetOptions( }, 'verbose|v' => \$verbose, 'override|o' => \$opt_override, - 'create-db' => \$opt_create_db, 'correct-compare' => \$WannaBuild::opt_correct_version_cmp, # TODO: remove after buildds no longer pass to wanna-build @@ -162,6 +150,7 @@ GetOptions( reupload-wait bd-uninstallable ) ]; }, 'dist|d=s' => sub { + $distribution = $_[1]; given ( $_[1] ) { when ( [qw< a all >] ) { $info_all_dists = 1; @@ -185,15 +174,8 @@ GetOptions( }, 'arch|A=s' => \$arch, 'user|U=s' => \$user, - 'category|c=s' => sub { - $category = $_[1]; - $category = $short_category{$category} - if exists $short_category{$category}; - die "Unknown category: $category\n" - if not $category ~~ [ values %short_category ]; - }, 'min-age|a=i' => \$list_min_age, - 'max-age=i' => \$list_min_age, + 'max-age=i' => \$list_max_age, 'format=s' => \$printformat, 'own-format=s' => \$ownprintformat, 'Pas=s' => \$Pas, @@ -201,12 +183,15 @@ GetOptions( 'extra-conflicts=s' => \$extra_conflicts, # special actions - 'export' => sub { _set_mode(@_); $export_to = $_[1]; }, - 'import' => sub { _set_mode(@_); $import_from = $_[1]; }, + 'export=s' => sub { _set_mode(@_); $export_to = $_[1]; }, + 'import=s' => sub { _set_mode(@_); $import_from = $_[1]; }, 'manual-edit' => \&_set_mode, 'distribution-architectures' => \&_set_mode, 'distribution-aliases' => \&_set_mode, ) or usage(); +$list_min_age = -1 * $list_max_age if $list_max_age; +print "export: $export_to\n"; +print "mode: $op_mode\n"; my $dbh; @@ -263,8 +248,7 @@ foreach my $name (keys %$rows) { } $distribution = $distribution_aliases{$distribution} if (isin($distribution, keys %distribution_aliases)); -$op_mode = $category ? "set-failed" : "set-building" - if !$op_mode; # default operation +$op_mode ||= "set-building"; undef $distribution if $distribution eq 'any'; if ($distribution) { my @dists = split(/[, ]+/, $distribution); @@ -307,7 +291,7 @@ die "Can't determine your user name\n" !($user = $real_user); if (!$fail_reason) { - if ($op_mode eq "set-failed" && !$category) { + if ($op_mode eq "set-failed" ) { print "Enter reason for failing (end with '.' alone on ". "its line):\n"; my $line; @@ -797,7 +781,7 @@ sub add_one_uploaded { sub add_one_failed { my $name = shift; my $version = shift; - my ($state, $cat); + my $state; my $pkg = get_source_info($name); if (!defined($pkg)) { @@ -832,17 +816,6 @@ sub add_one_failed { return; } - $cat = $category; - if (!$cat && $fail_reason =~ /^\[([^\]]+)\]/) { - $cat = $1; - $cat = $short_category{$cat} if exists $short_category{$cat}; - if (!isin( $cat, values %short_category )) { - print "$name: Warning: unknown category $cat; discarded\n"; - $cat = ""; - } - $fail_reason =~ s/^\[[^\]]+\][ \t]*\n*//; - } - if ($state eq "Needs-Build") { print "$name: Warning: not registered for building previously, ". "but processing anyway.\n"; @@ -862,22 +835,12 @@ sub add_one_failed { elsif ($state eq "Failed") { print "$name: already registered as failed; will append new message\n" if $fail_reason; - print "$name: already registered as failed; changing category\n" - if $cat; - } - - if (($cat eq "reminder-sent" || $cat eq "nmu-offered") && - defined $pkg->{'failed_category'} && - $pkg->{'failed_category'} ne $cat) { - (my $action = $cat) =~ s/-/ /; - $fail_reason .= "\n$short_date: $action"; } change_state( \$pkg, 'Failed' ); $pkg->{'builder'} = $user; $pkg->{'failed'} .= "\n" if $pkg->{'failed'}; $pkg->{'failed'} .= $fail_reason; - $pkg->{'failed_category'} = $cat if $cat; if (defined $pkg->{'permbuildpri'}) { $pkg->{'buildpri'} = $pkg->{'permbuildpri'}; } else { @@ -1290,15 +1253,6 @@ BEGIN { } $sectval{'unknown'} = -165; - %catval = ( "none" => -20, - "uploaded-fixed-pkg" => -19, - "fix-expected" => -18, - "reminder-sent" => -17, - "nmu-offered" => -16, - "easy" => -15, - "medium" => -14, - "hard" => -13, - "compiler-error" => -12 ); } sub sort_list_func { @@ -1311,7 +1265,6 @@ sub sort_list_func { 'n' => ['cmp', sub { return $_[0]->{'package'}; }], 'b' => ['cmp', sub { return $_[0]->{'builder'}; }], 'c' => ['<=>', sub { return ($_[0]->{'notes'}//"" =~ /^(out-of-date|partial)/) ? 0: ($_[0]->{'notes'}//"" =~ /^uncompiled/) ? 2 : 1; }], - 'f' => ['<=>', sub { return $catval{ $_[0]->{'failed_category'} ? $_[0]->{'failed_category'}: "none" }; }], 'S' => ['<->', sub { return isin($_[0]->{'priority'}, qw(required important standard)); }], 'T' => ['<->', sub { return $_[0]->{'state_time'} % 86400;} ], # Fractions of a day }; @@ -1329,7 +1282,7 @@ sub sort_list_func { sub calculate_prio { my $priomap = $yamlmap->{priority}; my $pkg = shift; - my @s=split("/", $pkg->{'section'}); + my @s=split("/", $pkg->{'section'}//""); $pkg->{'component'} = $s[0] if $s[1]; $pkg->{'component'} ||= 'main'; $pkg->{'calprio'} = 0; @@ -1490,7 +1443,7 @@ sub list_packages { my %scnt; my $ctime = time; - my $db = get_all_source_info(state => $state, user => $user, category => $category, list_min_age => $list_min_age); + my $db = get_all_source_info(state => $state, user => $user, list_min_age => $list_min_age); foreach $name (keys %$db) { next if $name =~ /^_/; push @list, calculate_prio($db->{$name}); @@ -1521,9 +1474,6 @@ sub list_packages { if $pkg->{'state'} ne "Needs-Build"; print print_format(" [%X]\n", $pkg, {}); print " Reasons for failing:\n", - " [Category: ", - defined $pkg->{'failed_category'} ? $pkg->{'failed_category'} : "none", - "]\n ", join("\n ",split("\n",$pkg->{'failed'})), "\n" if $pkg->{'state'} =~ /^Failed/; print " Dependencies: $pkg->{'depends'}\n" @@ -1566,7 +1516,7 @@ sub info_packages { 'bd_problem' => 'BD-Problem', 'binary_nmu_changelog' => 'Binary-NMU-Changelog', 'binary_nmu_version' => 'Binary-NMU-Version', 'buildpri' => 'BuildPri', 'depends' => 'Depends', 'failed' => 'Failed', - 'failed_category' => 'Failed-Category', 'notes' => 'Notes', + 'notes' => 'Notes', 'distribution' => 'Distribution', 'old_failed' => 'Old-Failed', 'permbuildpri' => 'PermBuildPri', 'rel' => 'Rel', 'calprio' => 'CalculatedPri', 'state_days' => 'State-Days', 'state_time' => 'State-Time', @@ -1616,6 +1566,7 @@ sub info_packages { } sub forget_packages { + no warnings; my( $name, $pkg, $key, $data ); foreach $name (@_) { @@ -1765,7 +1716,6 @@ sub change_state { ($pkg->{'failed'} // ""). "\n" . ($pkg->{'old_failed'} // ""); delete $pkg->{'failed'}; - delete $pkg->{'failed_category'}; } if (defined($$state) and $$state eq 'BD-Uninstallable') { delete $pkg->{'bd_problem'}; @@ -2192,7 +2142,7 @@ sub pkg_history_table_name { sub get_readonly_source_info { my $name = shift; # SELECT FLOOR(EXTRACT('epoch' FROM age(localtimestamp, '2010-01-22 23:45')) / 86400) -- change to that? - my $q = "SELECT rel, priority, state_change, permbuildpri, section, buildpri, failed, state, binary_nmu_changelog, bd_problem, version, package, distribution, installed_version, notes, failed_category, builder, old_failed, previous_state, binary_nmu_version, depends, extract(days from date_trunc('days', now() - state_change)) as state_days, floor(extract(epoch from now()) - extract(epoch from state_change)) as state_time" + my $q = "SELECT rel, priority, state_change, permbuildpri, section, buildpri, failed, state, binary_nmu_changelog, bd_problem, version, package, distribution, installed_version, notes, builder, old_failed, previous_state, binary_nmu_version, depends, extract(days from date_trunc('days', now() - state_change)) as state_days, floor(extract(epoch from now()) - extract(epoch from state_change)) as state_time" . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution AND result = 'successful') AS successtime" . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution ) AS anytime" . ", extra_depends, extra_conflicts, build_arch_all" @@ -2216,7 +2166,7 @@ sub get_source_info { sub get_all_source_info { my %options = @_; - my $q = "SELECT rel, priority, state_change, permbuildpri, section, buildpri, failed, state, binary_nmu_changelog, bd_problem, version, package, distribution, installed_version, notes, failed_category, builder, old_failed, previous_state, binary_nmu_version, depends, extract(days from date_trunc('days', now() - state_change)) as state_days, floor(extract(epoch from now()) - extract(epoch from state_change)) as state_time" + my $q = "SELECT rel, priority, state_change, permbuildpri, section, buildpri, failed, state, binary_nmu_changelog, bd_problem, version, package, distribution, installed_version, notes, builder, old_failed, previous_state, binary_nmu_version, depends, extract(days from date_trunc('days', now() - state_change)) as state_days, floor(extract(epoch from now()) - extract(epoch from state_change)) as state_time" # . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution AND result = 'successful') AS successtime" # . ", (SELECT max(build_time) FROM ".pkg_history_table_name()." WHERE pkg_history.package = packages.package AND pkg_history.distribution = packages.distribution ) AS anytime" . ", successtime.build_time as successtime, anytime.build_time as anytime, extra_depends, extra_conflicts" @@ -2247,12 +2197,6 @@ sub get_all_source_info { push @args, $options{user}; } - if ($options{category}) { - $q .= ' AND failed_category <> ? AND upper(state) = ? '; - push @args, $options{category}; - push @args, "FAILED"; - } - if ($options{list_min_age} && $options{list_min_age} > 0) { $q .= ' AND age(state_change) > ? '; push @args, $options{list_min_age} . " days"; @@ -2312,7 +2256,6 @@ sub update_source_info { 'old_failed = ?, ' . 'binary_nmu_version = ?, ' . 'binary_nmu_changelog = ?, ' . - 'failed_category = ?, ' . 'permbuildpri = ?, ' . 'buildpri = ?, ' . 'depends = ?, ' . @@ -2334,7 +2277,6 @@ sub update_source_info { $pkg->{'old_failed'}, $pkg->{'binary_nmu_version'}, $pkg->{'binary_nmu_changelog'}, - $pkg->{'failed_category'}, $pkg->{'permbuildpri'}, $pkg->{'buildpri'}, $pkg->{'depends'},