Skip to content

Commit

Permalink
Switch from %setup -q to %autosetup
Browse files Browse the repository at this point in the history
  • Loading branch information
dcermak committed Nov 13, 2020
1 parent f39a11a commit cfef5a2
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions cpanspec
Original file line number Diff line number Diff line change
Expand Up @@ -1472,18 +1472,35 @@ END
$description
\%prep
\%setup -q@{[($noprefix ? "" : " -n $buildpath")]}
END

my $all_patch_args_same = 1;
my $common_patch_args = undef;
if ($config->{patches}) {
for my $p (sort keys %{$config->{patches}}) {
my $args = $config->{patches}->{$p} || undef;
if (!defined($common_patch_args) && defined($args)) {
$common_patch_args = $args;
}
$all_patch_args_same = ($args // '') eq ($common_patch_args // '');
last if !$all_patch_args_same;
}
}

my $autosetup_arg = (!$config->{patches} || $all_patch_args_same) ? (defined($common_patch_args) ? " $common_patch_args" : "") : " -N";
print $spec <<END;
\%autosetup @{[($noprefix ? "" : " -n $buildpath")]}$autosetup_arg
END

if ($execs) {
print $spec qq{find . -type f ! -path "*/t/*" ! -name "*.pl" ! -path "*/bin/*" ! -path "*/script/*" ! -name "configure" -print0 | xargs -0 chmod 644\n};
}

if ($config->{patches}) {
if ($config->{patches} && !$all_patch_args_same) {
my $counter = 0;
for my $p (sort keys %{$config->{patches}}) {
my $args = $config->{patches}->{$p} || '';
print $spec "%patch$counter $args\n";
my $args = $config->{patches}->{$p} || undef;
print $spec defined($args) ? "%patch$counter $args\n" : "%patch$counter\n";
$counter++;
}
}
Expand Down

0 comments on commit cfef5a2

Please sign in to comment.