Bug 461180 - %expanding %%package from macro
%expanding %%package from macro
Product: Fedora
Classification: Fedora
Component: rpm (Show other bugs)
All Linux
medium Severity high
: ---
: ---
Assigned To: Panu Matilainen
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2008-09-04 14:30 EDT by Axel Thimm
Modified: 2008-09-11 08:16 EDT (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2008-09-11 08:16:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Axel Thimm 2008-09-04 14:30:33 EDT
Description of problem:
This was reported on the rpm-maint list:

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

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

(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
%%package -n foo2
Summary: foo2
Group: foo2
%description -n foo2
%%package -n foo3
Summary: foo3
Group: foo3
%description -n foo3

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

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


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?)

Axel.Thimm at ATrpms.net

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):

How reproducible:

Steps to Reproduce:
1.Create a specfile as above
2.rpm -q --specfile testmacro.spec
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).

Comment 1 Panu Matilainen 2008-09-11 01:36:48 EDT
It's a regression alright, will fix...
Comment 2 Panu Matilainen 2008-09-11 08:16:03 EDT
Should be fixed in rawhide now (rpm-4.5.90-0.git8461.7)

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