On 9/25/20 2:30 PM, Mark Mielke wrote:
On Fri, Sep 25, 2020 at 4:35 AM Daniel P. Berrangé <berrange@redhat.com> wrote:
If you have the tarball you can trivially generate the source RPM if
you need it because the tarball still contains the .spec file. IOW
just run

  $ rpmbuild -ts libvirt-6.7.0.tar.xz
  Wrote: /home/berrange/rpmbuild/SRPMS/libvirt-6.7.0-1.fc32.src.rpm

I've never tried this before... what does it do if the .spec file is non-trivial and includes things expanded by autoconf, or if there are multiple different .spec files?


That's not relevant in the case of libvirt, because we no longer use autoconf/configure/make, but use meson instead, and the source tarfile only has a single .spec file.


Even when libvirt did use autoconf, that step was done on the file libvirt.spec.in as a part of make dist, and so the source tar has always contained a libvirt.spec that is ready to be used directly by rpmbuild.



Personally, I have found the libvirt provided spec file limiting - and use a distro one like Fedora as a starting point instead.


I'm not sure what difference you're seeing here. The libvirt.spec in Fedora git is just directly imported from the upstream libvirt source tar every time the package is rebased. There is no difference. (well, except that the Fedora libvirt.spec file maintains the incomplete and thus totally pointless %changelog section).


And, I meant to try and figure out why this was and provide feedback about it.


If there's something you think is missing in libvirt's spec file, definitely send a patch for it.


But, for other projects such as openvswitch - I find that the one they build and maintain upstream, to be very useful. In this case, you do run autoconf and configure, and "make rpm-fedora" generates both RPM and SRPM. From that respect, the need to distribute a .src.rpm separately is not as important, but the ability to build an SRPM using an easy mechanism is the real requirement and I'm mostly wondering if "rpmbuild -ts" is sophisticated enough to support many real-world use cases, or if it is only useful for the most trivial and eventually limiting use cases.


Hmm. Maybe you're asking the question "in general" for any arbitrary package, while I am (and Dan was) answering only relative to libvirt? In that case I should stop and let someone who knows what they're talking about take over :-)