From 10eb812919f95f6c1a14d4261956d5b1217f279e Mon Sep 17 00:00:00 2001 From: Florian Festi Date: Fri, 29 Sep 2023 11:31:31 +0200 Subject: [PATCH] Add test case for dynamic spec setting properties of the main package --- tests/data/SPECS/dynamic.spec | 13 +++++++++++-- tests/rpmbuild.at | 26 ++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 2 deletions(-) diff --git a/tests/data/SPECS/dynamic.spec b/tests/data/SPECS/dynamic.spec index 5dbaa8584e..d46a5c415b 100644 --- a/tests/data/SPECS/dynamic.spec +++ b/tests/data/SPECS/dynamic.spec @@ -1,12 +1,14 @@ -Summary: dynamic hello -- hello, world rpm Name: dynamic Version: 1.0 Release: 1 +BuildArch: noarch +%{?!FULLDYNAMIC: Group: Utilities License: GPL Distribution: RPM test suite. URL: http://rpm.org -BuildArch: noarch +Summary: dynamic hello -- hello, world rpm +} %description Simple rpm demonstration. @@ -21,6 +23,13 @@ echo "Q: Why?\nA: Because we can!" > FAQ mkdir -p $RPM_BUILD_ROOT/usr/local/bin echo " " > $RPM_BUILD_ROOT/usr/local/bin/hello +%{?FULLDYNAMIC: +echo "Group: Utilities" >> %{specpartsdir}/mainpkg.specpart +echo "License: GPL" >> %{specpartsdir}/mainpkg.specpart +echo "Distribution: RPM test suite." >> %{specpartsdir}/mainpkg.specpart +echo "URL: http://rpm.org" >> %{specpartsdir}/mainpkg.specpart +echo "Summary: dynamic hello -- hello, world rpm" >> %{specpartsdir}/mainpkg.specpart +} echo "%package docs" >> %{specpartsdir}/docs.specpart %{?!FAIL:echo "Summary: Documentation for dynamic spec" >> %{specpartsdir}/docs.specpart} diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at index 0d28354084..e2057490bb 100644 --- a/tests/rpmbuild.at +++ b/tests/rpmbuild.at @@ -2406,6 +2406,32 @@ runroot rpm -ql /build/RPMS/noarch/dynamic-docs-1.0-1.noarch.rpm []) RPMTEST_CLEANUP +# ------------------------------ +# Check if dynamic spec generation works for main package, too +AT_SETUP([rpmbuild with dynamic spec generation for main package]) +AT_KEYWORDS([build]) +RPMDB_INIT +RPMTEST_CHECK([ + +runroot rpmbuild --define "_prefix /usr/local" -D "FULLDYNAMIC 1" -ba /data/SPECS/dynamic.spec +], +[0], +[ignore], +[ignore]) + +RPMTEST_CHECK([ + +runroot rpm -qp --qf "%{Summary}\n" /build/RPMS/noarch/dynamic-docs-1.0-1.noarch.rpm +runroot rpm -ql /build/RPMS/noarch/dynamic-docs-1.0-1.noarch.rpm +], +[0], +[Documentation for dynamic spec +/usr/local/share/doc/dynamic-docs-1.0 +/usr/local/share/doc/dynamic-docs-1.0/FAQ +], +[]) +RPMTEST_CLEANUP + # ------------------------------ # Check failing dynamic spec generation AT_SETUP([rpmbuild with dynamic spec generation fail])