| 1 |
# This rpmbuild.spec is designed for the OpenSUSE Build Service |
| 2 |
# to build packages for CentOS, Fedora, and OpenSUSE. |
| 3 |
|
| 4 |
# Fedora docs deprecate: |
| 5 |
# * Group |
| 6 |
# * BuildRoot |
| 7 |
# * %clean |
| 8 |
# https://docs.fedoraproject.org/en-US/packaging-guidelines/ |
| 9 |
|
| 10 |
# openSUSE docs deprecate: |
| 11 |
# * Group |
| 12 |
# * %clean |
| 13 |
# https://en.opensuse.org/openSUSE:Specfile_guidelines |
| 14 |
|
| 15 |
# Standard macro definitions on OBS. |
| 16 |
# openSUSE:Leap:15.6 reports suse_version 1500 |
| 17 |
# openSUSE:Leap:16.0 reports suse_version 1600 |
| 18 |
# openSUSE:Slowroll reports suse_version=1699 |
| 19 |
# openSUSE:Tumbleweed reports suse_version=1699 |
| 20 |
# CentOS_9_Stream reports centos_version=900 |
| 21 |
# Fedora 41 reports fedora_version=41 |
| 22 |
|
| 23 |
%define pyexe %{__python3} |
| 24 |
|
| 25 |
%if 0%{?fedora_version} || 0%{?rhel_version} || 0%{?centos_version} || 0%{?almalinux_version} || 0%{?rocky_version} |
| 26 |
%define is_redhat_family 1 |
| 27 |
%else |
| 28 |
%define is_redhat_family 0 |
| 29 |
%endif |
| 30 |
|
| 31 |
%if 0%{?is_opensuse} |
| 32 |
%define pyprefix %{modern_python} |
| 33 |
%define is_leap 0 |
| 34 |
%if 0%{?suse_version} <= 1600 |
| 35 |
%define is_leap 1 |
| 36 |
%endif # suse_version <= 1600 |
| 37 |
%if 0%{?suse_version} == 1500 |
| 38 |
%define pyexe /usr/bin/python3.11 |
| 39 |
%endif # suse_version == 1500 |
| 40 |
%endif # is_opensuse |
| 41 |
|
| 42 |
%if !0%{?is_opensuse} && !%{is_redhat_family} |
| 43 |
%{error:This package is only for openSUSE or Red Hat family distributions} |
| 44 |
%endif |
| 45 |
|
| 46 |
%if 0%{?almalinux_version} |
| 47 |
%define has_fdupes 0 |
| 48 |
%else |
| 49 |
%define has_fdupes 1 |
| 50 |
%endif |
| 51 |
|
| 52 |
# Fedora 42 unified /usr/sbin https://fedoraproject.org/wiki/Changes/Unify_bin_and_sbin |
| 53 |
%if "%{_bindir}" == "%{_sbindir}" |
| 54 |
%define has_sbin 0 |
| 55 |
%else |
| 56 |
%define has_sbin 1 |
| 57 |
%endif |
| 58 |
|
| 59 |
Name: bleachbit |
| 60 |
Version: 6.0.4 |
| 61 |
Release: 1%{?dist} |
| 62 |
Summary: Remove unnecessary files, free space, and maintain privacy |
| 63 |
License: GPL-3.0-or-later |
| 64 |
URL: https://www.bleachbit.org |
| 65 |
Source0: %{name}-%{version}.tar.gz |
| 66 |
BuildArch: noarch |
| 67 |
|
| 68 |
%if %{is_redhat_family} |
| 69 |
BuildRequires: desktop-file-utils |
| 70 |
BuildRequires: gettext |
| 71 |
BuildRequires: python3-psutil |
| 72 |
BuildRequires: python3-requests |
| 73 |
BuildRequires: python3-setuptools |
| 74 |
Requires(post): desktop-file-utils |
| 75 |
Requires(postun): desktop-file-utils |
| 76 |
Requires: python3 |
| 77 |
Requires: gtk3 |
| 78 |
Requires: python3-gobject |
| 79 |
Requires: python3-psutil |
| 80 |
Requires: python3-requests |
| 81 |
%endif |
| 82 |
|
| 83 |
%if 0%{?is_opensuse} |
| 84 |
BuildRequires: desktop-file-utils |
| 85 |
BuildRequires: make |
| 86 |
BuildRequires: %{pyprefix} |
| 87 |
BuildRequires: python-rpm-macros |
| 88 |
BuildRequires: %{pyprefix}-base |
| 89 |
# Leap 16.0 split the unversioned /usr/bin/python3 symlink into a separate |
| 90 |
# python3-base package that is no longer pulled in transitively by |
| 91 |
# python313-base. Require it explicitly so %{__python3} resolves. |
| 92 |
%if 0%{?suse_version} == 1600 |
| 93 |
BuildRequires: python3-base |
| 94 |
%endif |
| 95 |
BuildRequires: %{pyprefix}-psutil |
| 96 |
BuildRequires: %{pyprefix}-requests |
| 97 |
BuildRequires: %{pyprefix}-setuptools |
| 98 |
%if ! %{is_leap} |
| 99 |
BuildRequires: %{pyprefix}-sqlite-utils |
| 100 |
%endif |
| 101 |
BuildRequires: %{pyprefix}-xml |
| 102 |
BuildRequires: update-desktop-files |
| 103 |
Requires: gobject-introspection |
| 104 |
Requires: %{pyprefix} |
| 105 |
Requires: %{pyprefix}-gobject |
| 106 |
Requires: %{pyprefix}-gobject-Gdk |
| 107 |
Requires: %{pyprefix}-psutil |
| 108 |
Requires: %{pyprefix}-requests |
| 109 |
%if ! %{is_leap} |
| 110 |
Requires: %{pyprefix}-sqlite-utils |
| 111 |
%endif |
| 112 |
Requires: %{pyprefix}-xml |
| 113 |
Requires: typelib(Gtk) = 3.0 |
| 114 |
Requires: typelib(Notify) |
| 115 |
Requires: xdg-utils |
| 116 |
Recommends: libayatana-appindicator3-1 |
| 117 |
%endif |
| 118 |
|
| 119 |
%if %{has_fdupes} |
| 120 |
BuildRequires: fdupes |
| 121 |
%endif |
| 122 |
|
| 123 |
%description |
| 124 |
BleachBit frees disk space and maintains privacy by quickly removing |
| 125 |
unnecessary files such as cache, cookies, browser history, temporary |
| 126 |
files, and system logs. It can also shred files and clean free disk |
| 127 |
space to prevent data recovery. |
| 128 |
|
| 129 |
%prep |
| 130 |
%setup -q |
| 131 |
%{pyexe} -V |
| 132 |
|
| 133 |
|
| 134 |
%build |
| 135 |
%{pyexe} setup.py build |
| 136 |
cp org.bleachbit.BleachBit.desktop org.bleachbit.BleachBit-root.desktop |
| 137 |
sed -i -e 's/Name=BleachBit$/Name=BleachBit as Administrator/g' org.bleachbit.BleachBit-root.desktop |
| 138 |
|
| 139 |
%if %{is_redhat_family} |
| 140 |
|
| 141 |
cat > bleachbit.pam <<EOF |
| 142 |
#%%PAM-1.0 |
| 143 |
auth include config-util |
| 144 |
account include config-util |
| 145 |
session include config-util |
| 146 |
EOF |
| 147 |
|
| 148 |
cat > bleachbit.console <<EOF |
| 149 |
USER=root |
| 150 |
PROGRAM=/usr/bin/bleachbit |
| 151 |
SESSION=true |
| 152 |
EOF |
| 153 |
|
| 154 |
%endif |
| 155 |
|
| 156 |
make delete_windows_files |
| 157 |
|
| 158 |
|
| 159 |
%install |
| 160 |
make install PYTHON=%{pyexe} DESTDIR=%{buildroot} prefix=%{_prefix} |
| 161 |
|
| 162 |
%if %{is_redhat_family} |
| 163 |
|
| 164 |
sed -i -e 's/Exec=bleachbit$/Exec=bleachbit-root/g' org.bleachbit.BleachBit-root.desktop |
| 165 |
|
| 166 |
desktop-file-install \ |
| 167 |
--dir=%{buildroot}/%{_datadir}/applications/ \ |
| 168 |
--vendor="" org.bleachbit.BleachBit-root.desktop |
| 169 |
|
| 170 |
# consolehelper and userhelper |
| 171 |
ln -s consolehelper %{buildroot}/%{_bindir}/%{name}-root |
| 172 |
%if %{has_sbin} |
| 173 |
mkdir -p %{buildroot}/%{_sbindir} |
| 174 |
ln -s ../..%{_bindir}/%{name} %{buildroot}/%{_sbindir}/%{name}-root |
| 175 |
%endif |
| 176 |
mkdir -p %{buildroot}%{_sysconfdir}/pam.d |
| 177 |
install -m 644 %{name}.pam %{buildroot}%{_sysconfdir}/pam.d/%{name}-root |
| 178 |
mkdir -p %{buildroot}%{_sysconfdir}/security/console.apps |
| 179 |
install -m 644 %{name}.console %{buildroot}%{_sysconfdir}/security/console.apps/%{name}-root |
| 180 |
|
| 181 |
%endif |
| 182 |
|
| 183 |
|
| 184 |
%if 0%{?is_opensuse} |
| 185 |
sed -i -e 's/^Exec=bleachbit$/Exec=xdg-su -c bleachbit/g' org.bleachbit.BleachBit-root.desktop |
| 186 |
|
| 187 |
desktop-file-install \ |
| 188 |
--dir=%{buildroot}/%{_datadir}/applications/ \ |
| 189 |
--vendor="" org.bleachbit.BleachBit-root.desktop |
| 190 |
|
| 191 |
%suse_update_desktop_file -i org.bleachbit.BleachBit-root Utility Filesystem |
| 192 |
|
| 193 |
%suse_update_desktop_file org.bleachbit.BleachBit Utility Filesystem |
| 194 |
%endif |
| 195 |
|
| 196 |
desktop-file-validate %{buildroot}/%{_datadir}/applications/org.bleachbit.BleachBit.desktop |
| 197 |
desktop-file-validate %{buildroot}/%{_datadir}/applications/org.bleachbit.BleachBit-root.desktop |
| 198 |
|
| 199 |
make -C po install DESTDIR=%{buildroot} |
| 200 |
%find_lang %{name} |
| 201 |
|
| 202 |
%if %{has_fdupes} |
| 203 |
# Make symlinks for redundant .pyc files. |
| 204 |
%fdupes -s %{buildroot} |
| 205 |
%endif |
| 206 |
|
| 207 |
|
| 208 |
%check |
| 209 |
%{pyexe} bleachbit.py --sysinfo |
| 210 |
%{pyexe} bleachbit.py -l | wc -l |
| 211 |
%{pyexe} bleachbit.py -p system.cache | wc -l |
| 212 |
%{pyexe} -m unittest -v tests.TestFileUtilities tests.TestUnix |
| 213 |
|
| 214 |
|
| 215 |
%if %{is_redhat_family} |
| 216 |
%post |
| 217 |
update-desktop-database &> /dev/null ||: |
| 218 |
|
| 219 |
%postun |
| 220 |
update-desktop-database &> /dev/null ||: |
| 221 |
%endif |
| 222 |
|
| 223 |
|
| 224 |
%files -f %{name}.lang |
| 225 |
%defattr(-,root,root,-) |
| 226 |
%doc README.md |
| 227 |
%license COPYING |
| 228 |
%if %{is_redhat_family} |
| 229 |
%config(noreplace) %{_sysconfdir}/pam.d/%{name}-root |
| 230 |
%config(noreplace) %{_sysconfdir}/security/console.apps/%{name}-root |
| 231 |
%{_bindir}/%{name}-root |
| 232 |
%if %{has_sbin} |
| 233 |
%{_sbindir}/%{name}-root |
| 234 |
%endif |
| 235 |
%endif |
| 236 |
%{_bindir}/%{name} |
| 237 |
%{_datadir}/metainfo/org.bleachbit.BleachBit.metainfo.xml |
| 238 |
%{_datadir}/applications/org.bleachbit.BleachBit.desktop |
| 239 |
%{_datadir}/applications/org.bleachbit.BleachBit-root.desktop |
| 240 |
%{_datadir}/%{name}/ |
| 241 |
%{_datadir}/pixmaps/%{name}.png |
| 242 |
%dir %{_datadir}/polkit-1 |
| 243 |
%dir %{_datadir}/polkit-1/actions |
| 244 |
%{_datadir}/polkit-1/actions/org.bleachbit.policy |
| 245 |
|
| 246 |
|
| 247 |
%changelog |
| 248 |
|
| 249 |
* Tue Mar 18 2025 Andrew Ziem <[email protected]> - 6.0.4-1 |
| 250 |
- Update to 6.0.4 |
| 251 |
- See https://www.bleachbit.org/news |