summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xpython-updater72
1 files changed, 36 insertions, 36 deletions
diff --git a/python-updater b/python-updater
index 3e192bb..6392b6e 100755
--- a/python-updater
+++ b/python-updater
@@ -152,6 +152,41 @@ has_version() {
fi
}
+# get_ebuild_path(CATEGORY, PN, SLOT)
+get_ebuild_path() {
+ # These manual calls to Portage API are 2 times faster than 'portageq get_repo_path / "$(portageq metadata / ebuild "$(portageq best_visible / "${1}")" repository)"'.
+ /usr/bin/python -c "
+import sys
+
+if '' in sys.path:
+ sys.path.remove('')
+
+import portage
+
+dbapi = portage.db['/']['porttree'].dbapi
+pkg_list = dbapi.match('${1}/${2}${3:+:}${3}')
+if pkg_list:
+ best_visible = portage.best(pkg_list)
+ if best_visible:
+ repository = dbapi.aux_get(best_visible, ['repository'])
+ if repository:
+ repository_location = dbapi.getRepositoryPath(repository[0])
+ if repository_location:
+ print(repository_location + '/${1}/${2}/' + best_visible.split('/')[1] + '.ebuild')"
+}
+
+# get_ebuild_variable(CATEGORY, PN, SLOT, variable)
+get_ebuild_variable() {
+ if [[ "${PMS_COMMAND[${PMS_INDEX}]}" =~ ^(emerge|pmerge)$ ]]; then
+ local ebuild_path="$(get_ebuild_path "${1}" "${2}" "${3}")"
+ if [[ -f "${ebuild_path}" ]]; then
+ grep "^${4}=" "${ebuild_path}" | sed -e "s/${4}=[\"']\(.*\)[\"']/\1/"
+ fi
+ else
+ cave print-id-environment-variable "${1}/${2}${3:+:}${3}::/?" --best --format %v --variable-name ${4}
+ fi
+}
+
# get_vdb_variable(variable, environment_file)
get_vdb_variable() {
local variable="${1}"
@@ -236,41 +271,6 @@ get_USE_PYTHON() {
echo "${USE_PYTHON}"
}
-# get_ebuild_path(CATEGORY, PN, SLOT)
-get_ebuild_path() {
- # These manual calls to Portage API are 2 times faster than 'portageq get_repo_path / "$(portageq metadata / ebuild "$(portageq best_visible / "${1}")" repository)"'.
- /usr/bin/python -c "
-import sys
-
-if '' in sys.path:
- sys.path.remove('')
-
-import portage
-
-dbapi = portage.db['/']['porttree'].dbapi
-pkg_list = dbapi.match('${1}/${2}${3:+:}${3}')
-if pkg_list:
- best_visible = portage.best(pkg_list)
- if best_visible:
- repository = dbapi.aux_get(best_visible, ['repository'])
- if repository:
- repository_location = dbapi.getRepositoryPath(repository[0])
- if repository_location:
- print(repository_location + '/${1}/${2}/' + best_visible.split('/')[1] + '.ebuild')"
-}
-
-# get_RESTRICT_PYTHON_ABIS(CATEGORY, PN, SLOT)
-get_RESTRICT_PYTHON_ABIS() {
- if [[ "${PMS_COMMAND[${PMS_INDEX}]}" =~ ^(emerge|pmerge)$ ]]; then
- local ebuild_path="$(get_ebuild_path "${1}" "${2}" "${3}")"
- if [[ -f "${ebuild_path}" ]]; then
- grep "^RESTRICT_PYTHON_ABIS=" "${ebuild_path}" | sed -e "s/RESTRICT_PYTHON_ABIS=[\"']\(.*\)[\"']/\1/"
- fi
- else
- cave print-id-environment-variable "${1}/${2}${3:+:}${3}::/?" --best --format %v --variable-name RESTRICT_PYTHON_ABIS
- fi
-}
-
# check_python_abi_matching(PYTHON_ABI, PYTHON_ABI_pattern)
check_python_abi_matching() {
local pattern patterns patterns_list="0" PYTHON_ABI
@@ -739,7 +739,7 @@ for contents_file in $(find ${PKG_DBDIR}/ -name CONTENTS | sort); do
if [[ CHECK_PYTHON_ABIS -ne 0 ]]; then
if [[ -n "${PYTHON_MULTIPLE_ABIS}" || -n "${SUPPORT_PYTHON_ABIS}" ]]; then
new_PYTHON_ABIS=""
- RESTRICT_PYTHON_ABIS="$(get_RESTRICT_PYTHON_ABIS "${CATEGORY}" "${PN}" "${SLOT}")"
+ RESTRICT_PYTHON_ABIS="$(get_ebuild_variable "${CATEGORY}" "${PN}" "${SLOT}" "${RESTRICT_PYTHON_ABIS}")"
USE_PYTHON="$(get_USE_PYTHON "${CATEGORY}" "${PN}" "${SLOT}")"
for PYTHON_ABI in ${USE_PYTHON}; do
support_ABI="1"