FAQ Search Today's Posts Mark Forums Read

» Linux Archive
Home
New Posts
Search
FAQ


Go Back   Linux Archive > Redhat > Fedora Development

 
 
LinkBack Thread Tools
 
Old 01-05-2010, 03:50 PM
"Daniel P. Berrange"
 
Default Heads-up: %define vs %global in specs

On Tue, Jan 05, 2010 at 06:34:12PM +0200, Panu Matilainen wrote:
>
> For the impatient:
>
> Starting with today's rawhide, the these kind of constructs in specs
> no longer "work":
> %{?!foo: %define foo bar}
> For the generally desired effect, the above simply becomes:
> %{?!foo: %global foo bar}
>
> This is already recommended by the Fedora guidelines, but packages which
> haven't been updated to follow the guideline might need revising:
> https://fedoraproject.org/wiki/Packaging/Guidelines#.25global_preferred_over_.25define


What exactly do you mean 'no longer work' ? Can we expect to get a formal
RPM build error for this bogus construct, or will it silently build and
do the wrong thing ? From your long description, it sounds like the latter,
which means maintainers should audit their spec files to identify these
bogus macros

Regards,
Daniel
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 01-05-2010, 04:17 PM
"Tom "spot" Callaway"
 
Default Heads-up: %define vs %global in specs

On 01/05/2010 11:50 AM, Daniel P. Berrange wrote:
> What exactly do you mean 'no longer work' ? Can we expect to get a formal
> RPM build error for this bogus construct, or will it silently build and
> do the wrong thing ? From your long description, it sounds like the latter,
> which means maintainers should audit their spec files to identify these
> bogus macros

The easy way to be sure you're not hitting this is to not use %define.
Sed will fix your packages up quickly.

~spot

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 01-05-2010, 06:58 PM
Panu Matilainen
 
Default Heads-up: %define vs %global in specs

On Tue, 5 Jan 2010, Daniel P. Berrange wrote:


On Tue, Jan 05, 2010 at 06:34:12PM +0200, Panu Matilainen wrote:


For the impatient:

Starting with today's rawhide, the these kind of constructs in specs
no longer "work":
%{?!foo: %define foo bar}
For the generally desired effect, the above simply becomes:
%{?!foo: %global foo bar}

This is already recommended by the Fedora guidelines, but packages which
haven't been updated to follow the guideline might need revising:
https://fedoraproject.org/wiki/Packaging/Guidelines#.25global_preferred_over_.25define



What exactly do you mean 'no longer work' ? Can we expect to get a formal
RPM build error for this bogus construct, or will it silently build and
do the wrong thing ? From your long description, it sounds like the latter,
which means maintainers should audit their spec files to identify these
bogus macros


It depends on the details but most likely you'll get a build error of some
kind as you'll get unexpanded macros where you previously got expanded
macros (if you were lucky). For example


%{!?python_sitelib: %define python_sitelib %(python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
...

%files
%{python_sitelib}/mystuff.py

...would now error out at filelist processing stage as %{python_sitelib}
is not defined in the global scope and literal
"%{python_sitelib}/mystuff.py" is not a valid file name.


Or you can get downright parse errors etc. Sure there *are* cases where it
could go unnoticed: if you're creating package content based on such a
%define - using the python_sitelib again as a dumb example, rpm wouldn't
complain about file created (and packaged) from this, you'd just get wrong
contents (unexpanded macro name) in the file:


cat << EOF >> my.conf
%{python_sitelib}/mylib/
EOF

...but the potential for such silent errors has been there all the
time: you just need to call a parametrized macro (knowingly or as a
side-effect) somewhere in the spec and poof.


Oh and btw, technically there's nothing illegal or wrong with the
construct "%{?!foo: %define foo bar}" itself. What's wrong is trying to
*use* macro defined that way outside the %{} block where it was defined.


- Panu -

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 01-05-2010, 07:39 PM
Ville Skyttä
 
Default Heads-up: %define vs %global in specs

On Tuesday 05 January 2010, Tom "spot" Callaway wrote:
> On 01/05/2010 11:50 AM, Daniel P. Berrange wrote:
> > What exactly do you mean 'no longer work' ? Can we expect to get a formal
> > RPM build error for this bogus construct, or will it silently build and
> > do the wrong thing ? From your long description, it sounds like the
> > latter, which means maintainers should audit their spec files to identify
> > these bogus macros
>
> The easy way to be sure you're not hitting this is to not use %define.
> Sed will fix your packages up quickly.

Smiley noted, but blindly doing that has potential to break stuff too. Here's
one example that works as intended with %define but not with %global:

http://cvs.fedoraproject.org/viewvc/devel/bash-completion/bash-completion.spec?r1=1.46&r2=1.47

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 01-07-2010, 08:54 AM
Panu Matilainen
 
Default Heads-up: %define vs %global in specs

On Tue, 5 Jan 2010, Panu Matilainen wrote:



For the impatient:

Starting with today's rawhide, the these kind of constructs in specs no
longer "work":

%{?!foo: %define foo bar}
For the generally desired effect, the above simply becomes:
%{?!foo: %global foo bar}

This is already recommended by the Fedora guidelines, but packages which
haven't been updated to follow the guideline might need revising:

https://fedoraproject.org/wiki/Packaging/Guidelines#.25global_preferred_over_.25define


FYI, this change broke font package macros.

I've reverted the macro scoping "fix" until I have a chance to properly
investigate the breakage (possibly some quirk related to %{lua: ...}
macros).


- Panu -

--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 
Old 01-09-2010, 12:26 AM
Toshio Kuratomi
 
Default Heads-up: %define vs %global in specs

On Thu, Jan 07, 2010 at 11:54:14AM +0200, Panu Matilainen wrote:
> On Tue, 5 Jan 2010, Panu Matilainen wrote:
>
> >
> >For the impatient:
> >
> >Starting with today's rawhide, the these kind of constructs in
> >specs no longer "work":
> > %{?!foo: %define foo bar}
> >For the generally desired effect, the above simply becomes:
> > %{?!foo: %global foo bar}
> >
> >This is already recommended by the Fedora guidelines, but packages
> >which haven't been updated to follow the guideline might need
> >revising:
> >https://fedoraproject.org/wiki/Packaging/Guidelines#.25global_preferred_over_.25define
>
> FYI, this change broke font package macros.
>
> I've reverted the macro scoping "fix" until I have a chance to
> properly investigate the breakage (possibly some quirk related to
> %{lua: ...} macros).
>
I've updated the %global preferred over %define section to say that the bug
is fixed in F13 so people should definitely avoid %{?!foo: %define [..]}
type constructs. If this doesn't make it back in in time for F13, let me
know and I'll update for when we do fix it.

-Toshio
--
fedora-devel-list mailing list
fedora-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/fedora-devel-list
 

Thread Tools




All times are GMT. The time now is 09:36 AM.

VBulletin, Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2007 - 2008, www.linux-archive.org