On 12/01/16 10:18 PM, Andrew Toskin wrote:
> I'm new to RPM packaging. I've recently forked a repository, and one of the 
> first things I tried to do was clean up formatting of the .spec file. 
> Particularly the %if blocks were hard to follow because the previous author 
> did not use any indentation at all. However, it seems like maybe indentation 
> breaks tags. %if blocks that only contained other %macros inside seem to work 
> okay, but if I have any leading whitespace on the lines for tags such as 
> `Source1:` I get errors like this...
>
>> error: line 102: Unknown tag: Source1: firefox-45.0a2.tar.bz2
> ...and removing the leading whitespace removes the error.
>
> I'm having a hard time finding anything that explicitly says whether or not 
> leading whitespace is allowed in the spec file, so I'm hoping that I'm just 
> making some silly and simple mistake. Otherwise, not being able to indent 
> inside %if blocks is going to make working on this spec file more painful 
> than it could / should be.
> --
> devel mailing list
> devel@lists.fedoraproject.org
> http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org
Hello Andrew,
In general, leading whitespace is only allowed when making conditional
statement or using backslash like these following examples:

--- Example #1 ---
%if (0%{?fedora} && 0%{?fedora} < 19) || (0%{?rhel} && 0%{?rhel} < 7)
    --vendor="fedora"                      \
%endif
    --dir=${RPM_BUILD_ROOT}%{_datadir}/applications         \
    %{name}.desktop

--- Example #2 ---
for f in scribus/plugins/scriptplugin/{samples,scripts}/*.py
do
    sed '1{/#!\/usr\/bin\/env\|#!\/usr\/bin\/python/d}' $f > $f.new
    touch -r $f $f.new
    mv $f.new $f
done
----------

Hope it helps.

-- 
Luya Tshimbalanga
Graphic & Web Designer
E: l...@fedoraproject.org
W: http://www.coolest-storm.net
--
devel mailing list
devel@lists.fedoraproject.org
http://lists.fedoraproject.org/admin/lists/devel@lists.fedoraproject.org

Reply via email to