Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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
share|improve this question
    
Yes, this is software that I'm just unzipping into a directory, with no real build process. –  freiheit May 8 '13 at 21:11
add comment

1 Answer

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

Source1: Foo Bar.zip
...
%install
...
unzip "%SOURCE1"
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.