1
0

- fix empty line handling (multiple subsequent empty lines)

OBS-URL: https://build.opensuse.org/package/show/openSUSE:Tools/obs-service-format_spec_file?expand=0&rev=15
This commit is contained in:
Ruediger Oertel 2011-07-04 09:43:18 +00:00 committed by Git OBS Bridge
parent 70dfe6b7cc
commit 4afcf72f3d
3 changed files with 14 additions and 2 deletions

View File

@ -1,3 +1,8 @@
-------------------------------------------------------------------
Mon Jul 4 11:42:26 CEST 2011 - ro@suse.de
- fix empty line handling (multiple subsequent empty lines)
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Jul 4 00:16:05 CEST 2011 - ro@suse.de Mon Jul 4 00:16:05 CEST 2011 - ro@suse.de

View File

@ -30,6 +30,7 @@ Requires: osc-source_validator
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildArch: noarch BuildArch: noarch
%description %description
This is a source service for openSUSE Build Service. This is a source service for openSUSE Build Service.
@ -43,17 +44,22 @@ spec file instead of creating a new one.
%setup -q -D -T 0 -n . %setup -q -D -T 0 -n .
%build %build
%install %install
mkdir -p $RPM_BUILD_ROOT/usr/lib/obs/service/format_spec_file.files mkdir -p $RPM_BUILD_ROOT/usr/lib/obs/service/format_spec_file.files
install -m 0755 %{SOURCE0} $RPM_BUILD_ROOT/usr/lib/obs/service install -m 0755 %{SOURCE0} $RPM_BUILD_ROOT/usr/lib/obs/service
install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/obs/service install -m 0644 %{SOURCE1} $RPM_BUILD_ROOT/usr/lib/obs/service
install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT/usr/lib/obs/service/format_spec_file.files install -m 0755 %{SOURCE2} $RPM_BUILD_ROOT/usr/lib/obs/service/format_spec_file.files
%files %files
%defattr(-,root,root) %defattr(-,root,root)
%dir /usr/lib/obs %dir /usr/lib/obs
/usr/lib/obs/service /usr/lib/obs/service
%changelog %changelog

View File

@ -95,7 +95,7 @@ sub capitalize_case($)
sub maybe_add_empty_line() sub maybe_add_empty_line()
{ {
push @oldspec, "" push @oldspec, "XXXBLANKLINE"
if ($current_section ne "description" && $oldspec[-1] !~ /^\s*$/); if ($current_section ne "description" && $oldspec[-1] !~ /^\s*$/);
} }
@ -284,6 +284,7 @@ sub read_and_parse_old_spec {
$args[1] =~ s/^\!//; $args[1] =~ s/^\!//;
$if_not = 1; $if_not = 1;
} }
$args[2] = "" unless $args[2];
if ( ($args[1] eq "0") if ( ($args[1] eq "0")
|| ($args[1] eq "%name" && $args[2] eq "!=" && $args[3] eq $base_package) || ($args[1] eq "%name" && $args[2] eq "!=" && $args[3] eq $base_package)
|| ($args[1] eq "%name" && $args[2] eq "==" && $args[3] ne $base_package) || ($args[1] eq "%name" && $args[2] eq "==" && $args[3] ne $base_package)
@ -382,7 +383,7 @@ sub read_and_parse_old_spec {
warn "changed to $current_section for $_\n" if $debug; warn "changed to $current_section for $_\n" if $debug;
} }
push @oldspec, $_; push @oldspec, "$_";
# multiline macros need an extra newline with old RPMs # multiline macros need an extra newline with old RPMs
if (/^%(\w[\w\d]+).*[^\\]$/) { if (/^%(\w[\w\d]+).*[^\\]$/) {
push @oldspec, "" if (defined($multiline_macros{$1})); push @oldspec, "" if (defined($multiline_macros{$1}));