fix a bug when spec file not exist
authorYigang Wen <yigangx.wen@intel.com>
Thu, 7 Mar 2013 05:26:47 +0000 (13:26 +0800)
committerYigang Wen <yigangx.wen@intel.com>
Tue, 26 Mar 2013 01:08:39 +0000 (09:08 +0800)
check spec file before push into @packs

Change-Id: I311208145252939b5e90916f43ae2ba8a7dd82b1

depanneur

index fd0eb631fce0882eb5750a86bbdd4cc66313e11c..182135051407f0c5241664f83ff0d094ba7a9a6d 100755 (executable)
--- a/depanneur
+++ b/depanneur
@@ -606,7 +606,7 @@ sub prepare_git {
         $current_rev = query_git_commit_rev($base, $commit);
 
         my $cached_rev = read_cache($cache_key);
-        $skip = ($cached_rev eq $current_rev);
+        $skip = ($cached_rev eq $current_rev) && (-e "$pkg_path/$cache_key/$spec_file");
     }
 
     if (!$skip || $includeall == 1) {
@@ -619,10 +619,15 @@ sub prepare_git {
             return;
         }
     }
-    push(@packs, {
-        filename => "$pkg_path/$cache_key/$spec_file",
-        project_base_path => $base,
-    });
+    if ( -e "$pkg_path/$cache_key/$spec_file" ){
+        push(@packs, {
+            filename => "$pkg_path/$cache_key/$spec_file",
+            project_base_path => $base,
+        });
+    }else{
+        warning("spec file $spec_file has not been exported to $pkg_path/$cache_key/ correctly,".
+                " please check if there're special macros in Name/Version/Release fields");
+    }
 }
 
 sub parse_packs {