[Rpm-maint] how to store source in separate dirs w/o causing random build breaks...?

Linda Walsh rpm at tlinx.org
Sat Aug 13 22:35:18 UTC 2011

In order that my sources don't all get unpacked into 1 'sources' dir,
(files from different sources/versions could overwrite each other),
I have:

%_sourcedir %{_topdir}/SOURCES/%{name}-%{version}

This works for *most* builds ... but some faily miserably and I'm
wondering if there's a different way to get rpm to do what I want,
or if the spec files are maybe not following some standard, or what,
but example of problem:

on suse, they have the bash-4.1-xxx-src rpm, -- in it, it builds
a bunch of subpackages.


The problem is each package requires a 'version statement' --
That causes unpacking the sources to fail:

error: File /usr/src/packages/SOURCES/bash-6.1/readline-6.1.tar.bz2: No 
such file or directory

Of course the file is in the directory where the rpm was unpacked:

But it's using the version number from readline together with the name
from the rpm, -- and no way that could ever be right!  I mean it might have
some prayer of a chance if it matched the name with the right version, 
but I don't know if rpm supports unpacking sources for separate packages 
separate directories -- I wouldn't expect so.

FWIW, I already don't like the fact that all my specs are simply named
'NAME'.spec, as I've installed the source rpm for more that one version 
of the
same package, and -- only 1 .spec file gets left --- if it doesn't work 
for both versions (usually not)...   But when I want to build the prod, 
having to remember the version  isn't automatic.  But Rpm knows the 
version it unpacks into -- as it's in the spec file and rpm unpacked it!

So how to get a problem situation like the above to work?

I'd prefer something that would fix my 'macro' --

OR maybe it is a bug in RPM?   I.e. if it is is checking 'Source[x]', it
should use the 'Version' number of the 'rpm', and not the package?

Is there a different 'macro' for the 'rpm-version' (vs. the package 
being built version?)

I've tried to play with defining a pkg_version, but haven't haven't
been able to figure out if it is possible...i.e.:

hoped if pkg_version wasn't defined, would be defined to be version and
pickup 1st version in file, then it would be 'def'ed, and simply
return itself...:

%pkg_version   %{!?pkg_version:%{version}}
%_sourcedir    %{_topdir}/SOURCES/%{name}-%{pkg_version}

But really need like a way to do a conditional & else in a macro,
then I could
%pkg_version   ${?pkg_version:%{pkg_version}:%{version}}

like the 3-arg "?:" in perl a= (cond)?exp1:exp2;

Is this possible? or how to?

Thanks much!

More information about the Rpm-maint mailing list