push @args, "--repository $r";
}
- if ( ($clean || $cleanonce ) && ( ! grep $_ == $thread, @cleaned) &&
- $incremental == 0) {
+ if ( ($clean || $cleanonce ) && ( ! grep $_ == $thread, @cleaned) ) {
push @args, "--clean";
if ($cleanonce) {
push(@cleaned, $thread);
}
}
my $scratch = "$scratch_dir.$thread";
-
my $redirect = "";
if ($MAX_THREADS > 1 ) {
$redirect = "> /dev/null 2>&1";
}
- @args_inc = @args;
+
+ push @args, "--root $scratch";
+ push @args, "--clean" if (-e "$scratch/not-ready");
+ push @args, $redirect;
+
my $cmd = "";
+ my $builddir = "$scratch/home/abuild/rpmbuild/BUILD/$name-$version";
if ($incremental == 1) {
info("doing incremental build");
+ @args_inc = @args;
my $buildcmd = "";
- if ( -d "$scratch_dir.incremental/home/abuild/rpmbuild/BUILD/$name-$version" ) {
- $scratch = "$scratch_dir.incremental";
- } elsif ( ! -d "$scratch/home/abuild/rpmbuild/BUILD/$name-$version" ){
- debug("Build directory exists");
- $scratch = "$scratch_dir.incremental";
- push @args, "--stage=\"-bp\"";
- push @args, "--root $scratch";
- push @args, "--clean";
- push @args, $redirect;
- $cmd = join(" ", @args);
+ if ( ! -d "$builddir" || grep($_ eq "--clean", @args_inc)){
+ debug("Build directory does not exist");
+ push @args_inc, "--stage=\"-bp\"";
+ push @args_inc, "--clean" if (! grep($_ eq "--clean", @args_inc));
+ $cmd = join(" ", @args_inc);
return -1 if (my_system($cmd) != 0);
} else {
- info("build directory does not exist");
+ debug("build directory exists");
}
my $project_base_path = $to_build{$name}->{project_base_path};
- my $mount = "sudo mount -o bind $project_base_path $scratch/home/abuild/rpmbuild/BUILD/$name-$version";
+ if (! -e "$builddir") {
+ my_system("sudo mkdir -p $builddir");
+ }
+ my $mount = "sudo mount -o bind $project_base_path $builddir";
my_system($mount);
if ($run_configure == 1 ) {
- push @args_inc, "--define '%configure echo'";
- push @args_inc, "--define '%reconfigure echo'";
- push @args_inc, "--define '%autogen echo'";
+ push @args, "--define '%configure echo'";
+ push @args, "--define '%reconfigure echo'";
+ push @args, "--define '%autogen echo'";
}
- push @args_inc, "--stage=\"-bp\"";
- push @args_inc, "--root $scratch";
- push @args_inc, "--no-topdir-cleanup";
- push @args_inc, "--no-init";
- push @args_inc, "--short-circuit --stage=\"-bc\"";
- push @args_inc, $redirect;
- $cmd = join(" ", @args_inc);
- my_system ($cmd);
-
- $mount = "sudo umount $scratch/home/abuild/rpmbuild/BUILD/$name-$version";
- my_system($mount);
- info("finished incremental building $name");
- info("building log can be found here: $scratch/.build.log");
- $packages_built = 1;
- return 0;
+ push @args, "--root $scratch";
+ push @args, "--no-topdir-cleanup";
+ push @args, "--no-init";
+ @args = grep { $_ ne "--clean"} @args;
+ push @args, "--short-circuit --stage=\"-bs\"";
}
- push @args, "--root $scratch";
- push @args, "--clean" if (-e "$scratch/not-ready");
- push @args, $redirect;
-
$cmd = join(" ", @args);
debug($cmd);
- if (my_system ($cmd) == 0 ) {
+ my $ret = my_system ($cmd);
+ my_system("sudo umount $builddir") if ($incremental == 1);
+ if ($ret == 0) {
if (bsd_glob "$scratch/home/abuild/rpmbuild/SRPMS/*.rpm") {
my_system ("cp $scratch/home/abuild/rpmbuild/SRPMS/*.rpm $localrepo/$dist/src/SRPMS");
}