On Sun, 10 Jan 2016 03:16:24 +0000, Joseph L. Casale wrote:
I have a spec with two source files where I do not create the second,
it's not mine:
Source0: %{name}-%{version}.tar.gz
Source1: foo-bar.tar.xz
My prep sections looks like:
%setup -q
%setup -q -T -D -a 1
The tar.xz for Source1 has an unversioned name however it unpacks to a
versioned directory so I am trying to do something like:
%define foo-bar_dir %(ls -d %{_builddir}/%{name}-%{version}/foo-bar-*-baz |grep -o
'[^/]*$')
so I can leverage %{foo-bar_dir} in the %files section.
That approach sounds too complicated. %setup is a macro in the %prep
section, where you can run more commands to _set up_ your builddir. The
most obvious choice IMO would be to _rename_ the versioned dir to something
unique. You could also avoid the second invocation of %setup and extract
Source1 yourself using "tar". The parameters of the second %setup call
don't define builddir anymore, but only extract into the builddir from
the first invocation.