Accepting request 620080 from home:StefanBruens:branches:devel:tools:building

- Add firewalld rules, remove SuSEFirewall2 config
- Add systemd service units for icecream, icecream-scheduler
- Create socket and environment directories using tmpfiles.d
- Strip no longer needed options from config file
- Spec file cleanup:
  - remove cruft for 12.2 and older
  - use %license tag

OBS-URL: https://build.opensuse.org/request/show/620080
OBS-URL: https://build.opensuse.org/package/show/devel:tools:building/icecream?expand=0&rev=64
This commit is contained in:
Martin Pluskal 2018-07-17 12:02:01 +00:00 committed by Git OBS Bridge
parent 954b59f105
commit c474bdd3d0
10 changed files with 199 additions and 21 deletions

10
icecc-scheduler-wrapper Normal file
View File

@ -0,0 +1,10 @@
#! /bin/sh
params=""
if test -n "$ICECREAM_NETNAME"; then
params="$params -n $ICECREAM_NETNAME"
fi
exec /usr/sbin/icecc-scheduler $params

13
icecc-scheduler.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Icecream distributed compiler scheduler
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/icecream
User=icecc
Group=icecc
SyslogIdentifier=icecc-scheduler
ExecStart=/usr/lib/icecc/icecc-scheduler-wrapper
[Install]
WantedBy=multi-user.target

8
icecc-scheduler.xml Normal file
View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Icecream scheduler</short>
<description>Icecream is a distributed compiler daemon. Enable this option if this host runs the scheduler.</description>
<port protocol="tcp" port="8765"/>
<port protocol="tcp" port="8766"/><!-- Telnet interface -->
<port protocol="udp" port="8765"/><!-- Broadcast/discovery port -->
</service>

25
iceccd-wrapper Normal file
View File

@ -0,0 +1,25 @@
#! /bin/sh
params=""
if test -n "$ICECREAM_NETNAME"; then
params="$params -n $ICECREAM_NETNAME"
fi
if test -n "$ICECREAM_SCHEDULER_HOST"; then
params="$params -s $ICECREAM_SCHEDULER_HOST"
fi
if test "$ICECREAM_ALLOW_REMOTE" = "no" 2> /dev/null; then
params="$params --no-remote"
fi
if test -n "$ICECREAM_MAX_JOBS"; then
if test "$ICECREAM_MAX_JOBS" -eq 0 2> /dev/null; then
params="$params -m 1 --no-remote"
else
params="$params -m $ICECREAM_MAX_JOBS"
fi
fi
exec /usr/sbin/iceccd $@ $params

13
iceccd.service Normal file
View File

@ -0,0 +1,13 @@
[Unit]
Description=Icecream Distributed Compiler
After=network.target nss-lookup.target
[Service]
Type=simple
EnvironmentFile=-/etc/sysconfig/icecream
SyslogIdentifier=iceccd
ExecStart=/usr/lib/icecc/iceccd-wrapper -u icecream -vv -b /var/cache/icecream/
Nice=5
[Install]
WantedBy=multi-user.target

7
iceccd.xml Normal file
View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>Icecream compiler daemon (iceccd)</short>
<description>Icecream is a distributed compiler daemon. Enable this option if this host is a compile node.</description>
<port protocol="tcp" port="10245"/>
<source-port port="8765" protocol="udp"/><!-- scheduler announcements -->
</service>

4
icecream-tmpfiles.conf Normal file
View File

@ -0,0 +1,4 @@
# See tmpfiles.d(5) for details
#Type Path Mode UID GID Age Argument
d /run/icecc 0775 root icecream -
Z /var/cache/icecream 0755 icecream icecream -

View File

@ -1,3 +1,14 @@
-------------------------------------------------------------------
Fri Jun 29 01:18:26 UTC 2018 - stefan.bruens@rwth-aachen.de
- Add firewalld rules, remove SuSEFirewall2 config
- Add systemd service units for icecream, icecream-scheduler
- Create socket and environment directories using tmpfiles.d
- Strip no longer needed options from config file
- Spec file cleanup:
- remove cruft for 12.2 and older
- use %license tag
-------------------------------------------------------------------
Wed Jan 3 08:46:20 UTC 2018 - mpluskal@suse.com

View File

@ -24,23 +24,33 @@ Name: icecream
Version: 1.1
Release: 0
Summary: For Distributed Compile in the Network
License: GPL-2.0+ AND LGPL-2.1+
License: GPL-2.0-or-later AND LGPL-2.1-or-later
Group: Development/Tools/Building
URL: https://github.com/icecc/icecream
Source0: https://github.com/icecc/icecream/archive/%{version}.tar.gz
Source1: iceccd.xml
Source2: iceccd.service
Source3: iceccd-wrapper
Source4: icecc-scheduler.xml
Source5: icecc-scheduler.service
Source6: icecc-scheduler-wrapper
Source7: icecream-tmpfiles.conf
Source8: sysconfig.icecream
BuildRequires: docbook2x
BuildRequires: firewall-macros
BuildRequires: gcc-c++
BuildRequires: libcap-ng-devel
BuildRequires: libtool
BuildRequires: libxslt-tools
BuildRequires: lzo-devel
BuildRequires: systemd-rpm-macros
Requires: %{_bindir}/bzip2
Requires: /bin/tar
Requires: logrotate
Requires(pre): %fillup_prereq
Requires(pre): %insserv_prereq
Requires(pre): %{_sbindir}/groupadd
Requires(pre): %{_sbindir}/useradd
%{?systemd_requires}
Recommends: gcc-c++
%if 0%{?suse_version} > 1315
BuildRequires: clang-devel
@ -70,6 +80,7 @@ Wrapper symlinks for clang/clang++ for icecream distributed building.
%prep
%setup -q
cp %{SOURCE8} suse/
# DO NOT ADD PATCHES without github reference
%build
@ -82,50 +93,86 @@ make %{?_smp_mflags} V=1
%install
%make_install templatesdir=%{_fillupdir}
# firewalld instead of SuSEfirewall2
rm -R %{buildroot}/%{_sysconfdir}/sysconfig/SuSEfirewall2.d
install -m644 -p -D %{SOURCE1} %{buildroot}%{_libexecdir}/firewalld/services/iceccd.xml
install -m644 -p -D %{SOURCE4} %{buildroot}%{_libexecdir}/firewalld/services/icecc-scheduler.xml
# unit files and wrappers
install -m644 -p -D %{SOURCE2} %{buildroot}%{_unitdir}/iceccd.service
install -m755 -p -D %{SOURCE3} %{buildroot}%{_libexecdir}/icecc/iceccd-wrapper
install -m644 -p -D %{SOURCE5} %{buildroot}%{_unitdir}/icecc-scheduler.service
install -m755 -p -D %{SOURCE6} %{buildroot}%{_libexecdir}/icecc/icecc-scheduler-wrapper
# make sure runtime directories are automatically created
install -m644 -p -D %{SOURCE7} %{buildroot}/%{_tmpfilesdir}/icecream.conf
# cleanup SysV init
rm %{buildroot}/%{_sysconfdir}/init.d/icecream
rm %{buildroot}/%{_sbindir}/rcicecream
ln -s service %{buildroot}/%{_sbindir}/rciceccd
ln -s service %{buildroot}/%{_sbindir}/rcicecc-scheduler
sed -i -e '1s@/usr/bin/env bash@/bin/bash@' %{buildroot}/%{_bindir}/icecc-create-env
%preun
%stop_on_removal icecream
%service_del_preun iceccd.service icecc-scheduler.service
%pre
%{_sbindir}/groupadd -r icecream 2> /dev/null || :
%{_sbindir}/useradd -r -g icecream -s /bin/false -c "Icecream Daemon" -d %{_localstatedir}/cache/icecream icecream 2> /dev/null || :
%service_add_pre iceccd.service icecc-scheduler.service
# save state of old icecream SysV service
if [ "$1" -gt 1 ]; then
/usr/sbin/systemd-sysv-convert --save icecream || :
fi
%post
# older icecream versions may have left some files owned by root:root in the cache
rm -rf -- %{_localstatedir}/cache/icecream/*
%if 0%{?suse_version}
%{fillup_and_insserv -n icecream icecream}
%fillup_only
%endif
%tmpfiles_create %_tmpfilesdir/icecream.conf
%firewalld_reload
# migrate runlevel settings
if [ "$1" -gt 1 ] && [ -e /var/lib/systemd/sysv-convert/database ] ; then
grep -q 'ICECREAM_RUN_SCHEDULER="yes"' %{_sysconfdir}/sysconfig/icecream &&
sed -i -e '/icecream\s/ p; s/icecream\s/icecc-scheduler /' /var/lib/systemd/sysv-convert/database
sed -i -e '/icecream\s/ s/icecream\s/iceccd /' /var/lib/systemd/sysv-convert/database
fi
%service_add_post iceccd.service icecc-scheduler.service
# restart services
if [ "$1" -gt 1 ] ; then
if systemctl -q is-active icecream ; then
systemctl stop icecream
systemctl start iceccd
systemctl -q is-enabled icecc-scheduler && systemctl start icecc-scheduler
fi
fi
%postun
%restart_on_update icecream
%insserv_cleanup
%service_del_postun iceccd.service icecc-scheduler.service
%files
%doc COPYING README.md NEWS
%doc README.md NEWS
%license COPYING
%config %{_sysconfdir}/logrotate.d/icecream
%config %{_sysconfdir}/init.d/icecream
%{_bindir}/icecc-create-env
%{_bindir}/icecc
%{_bindir}/icerun
%{_sbindir}/icecc-scheduler
%{_sbindir}/iceccd
%{_sbindir}/rcicecream
%{_sbindir}/rcicecc*
%{_mandir}/man*/*
%{_libexecdir}/icecc
%exclude %{_libexecdir}/icecc/bin/clang
%exclude %{_libexecdir}/icecc/bin/clang++
%dir %{_libexecdir}/firewalld/
%dir %{_libexecdir}/firewalld/services/
%{_libexecdir}/firewalld/services/icecc*.xml
%{_unitdir}/icecc*.service
%{_tmpfilesdir}/icecream.conf
%if 0%{?suse_version}
%config %{_sysconfdir}/sysconfig/SuSEfirewall2.d/services/*
%{_fillupdir}/sysconfig.icecream
%if 0%{?suse_version} <= 1220
/opt/icecream
%exclude /opt/icecream/bin/clang
%exclude /opt/icecream/bin/clang++
%endif
%endif
%attr(-,icecream,icecream) %{_localstatedir}/cache/icecream
%attr(-,icecream,icecream) %{_localstatedir}/log/icecream
%ghost /run/icecc
%files -n libicecream-devel
%{_includedir}/icecc
@ -135,9 +182,5 @@ rm -rf -- %{_localstatedir}/cache/icecream/*
%files -n icecream-clang-wrappers
%{_libexecdir}/icecc/bin/clang
%{_libexecdir}/icecc/bin/clang++
%if 0%{?suse_version} <= 1220
/opt/icecream/bin/clang
/opt/icecream/bin/clang++
%endif
%changelog

44
sysconfig.icecream Normal file
View File

@ -0,0 +1,44 @@
#
## Type: string
## Path: Applications/icecream
## Default: ""
#
# Identification for the network the scheduler and daemon run on.
# You can have several distinct icecream networks in the same LAN
# for whatever reason.
#
ICECREAM_NETNAME=""
#
## Type: string
## Path: Applications/icecream
## Default: ""
#
# If the daemon can't find the scheduler by broadcast (e.g. because
# of a firewall) you can specify it.
#
ICECREAM_SCHEDULER_HOST=""
#
## Type: integer
## Path: Applications/icecream
## Default: ""
#
# You can overwrite here the number of jobs to run in parallel. Per
# default this depends on the number of (virtual) CPUs installed.
#
# Note: a value of "0" is actually interpreted as "1", however it
# also sets ICECREAM_ALLOW_REMOTE="no".
#
ICECREAM_MAX_JOBS=""
#
## Type: yesno
## Path: Applications/icecream
## Default: "yes"
#
# Specifies whether jobs submitted by other nodes are allowed to run on
# this one.
#
ICECREAM_ALLOW_REMOTE="yes"