From ad5ff488e0a74f7bb8d154e1c23561eac8fff39e Mon Sep 17 00:00:00 2001 From: Daniel Steiner Date: Sun, 20 Dec 2020 10:18:54 +0100 Subject: [PATCH] Phabricator and depend arcanist packages added --- fedora/SPECS/arcanist.spec | 78 +++++++ fedora/SPECS/phabricator.spec | 369 ++++++++++++++++++++++++++++++++++ 2 files changed, 447 insertions(+) create mode 100644 fedora/SPECS/arcanist.spec create mode 100644 fedora/SPECS/phabricator.spec diff --git a/fedora/SPECS/arcanist.spec b/fedora/SPECS/arcanist.spec new file mode 100644 index 0000000..8d46b78 --- /dev/null +++ b/fedora/SPECS/arcanist.spec @@ -0,0 +1,78 @@ +%global revision_date 20201220 +%global git_short_version_hash 4b3baca9 +%global git_full_version_hash 4b3baca999a4a229433c891cf69c2c4e2d634b89 + +Summary: A command line interface to Phabricator +Name: arcanist + +Epoch: 1 + +Version: 0.%{revision_date}.git%{git_short_version_hash} +Release: 1%{?dist} + +License: ASL 2.0 +URL: https://secure.phabricator.com/book/phabricator/article/arcanist/ +Source0: https://github.com/phacility/arcanist/archive/%{git_full_version_hash}.tar.gz#/arcanist-%{git_full_version_hash}.tar.gz + +Patch1: 0001-Set-the-default-pylint-command-to-pylint-3.patch + +BuildArch: noarch + +BuildRequires: bash-completion +BuildRequires: php(language) >= 5 +BuildRequires: php-cli +Requires: bash-completion +Requires: php(language) >= 5 +Requires: php-cli + +%description +A command line interface to Phabricator + +%prep +%setup -q -n arcanist-%{git_full_version_hash} + +# Not used by anyone other than upstream developers? +rm -rf scripts/breakout.py + +%patch1 -p1 + +%build + +%install +# copy arcanist to the buildroot +mkdir -p %{buildroot}%{_datadir}/%{name} +cp -a bin/ resources/ scripts/ src/ %{buildroot}%{_datadir}/%{name}/ + +mkdir -p %{buildroot}%{_datadir}/bash-completion/completions/ +cp -a support/shell/hooks/bash-completion.sh %{buildroot}%{_datadir}/bash-completion/completions/arc + +# symlink the bin +mkdir -p %{buildroot}%{_bindir} +pushd %{buildroot}%{_bindir} +ln -s %{_datadir}/%{name}/bin/arc +popd + +find %{buildroot}%{_datadir}/%{name}/ -type d -name test -exec rm -rvf {} \; 2>/dev/null || : +find %{buildroot}%{_datadir}/%{name}/ -type d -name __tests__ -exec rm -rvf {} \; 2>/dev/null || : + +# Fix shebangs +find %{buildroot}%{_datadir}/%{name}/ -type f -exec sed -i -r -e 's"^#!(.*)/usr/bin/env php"#!%{_bindir}/php"' {} \; +find %{buildroot}%{_datadir}/%{name}/ -type f -exec sed -i -r -e 's"^#!(.*)/usr/bin/env bash"#!%{_bindir}/bash"' {} \; + +%files +%{!?_licensedir:%global license %doc} +%license LICENSE +%doc README.md +%doc NOTICE +%{_datadir}/bash-completion/completions/arc +%dir %{_datadir}/%{name} +%{_datadir}/%{name}/bin +%{_datadir}/%{name}/resources +%{_datadir}/%{name}/scripts +%{_datadir}/%{name}/src +%{_bindir}/arc + +%changelog +* Sun Dec 20 2020 Daniel Steiner +- First build on Fedora 33. + diff --git a/fedora/SPECS/phabricator.spec b/fedora/SPECS/phabricator.spec new file mode 100644 index 0000000..5279f75 --- /dev/null +++ b/fedora/SPECS/phabricator.spec @@ -0,0 +1,369 @@ +%global revision_date 20201220 +%global git_short_version_hash b2ab18f8f3 +%global git_full_version_hash b2ab18f8f3d0cbab55b92da7a5fcbc0e148a4c99 + +Summary: An open software engineering platform +Name: phabricator + +Epoch: 1 + +Version: 0.%{revision_date}.git%{git_short_version_hash} +Release: 1%{?dist} +License: ASL 2.0 +Group: Applications/Productivity +URL: http://www.phabricator.org/ + +Source0: https://github.com/phacility/%{name}/archive/%{git_full_version_hash}.tar.gz#/%{name}-%{git_full_version_hash}.tar.gz +Source1: aphlict.service +Source2: phd.service +Source3: sshd-phab.service +Source4: phabricator.tmpfiles.conf +Source5: sshd_config_phab +Source6: phabricator.sysconfig +Source7: aphlict.config.json +Source8: phabricator.config.json + +Source998: README.fedora +Source999: README.rhel + +Patch1: 0001-No-matching-commits-to-users-on-displayname.patch + +Requires: arcanist >= %{ver_months_behind} +Requires: arcanist <= %{ver_months_ahead} +Requires: git-core +Requires: httpd +Requires: nodejs +Requires: nodejs-ws +Requires: php(language) >= 5 +Requires: php-curl +Requires: php-iconv +Requires: php-pecl-mailparse +Requires: python3-pygments +Requires: sudo + +Requires(post): systemd-units +Requires(postun): systemd-units +Requires(preun): coreutils +Requires(preun): systemd-units + +BuildRequires: systemd + +BuildArch: noarch + +%description +Phabricator is a collection of open source web applications that help +software companies build better software. + +%prep +%setup -q -n %{name}-%{git_full_version_hash} + +# Shipping is sorted in %files +cp -a %{SOURCE998} . +cp -a %{SOURCE999} . + +# externals that do not seem to be used at all +rm -rf \ + externals/httpful/ \ + externals/restful/ + +%patch1 -p1 + +grep -rlE '/usr/local/bin|bin/env' . | xargs sed -i -e ' 1 { + s,/usr/local/bin/php,%{_bindir}/php, + s,/usr/bin/env .*php,%{_bindir}/php, +}' + +sed -r -i \ + -e 's|/var/log/aphlict.log|/var/log/%{name}/aphlict.log|g' \ + -e 's|/var/tmp/aphlict/pid/aphlict.pid|/var/run/%{name}/aphlict.pid|g' \ + conf/aphlict/aphlict.default.json + +%build +# Nothing to do here + +%install +rm -rf %{buildroot} +install -d %{buildroot}%{_libexecdir}/%{name} +install -d %{buildroot}%{_datadir}/%{name} +install -d %{buildroot}%{_sysconfdir}/%{name}/ +install -d %{buildroot}%{_sysconfdir}/ssh/ +install -d %{buildroot}%{_sysconfdir}/sysconfig/ +install -d %{buildroot}%{_sysconfdir}/tmpfiles.d/ +install -d %{buildroot}%{_var}/lib/%{name} +install -d %{buildroot}%{_var}/lib/%{name}/files +install -d %{buildroot}%{_var}/lib/%{name}/repos +install -d %{buildroot}%{_var}/log/%{name} +install -d %{buildroot}%{_unitdir} + +cp -a \ + bin/ \ + conf/ \ + externals/ \ + resources/ \ + scripts/ \ + src/ \ + support/ \ + webroot/ \ + %{buildroot}%{_datadir}/%{name}/. + +# Hidden and zero-length, but needed in git / sources +rm -rf %{buildroot}%{_datadir}/%{name}/conf/keys/.keep + +mv \ + %{buildroot}%{_datadir}/%{name}/resources/sshd/phabricator-ssh-hook.sh \ + %{buildroot}%{_libexecdir}/%{name}/ssh-hook + +chmod a+x %{buildroot}%{_libexecdir}/%{name}/ssh-hook +sed -r -i \ + -e 's|^VCSUSER=.*$|VCSUSER="git"|g' \ + -e 's|^ROOT=.*$|ROOT="/usr/share/%{name}"|g' \ + %{buildroot}%{_libexecdir}/%{name}/ssh-hook + +install -p -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/aphlict.service +install -p -m 644 %{SOURCE2} %{buildroot}%{_unitdir}/phd.service +install -p -m 644 %{SOURCE3} %{buildroot}%{_unitdir}/sshd-phab.service + +install -p -m 644 %{SOURCE4} %{buildroot}%{_sysconfdir}/tmpfiles.d/%{name}.conf +install -p -m 644 %{SOURCE5} %{buildroot}%{_sysconfdir}/ssh/sshd_config_phab + +install -p -m 644 %{SOURCE6} %{buildroot}%{_sysconfdir}/sysconfig/%{name} + +pushd %{buildroot}%{_datadir}/%{name}/conf/aphlict/ +mv aphlict.default.json ../../../../..%{_sysconfdir}/%{name}/aphlict.config.json +ln -s ../../../../..%{_sysconfdir}/%{name}/aphlict.config.json aphlict.default.json +popd + +install -p -m 640 %{SOURCE7} %{buildroot}%{_sysconfdir}/%{name}/aphlict.config.json + +pushd %{buildroot}%{_datadir}/%{name}/conf/local/ +ln -s ../../../../..%{_sysconfdir}/%{name}/%{name}.config.json local.json +popd + +install -p -m 640 %{SOURCE8} %{buildroot}%{_sysconfdir}/%{name}/%{name}.config.json + +##install -d %{buildroot}%{_sysconfdir}/sudoers.d/ + +# Very probably not allowed +##cat > %{buildroot}%{_sysconfdir}/sudoers.d/apache << EOF +##apache ALL=(phabricator) SETENV: NOPASSWD: /usr/libexec/git-core/git-http-backend +##EOF + +# Very probably not allowed +##cat > %{buildroot}%{_sysconfdir}/sudoers.d/git << EOF +##git ALL=(phabricator) SETENV: NOPASSWD: /usr/bin/git-upload-pack, /usr/bin/git-receive-pack +##EOF + +%clean +rm -rf %{buildroot} + +%pretrans +if [ -f %{_datadir}/%{name}/conf/local/local.json ]; then + if [ ! -L %{_datadir}/%{name}/conf/local/local.json ]; then + mkdir -p %{_sysconfdir}/%{name} + chown phabricator:apache %{_sysconfdir}/%{name} + chmod 750 %{_sysconfdir}/%{name} + mv %{_datadir}/%{name}/conf/local/local.json \ + %{_sysconfdir}/%{name}/%{name}.config.json + chmod 640 %{_sysconfdir}/%{name}/%{name}.config.json + chown phabricator:apache %{_sysconfdir}/%{name}/%{name}.config.json + ln -s ../../../../..%{_sysconfdir}/%{name}/%{name}.config.json \ + %{_datadir}/%{name}/conf/local/local.json + fi +fi + +if [ -f %{_datadir}/%{name}/conf/aphlict/aphlict.default.json ]; then + if [ ! -L %{_datadir}/%{name}/conf/aphlict/aphlict.default.json ]; then + mkdir -p %{_sysconfdir}/%{name} + chown phabricator:apache %{_sysconfdir}/%{name} + chmod 750 %{_sysconfdir}/%{name} + mv %{_datadir}/%{name}/conf/aphlict/aphlict.default.json \ + %{_sysconfdir}/%{name}/aphlict.config.json + chmod 640 %{_sysconfdir}/%{name}/aphlict.config.json + chown phabricator:apache %{_sysconfdir}/%{name}/aphlict.config.json + ln -s ../../../../..%{_sysconfdir}/%{name}/aphlict.config.json \ + %{_sysconfdir}/%{name}/aphlict.config.json + fi +fi + +%pre +getent group phabricator >/dev/null || \ + groupadd -r phabricator >/dev/null 2>&1 || : + +getent passwd phabricator >/dev/null || \ + useradd -r -g phabricator -d /var/lib/phabricator -s /sbin/nologin \ + -c "Phabricator Service User" phabricator >/dev/null 2>&1 || : + +# Very probably inappropriate +#getent passwd git >/dev/null || \ +# useradd -r -d "/var/lib/git" -s /bin/bash \ +# -c "Git Service User" git >/dev/null 2>&1 || : +# +#passwd -d git >/dev/null 2>&1 || : +#passwd -uf git >/dev/null 2>&1 || : + +# Not possible without the former segment +#getent group phabricator | grep -q git || \ +# gpasswd -a git phabricator >/dev/null 2>&1 || : + +# Necessary for apache and phabricator to both have access to git repositories +getent group phabricator | grep -q apache || \ + gpasswd -a apache phabricator >/dev/null 2>&1 || : + +# Only execute on upgrade, not install/uninstall +if [ $1 -gt 1 -a -f /etc/sysconfig/%{name} ]; then + . /etc/sysconfig/%{name} || exit 0 + + if [ "${AUTO_DUMP_STORAGE}" == "1" ]; then + %{_datadir}/%{name}/bin/storage dump | \ + gzip -c > %{_var}/lib/%{name}/pre-%{version}-%{release}.sql.gz || : + fi +fi + +%post +# Very probably not allowed +#sed -i -e '/requiretty/d' /etc/sudoers >/dev/null 2>&1 || : + +%systemd_post httpd.service +%systemd_post aphlict.service +%systemd_post phd.service + +# Only execute on upgrade +if [ $1 -gt 1 -a -f /etc/sysconfig/%{name} ]; then + . /etc/sysconfig/%{name} || exit 0 + + if [ "${AUTO_UPGRADE_STORAGE}" == "1" ]; then + %{_datadir}/%{name}/bin/storage upgrade --force > \ + %{_var}/log/%{name}/upgrade-%{version}-%{release}.log 2>&1 || : + fi +fi + +%preun +%systemd_preun httpd.service +%systemd_preun aphlict.service +%systemd_preun phd.service + +%postun +%systemd_postun_with_restart httpd.service +%systemd_postun_with_restart aphlict.service +%systemd_postun_with_restart phd.service + +%files +%{!?_licensedir:%global license %doc} +%license LICENSE +%if 0%{?fedora} +%doc README.fedora +%else +%doc README.rhel +%endif +%doc README.md +%doc NOTICE +%{_datadir}/%{name} +%{_libexecdir}/%{name} +#%%config(noreplace) %{_sysconfdir}/sudoers.d/apache +#%%config(noreplace) %{_sysconfdir}/sudoers.d/git +%attr(0755, phabricator, apache) %dir %{_sysconfdir}/%{name}/ +%config(noreplace) %attr(0644, phabricator, apache) %{_sysconfdir}/%{name}/aphlict.config.json +%config(noreplace) %attr(0644, phabricator, apache) %{_sysconfdir}/%{name}/%{name}.config.json +%config(noreplace) %{_sysconfdir}/ssh/sshd_config_phab +%config(noreplace) %{_sysconfdir}/sysconfig/%{name} +%{_sysconfdir}/tmpfiles.d/%{name}.conf +%{_unitdir}/aphlict.service +%{_unitdir}/phd.service +%{_unitdir}/sshd-phab.service +%attr(0775, phabricator, phabricator) %{_var}/lib/%{name} +%attr(0775, phabricator, phabricator) %{_var}/log/%{name} + +%changelog +* Fri Mar 15 2019 Jeroen van Meeuwen (Kolab Systems) - 1:0.20190308.git2387a99d7-1 +- Promote Week #10 2019 + +* Mon Oct 16 2017 Jeroen van Meeuwen (Kolab Systems) - 1:0.20171014.gite21d60335-2 +- Rebuild + +* Mon Oct 16 2017 Jeroen van Meeuwen (Kolab Systems) - 1:0.20171014.gite21d60335-1 +- Promote Week #41 2017 + +* Sun May 28 2017 Jeroen van Meeuwen (Kolab Systems) - 1:0.20170527.gitd3b7a0f37-2 +- Rebuild + +* Tue Mar 14 2017 Jeroen van Meeuwen (Kolab Systems) - 0.20170311.gitae5f797-1 +- Promote Week #10 2017 + +* Thu Feb 23 2017 Jeroen van Meeuwen (Kolab Systems) - 0.20170218.git3e10f69-1 +- Promote Week #07 2017 + +* Thu Feb 09 2017 Jeroen van Meeuwen (Kolab Systems) - 0.20170205.gitc3bdcb4-1 +- Promote Week #05 2017 + +* Sun Jan 22 2017 Jeroen van Meeuwen (Kolab Systems) - 0.20170121.gitab4355c-2 +- Rebuild + +* Sun Jan 22 2017 Jeroen van Meeuwen (Kolab Systems) - 0.20170121.gitab4355c-1 +- Promote Week #03 2017 + +* Wed Jan 18 2017 Jeroen van Meeuwen (Kolab Systems) - 0.20170113.git0426ce7-1 +- Promote Week #02 2017 + +* Tue Dec 13 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161211.git3cd0001-2 +- Rebuild + +* Mon Dec 12 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161211.git3cd0001-1 +- Promote Week #49 2016 + +* Sun Dec 04 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161203.gitad65d93-5 +- Rebuild + +* Sun Dec 04 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161203.gitad65d93-4 +- Rebuild + +* Sun Dec 04 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161203.gitad65d93-3 +- Rebuild + +* Sat Dec 03 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161203.gitad65d93-2 +- Rebuild + +* Sat Dec 03 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161203.gitad65d93-1 +- Promote Week #48 2016 + +* Sat Dec 03 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161126.gitcfcc3b8-7 +- Rebuild + +* Thu Dec 01 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161126.gitcfcc3b8-6 +- Rebuild + +* Thu Dec 01 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161126.gitcfcc3b8-5 +- Rebuild + +* Thu Dec 01 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161126.gitcfcc3b8-4 +- Rebuild + +* Thu Dec 01 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161126.gitcfcc3b8-3 +- Rebuild + +* Thu Dec 01 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161126.gitcfcc3b8-2 +- Rebuild + +* Thu Dec 01 2016 Jeroen van Meeuwen (Kolab Systems) - 0.20161126.gitcfcc3b8-1 +- Rebuild + +* Tue Nov 29 2016 Jeroen van Meeuwen (Kolab Systems) - 20161126.gitcfcc3b8-1 +- Promote Week #47 2016 + +* Sat Nov 05 2016 Jeroen van Meeuwen (Kolab Systems) - 20161028.gitbd256e9-1 +- Promote Week #43 + +* Mon Oct 3 2016 Jeroen van Meeuwen (Kolab Systems) - 20161001.git8dbc3f1-1 +- Promote week #40 + +* Thu Sep 8 2016 Jeroen van Meeuwen (Kolab Systems) - 20160906.git6725f37-1 +- Promote week #36 + +* Thu Aug 25 2016 Jeroen van Meeuwen (Kolab Systems) - 20160821.gitb88348a-3 +- Add sshd config, service and libexec hook + +* Tue Aug 23 2016 Jeroen van Meeuwen (Kolab Systems) - 20160821.gitb88348a-2 +- Promote week #34 +- Allow the title of the home page to go through pht() + +* Tue Aug 9 2016 Jeroen van Meeuwen (Kolab Systems) - 20160806.git435f756-1 +- Further develop the packaging over the work from Tim Flink