Skip to content

Commit

Permalink
Add test case for dynamic spec
Browse files Browse the repository at this point in the history
setting properties of the main package
  • Loading branch information
ffesti committed Oct 11, 2023
1 parent 5af0ec9 commit 10eb812
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 2 deletions.
13 changes: 11 additions & 2 deletions tests/data/SPECS/dynamic.spec
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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}
Expand Down
26 changes: 26 additions & 0 deletions tests/rpmbuild.at
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down

0 comments on commit 10eb812

Please sign in to comment.