# Use the following command to get the commit0 hash value: # git ls-remote https://github.com/phacility/phabricator.git | grep stable %global commit0 61a5a4811540e6b8c0a16fb7e9199af7b38bcbbd %global shortcommit0 %(c=%{commit0}; echo ${c:0:7}) %global services phabricator-phd phabricator-aphlict httpd %global selinux_variants targeted # If these are changed, please review the following as well: # * Setting in local.json: phd.user # * Setting in local.json: diffusion.ssh-port # * Setting in local.json: diffusion.ssh-user # * File: phabricator-ssh-hook # * File: phabricator-sshd_config # * File: phabricator-sudo %global daemon_user phabricator %global vcs_user pgit %global ssh_port 2222 %global www_user apache Name: phabricator Version: 2018.50 Release: 2.%{shortcommit0}%{?dist} Summary: A collection of web apps which help build better software License: Apache License, Version 2.0 URL: https://github.com/phacility/%{name} Source0: https://github.com/phacility/%{name}/archive/%{commit0}.tar.gz#/%{name}-%{shortcommit0}.tar.gz Source1: phabricator-phd.service Source2: phabricator-httpd.conf Source3: phabricator-local.json Source4: phabricator-aphlict.service Source5: phabricator-aphlict.default.json Source6: phabricator-ssh-hook Source7: phabricator-sshd_config Source8: phabricator-sshd.service Source9: phabricator-sudo Source10: phabricator-selinux-1.0.tar.gz BuildArch: noarch Requires: arcanist Requires: git Requires: libphutil Requires: mariadb-server Requires: npm Requires: php Requires: php-gd Requires: php-mbstring Requires: php-mysqlnd Requires: php-process Requires: php-pecl-apcu Requires: php-pecl-json Requires: python-pygments Requires: phabricator-selinux Requires: sudo Requires(post): systemd-units Requires(post): selinux-policy-base Requires(preun): systemd-units Requires(postun): systemd-units BuildRequires: nodejs-packaging BuildRequires: selinux-policy BuildRequires: selinux-policy-devel %description Phabricator is a collection of web applications which help software companies build better software. Phabricator includes applications for: * Reviewing and auditing source code * Hosting and browsing repositories * Tracking bugs * Managing projects * Conversing with team members * Assembling a party to venture forth * Writing stuff down and reading it later * Hiding stuff from coworkers * Also some other things %package httpd Summary: Apache HTTPd integration for Phabricator Requires: phabricator Requires: httpd %description httpd Apache HTTPd specific integration for Phabricator. %package aphlict Summary: Realtime notifications for Phabricator Requires: phabricator Requires: nodejs-ws %description aphlict Apache HTTPd specific integration for Phabricator. %package sshd Summary: SSH service for Phabricator Requires: phabricator %description sshd SSH specific configuration for Phabricator. %package selinux Summary: SELinux support for Phabricator. Requires: policycoreutils-python %description selinux SELinux support Phabricator. %prep %setup -q -n %{name}-%{commit0} mkdir selinux gzip -dc %{SOURCE10} | tar -xvvf - -C selinux --strip-components=1 %build make -C selinux SHARE="%{_datadir}" TARGETS="%{name}" %install # Install the SELinux module(s). for SELINUXVARIANT in %{selinux_variants} do %{__install} -d %{buildroot}%{_datadir}/selinux/${SELINUXVARIANT} %{__install} -p -m 644 selinux/%{name}.pp.bz2 \ %{buildroot}%{_datadir}/selinux/${SELINUXVARIANT}/%{name}.pp.bz2 done [ -d "./selinux" ] && %{__rm} -rf ./selinux # Install sudo configuration. %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/sudoers.d %{__cp} %{SOURCE9} %{buildroot}%{_sysconfdir}/sudoers.d/%{name} # Install all service units. %{__install} -d -m 755 %{buildroot}%{_unitdir} %{__cp} %{SOURCE1} %{buildroot}%{_unitdir} %{__cp} %{SOURCE4} %{buildroot}%{_unitdir} %{__cp} %{SOURCE8} %{buildroot}%{_unitdir} # Install Apache HTTPd configuration. %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/httpd/conf.d %{__cp} %{SOURCE2} %{buildroot}%{_sysconfdir}/httpd/conf.d/phabricator.conf # Install Phabricator configuration files. %{__install} -d -m 755 %{buildroot}%{_sysconfdir}/%{name} %{__rm} ./conf/local/README %{__mv} ./conf/local %{buildroot}%{_sysconfdir}/%{name} %{__ln_s} %{_sysconfdir}/%{name}/local ./conf/local %{__rm} ./conf/aphlict/README %{__rm} ./conf/aphlict/aphlict.default.json %{__mv} ./conf/aphlict %{buildroot}%{_sysconfdir}/%{name} %{__ln_s} %{_sysconfdir}/%{name}/aphlict ./conf/aphlict %{__cp} %{SOURCE3} %{buildroot}%{_sysconfdir}/%{name}/local/local.json %{__cp} %{SOURCE5} %{buildroot}%{_sysconfdir}/%{name}/aphlict/aphlict.default.json %{__cp} %{SOURCE7} %{buildroot}%{_sysconfdir}/%{name}/sshd_config # Create a log and data directory. %{__install} -d -m 700 %{buildroot}%{_localstatedir}/log/%{name} %{__install} -d -m 770 %{buildroot}%{_sharedstatedir}/%{name} # Install the SSH hook. %{__install} -d -m 755 %{buildroot}%{_libexecdir} %{__cp} %{SOURCE6} %{buildroot}%{_libexecdir}/phabricator-ssh-hook # Install Phabricator. %{__install} -d -m 755 %{buildroot}%{_datarootdir}/%{name} find . -mindepth 1 -maxdepth 1 -exec %{__mv} -t \ %{buildroot}%{_datarootdir}/%{name}/ -- {} + # Link all NodeJS modules. %{__ln_s} %{nodejs_sitelib}/ \ %{buildroot}%{_datarootdir}/%{name}/support/aphlict/server/ # Install binaries (or rather, links to them). %{__install} -d -m 755 %{buildroot}%{_sbindir} %{__ln_s} %{_datarootdir}/%{name}/bin/config \ %{buildroot}%{_sbindir}/phabricator-config %{__ln_s} %{_datarootdir}/%{name}/bin/storage \ %{buildroot}%{_sbindir}/phabricator-storage %{__ln_s} %{_datarootdir}/%{name}/bin/remove \ %{buildroot}%{_sbindir}/phabricator-remove %clean %check %pre # Create a system group and user, unless they already exist. getent group %{daemon_user} >/dev/null || groupadd -r %{daemon_user} || : getent passwd %{daemon_user} >/dev/null || \ useradd -r -d %{_datarootdir}/%{name} -s /sbin/nologin -g %{daemon_user} \ %{daemon_user} || : if [ $1 -ge 1 ] then # Package upgrade, not uninstall. Shut down any services running. for SERVICE in %{services} do if systemctl --quiet is-active ${SERVICE}.service then touch %{_rundir}/%{name}-${SERVICE}.restart systemctl --quiet stop ${SERVICE}.service else %{__rm} -f %{_rundir}/%{name}-${SERVICE}.restart fi done fi %post if [ $1 -ge 1 ]; then # Upgrade the storage. %{_sbindir}/phabricator-storage --force >/dev/null # Package upgrade, not uninstall. Start any services already shut down. for SERVICE in %{services} do if [ -f %{_rundir}/%{name}-${SERVICE}.restart ] then systemctl --quiet start ${SERVICE}.service %{__rm} -f %{_rundir}/%{name}.restart fi done fi %systemd_post phabricator-phd.service %preun %systemd_preun phabricator-phd.service %postun %systemd_postun_with_restart phabricator-phd.service %post aphlict %systemd_post phabricator-aphlict.service %preun aphlict %systemd_preun phabricator-aphlict.service %postun aphlict %systemd_postun_with_restart phabricator-aphlict.service %post httpd # Add the WWW user to the Phabricator group. id -Gn %{www_user} | grep -q -E "\b%{daemon_user}\b" && \ usermod -a -G %{daemon_user} %{www_user} || : %pre sshd # Yes, this should probably be in a separate SELinux policy. if [ $1 -eq 1 ] then semanage port -a -t ssh_port_t -p tcp %{ssh_port} 2>/dev/null || : fi # Create a system group and user, unless they already exist. getent group %{vcs_user} >/dev/null || groupadd -r %{vcs_user} || : getent passwd %{vcs_user} >/dev/null || \ useradd -r -d %{_datarootdir}/%{name} -s /bin/sh -g %{vcs_user} -p NP \ %{vcs_user} || : %postun sshd if [ $1 -eq 0 ] then semanage port -d -t ssh_port_t -p tcp %{ssh_port} 2>/dev/null || : fi %post selinux for SELINUXVARIANT in %{selinux_variants} do %{_sbindir}/semodule -n -s ${SELINUXVARIANT} \ -i %{_datadir}/selinux/${SELINUXVARIANT}/%{name}.pp.bz2 if %{_sbindir}/selinuxenabled then %{_sbindir}/load_policy fi done %postun selinux if [ $1 -eq 0 ] then for SELINUXVARIANT in %{selinux_variants} do %{_sbindir}/semodule -n -s ${SELINUXVARIANT} -r %{name} > /dev/null || : if %{_sbindir}/selinuxenabled then %{_sbindir}/load_policy fi done fi %files %config(noreplace) %{_sysconfdir}/%{name}/local/local.json %config(noreplace) %{_sysconfdir}/sudoers.d/%{name} %dir %attr(0700,%{daemon_user},%{daemon_user}) %{_localstatedir}/log/%{name} %dir %attr(0770,%{daemon_user},%{daemon_user}) %{_sharedstatedir}/%{name} %{_datarootdir}/%{name} %{_unitdir}/phabricator-phd.service %{_sbindir}/phabricator-config %{_sbindir}/phabricator-storage %{_sbindir}/phabricator-remove %files httpd %config(noreplace) %{_sysconfdir}/httpd/conf.d/phabricator.conf %files aphlict %config(noreplace) %{_sysconfdir}/%{name}/aphlict/aphlict.default.json %{_unitdir}/phabricator-aphlict.service %{_datarootdir}/%{name}/support/aphlict/server/node_modules %files sshd %config(noreplace) %{_sysconfdir}/%{name}/sshd_config %attr(0755,root,root) %{_libexecdir}/phabricator-ssh-hook %{_unitdir}/phabricator-sshd.service %files selinux %{_datadir}/selinux %changelog * Fri Dec 21 2018 Daniel Uvehag - 2018.50-2.61a5a48 - Updated to 2018.50 (61a5a48) - Add missing dependency to sudo * Fri Jun 01 2018 Daniel Uvehag - 2018.20-2.9d0adf6 - Change dependency from php-mysql to php-mysqlnd * Thu May 31 2018 Daniel Uvehag - 2018.20-1.9d0adf6 - Updated to 2018.20 (9d0adf6) * Wed Jan 31 2018 Daniel Uvehag - 2018.4-5.1b4017b - Updated to 1b4017b889e29eb82eb80931eda3eeebae6b28a0 - Changed versioning to match upstream * Mon Jul 03 2017 Daniel Uvehag - 0-4.5306fbf - Updated to 5306fbfa7af4cdd8b326f86ed66f300c5cc22b9d * Mon May 22 2017 Daniel Uvehag - 0-3.4d2c7e4 - Updated to 4d2c7e4d3d5d61e34b7e2af3df0e901d89d29433 * Tue Nov 29 2016 Daniel Uvehag - 0-2.cfcc3b8 - Updated to cfcc3b834d1df721ca40ad436930ddde3cba430f * Tue Nov 22 2016 Daniel Uvehag - 0-1.74a0e5c - Initial packaging