Skip to content

Commit

Permalink
Fix locale install (#733)
Browse files Browse the repository at this point in the history
The application locales were not being included in the RPM. This PR
rearranges the location of locales, bringing them up to a top level
directory, and fixes up the installation process.

Adds additional content to the man page and fixes an issue installing it
#200.

This also fixes up a few annoyances caused from the vendoring refactor
in #730.

Also adds a check stage to CI that performs a RPM install and displays
the rpmdb metadata for it.

More #715
Closes #720
  • Loading branch information
jw3 authored Jan 10, 2023
1 parent e585d92 commit 227fcce
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .copr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ dnf: dnf-common
endif

dnf-common:
dnf install -y git openssl-devel dbus-devel python3-devel python3-pip python3-toml python3-beautifulsoup4 python3-requests python3-babel python3-markdown2 itstool
dnf install -y git which openssl-devel dbus-devel python3-devel python3-pip python3-toml python3-beautifulsoup4 python3-requests python3-babel python3-markdown2 itstool
dnf install -y rust-packaging || true
dnf install -y rust-toolset || true
cargo install cargo-vendor-filterer
Expand All @@ -49,7 +49,7 @@ vendor-app:
cp fapolicy-analyzer.tar.gz /tmp/rpmbuild/SOURCES/

vendor-py:
spectool -gf -C /tmp/rpmbuild/SOURCES/ \$(spec)
which spectool && spectool -gf -C /tmp/rpmbuild/SOURCES/ \$(spec) || true

vendor-rs:
cargo check
Expand Down
36 changes: 35 additions & 1 deletion .github/workflows/rpm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -217,8 +217,42 @@ jobs:
path: |
/tmp/archives/*.x86_64.rpm
install:
needs: [ config, srpm, rpm ]
name: Install ${{ matrix.props.dist }}
container: ${{ matrix.props.image }}
runs-on: ubuntu-20.04
strategy:
matrix: ${{ fromJson(needs.config.outputs.matrix )}}
steps:
- uses: actions/checkout@v2

- name: Download rpm artifacts
uses: actions/download-artifact@v3
with:
name: rpm-artifacts
path: /tmp/src/

- name: Checksum artifacts
run: |
sha256sum /tmp/src/*
- name: Enable EPEL
if: startsWith(matrix.props.dist, 'el')
run: |
dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
- name: Install RPM
run: |
dnf install -y /tmp/src/fapolicy-analyzer-*.${{ matrix.props.dist }}.x86_64.rpm
- name: Check RPM
run: |
rpm -qa --dump fapolicy-analyzer
rpm -q fapolicy-analyzer
publish:
needs: [ srpm, rpm, copr ]
needs: [ srpm, rpm, install, copr ]
name: Publish
if: startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-20.04
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -134,14 +134,14 @@ check: header-check format lint test
# Generate Fedora rawhide rpms
fc-rpm:
@echo -e "${GRN}--- Fedora RPM generation...${NC}"
make -f .copr/Makefile vendor
make -f .copr/Makefile vendor OS_ID=fedora
podman build -t fapolicy-analyzer:38 -f Containerfile .
podman run --rm -it --network=none -v /tmp:/v fapolicy-analyzer:38 /v

# Generate RHEL rpms
el-rpm:
@echo -e "${GRN}--- Rhel RPM generation...${NC}"
make -f .copr/Makefile vendor
make -f .copr/Makefile vendor OS_ID=rhel
podman build -t fapolicy-analyzer:el -f scripts/srpm/Containerfile.el .
podman run --rm -it --network=none -v /tmp:/v fapolicy-analyzer:el /v

Expand Down
20 changes: 17 additions & 3 deletions data/fapolicy-analyzer.8
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.SH NAME
fapolicy-analyzer \- Configuration and management of fapolicyd
.SH SYNOPSIS
This application consists of several GUI components:
This application consists of several GUI components that assist with the configuration and management of fapolicyd:
.P
1. Trust Administration
.br
Expand All @@ -12,14 +12,28 @@ This application consists of several GUI components:
3. Policy Profiling
.br
4. Log Analysis

.SH DESCRIPTION
File Access Policy Analyzer is a GUI tool to assist with the configuration and management of fapolicyd.

.SH NOTES
The configuration is located ~/.config/fapolicy-analyzer/config.toml.
.br
The startup script will use polkit to escalate privileges if sudo is not used.
.br

.SH OPTIONS
.TP
.B \-v, \-\-verbose
Enable verbose mode to increase logging output.

.SH FILES
.B ~/.config/fapolicy-analyzer/fapolicy-analyzer.toml
- application configuration
.P

.SH SEE ALSO
fapolicyd(8), fapolicyd.rules(5), fapolicyd.trust(5), fapolicyd-cli(1)
fapolicyd(8), fapolicyd.rules(5), fapolicyd.trust(5)

.SH BUGS
No known bugs.

13 changes: 6 additions & 7 deletions fapolicy-analyzer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ Tools to assist with the configuration and management of fapolicyd.
%prep
%cargo_prep

%autosetup -p0 -n %{name}
%autosetup -n %{name}

# throw out the checked-in lock
# this build will use what is available from the local registry
Expand All @@ -136,24 +136,23 @@ echo %{module_version} > VERSION
%install
%{py3_install_wheel %{module}-%{module_version}*%{_arch}.whl}
%{python3} help install --dest %{buildroot}/%{_datadir}/help
install bin/%{name} %{buildroot}/%{_sbindir}/%{name} -D
install data/fapolicy-analyzer.8 %{buildroot}/%{_mandir}/man8/* -D
install -D bin/%{name} %{buildroot}/%{_sbindir}/%{name}
install -D data/fapolicy-analyzer.8 -t %{buildroot}/%{_mandir}/man8/
desktop-file-install data/fapolicy-analyzer.desktop
find locale -name %{name}.mo -exec cp --parents -rv {} %{buildroot}/%{_datadir} \;
%find_lang %{name} --with-gnome

%post
update-desktop-database

%check
desktop-file-validate %{buildroot}/%{_datadir}/applications/%{name}.desktop

%files -n %{name} -f %{name}.lang
%doc scripts/srpm/README
%license LICENSE
%{python3_sitearch}/%{module}
%{python3_sitearch}/%{module}-%{module_version}*
%attr(755,root,root) %{_sbindir}/fapolicy-analyzer
%attr(644,root,root) %{_mandir}/man8/fapolicy-analyzer.8*
%attr(755,root,root) %{_datadir}/applications/%{name}.desktop
%attr(644,root,root) %{_mandir}/man8/*

%changelog
* Fri Dec 16 2022 John Wass <[email protected]> 1.0.0-1
Expand Down
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions scripts/srpm/fapolicy-analyzer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ python3 setup.py bdist_wheel
install bin/%{name} %{buildroot}/%{_sbindir}/%{name} -D
install data/fapolicy-analyzer.8 %{buildroot}/%{_mandir}/man8/* -D
desktop-file-install data/fapolicy-analyzer.desktop
find locale -name %{name}.mo -exec cp --parents -rv {} %{buildroot}/%{_datadir} \;
%find_lang %{name} --with-gnome

%post
Expand Down
8 changes: 4 additions & 4 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[extract_messages]
mapping_file = babel.cfg
output_file = ./fapolicy_analyzer/locale/fapolicy_analyzer.pot
input_dirs = ./fapolicy_analyzer/ui,./fapolicy_analyzer/glade
input_dirs = fapolicy_analyzer/ui,fapolicy_analyzer/glade
output_file = locale/fapolicy-analyzer.pot

[compile_catalog]
domain = fapolicy_analyzer
directory = ./fapolicy_analyzer/locale
domain = fapolicy-analyzer
directory = locale
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def get_version():
],
include_package_data=True,
package_data={
"fapolicy_analyzer": ["locale/*/LC_MESSAGES/*.mo"],
"fapolicy_analyzer.css": ["*.css"],
"fapolicy_analyzer.glade": ["*.glade"],
"fapolicy_analyzer.resources": ["*"],
Expand Down

0 comments on commit 227fcce

Please sign in to comment.