Re: rpm spec file prevent macros from expanding

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/19/2016 12:41 PM, Domen Vrankar wrote:
> 2016-07-19 0:42 GMT+02:00 Orion Poplawski <orion@xxxxxxxxxxxxx>:
>> On 07/18/2016 03:27 PM, Domen Vrankar wrote:
>>> Hi,
>>>
>>> I'm trying to prevent a macro in spec file from expanding and I've
>>> read that rewriting %{dist} (and probably %{?dist}) to %%{dist} in
>>> comments would do the trick.
>>>
>>> I was surprised that it doesn't seem to work outside comments so my
>>> question is if there is a different way of preventing certain defined
>>> macros from expanding?
>>> (not all of the instances of that macro but only one instance that I'd
>>> wish to treat as normal text and not as a macro)
>>>
>>> Thanks,
>>> Domen
>>> _______________________________________________
>>> Rpm-list mailing list
>>> Rpm-list@xxxxxxxxxxxxx
>>> http://lists.rpm.org/mailman/listinfo/rpm-list
>>>
>>
>> Works for me:
>>
>> %prep
>> echo %%{dist}
>>
>> Executing(%prep): /bin/sh -e /tmp/rpm/rpm-tmp.dxASqM
>> + umask 022
>> + cd /export/home/orion/redhat/test-0.1
>> + echo '%{dist}'
>> %{dist}
>>
>>
>> --
>> Orion Poplawski
>> Technical Manager                     303-415-9701 x222
>> NWRA, Boulder/CoRA Office             FAX: 303-415-9702
>> 3380 Mitchell Lane                       orion@xxxxxxxx
>> Boulder, CO 80301                   http://www.nwra.com
>> _______________________________________________
>> Rpm-list mailing list
>> Rpm-list@xxxxxxxxxxxxx
>> http://lists.rpm.org/mailman/listinfo/rpm-list
> 
> You're right... It seems to work on different locations in spec file
> except when it is part of %files section.
> 
> Is there a way to suppress the expansion in file/directory names?
> Also is there a way to escape other special characters such as * or
> %%% in file/directory names?
> 
> I know that it's a bad idea to use such characters in names in the
> first place but I'm still curious if this is possible.

Ah, interesting.  One hack that seems to work:

%undefine dist
%files
/%{dist}

You can also generally use * and ? to match the strange characters in the
filenames, e.g.:

%files
/*dist?

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion@xxxxxxxx
Boulder, CO 80301                   http://www.nwra.com
_______________________________________________
Rpm-list mailing list
Rpm-list@xxxxxxxxxxxxx
http://lists.rpm.org/mailman/listinfo/rpm-list



[Index of Archives]     [RPM Ecosystem]     [Linux Kernel]     [Red Hat Install]     [PAM]     [Red Hat Watch]     [Red Hat Development]     [Red Hat]     [Gimp]     [Yosemite News]     [IETF Discussion]

  Powered by Linux