From 2a557e54ad837f62357b3ba2e075cb03cdce3c3f Mon Sep 17 00:00:00 2001 From: Yigang Wen Date: Tue, 4 Mar 2014 17:47:09 +0800 Subject: [PATCH] Fix gbs build fails if packaging/ is a symlink judge whether packaging dir is a symbolic link when search spec file with git show commit:packaging_dir Change-Id: I4f43271543fc22ed01f411d61b813c2b7cd56c9d Signed-off-by: Yigang Wen --- depanneur | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/depanneur b/depanneur index 928493d..6a603b1 100755 --- a/depanneur +++ b/depanneur @@ -499,12 +499,27 @@ sub fill_packs_from_git { my (undef, $tmp_file) = tempfile(CLEANUP=>1, OPEN => 0); if (my_system("cd $base; git show $commit:$packaging_dir >$tmp_file 2>/dev/null") == 0) { open my $file, '<', $tmp_file or die $!; - while (<$file>) { - chomp; - next if $_ !~ /\.spec$/; - next if $arg_spec ne "" && $_ ne $arg_spec; - push(@pre_packs, {filename => "$base/$packaging_dir/$_", - project_base_path => $base}); + my $first_line = <$file>; + if ($first_line =~ /^tree/) { + while (<$file>) { + chomp; + next if $_ !~ /\.spec$/; + next if $arg_spec ne "" && $_ ne $arg_spec; + push(@pre_packs, {filename => "$base/$packaging_dir/$_", + project_base_path => $base}); + } + } else { #packaging_dir is a symbol link + my (undef, $tmp_symlink_file) = tempfile(CLEANUP=>1, OPEN => 0); + if (my_system("cd $base; git show $commit:$first_line >$tmp_symlink_file 2>/dev/null") == 0) { + open my $symlink_file, '<', $tmp_symlink_file or die $!; + while (<$symlink_file>) { + chomp; + next if $_ !~ /\.spec$/; + next if $arg_spec ne "" && $_ ne $arg_spec; + push(@pre_packs, {filename => "$base/$first_line/$_", + project_base_path => $base}); + } + } } } } else { @@ -513,7 +528,7 @@ sub fill_packs_from_git { my @spec_list = glob($pattern); foreach my $spec (@spec_list) { push(@pre_packs, {filename => "$spec", - project_base_path => $base}); + project_base_path => $base}); } } } -- 2.34.1