$category, %catval, %short_category,
$short_date, $list_min_age, $dbbase, @curr_time,
$build_priority, %new_vers, $binNMUver, %merge_srcvers, %merge_binsrc,
- $lock_for_pid, $transactional);
+ $lock_for_pid, $transactional, $read_only);
# global vars
-$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin";
+$ENV{'PATH'} = "/bin:/usr/bin:/usr/local/bin:/org/wanna-build/bin/";
$verbose = 0;
$mail_logs = "";
@curr_time = gmtime;
$| = 1;
$lock_for_pid = -1; # -1 means normal procedure
$transactional = 0; # 0 means: work on main copy
+$read_only = 0; # 1 means: do not set or check lock, do never write
# map program invocation names to operation modes
my %prognames = ( "uploaded-build" => "set-uploaded",
"start-transaction" => { mode => "start-transaction" },
"commit-transaction" => { mode => "commit-transaction" },
"transactional" => { flag => \$transactional },
+ "read-only" => { flag => \$read_only },
"manual-edit" => { mode => "manual-edit" },
"create-maintenance-lock" => { mode => "maintlock-create" },
"remove-maintenance-lock" => { mode => "maintlock-remove" },
print "wanna-build $version for $distribution on $conf::dbbase\n";
}
+if ($read_only && !isin( $op_mode, qw(list export info))) {
+ warn "Invalid operation with --read-only. You can only use --list, --export or --info.\n";
+ exit 1;
+}
+
if (!@ARGV && !isin( $op_mode, qw(list merge-quinn merge-partial-quinn import export
merge-packages manual-edit maintlock-create lock-for unlock-for
start-transaction commit-transaction
exit 0;
}
-lock_db( $distribution );
+if (!$read_only) {
+ lock_db( $distribution );
+}
if ($op_mode eq "start-transaction") {
copy ( db_filename_master( $distribution ), db_filename_transaction( $distribution ))
}
END {
- untie %db;
- if ($lock_for_pid == -1) {
- unlock_db( $distribution );
- }
- foreach (keys %conf::distributions) {
- untie %{$otherdb{$_}} if tied(%{$otherdb{$_}});
- unlock_db( $_ ) if $otherdb_lock{$_};
+ if (!$read_only) {
+ untie %db;
+ if ($lock_for_pid == -1) {
+ unlock_db( $distribution );
+ }
+ foreach (keys %conf::distributions) {
+ untie %{$otherdb{$_}} if tied(%{$otherdb{$_}});
+ unlock_db( $_ ) if $otherdb_lock{$_};
+ }
}
}
-tie %db, 'MLDBM', db_filename( $distribution ), GDBM_WRCREAT, 0664
+tie %db, 'MLDBM', db_filename( $distribution ), $read_only ? GDBM_READER : GDBM_WRCREAT, 0664
or die "FATAL: Cannot open database\n";
process();
@ARGV = ( $ARGS[1] );
parse_quinn_diff(0);
@ARGV = ( $ARGS[2] );
- my $build_deps = parse_sources(1);
- call_edos_depcheck( $ARGS[0], $ARGS[2] );
+ my $srcs = parse_sources(1);
+ call_edos_depcheck( $ARGS[0], $srcs );
clean_db();
last SWITCH;
};
}
$state = $pkg->{'State'};
- if ($state eq "Dep-Wait") {
+ if ($state eq "BD-Uninstallable") {
if ($opt_override) {
- print "$name: Forcing source dependency list to be cleared\n";
+ 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" );
+ $db{$name} = $pkg;
+ print "$name: given back\n" if $verbose;
+ return;
}
else {
- print "$name: waiting for source dependencies. Skipping\n",
+ print "$name: has uninstallable build-dependencies. Skipping\n",
" (use --override to clear dependency list and ",
"give back anyway)\n";
return;
}
}
- if ($state eq "BD-Uninstallable") {
+ elsif ($state eq "Dep-Wait") {
if ($opt_override) {
- print "$name: Forcing uninstallability mark to be removed\n";
+ print "$name: Forcing source dependency list to be cleared\n";
}
else {
- print "$name: has uninstallable build-dependencies. Skipping\n",
+ print "$name: waiting for source dependencies. Skipping\n",
" (use --override to clear dependency list and ",
"give back anyway)\n";
return;
"Skipping.\n";
return;
}
- change_state( \$pkg, 'Needs-Build' );
+ if ($distribution eq "unstable") {
+ change_state( \$pkg, 'BD-Uninstallable' );
+ $pkg->{'BD-Problem'} = "Installability of build dependencies not tested yet";
+ } else {
+ change_state( \$pkg, 'Needs-Build' );
+ }
delete $pkg->{'Builder'};
delete $pkg->{'Depends'};
log_ta( $pkg, "--give-back" );
return;
}
- change_state( \$pkg, 'Needs-Build' );
+ change_state( \$pkg, 'BD-Uninstallable' );
+ $pkg->{'BD-Problem'} = "Installability of build dependencies not tested yet";
delete $pkg->{'Builder'};
delete $pkg->{'Depends'};
$pkg->{'Binary-NMU-Version'} = $binNMUver;
$pkgs{$name}{'ver'} = $version;
$pkgs{$name}{'bin'} = $binaries;
+ $pkgs{$name}{'dep'} = $builddep;
+ $pkgs{$name}{'conf'} = $buildconf;
my $pkg = $db{$name};
if (defined $pkg) {
$pkg->{'Section'} = $section, $change++
if defined $section and (not defined($pkg->{'Section'}) or $pkg->{'Section'} ne $section);
- # Store Build-Deps and Build-Conflicts for edos-debcheck later
- $pkg->{'Build-Depends'} = $builddep, $change++
- if ($pkg->{'Build-Depends'} ne $builddep);
- $pkg->{'Build-Conflicts'} = $builddep, $change++
- if ($pkg->{'Build-Conflicts'} ne $buildconf);
+ # Remove field from previous wanna-build versions
+ for (qw/Reason Build-Depends Build-Conflicts/) {
+ if (exists $pkg->{$_}) {
+ delete $pkg->{$_};
+ $change++;
+ }
+ }
$db{$name} = $pkg if $change;
}
if $pkg->{'State'} =~ /^Failed/;
print " Dependencies: $pkg->{'Depends'}\n"
if $pkg->{'State'} eq "Dep-Wait";
- print " Reason: $pkg->{'Reason'}\n"
+ print " Reasons for BD-Uninstallable:\n ",
+ join("\n ",split("\n",$pkg->{'BD-Problem'})), "\n"
if $pkg->{'State'} eq "BD-Uninstallable";
print " Previous state was $pkg->{'Previous-State'} until ",
"$pkg->{'State-Change'}\n"
if $verbose && $pkg->{'Previous-State'};
+ print " No previous state recorded\n"
+ if $verbose && !$pkg->{'Previous-State'};
print " Previous failing reasons:\n ",
join("\n ",split("\n",$pkg->{'Old-Failed'})), "\n"
if $verbose && $pkg->{'Old-Failed'};
unlink( $lockfile );
return;
}
- warn "Databases locked for general maintenance by $usr -- ".
+ warn "Databases in $conf::dbbase locked for general maintenance by $usr -- ".
"please wait\n" if $try == 0;
}
if (++$try > 120) {
my $val = $ui->{$key};
$val =~ s/\n*$//;
$val =~ s/^/ /mg;
- $val =~ s/^ $/ ./mg;
+ $val =~ s/^ +$/ ./mg;
print F "$key: $val\n";
}
print F "\n";
my $val = $pkg->{$key};
$val =~ s/\n*$//;
$val =~ s/^/ /mg;
- $val =~ s/^ $/ ./mg;
+ $val =~ s/^ +$/ ./mg;
print F "$key: $val\n";
}
print F "\n";
delete $pkg->{'Failed-Category'};
}
if (defined($$state) and $$state eq 'BD-Uninstallable') {
- delete $pkg->{'Reason'};
+ delete $pkg->{'BD-Problem'};
}
$$state = $newstate;
}
sub call_edos_depcheck {
my $packagesfile = shift;
- my $sourcesfile = shift;
+ my $srcs = shift;
my $key;
return if defined ($conf::distributions{$distribution}{noadw});
my $pkg = $db{$key};
print SOURCES "Package: $key\n";
print SOURCES "Version: $pkg->{'Version'}\n";
- print SOURCES "Build-Depends: $pkg->{'Build-Depends'}\n" if $pkg->{'Build-Depends'};
- print SOURCES "Build-Conflicts: $pkg->{'Build-Conflicts'}\n" if $pkg->{'Build-Conflicts'};
+ print SOURCES "Build-Depends: $srcs->{$key}{'dep'}\n" if $srcs->{$key}{'dep'};
+ print SOURCES "Build-Conflicts: $srcs->{$key}{'conf'}\n" if $srcs->{$key}{'conf'};
print SOURCES "Architecture: all\n";
print SOURCES "\n";
}
my $change =
(defined $interesting_packages{$key} and $pkg->{'State'} eq 'Needs-Build') ||
(not defined $interesting_packages{$key} and $pkg->{'State'} eq 'BD-Uninstallable');
+ my $problemchange = $interesting_packages{$key} ne $pkg->{'BD-Problem'};
if ($change) {
if (defined $interesting_packages{$key}) {
change_state( \$pkg, 'BD-Uninstallable' );
- $pkg->{'Reason'} = $interesting_packages{$key};
+ $pkg->{'BD-Problem'} = $interesting_packages{$key};
} else {
change_state( \$pkg, 'Needs-Build' );
}
+ }
+ if ($problemchange) {
+ if (defined $interesting_packages{$key}) {
+ $pkg->{'BD-Problem'} = $interesting_packages{$key};
+ }
+ }
+ if ($change) {
log_ta( $pkg, "--merge-all" );
- $db{$key} = $pkg;
print "edos-builddebchange changed state of ${key}_$pkg->{'Version'} to $pkg->{'State'}\n" if $verbose;
}
+ if ($change || $problemchange) {
+ $db{$key} = $pkg;
+ }
}
}
a new version number (source-version + "+b<num>")
--give-back: Mark a package as ready to build that is in state Building,
Built or Build-Attempted. To give back a package in state Failed, use
- --override
+ --override. This command will actually put the package in state
+ BD-Uninstallable, until the installability of its Build-Dependencies
+ were verified. This happens at each call of --merge-all, usually
+ every 15 minutes.
--merge-quinn: Merge quinn-diff output into database.
--merge-packages: Merge Packages files into database.
--pretend-avail: Pretend that given packages are available now and give
--export FILE: Export database to a ASCII file FILE
--lock-for PID: Locks the database for the process with this pid
--unlock-for PID: Unlocks the database for the process with this pid
- --act-on-behalf-of PID: Ignores the log (if it is held by this pid)
+ --act-on-behalf-of PID: Ignores the lock (if it is held by this pid)
--start-transaction: Creates a copy of the state of the database, for
use with --transactional. This overrides any previous uncommited
transaction. Should only be used after --lock-for