-
Notifications
You must be signed in to change notification settings - Fork 360
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Read in *.specpart files from %{specpartsdir} aka $RPM_SPECPARTS_DIR after the %install script. This allows the build process to add sub packages to the build. In the future more changes to the packages may be possible - like amending package declarations. The %{specpartsdir} is created by the %setup pseudo macro inside of the buildsubdir. It's presence allows build scripts to check if this feature is supported in the running rpmbuild instance.
- Loading branch information
Showing
13 changed files
with
200 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
layout: default | ||
title: rpm.org - Package Build Process | ||
--- | ||
# Dynamic Spec Generation | ||
|
||
Since rpm 4.19 RPM supports parsing dynamically generated specs. This | ||
allows the build scripts (**%build** or **%install**) to create parts | ||
of the spec file. The parts are read in and parsed after **%install** | ||
and before **%check**. Because of this they obviously can't contain | ||
the build scripts but are intended to create sub packages based on the | ||
build results. | ||
|
||
The files need to be placed in the **%{specpartsdir}** (also available | ||
as **$RPM_SPECPARTS_DIR** in the build scripts) and have a | ||
**.specpart** postfix. The directory is created by **%setup** in the | ||
**buildsubdir**. Scripts must fail if it is not present. They should | ||
give an error message that dynamic spec generation is not supported on | ||
the given RPM version if the directory is not found or switch to an | ||
alternative that does not require the feature. | ||
|
||
Generally the specparts should be generated by separate scripts and not | ||
directly from the build scripts themselves. This can be done for | ||
testing but one needs to be careful that the spec syntax is not | ||
already parsed when the spec file is read. Avoid Spec directives or | ||
sections starting right at the beginning of the line as they will be | ||
interpreted right away. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
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 | ||
echo "Summary: Documentation for dynamic spec" >> %{specpartsdir}/docs.specpart | ||
echo "BuildArch: noarch" >> %{specpartsdir}/docs.specpart | ||
echo "%files docs" >> %{specpartsdir}/docs.specpart | ||
echo "%doc FAQ" >> %{specpartsdir}/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
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" >> %{specpartsdir}/docs.specpart | ||
echo "%doc FAQ" >> %{specpartsdir}/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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters