diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/data/SPECS/dynamic.spec | 39 | ||||
-rw-r--r-- | tests/rpmbuild.at | 43 | ||||
-rw-r--r-- | tests/rpmspec.at | 1 |
3 files changed, 83 insertions, 0 deletions
diff --git a/tests/data/SPECS/dynamic.spec b/tests/data/SPECS/dynamic.spec new file mode 100644 index 000000000..5dbaa8584 --- /dev/null +++ b/tests/data/SPECS/dynamic.spec @@ -0,0 +1,39 @@ +Summary: dynamic hello -- hello, world rpm +Name: dynamic +Version: 1.0 +Release: 1 +Group: Utilities +License: GPL +Distribution: RPM test suite. +URL: http://rpm.org +BuildArch: noarch + +%description +Simple rpm demonstration. + +%prep +%setup -q -T -c + +%build +echo "Q: Why?\nA: Because we can!" > FAQ + +%install +mkdir -p $RPM_BUILD_ROOT/usr/local/bin +echo " " > $RPM_BUILD_ROOT/usr/local/bin/hello + + +echo "%package docs" >> %{specpartsdir}/docs.specpart +%{?!FAIL:echo "Summary: Documentation for dynamic spec" >> %{specpartsdir}/docs.specpart} +echo "BuildArch: noarch" >> %{specpartsdir}/docs.specpart +echo "%description docs" >> %{specpartsdir}/docs.specpart +echo "Test for dynamically generated spec files" >> %{specpartsdir}/docs.specpart +echo "%files docs" >> $RPM_SPECPARTS_DIR/docs.specpart +echo "%doc FAQ" >> $RPM_SPECPARTS_DIR/docs.specpart + +%files +%defattr(-,root,root) +%attr(0751,root,root) /usr/local/bin/hello + +%changelog +* Mon Oct 24 2022 Florian Festi <ffesti@redhat.com> +- create. diff --git a/tests/rpmbuild.at b/tests/rpmbuild.at index 2fe29705e..00f89209b 100644 --- a/tests/rpmbuild.at +++ b/tests/rpmbuild.at @@ -2272,3 +2272,46 @@ runroot rpmbuild \ ], [ignore]) AT_CLEANUP + +# ------------------------------ +# Check if dynamic spec generation works +AT_SETUP([rpmbuild with dynamic spec generation]) +AT_KEYWORDS([build]) +RPMDB_INIT +AT_CHECK([ + +runroot rpmbuild --define "_prefix /usr/local" -ba /data/SPECS/dynamic.spec +], +[0], +[ignore], +[ignore]) + +AT_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 +], +[]) +AT_CLEANUP + +# ------------------------------ +# Check failing dynamic spec generation +AT_SETUP([rpmbuild with dynamic spec generation fail]) +AT_KEYWORDS([build]) +RPMDB_INIT +AT_CHECK([ + +runroot rpmbuild --quiet -D "FAIL 1" -ba /data/SPECS/dynamic.spec +], +[1], +[], +[error: Summary field must be present in package: dynamic-docs +error: parsing failed +]) + +AT_CLEANUP diff --git a/tests/rpmspec.at b/tests/rpmspec.at index 5dfd18d5a..1e1792bfb 100644 --- a/tests/rpmspec.at +++ b/tests/rpmspec.at @@ -333,6 +333,7 @@ if [ $STATUS -ne 0 ]; then exit $STATUS fi cd 'hello-1.0' +/usr/bin/mkdir SPECPARTS /usr/bin/chmod -Rf a+rX,u+w,g-w,o-w . echo "Patch #0 (hello-1.0-modernize.patch):" /usr/bin/patch --no-backup-if-mismatch -f -p1 -b --suffix .modernize --fuzz=0 < /build/SOURCES/hello-1.0-modernize.patch |