Blob Blame History Raw
%global provider        github
%global provider_tld    com
%global project         Yelp
%global repo            dumb-init
%global provider_prefix %{provider}.%{provider_tld}/%{project}/%{repo}
%global commit          d283f8a58bea8374c03becf8f06339670f2f07ee
%global shortcommit     %(c=%{commit}; echo ${c:0:7})

%global YYYYMMDD        20170802

Name:           %{repo}
Version:        1.2.0
Release:        1.%{YYYYMMDD}git%{shortcommit}%{?dist}
Summary:        Entry-point for containers that proxies signals
License:        MIT
URL:            https://%{provider_prefix}
Source0:        %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
Patch0:         initscripts.patch

BuildRequires:  gcc, help2man

#To build in rhel6, we just run gcc and help2man.
#Containers do not work in rhel6, python is old, packages are missing, tests will not work
#the following is only for future reference:
#BuildRequires:  python, python2-pytest, python2-mock
# /bin/xxd of vim-common of is needed for non-released versions
# BuildRequires:  vim-common

%description
dumb-init is a simple process supervisor and init system designed to run as
PID 1 inside minimal container environments (such as Docker).

* It can handle orphaned zombie processes.
* It can pass signals properly for simple containers.

%prep
%setup -q -n %{name}-%{commit}
%patch0 -p1 -b .initscripts

%build
gcc -std=gnu99 %{optflags} -o %{name} dumb-init.c

#a wrapper to redirect stderr for old help2man
cat <<EOF >%{name}.wrapper
#!/bin/bash
./dumb-init "\$@" 2>&1
EOF

chmod a+x %{name}.wrapper
help2man --include debian/help2man --no-info --name '%{summary}' ./%{name}.wrapper> %{name}.1
rm %{name}.wrapper

#sadly, in rhel6, no containers, no tests
#%%check
#PATH=.:$PATH py.test tests/

%install
install -Dpm0755 %{name} %{buildroot}%{_bindir}/%{name}
install -Dpm0644 %{name}.1 %{buildroot}%{_mandir}/man1/%{name}.1

%files
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.1*
%doc README.md LICENSE

%changelog
* Mon Aug 21 2017 Frantisek Kluknavsky <fkluknav@redhat.com> - 1.2.0-2.20170802gitd283f8a
- rebased and heavily adapted for rhel6

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 1.1.3-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Wed Aug 31 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-10
- revert to python2

* Wed Aug 31 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-9
- support epel

* Fri Aug 26 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-8
- run tests

* Wed Aug 17 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-7
- let manpage automatically marked as document

* Wed Aug 17 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-6
- remove gzip after help2man
- add missing BuildRequire

* Wed Aug 17 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-4
- install 644 for manpage

* Wed Aug 17 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-3
- remove vim-common and use install

* Mon Aug 15 2016 Muayyad Alsadi <alsadi@gmail.com> - 1.1.3-2
- initial packaging