# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=8 PYTHON_COMPAT=( python3_{11..12} ) inherit toolchain-funcs python-single-r1 git-r3 DESCRIPTION="Command-line tool for Phabricator" HOMEPAGE="https://www.phacility.com" EGIT_REPO_URI="https://github.com/phacility/arcanist.git" EGIT_BRANCH="stable" EGIT_COMMIT="b6babd9a07f428c68863cb38f2fa87114e9ca2eb" LICENSE="Apache-2.0" SLOT="stable" KEYWORDS="~amd64 ~x86" IUSE="git lint mercurial subversion ssl test" REQUIRED_USE="test? ( lint ) ${PYTHON_REQUIRED_USE}" RESTRICT="!test? ( test )" DEPEND="app-alternatives/awk:0 test? ( sys-devel/bison:0 >=sys-devel/flex-2.5.35:0 dev-lang/php[xmlwriter] )" RDEPEND="dev-lang/php[curl,iconv,mysql,mysqli,pcntl,ssl?,unicode] git? ( dev-vcs/git:0 ) mercurial? ( dev-vcs/mercurial:0 ) subversion? ( dev-vcs/subversion:0 ) lint? ( app-admin/puppet-lint:0 dev-php/PHP_CodeSniffer:0 $(python_gen_cond_dep ' dev-python/pylint:0[${PYTHON_USEDEP}] dev-python/flake8:0[${PYTHON_USEDEP}] ') dev-util/cppcheck:0 net-libs/nodejs[npm] ) ${PYTHON_DEPS}" PATCHES=( "${FILESDIR}/${PV}-MEDIUM-get-VERSION-from-usr-share-PN-GIT_COMMIT_INFO.patch" "${FILESDIR}/${PV}-MINOR-disable-self-upgrade.patch" "${FILESDIR}/${PV}-MEDIUM-use-system-provided-by-ca-certificates.patch" ) src_test() { einfo "Note that you need to install some Node JS script manually:" einfo " npm install -g coffeelint" einfo " npm install -g csslint" einfo " npm install -g jscs" einfo " npm install -g jshint" einfo " npm install -g jsonlint" einfo " npm install -g less" local GIT_NAME="${FUNCNAME} for ${CATEGORY}/${PF}" local GIT_EMAIL="portage@localhost" export GIT_AUTHOR_NAME="${GIT_NAME}" export GIT_AUTHOR_EMAIL="${GIT_EMAIL}" export GIT_COMMITTER_NAME="${GIT_NAME}" export GIT_COMMITTER_EMAIL="${GIT_EMAIL}" # Unable to locate binary "golint" to run linter ArcanistGoLintLinter. You may need to install the binary, or adjust your linter configuration. # TO INSTALL: Install Golint using `go get github.com/golang/lint/golint`. # Set config in .git/arc/config for ArcanistPyLintLinter bin/arc set-config --local lint.pylint.codes.advice '^(C|R).*' > /dev/null || die bin/arc set-config --local lint.pylint.codes.error '^(E|F).*' > /dev/null || die bin/arc set-config --local lint.pylint.codes.warning '^W.*' > /dev/null || die # + https://secure.phabricator.com/T7170 bin/arc unit --everything --no-coverage || die "arc unit failed" } src_prepare() { default git log --format='%ct%x01%H' -n 1 > "${S}/GIT_COMMIT_INFO" git remote add origin "${EGIT_REPO_URI}" git remote -v > "${S}/GIT_REMOTE_INFO" if use test ; then tc-export AR CXX fi find "${S}" -type f -name .gitignore -print0 \ | xargs -0 --no-run-if-empty -- \ rm || die rm bin/*.bat || die rm -r resources/ssl || die rm ./src/parser/xhpast/bin/xhpast.exe || die # Replace 'env' shebang to files it point to find "${S}" -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 "Replace ${REPLY/#${S}\/} shebang to #!${path} ${args}" sed -i \ -e "1 s:^#!.*:#!${path} ${args}:" \ "${REPLY}" || die done } src_compile() { if use test ; then cd support/xhpast # Avoid sandbox violation for dev-lang/php[snmp] # php -f generate_nodes.php' # # * ACCESS DENIED: open_wr: /var/lib/net-snmp/mib_indexes/0 # abs_path: /var/lib/net-snmp/mib_indexes/0 # res_path: /var/lib/net-snmp/mib_indexes/0 # /usr/lib64/libsandbox.so(+0xd9d1)[0x7f226c8899d1] # /usr/lib64/libsandbox.so(+0xdaf8)[0x7f226c889af8] # /usr/lib64/libsandbox.so(+0x59cf)[0x7f226c8819cf] # /usr/lib64/libsandbox.so(fopen+0x7c)[0x7f226c8843ec] # /usr/lib64/libnetsnmp.so.30(netsnmp_mibindex_new+0x48)[0x7f22695f55e8] # /usr/lib64/libnetsnmp.so.30(add_mibdir+0x9c)[0x7f226960a00c] # /usr/lib64/libnetsnmp.so.30(netsnmp_init_mib+0xca)[0x7f22695f4bea] # /usr/lib64/libnetsnmp.so.30(init_snmp+0x32d)[0x7f226961c2dd] # php(zm_startup_snmp+0x51)[0x7f226cf81e11] # php(zend_startup_module_ex+0x11a)[0x7f226d0bccea] # /proc/15834/cmdline: php -f generate_nodes.php # # See snmp_config(5) export SNMP_PERSISTENT_DIR="${T}" emake emake install fi } src_install() { insinto "/usr/share/${PN}" doins GIT_COMMIT_INFO GIT_REMOTE_INFO insinto "/usr/share/php/${PN}" doins -r bin externals resources scripts src insinto "/usr/share/php/${PN}/support" doins -r support/init support/lib if use test ; then fperms 755 "/usr/share/php/${PN}/src/parser/xhpast/bin/xhpast" dosym "../share/php/${PN}/src/parser/xhpast/bin/xhpast" /usr/bin/xhpast fi # 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 dosym "../share/php/${PN}/bin/arc" /usr/bin/arc dodoc NOTICE README.md } pkg_postinst() { if use lint; then elog elog "Some linter need external NodeJS script. To install them, use:" elog " npm install -g csslint" fi }