-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restructure RPM for subpackages (#1025)
Restructure the RPM build into separate CLI and GUI installations This does a few things: - builds separate GUI and CLI RPMs - separates the runtime dependency graph, greatly reducing the footprint for the CLI - updates the container builds to use mock - adds workflow for Fedora 42, because it's that time of the year The tdb tool is distributed as the initial CLI binary. It may be further refactored in function, name, and possibly location. Tested in Koji on Rawhide and EPEL 9. Closes #1024
- Loading branch information
Showing
13 changed files
with
169 additions
and
104 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,25 +1,40 @@ | ||
ARG image=registry.fedoraproject.org/fedora:39 | ||
FROM $image AS build-stage | ||
ARG image=registry.fedoraproject.org/fedora:latest | ||
FROM $image AS fedorabuild | ||
ARG version | ||
ARG spec=fapolicy-analyzer.spec | ||
|
||
RUN dnf install -y rpm-build rpmdevtools dnf-plugins-core python3-pip nano | ||
# rpmbuild tools could be installed in the el stage | ||
# but caching them here ends up saving time on rebuilds | ||
RUN dnf install -y mock rpm-build rpmdevtools | ||
|
||
RUN useradd -u 10001 -g 0 -d /home/default default | ||
|
||
USER 10001 | ||
RUN mkdir -p /tmp/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS} | ||
WORKDIR /tmp/rpmbuild | ||
|
||
COPY --chown=10001:0 fapolicy-analyzer.spec SPECS/ | ||
COPY --chown=10001:0 $spec SPECS/fapolicy-analyzer.spec | ||
|
||
USER root | ||
RUN dnf -y builddep SPECS/fapolicy-analyzer.spec | ||
|
||
USER 10001 | ||
|
||
COPY --chown=10001:0 fapolicy-analyzer.tar.gz SOURCES/ | ||
COPY --chown=10001:0 vendor-docs.tar.gz SOURCES/ | ||
COPY --chown=10001:0 scripts/srpm/build.sh ./build.sh | ||
COPY --chown=10001:0 fapolicy-analyzer-$version.tar.gz SOURCES/ | ||
COPY --chown=10001:0 vendor-docs-$version.tar.gz SOURCES/ | ||
COPY --chown=10001:0 scripts/srpm/build.sh . | ||
|
||
RUN spectool -g -C /tmp/rpmbuild/SOURCES/ SPECS/fapolicy-analyzer.spec | ||
USER root | ||
|
||
ENTRYPOINT ["/tmp/rpmbuild/build.sh"] | ||
|
||
FROM fedorabuild as elbuild | ||
ARG version | ||
|
||
USER 10001 | ||
|
||
RUN spectool --list-files SPECS/fapolicy-analyzer.spec | grep pythonhosted | cut -d' ' -f2 | xargs -I{} curl -sLO --output-dir SOURCES {} | ||
|
||
COPY --chown=10001:0 vendor-rs-$version.tar.gz SOURCES/ | ||
|
||
USER root |
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 |
---|---|---|
@@ -1,4 +1,6 @@ | ||
%bcond_without check | ||
%bcond_without cli | ||
%bcond_without gui | ||
|
||
Summary: File Access Policy Analyzer | ||
Name: fapolicy-analyzer | ||
|
@@ -41,6 +43,22 @@ BuildRequires: audit-libs-devel | |
BuildRequires: cargo-rpm-macros | ||
BuildRequires: python3dist(setuptools-rust) | ||
|
||
Requires: %{name}-cli | ||
Requires: %{name}-gui | ||
|
||
%description | ||
Tools to assist with the configuration and management of fapolicyd. | ||
|
||
|
||
%package cli | ||
Summary: File Access Policy Analyzer CLI | ||
|
||
%description cli | ||
CLI Tools to assist with the configuration and management of fapolicyd. | ||
|
||
%package gui | ||
Summary: File Access Policy Analyzer GUI | ||
|
||
Requires: python3 | ||
Requires: python3-gobject | ||
Requires: python3-events | ||
|
@@ -67,15 +85,22 @@ Requires: webkit2gtk4.1 | |
%global module_version %{lua: v = string.gsub(rpm.expand("%{?version}"), "~dev", ".dev"); \ | ||
v = string.gsub(v, "~rc", "rc"); print(v) } | ||
|
||
%description | ||
Tools to assist with the configuration and management of fapolicyd. | ||
%description gui | ||
GUI Tools to assist with the configuration and management of fapolicyd. | ||
|
||
%prep | ||
%autosetup -n %{name} | ||
%cargo_prep | ||
|
||
# disable dev-tools crate | ||
%if %{without cli} | ||
# disable tools crate | ||
sed -i '/tools/d' Cargo.toml | ||
%endif | ||
|
||
%if %{without gui} | ||
# disable pyo3 crate | ||
sed -i '/pyo3/d' Cargo.toml | ||
%endif | ||
|
||
# extract our doc sourcs | ||
tar xvzf %{SOURCE1} | ||
|
@@ -96,6 +121,12 @@ echo "audit" > FEATURES | |
%cargo_generate_buildrequires -a | ||
|
||
%build | ||
|
||
%if %{with cli} | ||
cargo build --bin tdb --release | ||
%endif | ||
|
||
%if %{with gui} | ||
# ensure standard Rust compiler flags are set | ||
export RUSTFLAGS="%{build_rustflags}" | ||
|
||
|
@@ -105,8 +136,15 @@ export RUSTFLAGS="%{build_rustflags}" | |
|
||
%{cargo_license_summary} | ||
%{cargo_license} > LICENSE.dependencies | ||
%endif | ||
|
||
%install | ||
|
||
%if %{with cli} | ||
install -D target/release/tdb %{buildroot}/%{_sbindir}/%{name}-trust | ||
%endif | ||
|
||
%if %{with gui} | ||
%{py3_install_wheel %{module}-%{module_version}*%{_target_cpu}.whl} | ||
%{python3} help install --dest %{buildroot}/%{_datadir}/help | ||
install -D bin/%{name} %{buildroot}/%{_sbindir}/%{name} | ||
|
@@ -115,14 +153,17 @@ install -D data/config.toml -t %{buildroot}%{_sysconfdir}/%{name}/ | |
desktop-file-install data/%{name}.desktop | ||
find locale -name %{name}.mo -exec cp --parents -rv {} %{buildroot}/%{_datadir} \; | ||
%find_lang %{name} --with-gnome | ||
%endif | ||
|
||
%check | ||
%if %{with gui} | ||
desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop | ||
%endif | ||
|
||
%files -n %{name} -f %{name}.lang | ||
%doc scripts/srpm/README | ||
%license LICENSE | ||
%license LICENSE.dependencies | ||
%files cli | ||
%attr(755,root,root) %{_sbindir}/%{name}-trust | ||
|
||
%files gui | ||
%{python3_sitearch}/%{module} | ||
%{python3_sitearch}/%{module}-%{module_version}* | ||
%attr(755,root,root) %{_sbindir}/%{name} | ||
|
@@ -131,6 +172,11 @@ desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop | |
%config(noreplace) %attr(644,root,root) %{_sysconfdir}/%{name}/config.toml | ||
%ghost %attr(640,root,root) %verify(not md5 size mtime) %{_localstatedir}/log/%{name}/%{name}.log | ||
|
||
%files -f %{name}.lang | ||
%doc scripts/srpm/README | ||
%license LICENSE | ||
%license LICENSE.dependencies | ||
|
||
%changelog | ||
* Sun Jul 28 2024 John Wass <[email protected]> 1.4.0-1 | ||
- New release |
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 @@ | ||
Subpackaged RPM build to support separate CLI and GUI installations. |
This file was deleted.
Oops, something went wrong.
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
Oops, something went wrong.