# RPM Specific %define python_package_src command_line_assistant %define binary_name c %define daemon_binary_name clad # SELinux specific %define relabel_files() \ restorecon -R /usr/sbin/clad; \ restorecon -R /etc/xdg/command-line-assistant/config.toml; \ restorecon -R /etc/xdg/command-line-assistant; \ restorecon -R /var/lib/command-line-assistant; \ restorecon -R /var/log/command-line-assistant; \ restorecon -R /var/log/command-line-assistant/audit.log; \ %define selinux_policyver 41.27-1 %define selinuxtype targeted %define modulename %{daemon_binary_name} Name: command-line-assistant Version: 0.1.0 Release: 1.20250117171627620349.pr122.61.g0eb4e27%{?dist} Summary: A simple wrapper to interact with RAG License: Apache-2.0 URL: https://github.com/rhel-lightspeed/command-line-assistant Source0: command-line-assistant-0.1.0.tar.gz # noarch because there is no extension module for this package. BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-wheel BuildRequires: python3-pip BuildRequires: systemd-units # Build dependencies for SELinux policy BuildRequires: selinux-policy-devel Requires: python3-dasbus Requires: python3-requests Requires: python3-sqlalchemy Requires: systemd # Add selinux subpackge as dependency Requires: %{name}-selinux # Not needed after RHEL 10 as it is native in Python 3.11+ %if 0%{?rhel} && 0%{?rhel} < 10 BuildRequires: python3-tomli Requires: python3-tomli %endif # Ref: https://docs.fedoraproject.org/en-US/packaging-guidelines/Python_201x/#_automatically_generated_dependencies %{?python_disable_dependency_generator} %description A simple wrapper to interact with RAG %package selinux Summary: CLAD SELinux policy BuildArch: noarch Requires: selinux-policy-%{selinuxtype} Requires(post): selinux-policy-%{selinuxtype} %description selinux This package installs and sets up the SELinux policy security module for clad. %prep %autosetup -n command-line-assistant-0.1.0 %build %py3_build_wheel # Build selinux policy file pushd data/release/selinux %{__make} %{modulename}.pp.bz2 popd %install %py3_install_wheel %{python_package_src}-%{version}-py3-none-any.whl # Create needed directories in buildroot %{__install} -d %{buildroot}/%{_sbindir} %{__install} -d %{buildroot}/%{_sysconfdir}/xdg/%{name} %{__install} -d %{buildroot}/%{_sharedstatedir}/%{name} %{__install} -d %{buildroot}/%{_localstatedir}/log/%{name} %{__install} -d %{buildroot}/%{_mandir}/man1 %{__install} -d %{buildroot}/%{_mandir}/man8 %{__install} -d %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype} # Move the daemon to /usr/sbin instead of /usr/bin %{__install} -m 0755 %{buildroot}/%{_bindir}/%{daemon_binary_name} %{buildroot}/%{_sbindir}/%{daemon_binary_name} %{__rm} %{buildroot}/%{_bindir}/%{daemon_binary_name} # System units %{__install} -D -m 0644 data/release/systemd/%{daemon_binary_name}.service %{buildroot}/%{_unitdir}/%{daemon_binary_name}.service # d-bus policy config %{__install} -D -m 0644 data/release/dbus/com.redhat.lightspeed.conf %{buildroot}/%{_sysconfdir}/dbus-1/system.d/com.redhat.lightspeed.conf %{__install} -D -m 0644 data/release/dbus/com.redhat.lightspeed.query.service %{buildroot}/%{_datadir}/dbus-1/system-services/com.redhat.lightspeed.query.service %{__install} -D -m 0644 data/release/dbus/com.redhat.lightspeed.history.service %{buildroot}/%{_datadir}/dbus-1/system-services/com.redhat.lightspeed.history.service # Config file %{__install} -D -m 0644 data/release/xdg/config.toml %{buildroot}/%{_sysconfdir}/xdg/%{name}/config.toml # Manpages %{__install} -D -m 0644 data/release/man/%{binary_name}.1 %{buildroot}/%{_mandir}/man1/%{binary_name}.1 %{__install} -D -m 0644 data/release/man/%{daemon_binary_name}.8 %{buildroot}/%{_mandir}/man8/%{daemon_binary_name}.8 # selinux %{__install} -m 0644 data/release/selinux/%{modulename}.pp.bz2 %{buildroot}%{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 %preun %systemd_preun %{daemon_binary_name}.service %pre selinux %selinux_relabel_pre -s %{selinuxtype} %post %systemd_post %{daemon_binary_name}.service %post selinux %selinux_modules_install -s %{selinuxtype} %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 %postun %systemd_postun_with_restart %{daemon_binary_name}.service %postun selinux if [ $1 -eq 0 ]; then %selinux_modules_uninstall -s %{selinuxtype} %{modulename} fi %posttrans selinux %selinux_relabel_post -s %{selinuxtype} %files %doc README.md %license LICENSE %{python3_sitelib}/%{python_package_src}/ %{python3_sitelib}/%{python_package_src}-%{version}.dist-info/ # Binaries %{_bindir}/%{binary_name} %{_sbindir}/%{daemon_binary_name} # System units %{_unitdir}/%{daemon_binary_name}.service # d-bus policy config %config %{_sysconfdir}/dbus-1/system.d/com.redhat.lightspeed.conf %{_datadir}/dbus-1/system-services/com.redhat.lightspeed.query.service %{_datadir}/dbus-1/system-services/com.redhat.lightspeed.history.service # Config file %config %{_sysconfdir}/xdg/%{name}/config.toml # Manpages %{_mandir}/man1/%{binary_name}.1.gz %{_mandir}/man8/%{daemon_binary_name}.8.gz # Needed directories %dir %{_sharedstatedir}/%{name} %dir %{_localstatedir}/log/%{name} %files selinux %attr(0600,root,root) %{_datadir}/selinux/packages/%{selinuxtype}/%{modulename}.pp.bz2 %ghost %verify(not md5 size mode mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename} %changelog * Fri Jan 17 2025 Packit - 0.1.0-1.20250117171627620349.pr122.61.g0eb4e27 - Update .packit.yaml (Rodolfo Olivieri) - Try fedora builds (#121) (Rodolfo Olivieri) - Remove caret handling from query submission (#119) (Rodolfo Olivieri) - Cleaning up leftover things (#117) (Rodolfo Olivieri) - [RHEL-68636, RHEL-68637] Update packaging to include selinux custom policy (#103) (Rodolfo Olivieri) - Fix returncode when running commands (#116) (Rodolfo Olivieri) - Remove json history from rpm spec (#115) (Rodolfo Olivieri) - Update rpm changelog (#114) (Rodolfo Olivieri) - Update manpages for RH1 (#113) (Rodolfo Olivieri) - Add user_id to history tables. (#112) (Rodolfo Olivieri) - Fix ordering from history results (#111) (Rodolfo Olivieri) - [RSPEED-416] Migrate JSON history cache to database solution (#108) (Rodolfo Olivieri) - Fix CodeQL workflow to run on develop (#110) (Rodolfo Olivieri) - Add --input for query subcommand (#107) (Rodolfo Olivieri) - Add missing dependency for readthedocs (#106) (Rodolfo Olivieri) - Add new dependencies for readthedocs to build (#105) (Rodolfo Olivieri) - Implement a basic user session management (#104) (Rodolfo Olivieri) - Include a filter option for history management (#101) (Rodolfo Olivieri) - [RSPEED-408] Add audit logging to stdout (#99) (Rodolfo Olivieri) - Fix config.toml for release and devel path (#98) (Rodolfo Olivieri) - Allow only deterministic tests to be run. (#89) (Martin "kokesak" Litwora) - [pre-commit.ci] pre-commit autoupdate (#97) (pre-commit-ci[bot]) - Remove record command (#95) (Rodolfo Olivieri) - Update legal message (#94) (Rodolfo Olivieri) - Small code refactor for outputting text (#93) (Rodolfo Olivieri) - Normalize the folder name to command-line-assistant (#96) (Rodolfo Olivieri) - [RSPEED-388] Add exception handling for SSL certificates (#87) (Rodolfo Olivieri) - Add audit logging capability to CLAD (#90) (Rodolfo Olivieri) - [RSPEED-403] Prevent binary stdin (#92) (Rodolfo Olivieri) - [RSPEED-334] Generate manpages for CLA and CLAD (#91) (Rodolfo Olivieri) - Apply NO_COLOR to colored output (#88) (Rodolfo Olivieri) - Small modifications to CONTRIBUTING.md (#86) (Rodolfo Olivieri) - Remove colorama dependency and use only unicodes (#85) (Rodolfo Olivieri) - Fix makefile systemd comment (#84) (Rodolfo Olivieri) - Fix query read from stdin (#83) (Rodolfo Olivieri) - Fix build path (#82) (Rodolfo Olivieri) - Fix readthedocs yaml config (#81) (Rodolfo Olivieri) - Add readthedocs build support (#80) (Rodolfo Olivieri) - Add sphinx docs (#79) (Rodolfo Olivieri) - Add 100% docstring coverage (#78) (Rodolfo Olivieri) - Update dependency coverage to v7.6.10 (#77) (renovate[bot]) - Update systemd release units to be d-bus activable (#72) (Rodolfo Olivieri) - Improve error handling (#76) (Rodolfo Olivieri) - Query against rlsrag (#75) (Rodolfo Olivieri) - Add local history management and improve the command (#74) (Rodolfo Olivieri) - The connect_signals was triggered the API request twice (#73) (Rodolfo Olivieri) - Add schema for input/output queries and history (#70) (Rodolfo Olivieri) - Switch to system bus instead of session bus (#69) (Rodolfo Olivieri) - Split the query and history dbus implementations (#66) (Rodolfo Olivieri) - Update specfile to include config from release dir (#68) (Rodolfo Olivieri) - Enable copr builds in develop (#67) (Rodolfo Olivieri) - [RSPEED-279] Add Command Line Assistant Daemon (#58) (Rodolfo Olivieri) - Update dependency coverage to v7.6.9 (#60) (renovate[bot]) - Add an experimental rendering module for client (#62) (Rodolfo Olivieri) - Refactor the CLI to be separate commands (#61) (Rodolfo Olivieri) - Add Pull Request template to keep description orgainzed (#49) (Rodolfo Olivieri) - Update dependency pytest to v8.3.4 (#57) (renovate[bot]) - Add CODEOWNERS file (#52) (Rodolfo Olivieri) - Remove container testing from pipeline (#51) (Martin "kokesak" Litwora) - Add more test cases to cover the recent features (#34) (Rodolfo Olivieri) - Update dependency coverage to v7.6.8 (#48) (renovate[bot]) * Wed Jan 22 2025 Rodolfo Olivieri 0.2.0 - Add workaround for SQLite UUID types - Update packaging to include selinux custom policy - Fix returncode when running commands - Refactor the CLI to be separate commands - Add an experimental rendering module for client - Add Command Line Assistant Daemon - Update specfile to include config from release dir - Split the query and history dbus implementations - Switch to system bus instead of session bus - Add schema for input/output queries and history - The connect_signals was triggered the API request twice - Add local history management and improve the command - Query against rlsrag - Improve error handling - Update systemd units to be socket activated - Add 100% docstring coverage - Fix query read from stdin - Remove colorama dep - Apply NO_COLOR to colored output - Generate manpages for CLA and CLAD - Prevent binary stdin - Add audit logging capability to CLAD - Add exception handling for SSL certificates - Normalize the folder name to command-line-assistant - Small code refactor for outputting text - Update legal message - Remove record command - Fix config.toml for release and devel - Add audit logging to stdout - Add filter history option - Implement a basic user session management - Add input field for query by - Migrate JSON history cache to database solution - Fix ordering from history results - Add user_id to history tables. - Update manpages for RH1 * Mon Nov 25 2024 Rodolfo Olivieri 0.1.0 - Initial release of Command Line Assistant - Rework config file handler and history - Remove leftover yaml import from utils - Fix config and history wrong paths - Add option to disable SSL verification on backend - Drop builds for EPEL 8 - Remove leftover yaml config file - Refactor to use dataclasses instead of namedtuple - Improve logging - Transform dict to schema config - Append stdin to the user query - Convert the config class to be a dataclass - Remove use of slots in dataclasses