some errors found [was:] what is wrong with this conditional scriptlet on rpm.spec

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

 



On Wed, 2021-11-03 at 18:41 +0000, Sérgio Basto wrote:
> On Wed, 2021-11-03 at 14:26 -0400, Ben Beasley wrote:
> > I don’t know where to find documentation for operator precedence in
> > RPM 
> > conditional expressions, but it looks like “!” binds more tightly
> > than 
> > “>=”, so
> > 
> >  > %if ! 0%{?rhel} >= 8
> > 
> > is grouped as
> > 
> >  > %if (! 0%{?rhel}) >= 8
> > 
> > which becomes, on Fedora:
> > 
> >  > %if (! 00) >= 8
> > 
> >  > %if 1 >= 8
> > 
> > and therefore evaluates false.
> > 
> > Writing
> > 
> >  > %if ! (0%{?rhel} >= 8)
> > 
> > seems to do what you want, as would:
> 
> yes is exactly what I'm missing 
> 
> Thank you 
> 
> 
> >  > %if 0%{?rhel} < 8
> > 
> 
> the logic doesn't fail , but it is trick because includes {?fedora}
> 

I mean attention on use of "less then" (<) because is tricky, all
Fedora releases are included by "%if 0%{?rhel} < 8" 

if we only want rhel and rhel < 8 , the correct is  

%if 0%{?rhel} && 0%{?rhel} < 8

and the negation is (all but epel7) 

%if ! (0%{?rhel} && 0%{?rhel} < 8)


I found some specs in Fedora is this kind of errors (two are related
with imageMagick) 

https://sourcegraph.com/search?q=context:global+r:src.fedoraproject.org+file:.*\.spec%24+![^\(]%3F0+[%3E%3C%3D]&patternType=regexp&case=yes
not all 64 results are wrong I only confirmed 9.

https://sourcegraph.com/src.fedoraproject.org/rpms/wsjtx/-/blob/wsjtx.spec?L60
https://sourcegraph.com/src.fedoraproject.org/rpms/wmdocker/-/blob/wmdocker.spec?L17
https://sourcegraph.com/src.fedoraproject.org/rpms/qt5-qtbase/-/blob/qt5-qtbase.spec?L376
https://sourcegraph.com/src.fedoraproject.org/rpms/pstoedit/-/blob/pstoedit.spec?L26
https://sourcegraph.com/src.fedoraproject.org/rpms/ocaml-fileutils/-/blob/ocaml-fileutils.spec?L72
https://sourcegraph.com/src.fedoraproject.org/rpms/mrbs/-/blob/mrbs.spec?L15
https://sourcegraph.com/src.fedoraproject.org/rpms/mrpt/-/blob/mrpt.spec?L59
https://sourcegraph.com/src.fedoraproject.org/rpms/klog/-/blob/klog.spec?L27
https://sourcegraph.com/src.fedoraproject.org/rpms/inkscape/-/blob/inkscape.spec?L43


> > On 11/3/21 14:09, Sérgio Basto wrote:
> > > Hi,
> > > 
> > > I just notice build in mock or koji this scriptlet [1] on a build
> > > for
> > > Fedora gives me "is rhel 8 or 9" , what I'm missing ?
> > > 
> > > 
> > > Thank you
> > > 
> > > [1]
> > > %if ! 0%{?rhel} >= 8
> > > echo "is not rhel >= 8"
> > > %else
> > > echo "is rhel 8 or 9"
> > > %endif
> > > 
> > _______________________________________________
> > devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
> > To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
> > Fedora Code of Conduct:  
> > https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> > List Guidelines:  
> > https://fedoraproject.org/wiki/Mailing_list_guidelines
> > List Archives:  
> > https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
> > Do not reply to spam on the list, report it:  
> > https://pagure.io/fedora-infrastructure
> 
> -- 
> Sérgio M. B.
> _______________________________________________
> devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
> To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
> Fedora Code of Conduct:
> https://docs.fedoraproject.org/en-US/project/code-of-conduct/
> List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
> List Archives:
> https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
> Do not reply to spam on the list, report it:
> https://pagure.io/fedora-infrastructure

-- 
Sérgio M. B.
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx
Do not reply to spam on the list, report it: https://pagure.io/fedora-infrastructure




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Fedora Announce]     [Fedora Users]     [Fedora Kernel]     [Fedora Testing]     [Fedora Formulas]     [Fedora PHP Devel]     [Kernel Development]     [Fedora Legacy]     [Fedora Maintainers]     [Fedora Desktop]     [PAM]     [Red Hat Development]     [Gimp]     [Yosemite News]

  Powered by Linux