Now I am looking for feedback about general approach. Of course it could be somehow polished and improved to hide some boiler plate.
This part:
%{echo:%(
[ ! -e %{S:1} ] &&
Looks really clumsy. After reading the
https://pagure.io/packaging-committee/issue/1132#comment-769233
I like
# Script: gen_clean_tarball.sh
approach. Whether it will be special comment, macro (with support
for extraction in spectool) or new tag in RPM - I do not care. The
important part is that it is standalone file, which can be easily
locally executed. That would ease development and debugging.
Miroslav