fix packaging dir detect issue
authorZhang Qiang <qiang.z.zhang@intel.com>
Thu, 12 Sep 2013 14:47:59 +0000 (22:47 +0800)
committerZhang Qiang <qiang.z.zhang@intel.com>
Mon, 16 Sep 2013 07:15:53 +0000 (15:15 +0800)
packaging dir can contains multiple level directory, so use packaging_dir
to resolve package git dir is the correct way

Fixes: #1315

Change-Id: I1a0d894102e0e66c2fdff65bbbb1bdd3fe11b3e2

depanneur

index f51c37d..8a498dd 100755 (executable)
--- a/depanneur
+++ b/depanneur
@@ -580,16 +580,15 @@ sub query_git_commit_rev {
 sub prepare_git {
     my $config = shift;
     my $spec = shift;
-
-    my $packaging = dirname($spec);
-    my $base = dirname($packaging);
-
     my $spec_file = basename($spec);
+    my $base = dirname($spec);
+    $base =~ s!\Q$packaging_dir\E!!;
+
     if ($includeall == 0) {
         my $tmp_dir = abs_path(tempdir(CLEANUP=>1));
         my $tmp_spec = "$tmp_dir/$spec_file";
         my $without_base = $spec;
-        $without_base =~ s!\Q$base\E/!!;
+        $without_base ="$packaging_dir/$spec_file";
         if (my_system("cd $base; git show $commit:$without_base >$tmp_spec 2>/dev/null") != 0) {
             warning("failed to checkout spec file from commit: $commit:$without_base");
             return;