diff options
-rwxr-xr-x | rpmbuildupdate | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/rpmbuildupdate b/rpmbuildupdate index 86312b1..ac7f7fd 100755 --- a/rpmbuildupdate +++ b/rpmbuildupdate @@ -269,21 +269,25 @@ sub build { $spec .= $_; - if (/^Source[0-9]*:\s+(\S+)/i) { + + # For %vars ! + $specvars{$1} = $2 if /\%define\s+(\S+?)\s+(\S+)/g; + foreach my $i ('url', 'name', 'version', 'release', 'epoch') { + $specvars{$i} = $1 if !$specvars{$i} && /\b$i\s*:\s+(\S+)/gi; + } + + if (/^Source[0-9]*:\s+(\S+)/i) { my $source = $1; - if ($source =~ /(?:ftp|svns?|https?):\/\/\S+/) { + # TODO could it be done cleanly with RPM4::expand ? + $source =~ s/\%url/$specvars{'url'}/; + $source =~ s/\%{url}/$specvars{'url'}/; + if ($source =~ /(?:ftp|svns?|https?):\/\/\S+/) { push(@url, $source); } else { $tar_ball= $source unless $tar_ball; }; } - - # For %vars ! - $specvars{$1} = $2 if /\%define\s+(\S+?)\s+(\S+)/g; - foreach my $i ('url', 'name', 'version', 'release', 'epoch') { - $specvars{$i} = $1 if !$specvars{$i} && /\b$i\s*:\s+(\S+)/gi; - } - + if (/^\%changelog/) { $message =~ s/\%\%VERSION/$newversion/; my @l = getpwuid($<); |