X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=bin%2Fwanna-build;h=18822532e8eaa04c00bd1de047147924cecf7af5;hb=c44876928c07326581b0b4588c4a5e62e892750c;hp=ffb33482791cff4141c60b1eda51a0dcb9037ab0;hpb=92ae52fb838965a3696cf10daf4ea24cfa7efcb8;p=wannabuild.git diff --git a/bin/wanna-build b/bin/wanna-build index ffb3348..1882253 100755 --- a/bin/wanna-build +++ b/bin/wanna-build @@ -42,6 +42,7 @@ use File::Copy; use DBI; use lib '/org/wanna-build/bin'; use lib '/org/wanna-build/lib'; +#use lib 'lib'; use WannaBuild; use YAML::Tiny; use Data::Dumper; @@ -63,6 +64,7 @@ our ($verbose, $mail_logs, $list_order, $list_state, ); 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 # global vars @@ -82,9 +84,6 @@ my %prognames = ( "uploaded-build" => "set-uploaded", "give-back-build" => "set-needs-build", "dep-wait-build" => "set-dep-wait", "forget-build" => "forget", - "merge-quinn" => "merge-quinn", - "merge-packages" => "merge-packages", - "merge-sources" => "merge-sources", "build-info" => "info" ); %short_category = ( u => "uploaded-fixed-pkg", @@ -110,6 +109,8 @@ elsif ($progname =~ /^list-(.*)$/) { my %options = (# flags simulate => { flag => \$simulate }, # this is not supported by all operations (yet)! + "simulate-edos" => { flag => \$simulate_edos }, + "simulate-all" => { code => sub { $simulate = 1; $simulate_edos = 1; } }, api => { arg => \$api, code => sub { # official apis are numeric die "$api isn't numeric" unless int($api) eq $api; @@ -133,13 +134,13 @@ my %options = "dep-wait" => { mode => "set-dep-wait" }, forget => { mode => "forget" }, 'forget-user' => { mode => 'forget-user' }, - "merge-quinn" => { mode => "merge-quinn" }, - "merge-partial-quinn" => { mode => "merge-partial-quinn" }, - "merge-packages" => { mode => "merge-packages" }, - "merge-sources" => { mode => "merge-sources" }, + #"merge-quinn" => { mode => "merge-quinn" }, + #"merge-partial-quinn" => { mode => "merge-partial-quinn" }, + #"merge-packages" => { mode => "merge-packages" }, + #"merge-sources" => { mode => "merge-sources" }, "pretend-avail" => { short => "p", mode => "pretend-avail" }, - "merge-all" => { mode => "merge-all" }, - "merge-all-secondary" => { mode => "merge-all-secondary" }, + #"merge-all" => { mode => "merge-all" }, + #"merge-all-secondary" => { mode => "merge-all-secondary" }, "merge-v3" => { mode => "merge-v3" }, info => { short => "i", mode => "info" }, 'binNMU' => { mode => 'set-binary-nmu', arg => \$binNMUver, @@ -364,7 +365,7 @@ END { } my $schema_suffix = ''; -if (isin( $op_mode, qw(list info)) && $distribution !~ /security/ && !(not -t and $user =~ /-/) && !($privmode eq 'yes')) { +if (isin( $op_mode, qw(list info)) && $distribution !~ /security/ && !(not -t and $user =~ /buildd-/) && !($privmode eq 'yes')) { $dbh = DBI->connect("DBI:Pg:service=wanna-build") || die "FATAL: Cannot open database: $DBI::errstr\n"; $schema_suffix = '_public'; @@ -520,7 +521,7 @@ sub process { } parse_all_v3($$srcs, {'arch' => $arch, 'suite' => $distribution, 'time' => $curr_date}); @bpkgs = @ipkgs unless @bpkgs; - call_edos_depcheck( {'arch' => $arch, 'pkgs' => @bpkgs, 'srcs' => $$srcs, 'depwait' => 1 }); + call_edos_depcheck( {'arch' => $arch, 'pkgs' => \@bpkgs, 'srcs' => $$srcs, 'depwait' => 1 }); last SWITCH; }; /^import/ && do { @@ -542,7 +543,7 @@ sub process { die "Unexpected operation mode $op_mode\n"; } - if (not -t and $user =~ /-/) { + if (not -t and $user =~ /buildd-/) { my $userinfo = get_user_info($user); if (!defined $userinfo) { @@ -615,6 +616,7 @@ sub add_one_building { $ok = 1; my $pkg = get_source_info($name); + $pkg->{'version'} =~ s/\+b[0-9]+$//; if (defined($pkg)) { if ($pkg->{'state'} eq "Not-For-Us") { $ok = 0; @@ -773,6 +775,7 @@ sub add_one_attempted { print "$name: not registered yet.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; if (($pkg->{'state'} ne "Building") && ($pkg->{'state'} ne "Build-Attempted")) { print "$name: not taken for building (state is $pkg->{'state'}). ", @@ -805,6 +808,7 @@ sub add_one_built { print "$name: not registered yet.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; if (($pkg->{'state'} ne "Building") && ($pkg->{'state'} ne "Build-Attempted")) { print "$name: not taken for building (state is $pkg->{'state'}). ", @@ -836,6 +840,7 @@ sub add_one_uploaded { print "$name: not registered yet.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; if ($pkg->{'state'} eq "Uploaded" && pkg_version_eq($pkg,$version)) { @@ -885,6 +890,7 @@ sub add_one_failed { print "$name: not registered yet.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; $state = $pkg->{'state'}; if ($state eq "Not-For-Us") { @@ -973,6 +979,7 @@ sub add_one_notforus { my $name = shift; my $version = shift; my $pkg = get_source_info($name); + $pkg->{'version'} =~ s/\+b[0-9]+$//; if ($pkg->{'state'} eq 'Not-For-Us') { # reset Not-For-Us state in case it's called twice; this is @@ -1029,6 +1036,7 @@ sub add_one_needsbuild { print "$name: not registered; can't give back.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; $state = $pkg->{'state'}; if ($state eq "BD-Uninstallable") { @@ -1106,6 +1114,7 @@ sub set_one_binnmu { print "$name: not registered; can't register for binNMU.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; my $db_ver = $pkg->{'version'}; if (!version_eq($db_ver, $version)) { @@ -1181,6 +1190,7 @@ sub set_one_buildpri { print "$name: not registered; can't set priority.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; $state = $pkg->{'state'}; if ($state eq "Not-For-Us") { @@ -1219,6 +1229,7 @@ sub add_one_depwait { print "$name: not registered yet.\n"; return; } + $pkg->{'version'} =~ s/\+b[0-9]+$//; $state = $pkg->{'state'}; if ($state eq "Dep-Wait") { @@ -2020,6 +2031,7 @@ sub list_packages { my $db = get_all_source_info(state => $state, user => $user, category => $category, list_min_age => $list_min_age); foreach $name (keys %$db) { next if $name =~ /^_/; + $db->{$name}->{'version'} =~ s/\+b[0-9]+$//; push @list, calculate_prio($db->{$name}); } @@ -2433,11 +2445,11 @@ sub wb_edos_builddebcheck { my $sourceprefix="source---"; my $architecture=$args->{'arch'}; my $edosoptions = "-failures -explain -quiet"; - my @packagefiles = $args->{'pkgs'}; + my $packagefiles = $args->{'pkgs'}; my $sourcesfile = $args->{'src'}; my $packagearch=""; - foreach my $packagefile (@packagefiles) { + foreach my $packagefile (@$packagefiles) { open(P,$packagefile); while (

) { next unless /^Architecture/; @@ -2466,9 +2478,9 @@ sub wb_edos_builddebcheck { } } - print "calling: edos-debcheck $edosoptions < $sourcesfile ".join('', map {" '-base FILE' ".$_ } @packagefiles)."\n"; + print "calling: edos-debcheck $edosoptions < $sourcesfile ".join('', map {" '-base FILE' ".$_ } @$packagefiles)."\n"; open(RESULT, '-|', - "edos-debcheck $edosoptions < $sourcesfile ".join('', map {" '-base FILE' ".$_ } @packagefiles)); + "edos-debcheck $edosoptions < $sourcesfile ".join('', map {" '-base FILE' ".$_ } @$packagefiles)); my $explanation=""; my $result={}; @@ -2511,6 +2523,7 @@ sub wb_edos_builddebcheck { sub call_edos_depcheck { + return if $simulate_edos; my $args = shift; my $srcs = $args->{'srcs'}; my $key; @@ -2804,6 +2817,7 @@ sub get_all_source_info { sub update_source_info { my $pkg = shift; + print Dumper $pkg if $verbose and $simulate; return if $simulate; my $pkg2 = get_source_info($pkg->{'package'}); @@ -2940,16 +2954,18 @@ sub parse_all_v3() { # does at least one binary exist in the database and is more recent - if so, we're probably just outdated, ignore the source package for my $bin (@{$pkgs->{'binary'}}) { - if ($binary->{$bin} and vercmp($pkgs->{'version'}, $binary->{$bin}) < 0) { + if ($binary->{$bin} and vercmp($pkgs->{'version'}, $binary->{$bin}->{'version'}) < 0) { print "$logstr skipped because binaries (assumed to be) overwritten\n" if $verbose || $simulate; next SRCS; } } $pkg->{'package'} = $name; } - my $logstr = "merge-v3 $vars->{'time'} ".$name."_$pkgs->{'version'} ($vars->{'arch'}, $vars->{'suite'}, previous: $pkg->{'version'}, $pkg->{'state'}):"; + my $logstr = "merge-v3 $vars->{'time'} ".$name."_$pkgs->{'version'}". + " ($vars->{'arch'}, $vars->{'suite'}, previous: $pkg->{'version'}". + ", $pkg->{'state'}):"; - if (isin($pkgs->{'status'}, qw (installed related)) && $pkg->{'binary_nmu_version'} && $pkgs->{'binnmu'} < $pkg->{'binary_nmu_version'}) { + if (isin($pkgs->{'status'}, qw (installed related)) && $pkg->{'binary_nmu_version'} && $pkgs->{'binnmu'} < int($pkg->{'binary_nmu_version'})) { $pkgs->{'status'} = 'out-of-date'; } if (isin($pkgs->{'status'}, qw (installed related))) { @@ -2957,16 +2973,22 @@ sub parse_all_v3() { if ($pkg->{'state'} ne 'Installed') { change_state( \$pkg, 'Installed'); delete $pkg->{'depends'}; + delete $pkg->{'binary_nmu_version'}; + # delete $pkg->{'binary_nmu_changelog'}; - we keep the changelog for now in case there are bugs; activate in August 2010 or later $change++; } - my $attrs = { 'version' => 'version', 'installed_version' => 'version', 'binary_nmu_version' => 'binnmu', 'section' => 'section', 'priority' => 'priority' }; + my $attrs = { 'version' => 'version', 'installed_version' => 'version', 'section' => 'section', 'priority' => 'priority' }; foreach my $k (keys %$attrs) { if ($pkg->{$k} ne $pkgs->{$attrs->{$k}}) { $pkg->{$k} = $pkgs->{$attrs->{$k}}; $change++; } } - if (isin($pkgs->{'status'}, qw (related))) { + if ($pkg->{'binary_nmu_version'}) { # cleanup only + delete $pkg->{'binary_nmu_version'}; + $change++; + } + if (isin($pkgs->{'status'}, qw (related)) and $pkg->{'notes'} ne "related") { $pkg->{'notes'} = "related"; $change++; } @@ -2998,7 +3020,9 @@ sub parse_all_v3() { print "$logstr package in unknown state: $pkgs->{'status'}\n"; next SRCS; } - next if $pkgs->{'version'} eq $pkg->{'version'}; + next if $pkgs->{'version'} eq $pkg->{'version'} and $pkgs->{'binnmu'} >= int($pkg->{'binary_nmu_version'}); + next if $pkgs->{'version'} eq $pkg->{'version'} and !isin( $pkg->{'state'}, qw(Installed)); + next if isin( $pkg->{'state'}, qw(Not-For-Us Failed-Removed)); if (defined( $pkg->{'state'} ) && isin( $pkg->{'state'}, qw(Building Built Build-Attempted))) { send_mail( $pkg->{'builder'}, @@ -3020,8 +3044,8 @@ sub parse_all_v3() { $pkg->{'dep'} = $pkgs->{'depends'}; $pkg->{'conf'} = $pkgs->{'conflicts'}; delete $pkg->{'builder'}; - delete $pkg->{'binary_nmu_version'}; - delete $pkg->{'binary_nmu_changelog'}; + delete $pkg->{'binary_nmu_version'} unless $pkgs->{'binnmu'}; + delete $pkg->{'binary_nmu_changelog'} unless $pkgs->{'binnmu'}; log_ta( $pkg, "--merge-v3: needs-build" ) unless $simulate; update_source_info($pkg) unless $simulate; print "$logstr set to needs-builds\n" if $simulate || $verbose;