my $dryrun = 0;
my $help = 0;
my $keepgoing = 0;
+my $clean_repos = 0;
my $virtualenv = "$ENV{'VIRTUAL_ENV'}";
my $build_root = $ENV{TIZEN_BUILD_ROOT};
"keep-packs" => \$keep_packs,
"define=s" => \@defines,
"spec=s" => \$arg_spec,
+ "clean-repos" => \$clean_repos,
);
if ( $help ) {
my $pkg_path = "$build_root/local/sources/$dist";
my $cache_path = "$build_root/local/sources/$dist/cache";
+my $success_logs_path = "$localrepo/$dist/$arch/logs/success";
+my $fail_logs_path = "$localrepo/$dist/$arch/logs/fail";
my $rpm_repo_path = "$localrepo/$dist/$arch/RPMS";
my $srpm_repo_path = "$localrepo/$dist/$arch/SRPMS";
mkdir_p($order_dir);
-mkdir_p "$localrepo/$dist/$arch/logs/success";
-mkdir_p "$localrepo/$dist/$arch/logs/fail";
+mkdir_p($success_logs_path);
+mkdir_p($fail_logs_path);
mkdir_p($cache_path);
mkdir_p($rpm_repo_path);
mkdir_p($srpm_repo_path);
if (bsd_glob "$scratch/home/abuild/rpmbuild/RPMS/*/*.rpm") {
my_system ("cp $scratch/home/abuild/rpmbuild/RPMS/*/*.rpm $rpm_repo_path");
}
- mkdir_p "$localrepo/$dist/$arch/logs/success/$name-$version-$release";
+ mkdir_p "$success_logs_path/$name-$version-$release";
if (-e "$scratch/.build.log") {
- my_system ("cp $scratch/.build.log $localrepo/$dist/$arch/logs/success/$name-$version-$release/log");
+ my_system ("cp $scratch/.build.log $success_logs_path/$name-$version-$release/log");
my_system ("sudo rm -f $scratch/.build.log ");
}
# Detach and terminate
$packages_built = 1;
return 0;
} else {
- mkdir_p "$localrepo/$dist/$arch/logs/fail/$name-$version-$release";
+ mkdir_p "$fail_logs_path/$name-$version-$release";
if ( -f "$scratch/.build.log" ) {
- my_system ("cp $scratch/.build.log $localrepo/$dist/$arch/logs/fail/$name-$version-$release/log");
+ my_system ("cp $scratch/.build.log $fail_logs_path/$name-$version-$release/log");
my_system ("sudo rm -f $scratch/.build.log");
- warning("build failed, Leaving the logs in $localrepo/$dist/$arch/logs/fail/$name-$version-$release/log");
+ warning("build failed, Leaving the logs in $fail_logs_path/$name-$version-$release/log");
}
return 1;
}
}
error("no spec files to build.\n") if (@packs == 0);
+if ($clean_repos && -e "$localrepo/$dist/$arch") {
+ info("cleaning up local repo: $rpm_repo_path ...");
+ my_system("rm -rf $rpm_repo_path/*");
+ my_system("rm -rf $srpm_repo_path/*");
+ my_system("rm -rf $success_logs_path/*");
+ my_system("rm -rf $fail_logs_path/*");
+ info("updating local repo ...");
+ createrepo ($arch, $dist);
+}
+
info("retrieving repo metadata...");
my $repos_setup = 1;
my_system("> $order_dir/.repo.cache.local");