consider local RPMs generated using local source code
authorZhang Qiang <qiang.z.zhang@intel.com>
Sat, 15 Sep 2012 13:32:04 +0000 (21:32 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Sat, 15 Sep 2012 13:49:57 +0000 (21:49 +0800)
generate RPM order data for local RPMs of local source packages,
which would be merged with order data generate from repos configed
from repos.

Change-Id: I73799d558a2cdf3c6c3ed1657eacf2dc032b98ef

depanneur

index 73fa3c5510eda4d4574c3381b84be93d035db0ef..e1201ba322a9cc9abec65af17904977b74a8d687 100755 (executable)
--- a/depanneur
+++ b/depanneur
@@ -800,6 +800,7 @@ sub build_package {
     } else {
         push @args, "--root $scratch";
         push @args, "--clean" if (-e "$scratch/not-ready");
+        push @args, $redirect;
     }
     
     $cmd = join(" ", @args);
@@ -882,20 +883,23 @@ foreach my $sp (@original_specs) {
 
 info("Retrieving repo metadata...");
 my $repos_setup = 1;
-
-system("> $order_dir/.repo.cache");
+system("> $order_dir/.repo.cache.local");
+if (-d "$localrepo/$dist/$arch/RPMS") {
+    system("$build_dir/createrpmdeps $localrepo/$dist/$arch/RPMS >> $order_dir/.repo.cache.local");
+    system("echo D: >> $order_dir/.repo.cache.local");
+}
+system("> $order_dir/.repo.cache.remote");
 foreach my $repo (@package_repos) {
-    my $cmd = "$build_dir/createrepomddeps --cachedir=$cache_dir $repo >> $order_dir/.repo.cache ";
+    my $cmd = "$build_dir/createrepomddeps --cachedir=$cache_dir $repo >> $order_dir/.repo.cache.remote ";
     debug($cmd);
     if ( system($cmd) == 0 ) {
-        system("echo D: >> $order_dir/.repo.cache");
+        system("echo D: >> $order_dir/.repo.cache.remote");
     } else {
         $repos_setup = 0;
     }
 }
-
-# Save .repo.cache as remote repo cache
-system("cp $order_dir/.repo.cache $order_dir/.repo.cache.remote");
+# Merge local repo cache and remote repo cache
+system("cat $order_dir/.repo.cache.local $order_dir/.repo.cache.remote >$order_dir/.repo.cache");
 
 if ($repos_setup == 0 ) {
     error("repo cache creation failed...");