Accepting request 761536 from home:namtrac:branches:Base:System

- Even more cleanups
- Use upstream tarball

OBS-URL: https://build.opensuse.org/request/show/761536
OBS-URL: https://build.opensuse.org/package/show/Base:System/earlyoom?expand=0&rev=4
This commit is contained in:
OBS User embar- 2020-01-08 16:39:10 +00:00 committed by Git OBS Bridge
parent 7ee727b5fb
commit f17188c495
3 changed files with 13 additions and 36 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:dbc396661e0e5a0a3b7664b9469349342ef9b5d3904e0ec2a9b8bb61a0374b52
size 28106

3
earlyoom-1.3.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2c605017d1208e43b92708e9bae623bc860b6ab2e5390c935e5e10ac932016f8
size 31399

View File

@ -16,20 +16,20 @@
#
%global rpm_version %(rpm -q --qf %%{version} rpm)
%if ! 0%{?_fillupdir:1}
%global _fillupdir %{_localstatedir}/adm/fillup-templates
%endif
Name: earlyoom
Version: 1.3
Release: 0%{?extraver:0.}1%{?dist}
Release: 0
Summary: Early OOM Daemon for Linux
License: MIT
Group: System/Daemons
URL: https://github.com/rfjakob/earlyoom
Source0: %{name}-%{version}.tar.bz2
Source0: https://github.com/rfjakob/earlyoom/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
Source11: earlyoom.sysconfig
# pandoc only for `pandoc MANPAGE.md -s -t man > earlyoom.1`, thus could be excluded if earlyoom.1 would be provided.
# pandoc only for `pandoc MANPAGE.md -s -t man > earlyoom.1`
BuildRequires: pandoc
BuildRequires: pkgconfig
BuildRequires: pkgconfig(systemd)
@ -41,29 +41,21 @@ Conflicts: oomd
earlyoom checks the amount of available memory and free swap, and if both are
below critical level, it will kill the largest process (highest oom_score).
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{name}-%{version}%{?extraver}
%setup -q
# Fix defaults file location
sed -i 's|/default/|/sysconfig/|' earlyoom.service.in
# CentOS' gzip does not have option `-k`
sed -i 's|gzip -f -k.*$|gzip -c $< > $@|' Makefile
# Fix LDFLAGS handling
sed -ri '/LDFLAGS/ s|$| -lrt|' Makefile
# Build step (compile/build binaries, documentation, etc)
%build
_CFLAGS='%{optflags} %{?gcc_lto} -Wall -Wextra -DVERSION=\"%{version}\" -fstack-protector-all -std=gnu99'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}'
make %{?_smp_mflags} \
CFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
CFLAGS='%{optflags} -DVERSION=\"%{version}\" -std=gnu99'
make %{?_smp_mflags} CFLAGS="$CFLAGS"
# Install built stuff
%install
make install DESTDIR=%{buildroot} \
SYSTEMDUNITDIR=%{_unitdir} \
PREFIX=%{_prefix}
%make_install PREFIX=%{_prefix} SYSTEMDUNITDIR=%{_unitdir}
install -D -m644 %{SOURCE11} %{buildroot}%{_fillupdir}/sysconfig.%{name}
# Files list
@ -76,32 +68,17 @@ install -D -m644 %{SOURCE11} %{buildroot}%{_fillupdir}/sysconfig.%{name}
%{_fillupdir}/sysconfig.%{name}
%{_mandir}/man1/earlyoom.1%{?ext_man}
%if 0%{?_unitdir:1}
%pre
%{service_add_pre %{name}.service}
%endif
%post
%if 0%{?_unitdir:1}
%{fillup_only %{name}}
%{service_add_post %{name}.service}
%else
%{fillup_and_insserv %{name}}
%endif
%preun
%if 0%{?_unitdir:1}
%{service_del_preun %{name}.service}
%else
%{stop_on_removal %{name}}
%endif
%postun
%if 0%{?_unitdir:1}
%{service_del_postun %{name}.service}
%else
%{restart_on_update %{name}}
%endif
%insserv_cleanup
%changelog