Bug 461180

Summary: %expanding %%package from macro
Product: [Fedora] Fedora Reporter: Axel Thimm <axel.thimm>
Component: rpmAssignee: Panu Matilainen <pmatilai>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: medium    
Version: rawhideCC: ffesti, jnovy, pnasrat
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-09-11 12:16:03 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Axel Thimm 2008-09-04 18:30:33 UTC
Description of problem:
This was reported on the rpm-maint list:
https://lists.dulug.duke.edu/pipermail/rpm-maint/2008-September/001125.html
Hi,

I'm very often using constructs that create a macro that is later
expanding before %install defining several subpackages (like the
debuginfo packages do). This worked for all version of rpm as far back
as RHL8, but breaks now with F10.

The simplified construct is as follows:

Some macro file (e.g. /etc/rpm/macros.libs) contains the following
definition:

%testmacro() \
%package -n %1\
Summary: %1\
Group: %1\
%description -n %1\
blah

(I tried with adding %{nil} more empty lines at the end etc, this is
just one variant).

A test specfile contains a variant w/o using the testmacro (which
works) and one that does, where the macro seems to kill any further
%%package instances in the %expand:

%{expand:%%package -n foo1
Summary: foo1
Group: foo1
%description -n foo1
foo1
%%package -n foo2
Summary: foo2
Group: foo2
%description -n foo2
foo2
%%package -n foo3
Summary: foo3
Group: foo3
%description -n foo3
foo3}

%{expand:%%package -n bar1
Summary: bar1
Group: bar1
%description -n bar1
bar1
%%{testmacro bar2}
%%package -n bar3
Summary: bar3
Group: bar3
%description -n bar3
bar3}

The expected behaviour from a query on this specfile is to get
subpackages like

main-1.0-1
foo1-1.0-1
foo2-1.0-1
foo3-1.0-1
bar1-1.0-1
bar2-1.0-1
bar3-1.0-1

F10's 4.5.90 kills the subpackage after the %%{testmacro ...}
invocation, e.g. there is no bar3.

Is this a bug in rpm, or was I using a buggy feature all these years
and need to do it properly? (If so what is the proper way?)

Thanks!
-- 
Axel.Thimm at ATrpms.net

https://lists.dulug.duke.edu/pipermail/rpm-maint/2008-September/001126.html
On Thu, Sep 04, 2008 at 10:03:28AM +0200, devzero2000 wrote:
> Probably a bug in rpm 4.6 on FC10:%%{testmacro bar2} have to expand as
> expected . I have put a %trace in the SPEC and i have this
> result from rpmbuild -bi (look at the macros expansion):
> 
> 
>   1>   %{expand:%%package -n bar1
> Summary: bar1
> Group: bar1
> %description -n bar1
> bar1
> %%{testmacro bar2}
> %%package -n bar3
> Summary: bar3
> Group: bar3
> %description -n bar3
> bar3}^
>   2>     %description^-n bar1
>   2>     %description^-n bar3
>   1<   bar3
>   2>     %package^-n bar1
>   2>     %description^-n bar1
>   2>     %{testmacro bar2}^
>   3>       %package^-n %1
>   3>       %1^
>   3<       bar2
>   3>       %1^
>   3<       bar2
>   3>       %1^
>   3<       bar2
>   3>       %description^-n %1
>   3>       %1^
>   3<       bar2
>   3>       %{nil}^
>   4>         %{!?nil}^
>   3<       (empty)
>   2<     (empty)
>   2>     %package^-n bar3
>   2>     %description^-n bar3
>   1<   bar3
>   0< %package -n bar1
> Summary: bar1
> Group: bar1
> %description -n bar1
> bar1
> 
> %package -n bar2
> Summary: bar2
> Group: bar2
> %description -n bar2
> 
> %package -n bar3
> Summary: bar3
> Group: bar3
> %description -n bar3
> bar3
> 
> In effect from an rpmbuild -ba test-macros.spec i have
> 
> Wrote: /home/machbuild/rpmbuild/SRPMS/test-macros-1.0-1.src.rpm
> Wrote: /home/machbuild/rpmbuild/RPMS/test-macros-1.0-1.noarch.rpm
> Wrote: /home/machbuild/rpmbuild/RPMS/foo1-1.0-1.noarch.rpm
> Wrote: /home/machbuild/rpmbuild/RPMS/foo2-1.0-1.noarch.rpm
> Wrote: /home/machbuild/rpmbuild/RPMS/foo3-1.0-1.noarch.rpm
> Wrote: /home/machbuild/rpmbuild/RPMS/bar1-1.0-1.noarch.rpm
> Wrote: /home/machbuild/rpmbuild/RPMS/bar2-1.0-1.noarch.rpm
> Wrote: /home/machbuild/rpmbuild/RPMS/bar3-1.0-1.noarch.rpm
> 
> My rpm version on FC9 is
> 
> rpm -V --version
> rpm (RPM) 5.1.4
> 
> Perhaps you have to  fillup a redhat bugzilla for the "official" rpm version
> on FC10.
> 
> Regards


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

How reproducible:
100%

Steps to Reproduce:
1.Create a specfile as above
2.rpm -q --specfile testmacro.spec
3.
  
Actual results:
See above, subpackages are suddenly missing

Expected results:
Behaviour like rpm <= 4.4.x, e.g. the macros should expand and the %packages parsed.

Additional info:
This is needed for ATrpms (and maybe other 3rd party repos) to support F10. Whether specfiles in Fedora proper are affected will only turn up with the mass rebuilds (most likely there won't be any).

Thanks!

Comment 1 Panu Matilainen 2008-09-11 05:36:48 UTC
It's a regression alright, will fix...

Comment 2 Panu Matilainen 2008-09-11 12:16:03 UTC
Should be fixed in rawhide now (rpm-4.5.90-0.git8461.7)