my $extra_packs = "";
my $ccache = 0;
-my @tobuild = ();
my @tofind = ();
-my @final = ();
my %to_build = ();
my %pkgdeps = ();
my @running :shared = ();
return $path;
}
+if ($incremental == 1 && $style ne 'git') {
+ error("incremental build only support git style packages");
+}
+
my @package_repos = ();
my $Config;
if (-e $config_filename) {
sub fill_packs_from_obs {
my $name = shift;
+ # exclude spec file that in .osc subdirs
$name =~ m/\.osc/ || push(@packs, $name);
}
sub query_git_commit_rev {
my ($base, $commit_id) = @_;
- open(my $git, '-|', "git --git-dir $base/.git rev-parse $commit_id") ||
+ open(my $git, '-|', "git --git-dir $base/.git rev-parse $commit_id") ||
die "query git commit reversion($commit_id) failed: $!";
my $rev = readline($git);
close($git);
return;
}
}
- push(@packs, "$pkg_path/$cache_key/$spec_file");
+ push(@packs, {
+ filename => "$pkg_path/$cache_key/$spec_file",
+ project_base_path => $base,
+ });
}
sub parse_packs {
my ($config, @packs) = @_;
my %packs = ();
- foreach my $spec (@packs) {
+ foreach my $spec_ref (@packs) {
+ my $spec;
+ my $base;
+ if (ref($spec_ref) eq "HASH") {
+ # project_base_path set in sub prepare_git()
+ $spec = $spec_ref->{filename};
+ $base = $spec_ref->{project_base_path};
+ } else {
+ $spec = $spec_ref;
+ }
my $pack = Build::Rpm::parse($config, $spec);
if ( ( $pack->{'exclarch'} ) && ( ! grep $_ eq $archs[0], @{$pack->{'exclarch'}} ) ) {
debug("arch not compatible");
release => $release,
deps => @buildrequires,
subpacks => @subpacks,
- filename => $spec
+ filename => $spec,
+ };
+ if ($base) {
+ $packs{$name}{project_base_path} = $base;
}
}
return %packs;
} else {
info("build directory does not exist");
}
- my $mount = "sudo mount -o bind $package_path $scratch/home/abuild/rpmbuild/BUILD/$name-$version";
+ 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";
my_system($mount);
if ($run_configure == 1 ) {
push @args_inc, "--define '%configure echo'";
chomp(@bins);
close($file);
my @alldeps = ();
+ my @tobuild = ();
foreach my $b (@bins) {
next if $b eq "";
my $found = 0;
print " $p, ";
}
print "\n";
+ my @final;
foreach my $name (@tobuild) {
my $fn = $packs{$name}->{filename};
- push(@final, $fn);
+ if (exists $packs{$name}{project_base_path}) {
+ push(@final, {
+ filename => $fn,
+ project_base_path => $packs{$name}{project_base_path},
+ });
+ } else {
+ push(@final, $fn);
+ }
}
%to_build = parse_packs($config, @final);
} elsif ( $binarylist ne "") {
%to_build = %packs
}
-if ($incremental == 1 && ! -d "$package_path/.git") {
- # if $package_path/.git exists, one package found for building
+if ($incremental == 1 && scalar(keys %to_build) > 1) {
error("incremental build only support building one package");
}