Bug 712061

Summary: RPM cannot handle some constructs
Product: Red Hat Enterprise Linux 6 Reporter: Vít Ondruch <vondruch>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED NOTABUG QA Contact: Red Hat Satellite QA List <satqe-list>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 6.2   
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-06-09 12:29:45 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Vít Ondruch 2011-06-09 11:55:48 UTC
Description of problem:
RPM cannot handle the following construct

%{?condition:bash -c " \}
some command \
  with plenty of options \
%{?condition:"}

The idea is to wrap some command by external command, only when condition is valid. When building, everything is ignored since begin of the construct till begin of the next section

Comment 2 Panu Matilainen 2011-06-09 12:29:45 UTC
You need to double-escape the backslash inside macros as \ is a line-continuation
marker for the macro body itself. This works:

%{?condition:bash -c " \\}
some command \
  with plenty of options \
%{?condition:"}

Comment 3 Vít Ondruch 2011-06-10 09:43:30 UTC
But again, then there is bug. The following is the content of the script. Why is there double backslash?

bash -c " \\
some command \
  with plenty of options \
"