From ac8820f58be7f1e945636aedf602a0f47250bd42 Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Sun, 2 Sep 2018 16:55:25 +0100 Subject: www-apps/phabricator: Version bump Package-Manager: Portage-2.3.40, Repoman-2.3.9 --- ...VERSION-for-files-in-usr-share-PN-GIT_COM.patch | 50 ------ ...20180730-blacklists-for-registering-users.patch | 67 -------- ...VERSION-for-files-in-usr-share-PN-GIT_COM.patch | 50 ++++++ ...20180824-blacklists-for-registering-users.patch | 67 ++++++++ ...VERSION-for-files-in-usr-share-PN-GIT_COM.patch | 2 +- .../9999-blacklists-for-registering-users.patch | 2 +- www-apps/phabricator/phabricator-20180730.ebuild | 183 --------------------- www-apps/phabricator/phabricator-20180824.ebuild | 183 +++++++++++++++++++++ 8 files changed, 302 insertions(+), 302 deletions(-) delete mode 100644 www-apps/phabricator/files/20180730-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch delete mode 100644 www-apps/phabricator/files/20180730-blacklists-for-registering-users.patch create mode 100644 www-apps/phabricator/files/20180824-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch create mode 100644 www-apps/phabricator/files/20180824-blacklists-for-registering-users.patch delete mode 100644 www-apps/phabricator/phabricator-20180730.ebuild create mode 100644 www-apps/phabricator/phabricator-20180824.ebuild (limited to 'www-apps') diff --git a/www-apps/phabricator/files/20180730-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch b/www-apps/phabricator/files/20180730-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch deleted file mode 100644 index 714d5024..00000000 --- a/www-apps/phabricator/files/20180730-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch +++ /dev/null @@ -1,50 +0,0 @@ -From 3f0d6d0b418328e204181f351798386bfc26a110 Mon Sep 17 00:00:00 2001 -From: Bertrand Jacquin -Date: Sat, 22 Feb 2014 18:31:14 +0100 -Subject: [PATCH 1/2] MEDIUM: Get VERSION for files in - /usr/share//GIT_COMMIT_INFO rather than from git - ---- - .../PhabricatorConfigVersionController.php | 29 +++++++++++----------- - 1 file changed, 15 insertions(+), 14 deletions(-) - -diff --git a/src/applications/config/controller/PhabricatorConfigVersionController.php b/src/applications/config/controller/PhabricatorConfigVersionController.php -index 8a87dec5cce6..f6a218cfc422 100644 ---- a/src/applications/config/controller/PhabricatorConfigVersionController.php -+++ b/src/applications/config/controller/PhabricatorConfigVersionController.php -@@ -105,20 +105,21 @@ final class PhabricatorConfigVersionController - $remote_futures = array(); - - foreach ($specs as $lib) { -- $root = dirname(phutil_get_library_root($lib)); -- -- $log_command = csprintf( -- 'git log --format=%s -n 1 --', -- '%H %ct'); -- -- $remote_command = csprintf( -- 'git remote -v'); -- -- $log_futures[$lib] = id(new ExecFuture('%C', $log_command)) -- ->setCWD($root); -- -- $remote_futures[$lib] = id(new ExecFuture('%C', $remote_command)) -- ->setCWD($root); -+ switch ($lib) { -+ case "phutil": -+ $_dir = "libphutil"; -+ break; -+ case "sprint": -+ $_dir = "phabricator-extensions-Sprint"; -+ break; -+ default: -+ $_dir = $lib; -+ } -+ -+ $log_futures[$lib] = -+ id(new ExecFuture('cat -- %s', "/usr/share/" . $_dir . "/GIT_COMMIT_INFO")); -+ $remote_futures[$lib] = -+ id(new ExecFuture('cat -- %s', "/usr/share/" . $_dir . "/GIT_REMOTE_INFO")); - } - - $all_futures = array_merge($log_futures, $remote_futures); diff --git a/www-apps/phabricator/files/20180730-blacklists-for-registering-users.patch b/www-apps/phabricator/files/20180730-blacklists-for-registering-users.patch deleted file mode 100644 index 1961f3f2..00000000 --- a/www-apps/phabricator/files/20180730-blacklists-for-registering-users.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 8ca4504b878d216dc79ae8ac84dfb2bee0ae6338 Mon Sep 17 00:00:00 2001 -From: Carsten Haitzler -Date: Thu, 8 Feb 2018 18:29:06 +0900 -Subject: [PATCH 2/2] blacklists for registering users - -i came up with this patch to allow phab to have email blacklists for -registering users... thanks to spam. ---- - .../PhabricatorAuthenticationConfigOptions.php | 7 ++++++- - .../people/storage/PhabricatorUserEmail.php | 20 +++++++++++++++++--- - 2 files changed, 23 insertions(+), 4 deletions(-) - -diff --git a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php -index 2239d98858d3..beb719fd4a5c 100644 ---- a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php -+++ b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php -@@ -69,7 +69,12 @@ final class PhabricatorAuthenticationConfigOptions - "it implies {{auth.require-email-verification}}.\n\n". - "You should omit the `@` from domains. Note that the domain must ". - "match exactly. If you allow `yourcompany.com`, that permits ". -- "`joe@yourcompany.com` but rejects `joe@mail.yourcompany.com`.")) -+ "`joe@yourcompany.com` but rejects `joe@mail.yourcompany.com`.\n\n" . -+ "You may also use this as a blacklist by prefixing any domain with" . -+ "a `!` (exclamation) mark. If any entry in this list has this mark" . -+ "then the list as a whole is treated as a blacklist and whitelist" . -+ "items as above are ineffective and only items with a `!` at the" . -+ "start of them are effective in blacklisting domains.")) - ->addExample( - "yourcompany.com\nmail.yourcompany.com", - pht('Valid Setting')), -diff --git a/src/applications/people/storage/PhabricatorUserEmail.php b/src/applications/people/storage/PhabricatorUserEmail.php -index 42946015dee1..e116d5421697 100644 ---- a/src/applications/people/storage/PhabricatorUserEmail.php -+++ b/src/applications/people/storage/PhabricatorUserEmail.php -@@ -110,15 +110,29 @@ final class PhabricatorUserEmail extends PhabricatorUserDAO { - return false; - } - -+ $default_allow = false; -+ - $lower_domain = phutil_utf8_strtolower($domain); - foreach ($allowed_domains as $allowed_domain) { - $lower_allowed = phutil_utf8_strtolower($allowed_domain); -- if ($lower_allowed === $lower_domain) { -- return true; -+ // allow !domain.com to indicate this domain is NOT allowed instead -+ // of explicitly allowed. if you have at least 1 "not" domain listed -+ // then the list becomes a blacklist and only domains NOT allowed will -+ // be filtered. -+ if (substr($lower_allowed, 0, 1) === "!") { -+ $default_allow = true; -+ $lower_allowed = substr($lower_allowed, 1); -+ if ($lower_allowed === $lower_domain) { -+ return false; -+ } -+ } else { -+ if ($lower_allowed === $lower_domain) { -+ return true; -+ } - } - } - -- return false; -+ return $default_allow; - } - - diff --git a/www-apps/phabricator/files/20180824-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch b/www-apps/phabricator/files/20180824-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch new file mode 100644 index 00000000..f9f2484d --- /dev/null +++ b/www-apps/phabricator/files/20180824-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch @@ -0,0 +1,50 @@ +From a9b7339856c1ba30e0381d7b628e69d5cfaff0ff Mon Sep 17 00:00:00 2001 +From: Bertrand Jacquin +Date: Sat, 22 Feb 2014 18:31:14 +0100 +Subject: [PATCH 1/2] MEDIUM: Get VERSION for files in + /usr/share//GIT_COMMIT_INFO rather than from git + +--- + .../PhabricatorConfigVersionController.php | 29 +++++++++++----------- + 1 file changed, 15 insertions(+), 14 deletions(-) + +diff --git a/src/applications/config/controller/PhabricatorConfigVersionController.php b/src/applications/config/controller/PhabricatorConfigVersionController.php +index 8a87dec5cce6..f6a218cfc422 100644 +--- a/src/applications/config/controller/PhabricatorConfigVersionController.php ++++ b/src/applications/config/controller/PhabricatorConfigVersionController.php +@@ -105,20 +105,21 @@ final class PhabricatorConfigVersionController + $remote_futures = array(); + + foreach ($specs as $lib) { +- $root = dirname(phutil_get_library_root($lib)); +- +- $log_command = csprintf( +- 'git log --format=%s -n 1 --', +- '%H %ct'); +- +- $remote_command = csprintf( +- 'git remote -v'); +- +- $log_futures[$lib] = id(new ExecFuture('%C', $log_command)) +- ->setCWD($root); +- +- $remote_futures[$lib] = id(new ExecFuture('%C', $remote_command)) +- ->setCWD($root); ++ switch ($lib) { ++ case "phutil": ++ $_dir = "libphutil"; ++ break; ++ case "sprint": ++ $_dir = "phabricator-extensions-Sprint"; ++ break; ++ default: ++ $_dir = $lib; ++ } ++ ++ $log_futures[$lib] = ++ id(new ExecFuture('cat -- %s', "/usr/share/" . $_dir . "/GIT_COMMIT_INFO")); ++ $remote_futures[$lib] = ++ id(new ExecFuture('cat -- %s', "/usr/share/" . $_dir . "/GIT_REMOTE_INFO")); + } + + $all_futures = array_merge($log_futures, $remote_futures); diff --git a/www-apps/phabricator/files/20180824-blacklists-for-registering-users.patch b/www-apps/phabricator/files/20180824-blacklists-for-registering-users.patch new file mode 100644 index 00000000..88983ede --- /dev/null +++ b/www-apps/phabricator/files/20180824-blacklists-for-registering-users.patch @@ -0,0 +1,67 @@ +From 3022c06ecbc4856859e68bf7c7f88a9fbc31ad0b Mon Sep 17 00:00:00 2001 +From: Carsten Haitzler +Date: Thu, 8 Feb 2018 18:29:06 +0900 +Subject: [PATCH 2/2] blacklists for registering users + +i came up with this patch to allow phab to have email blacklists for +registering users... thanks to spam. +--- + .../PhabricatorAuthenticationConfigOptions.php | 7 ++++++- + .../people/storage/PhabricatorUserEmail.php | 20 +++++++++++++++++--- + 2 files changed, 23 insertions(+), 4 deletions(-) + +diff --git a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php +index 2239d98858d3..beb719fd4a5c 100644 +--- a/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php ++++ b/src/applications/config/option/PhabricatorAuthenticationConfigOptions.php +@@ -69,7 +69,12 @@ final class PhabricatorAuthenticationConfigOptions + "it implies {{auth.require-email-verification}}.\n\n". + "You should omit the `@` from domains. Note that the domain must ". + "match exactly. If you allow `yourcompany.com`, that permits ". +- "`joe@yourcompany.com` but rejects `joe@mail.yourcompany.com`.")) ++ "`joe@yourcompany.com` but rejects `joe@mail.yourcompany.com`.\n\n" . ++ "You may also use this as a blacklist by prefixing any domain with" . ++ "a `!` (exclamation) mark. If any entry in this list has this mark" . ++ "then the list as a whole is treated as a blacklist and whitelist" . ++ "items as above are ineffective and only items with a `!` at the" . ++ "start of them are effective in blacklisting domains.")) + ->addExample( + "yourcompany.com\nmail.yourcompany.com", + pht('Valid Setting')), +diff --git a/src/applications/people/storage/PhabricatorUserEmail.php b/src/applications/people/storage/PhabricatorUserEmail.php +index 42946015dee1..e116d5421697 100644 +--- a/src/applications/people/storage/PhabricatorUserEmail.php ++++ b/src/applications/people/storage/PhabricatorUserEmail.php +@@ -110,15 +110,29 @@ final class PhabricatorUserEmail extends PhabricatorUserDAO { + return false; + } + ++ $default_allow = false; ++ + $lower_domain = phutil_utf8_strtolower($domain); + foreach ($allowed_domains as $allowed_domain) { + $lower_allowed = phutil_utf8_strtolower($allowed_domain); +- if ($lower_allowed === $lower_domain) { +- return true; ++ // allow !domain.com to indicate this domain is NOT allowed instead ++ // of explicitly allowed. if you have at least 1 "not" domain listed ++ // then the list becomes a blacklist and only domains NOT allowed will ++ // be filtered. ++ if (substr($lower_allowed, 0, 1) === "!") { ++ $default_allow = true; ++ $lower_allowed = substr($lower_allowed, 1); ++ if ($lower_allowed === $lower_domain) { ++ return false; ++ } ++ } else { ++ if ($lower_allowed === $lower_domain) { ++ return true; ++ } + } + } + +- return false; ++ return $default_allow; + } + + diff --git a/www-apps/phabricator/files/9999-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch b/www-apps/phabricator/files/9999-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch index b52d183c..66669688 100644 --- a/www-apps/phabricator/files/9999-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch +++ b/www-apps/phabricator/files/9999-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch @@ -1,4 +1,4 @@ -From d14ca9a8c1e1b63bddcebf46b40ec52c3a3adf36 Mon Sep 17 00:00:00 2001 +From 4c2cff6c02973fd8f100d5a852f26b49f8ab231d Mon Sep 17 00:00:00 2001 From: Bertrand Jacquin Date: Sat, 22 Feb 2014 18:31:14 +0100 Subject: [PATCH 1/2] MEDIUM: Get VERSION for files in diff --git a/www-apps/phabricator/files/9999-blacklists-for-registering-users.patch b/www-apps/phabricator/files/9999-blacklists-for-registering-users.patch index 7b1ec634..045fb272 100644 --- a/www-apps/phabricator/files/9999-blacklists-for-registering-users.patch +++ b/www-apps/phabricator/files/9999-blacklists-for-registering-users.patch @@ -1,4 +1,4 @@ -From be2ba6e39aa6bfb0292c0eb9bd5f040e8a6209e3 Mon Sep 17 00:00:00 2001 +From 03e04ca72ff2aee58631d4901da796430a0c0704 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Thu, 8 Feb 2018 18:29:06 +0900 Subject: [PATCH 2/2] blacklists for registering users diff --git a/www-apps/phabricator/phabricator-20180730.ebuild b/www-apps/phabricator/phabricator-20180730.ebuild deleted file mode 100644 index 6d617ae6..00000000 --- a/www-apps/phabricator/phabricator-20180730.ebuild +++ /dev/null @@ -1,183 +0,0 @@ -# Copyright 1999-2018 Gentoo Foundation -# Distributed under the terms of the GNU General Public License v2 - -EAPI=6 -WEBAPP_NO_AUTO_INSTALL=yes -WEBAPP_MANUAL_SLOT=yes -inherit git-r3 webapp - -DESCRIPTION="Collection of web applications which makes it easier to scale software companies" -HOMEPAGE="https://www.phacility.com" -EGIT_REPO_URI="https://github.com/phacility/phabricator.git" -EGIT_BRANCH="stable" -EGIT_COMMIT="58e8d3c134790e2c58e34568dc65f1951561dcb2" - -LICENSE="Apache-2.0" -SLOT="stable" -KEYWORDS="~amd64" -IUSE="extension-sprint git highlight mail mercurial subversion ssl test" -REQUIRED_USE="test? ( git mercurial subversion )" - -DEPEND="!${CATEGORY}/${PN}:0 - virtual/awk:0 - test? ( - =www-client/arcanist-20180720:stable[test] - )" -RDEPEND=">=app-admin/webapp-config-1.51-r1:0 - sys-apps/gentoo-functions - || ( - >=www-servers/apache-2.2.7:2[apache2_modules_rewrite] - www-servers/nginx:0 - www-servers/lighttpd:0 - ) - app-misc/jq:0 - dev-lang/php[cli,curl,gd,iconv,json,mysql,mysqli,pcntl,simplexml,ssl?,unicode] - dev-php/pecl-apcu - dev-php/PHPExcel - media-gfx/imagemagick[jpeg,png,webp] - virtual/mysql - =dev-php/libphutil-20180720:stable - net-libs/nodejs:0 - =www-client/arcanist-20180720:stable[git?,mercurial?,subversion?] - git? ( dev-vcs/git:0 ) - mercurial? ( >dev-vcs/mercurial-2.2:0 ) - subversion? ( >dev-vcs/subversion-1.7.1:0 ) - highlight? ( dev-python/pygments:0 ) - mail? ( dev-php/pecl-mailparse:0 )" -PDEPEND="extension-sprint? ( www-apps/phabricator-extensions-Sprint )" - -pkg_setup() { - webapp_pkg_setup - - if use test ; then - einfo "Environnement variables you can tweak for database tests" - einfo " PHABRICATOR_MYSQL_HOST (default my.cnf[client].host || my.cnf[client].socket)" - einfo " PHABRICATOR_MYSQL_USER (default my.cnf[client].user || current user)" - einfo " PHABRICATOR_MYSQL_PASS (default my.cnf[client].password || empty)" - einfo - einfo "src_test() may fail if such variable are not defined" - fi -} - -src_prepare() { - default - - git log --format='%H %ct' -n 1 > "${S}/GIT_COMMIT_INFO" - git remote add origin "${EGIT_REPO_URI}" - git remote -v > "${S}/GIT_REMOTE_INFO" - - eapply "${FILESDIR}/${PV}-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch" - eapply "${FILESDIR}/${PV}-blacklists-for-registering-users.patch" - - find -type f -name .gitignore -print0 \ - | xargs -0 --no-run-if-empty -- \ - rm - - rm -r scripts/install - - # Replace 'env' shebang to files it point to - find -type f \ - | sort \ - | xargs -n 1 --no-run-if-empty -- \ - awk 'NR == 1 && /^#!\/usr\/bin\/env/ {print FILENAME}' \ - | while read ; do - set -- $(sed -ne '1 s:^#!\([^ ]*\) ::p;q' ${REPLY}) - cmd="$1" ; shift ; args="$@" - - case "${cmd}" in - bash|php) ;; - *) continue ;; - esac - - path="$(type -p ${cmd})" || continue - [[ -z "${path}" ]] && continue - - einfo "Changing ${REPLY} shebang to #!${path} ${args}" - sed -i \ - -e "1 s:^#!.*:#!${path} ${args}:" \ - "${REPLY}" - eend $? - done -} - -src_test() { - local BASE_URI="http://localhost.localdomain" - - einfo "Setting phabricator.base-uri='${BASE_URI}'" - bin/config set phabricator.base-uri "${BASE_URI}" > /dev/null - eend $? - - if [[ -n "${PHABRICATOR_MYSQL_HOST}" ]] ; then - einfo "Setting mysql.host='${PHABRICATOR_MYSQL_HOST}'" - bin/config set mysql.host "${PHABRICATOR_MYSQL_HOST}" > /dev/null - eend $? - fi - - if [[ -n "${PHABRICATOR_MYSQL_USER}" ]] ; then - einfo "Setting mysql.user='${PHABRICATOR_MYSQL_USER}'" - bin/config set mysql.user "${PHABRICATOR_MYSQL_USER}" > /dev/null - eend $? - fi - - if [[ -n "${PHABRICATOR_MYSQL_PASS}" ]] ; then - einfo "Setting mysql.pass='${PHABRICATOR_MYSQL_PASS}'" - bin/config set mysql.pass "${PHABRICATOR_MYSQL_PASS}" > /dev/null - eend $? - fi - - arc unit --everything --no-coverage || die "arc unit failed" - - # Cleanup tests only config files - rm conf/local/local.json -} - -src_install() { - insinto "/usr/share/${PN}" - doins GIT_COMMIT_INFO GIT_REMOTE_INFO - - webapp_src_preinst - - # All directories must be private (ie accessible in hostroot), - # expect webroot that will become htdocs - insinto "${MY_HOSTROOTDIR}" - doins -r bin conf externals resources scripts src support - - # All files and directories present in webroot/ will be - # installed in htdocs - insinto "${MY_HTDOCSDIR}" - doins -r webroot/* - - newins "${FILESDIR}/htaccess" .htaccess - - # Make executable all shebanged files - find "${ED}" -type f \ - | xargs -n 1 --no-run-if-empty -- \ - awk 'NR == 1 && /^#!/ {print FILENAME}' \ - | sed -e "s:${ED}:/:" \ - | xargs --no-run-if-empty -- \ - fperms 755 - - webapp_configfile "${MY_HTDOCSDIR}/.htaccess" - webapp_hook_script "${FILESDIR}/webapp-hook" - - webapp_src_install - - newinitd "${FILESDIR}/phd.initd" phd - newconfd "${FILESDIR}/phd.confd" phd - - newinitd "${FILESDIR}/aphlict.initd" aphlict - newconfd "${FILESDIR}/aphlict.confd" aphlict - - insinto /etc/logrotate.d - newins "${FILESDIR}/${PN}.logrotate" "${PN}" - - dodoc NOTICE README.md -} - -pkg_postinst() { - webapp_pkg_postinst - - elog - elog "For more info about how to configure, see" - elog " https://secure.phabricator.com/book/phabricator/article/configuration_guide" -} diff --git a/www-apps/phabricator/phabricator-20180824.ebuild b/www-apps/phabricator/phabricator-20180824.ebuild new file mode 100644 index 00000000..eb293d93 --- /dev/null +++ b/www-apps/phabricator/phabricator-20180824.ebuild @@ -0,0 +1,183 @@ +# Copyright 1999-2018 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=6 +WEBAPP_NO_AUTO_INSTALL=yes +WEBAPP_MANUAL_SLOT=yes +inherit git-r3 webapp + +DESCRIPTION="Collection of web applications which makes it easier to scale software companies" +HOMEPAGE="https://www.phacility.com" +EGIT_REPO_URI="https://github.com/phacility/phabricator.git" +EGIT_BRANCH="stable" +EGIT_COMMIT="fa4f53077172a865bfd89b6063807afe03bd722b" + +LICENSE="Apache-2.0" +SLOT="stable" +KEYWORDS="~amd64" +IUSE="extension-sprint git highlight mail mercurial subversion ssl test" +REQUIRED_USE="test? ( git mercurial subversion )" + +DEPEND="!${CATEGORY}/${PN}:0 + virtual/awk:0 + test? ( + =www-client/arcanist-20180824:stable[test] + )" +RDEPEND=">=app-admin/webapp-config-1.51-r1:0 + sys-apps/gentoo-functions + || ( + >=www-servers/apache-2.2.7:2[apache2_modules_rewrite] + www-servers/nginx:0 + www-servers/lighttpd:0 + ) + app-misc/jq:0 + dev-lang/php[cli,curl,gd,iconv,json,mysql,mysqli,pcntl,simplexml,ssl?,unicode] + dev-php/pecl-apcu + dev-php/PHPExcel + media-gfx/imagemagick[jpeg,png,webp] + virtual/mysql + =dev-php/libphutil-20180824:stable + net-libs/nodejs:0 + =www-client/arcanist-20180824:stable[git?,mercurial?,subversion?] + git? ( dev-vcs/git:0 ) + mercurial? ( >dev-vcs/mercurial-2.2:0 ) + subversion? ( >dev-vcs/subversion-1.7.1:0 ) + highlight? ( dev-python/pygments:0 ) + mail? ( dev-php/pecl-mailparse:0 )" +PDEPEND="extension-sprint? ( www-apps/phabricator-extensions-Sprint )" + +pkg_setup() { + webapp_pkg_setup + + if use test ; then + einfo "Environnement variables you can tweak for database tests" + einfo " PHABRICATOR_MYSQL_HOST (default my.cnf[client].host || my.cnf[client].socket)" + einfo " PHABRICATOR_MYSQL_USER (default my.cnf[client].user || current user)" + einfo " PHABRICATOR_MYSQL_PASS (default my.cnf[client].password || empty)" + einfo + einfo "src_test() may fail if such variable are not defined" + fi +} + +src_prepare() { + default + + git log --format='%H %ct' -n 1 > "${S}/GIT_COMMIT_INFO" + git remote add origin "${EGIT_REPO_URI}" + git remote -v > "${S}/GIT_REMOTE_INFO" + + eapply "${FILESDIR}/${PV}-MEDIUM-Get-VERSION-for-files-in-usr-share-PN-GIT_COM.patch" + eapply "${FILESDIR}/${PV}-blacklists-for-registering-users.patch" + + find -type f -name .gitignore -print0 \ + | xargs -0 --no-run-if-empty -- \ + rm + + rm -r scripts/install + + # Replace 'env' shebang to files it point to + find -type f \ + | sort \ + | xargs -n 1 --no-run-if-empty -- \ + awk 'NR == 1 && /^#!\/usr\/bin\/env/ {print FILENAME}' \ + | while read ; do + set -- $(sed -ne '1 s:^#!\([^ ]*\) ::p;q' ${REPLY}) + cmd="$1" ; shift ; args="$@" + + case "${cmd}" in + bash|php) ;; + *) continue ;; + esac + + path="$(type -p ${cmd})" || continue + [[ -z "${path}" ]] && continue + + einfo "Changing ${REPLY} shebang to #!${path} ${args}" + sed -i \ + -e "1 s:^#!.*:#!${path} ${args}:" \ + "${REPLY}" + eend $? + done +} + +src_test() { + local BASE_URI="http://localhost.localdomain" + + einfo "Setting phabricator.base-uri='${BASE_URI}'" + bin/config set phabricator.base-uri "${BASE_URI}" > /dev/null + eend $? + + if [[ -n "${PHABRICATOR_MYSQL_HOST}" ]] ; then + einfo "Setting mysql.host='${PHABRICATOR_MYSQL_HOST}'" + bin/config set mysql.host "${PHABRICATOR_MYSQL_HOST}" > /dev/null + eend $? + fi + + if [[ -n "${PHABRICATOR_MYSQL_USER}" ]] ; then + einfo "Setting mysql.user='${PHABRICATOR_MYSQL_USER}'" + bin/config set mysql.user "${PHABRICATOR_MYSQL_USER}" > /dev/null + eend $? + fi + + if [[ -n "${PHABRICATOR_MYSQL_PASS}" ]] ; then + einfo "Setting mysql.pass='${PHABRICATOR_MYSQL_PASS}'" + bin/config set mysql.pass "${PHABRICATOR_MYSQL_PASS}" > /dev/null + eend $? + fi + + arc unit --everything --no-coverage || die "arc unit failed" + + # Cleanup tests only config files + rm conf/local/local.json +} + +src_install() { + insinto "/usr/share/${PN}" + doins GIT_COMMIT_INFO GIT_REMOTE_INFO + + webapp_src_preinst + + # All directories must be private (ie accessible in hostroot), + # expect webroot that will become htdocs + insinto "${MY_HOSTROOTDIR}" + doins -r bin conf externals resources scripts src support + + # All files and directories present in webroot/ will be + # installed in htdocs + insinto "${MY_HTDOCSDIR}" + doins -r webroot/* + + newins "${FILESDIR}/htaccess" .htaccess + + # Make executable all shebanged files + find "${ED}" -type f \ + | xargs -n 1 --no-run-if-empty -- \ + awk 'NR == 1 && /^#!/ {print FILENAME}' \ + | sed -e "s:${ED}:/:" \ + | xargs --no-run-if-empty -- \ + fperms 755 + + webapp_configfile "${MY_HTDOCSDIR}/.htaccess" + webapp_hook_script "${FILESDIR}/webapp-hook" + + webapp_src_install + + newinitd "${FILESDIR}/phd.initd" phd + newconfd "${FILESDIR}/phd.confd" phd + + newinitd "${FILESDIR}/aphlict.initd" aphlict + newconfd "${FILESDIR}/aphlict.confd" aphlict + + insinto /etc/logrotate.d + newins "${FILESDIR}/${PN}.logrotate" "${PN}" + + dodoc NOTICE README.md +} + +pkg_postinst() { + webapp_pkg_postinst + + elog + elog "For more info about how to configure, see" + elog " https://secure.phabricator.com/book/phabricator/article/configuration_guide" +} -- cgit v1.2.3