Name:   ublue-update
Vendor: ublue-os
Version:  1.2.5.a379c62
Release:  1%{?dist}
Summary:  Centralized update service/checker made for Universal Blue
License:  Apache-2.0
URL:      https://github.com/%{vendor}/%{name}
# Detailed information about the source Git repository and the source commit
# for the created rpm package
VCS:        git+https://github.com/akdev1l/ublue-update.git#a379c62042fa4eeba6d688016763dd6ac4114535:

# git_dir_pack macro places the repository content (the source files) into a tarball
# and returns its filename. The tarball will be used to build the rpm.
Source:     ublue-update-a379c620.tar.gz

BuildArch:     noarch
Supplements:   rpm-ostree flatpak
BuildRequires: make
BuildRequires: systemd-rpm-macros
BuildRequires: black
BuildRequires: ShellCheck
BuildRequires: python-flake8
BuildRequires: python-build
BuildRequires: python-setuptools
BuildRequires: python
BuildRequires: python-pip
BuildRequires: python-devel
BuildRequires: pyproject-rpm-macros
BuildRequires: python-setuptools_scm
BuildRequires: python-wheel
Requires: skopeo
Requires: libnotify

%global sub_name %{lua:t=string.gsub(rpm.expand("%{NAME}"), "^ublue%-", ""); print(t)}

%description
Installs and configures ublue-update script, systemd services, and systemd timers for auto update

%prep
%setup -T -b 0 -q -n ublue-update

%build
ls
ls src
black src
flake8 src
shellcheck files/etc/%{NAME}.d/*.sh
%pyproject_wheel

%install
%pyproject_install
%pyproject_save_files ublue_update
cp -rp files/etc files/usr %{buildroot}

%post
%systemd_user_post %{NAME}.timer

%preun
%systemd_user_preun %{NAME}.timer

%files -f %{pyproject_files}
%attr(0755,root,root) %{_bindir}/%{name}
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/user/%{NAME}.service
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/user/%{NAME}.timer
%attr(0644,root,root) %{_exec_prefix}/lib/systemd/user-preset/00-%{NAME}.preset
%attr(0644,root,root) %{_exec_prefix}/etc/%{NAME}/%{NAME}.toml
%attr(0755,root,root) %{_sysconfdir}/%{NAME}.d/*.sh

%changelog
%autochangelog