Hi,
It is quite common, to have some sources, which are not available as a
tarball from upstream. In case of rubygem- packages, they quite often do
not ship their test suites. In this case, our .spec file contains
something like [1]:
~~~
# Tests are not packaged with the gem. You may get them like so:
# git clone --no-checkout
https://github.com/discourse/mini_mime
# git -C mini_mime archive -v -o mini_mime-1.1.0-test.txz v1.1.0 test
Source1: %{gem_name}-%{version}-test.txz
~~~
This is quite fine. However, if there is opened PR [2], the CI would
work only as long sources are in the look a side cache, which is not
always desirable, because this might be just some WIP.
I while ago, I proposed [3] this "executable" comments instead:
~~~
Source1: %{gem_name}-%{version}-test.txz
%{echo:%(
[ ! -e %{S:1} ] &&
rm -rf %{name} &&
git clone
https://github.com/discourse/mini_mime %{name} &&
git -C %{name} archive -v -o %{S:1} v%{version} test/
)}
~~~
I know, that some may say "it won't work in Koji", that is true, but
won't necessarily be issue for CI. The other argument might be "it is
creating some random tarball from random source", but if the accompanied
`sources` file contains the right checksums, `fedpkg srpm` ensures that
only the tarballs with the right content is used.
While others might just handwavy upload the random sources into look a
side cache, I think this is way better approach.
Now I am looking for feedback about general approach. Of course it could
be somehow polished and improved to hide some boiler plate.
Vít
[1]:
https://src.fedoraproject.org/rpms/rubygem-mini_mime/blob/c25611d64d17c37...
[2]:
https://src.fedoraproject.org/rpms/rubygem-mini_mime/pull-request/2
[3]:
https://pagure.io/packaging-committee/issue/1132#comment-769233