Open FrostyX opened 4 months ago
I am pasting the whole specfile here for easier reading in the browser
## START: Set by rpmautospec
## (rpmautospec version 0.6.1)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
-- Packages use something like this:
-- release_number = 18;
-- base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
-- print(release_number + base_release_number - 1);
-- But a more reliable reproducer is the following
print(os.time())
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
## END: Set by rpmautospec
Name: hello
Version: 2.12.1
Release: %autorelease
Summary: Prints a familiar, friendly greeting
# All code is GPLv3+.
# Parts of the documentation are under GFDL
License: GPL-3.0-or-later AND GFDL-1.3-or-later
URL: https://www.gnu.org/software/hello/
Source0: https://ftp.gnu.org/gnu/hello/hello-%{version}.tar.gz
BuildRequires: gcc
BuildRequires: gnupg2
BuildRequires: make
Recommends: info
Provides: bundled(gnulib)
%description
The GNU Hello program produces a familiar, friendly greeting.
Yes, this is another implementation of the classic program that
prints “Hello, world!” when you run it.
However, unlike the minimal version often seen, GNU Hello processes
its argument list to modify its behavior, supports greetings in many
languages, and so on. The primary purpose of GNU Hello is to
demonstrate how to write other programs that do these things; it
serves as a model for GNU coding standards and GNU maintainer
practices.
%prep
%setup -q
%build
%configure
%make_build
%install
%make_install
rm -f %{buildroot}%{_infodir}/dir
%find_lang hello
%files -f hello.lang
%license COPYING
%{_mandir}/man1/hello.1*
%{_bindir}/hello
%{_infodir}/hello.info*
%changelog
%autochangelog
It is also worth mentioning that this issue happens only when calling mock with --spec
and --sources
. If you specify a SRPM on the input, there will be only one SRPM in the results directory. Even though with a different release number than the original (I think this is fine).
Note for myself: maybe this can be reproduced by %generatebuildrequires that makes more src.rpm.
Short description of the problem
When using rpmautospec (or probably any other way to dynamically generate version or release number, Mock can generate multiple SRPM packages in the results directory.
We should either fix it or let Mock gracefully fail, refusing to finish such a build.
Output of
rpm -q mock
Steps to reproduce issue
sudo rm -rf /var/lib/mock/fedora-40-x86_64/result/*
mv hello.spec.txt hello.spec
mock -r fedora-40-x86_64 --sources hello-2.12.1.tar.gz --spec hello.spec
ls /var/lib/mock/fedora-40-x86_64/result |grep src.rpm
Example output:
Also, the final RPM filename differs from both of them -
hello-2.12.1-1709662074.fc40.x86_64.rpm
Any additional notes
We encountered this issue several times in Copr and it was always confusing and hard to debug. Last reported case was https://github.com/fedora-copr/copr/issues/3110