4

I'm trying to build an RPM, but the source file from the vendor has a space in the filename, and there doesn't seem to be any good way to escape the filename so that it builds.

I've tried putting a \ in front of the spaces. I've tried replacing them with %20. I tried +. I've tried putting "s around it, I've tried ' around it.

For now, I'm working around it by renaming the source file from the vendor to not have spaces, but I really prefer to leave original vendor source filenames intact whenever possible.

With no escaping or quoting, I get:

+ unzip .../Foo Bar.zip
unzip:  cannot find or open .../Foo, .../Foo.zip or .../Foo.ZIP.

With \, the unzip works, but then:

error: Bad file: .../Foo\ Bar.zip: No such file or directory

Here is a fully functional test.spec file (I did zip "Foo Bar.zip" test.spec to get a sample zipfile):

Summary: Test
Name: test
Version: 1
Release: 1
License: Whatever
URL: http://www.example.com/
Source1: Foo Bar.zip

%description
Just a test of escaping stuff...

%prep
%build
%install
%{__install} -d -m0755 %{buildroot}/foo
cd %{buildroot}/foo
unzip %SOURCE1

%clean
%{__rm} -rf %{buildroot}

%files
/foo

%changelog
* Wed May 8 2013 Example <example@example.org>
- Whatever
freiheit
  • 14,334
  • 1
  • 46
  • 69

1 Answers1

4

Turns out, that leaving the Source unescaped, and quoting it in the %install does the trick:

Source1: Foo Bar.zip
...
%install
...
unzip "%SOURCE1"
freiheit
  • 14,334
  • 1
  • 46
  • 69