Bug 490740 - nested lua expansions not supported
Summary: nested lua expansions not supported
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: rpm
Version: rawhide
Hardware: All
OS: Linux
low
medium
Target Milestone: ---
Assignee: Panu Matilainen
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2009-03-17 19:22 UTC by Carl Roth
Modified: 2011-07-19 09:05 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: Enhancement
Doc Text:
Clone Of:
Environment:
Last Closed: 2011-07-19 09:05:01 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)
spec file with lua scripts (551 bytes, text/plain)
2009-03-17 19:23 UTC, Carl Roth
no flags Details

Description Carl Roth 2009-03-17 19:22:27 UTC
Description of problem:

Nested lua expansions in an RPM spec file don't appear to work.  From what I can tell (also by peeking at the RPM sources) the print buffer for lua expansions is not preserved between nested lua invocations.

Version-Release number of selected component (if applicable):

rpm-4.6.0-1.fc10.x86_64 (also affects F9 rpm)

How reproducible:

Always (see attach spec)

Steps to Reproduce:
1. download the attached spec file
2. rpmbuild --nodeps -bs *.spec
3. rpm -qp --requires *.src.rpm
  
Actual results:


Expected results:


Additional info:

I guess the workaround is to never nest lua expansions, but it can be tricky if other rpm macros are defined in terms of them...

Comment 1 Carl Roth 2009-03-17 19:23:29 UTC
Created attachment 335592 [details]
spec file with lua scripts

Comment 2 Jeff Johnson 2009-09-21 13:35:04 UTC
(aside)
Nested lua expansions actually "work" @rpm5.org.

Here's your foo.spec with %trace added:
  0< # this statement stumbles (print buffer is mis-directed)
  1>   %{expand:%{lua:
  foo = rpm.expand("%__foo")
  print("BuildRequires: " .. foo .. "-devel" .. "\n")
}}^
  2>     %{lua:
  foo = rpm.expand("%__foo")
  print("BuildRequires: " .. foo .. "-devel" .. "\n")
}^
  1>   %__foo^
  2>     %{lua:
  print("foo")
}^
  1<   foo
  0< foo
  1<   BuildRequires: foo-devel
  1<   BuildRequires: foo-devel
  0< BuildRequires: foo-devel

But the fundamental issue for RPM is
    Is there any need for multiple nested lua invocations in RPM
    coordinated through a print buffer?

E.g. the embedded lua interpreter is (by intent) persistent so that
variables can be shared between invocations.

OTOH, the expectation here is that the print buffer be specifcally tied
to each nested invocation, i.e. unshared. That isn't a suprising expectation,
just not what was/is implemented with embedded lua.

Its conceivable to have lua invocations behave either with globally
shared state, or with independent nested invocations, dependent
on how invoked. The analogue in shell is {} vs () nesting, commands within
{} are executed by the current interpreter, () nests an interpreter when needed.

But that just brings me full circle to
    Is there really any need for this level of complexity to generate
        BuildRequires: foo-devel

Comment 3 Bug Zapper 2009-11-18 11:32:45 UTC
This message is a reminder that Fedora 10 is nearing its end of life.
Approximately 30 (thirty) days from now Fedora will stop maintaining
and issuing updates for Fedora 10.  It is Fedora's policy to close all
bug reports from releases that are no longer maintained.  At that time
this bug will be closed as WONTFIX if it remains open with a Fedora 
'version' of '10'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version prior to Fedora 10's end of life.

Bug Reporter: Thank you for reporting this issue and we are sorry that 
we may not be able to fix it before Fedora 10 is end of life.  If you 
would still like to see this bug fixed and are able to reproduce it 
against a later version of Fedora please change the 'version' of this 
bug to the applicable version.  If you are unable to change the version, 
please add a comment here and someone will do it for you.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events.  Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

The process we are following is described here: 
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 4 Panu Matilainen 2011-05-24 17:49:57 UTC
FWIW, support for nested Lua macros has now been added upstream.

Comment 5 Panu Matilainen 2011-07-19 09:05:01 UTC
Nested lua macros are supported in rpm >= 4.9.1, in rawhide now.


Note You need to log in before you can comment on or make changes to this bug.