mirror of
https://github.com/flatcar/scripts.git
synced 2025-09-30 10:01:32 +02:00
bump(sys-apps/portage): bump to a version on the mirrors
This commit is contained in:
parent
7bd6a483ad
commit
61ea6f3969
@ -1,6 +1,6 @@
|
|||||||
# Copyright 1999-2013 Gentoo Foundation
|
# Copyright 1999-2013 Gentoo Foundation
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.58.ebuild,v 1.1 2013/03/22 02:41:18 zmedico Exp $
|
# $Header: /var/cvsroot/gentoo-x86/sys-apps/portage/portage-2.1.11.63.ebuild,v 1.1 2013/05/03 21:08:22 zmedico Exp $
|
||||||
|
|
||||||
# Require EAPI 2 since we now require at least python-2.6 (for python 3
|
# Require EAPI 2 since we now require at least python-2.6 (for python 3
|
||||||
# syntax support) which also requires EAPI 2.
|
# syntax support) which also requires EAPI 2.
|
||||||
@ -10,7 +10,7 @@ PYTHON_COMPAT=(
|
|||||||
python3_1 python3_2 python3_3 python3_4
|
python3_1 python3_2 python3_3 python3_4
|
||||||
python2_6 python2_7
|
python2_6 python2_7
|
||||||
)
|
)
|
||||||
inherit eutils python
|
inherit eutils multilib
|
||||||
|
|
||||||
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
|
DESCRIPTION="Portage is the package management and distribution system for Gentoo"
|
||||||
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
|
HOMEPAGE="http://www.gentoo.org/proj/en/portage/index.xml"
|
||||||
@ -117,8 +117,61 @@ compatible_python_is_selected() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
current_python_has_xattr() {
|
current_python_has_xattr() {
|
||||||
[[ $(/usr/bin/python -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
|
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
|
||||||
/usr/bin/python -c 'import xattr' 2>/dev/null
|
local PYTHON=/usr/bin/${EPYTHON}
|
||||||
|
[[ $("${PYTHON}" -c 'import sys ; sys.stdout.write(sys.hexversion >= 0x3030000 and "yes" or "no")') = yes ]] || \
|
||||||
|
"${PYTHON}" -c 'import xattr' 2>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
call_with_python_impl() {
|
||||||
|
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
|
||||||
|
env EPYTHON=${EPYTHON} "$@"
|
||||||
|
}
|
||||||
|
|
||||||
|
get_python_interpreter() {
|
||||||
|
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
|
||||||
|
local impl=$1 python
|
||||||
|
case "${impl}" in
|
||||||
|
python*)
|
||||||
|
python=${impl/_/.}
|
||||||
|
;;
|
||||||
|
pypy*)
|
||||||
|
python=${impl/_/.}
|
||||||
|
python=${python/pypy/pypy-c}
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
die "Unrecognized python target: ${impl}"
|
||||||
|
esac
|
||||||
|
echo ${python}
|
||||||
|
}
|
||||||
|
|
||||||
|
get_python_sitedir() {
|
||||||
|
[ $# -eq 1 ] || die "expected 1 argument, got $#: $*"
|
||||||
|
local impl=$1
|
||||||
|
local site_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
|
||||||
|
[[ -d ${ROOT}${site_dir} ]] || \
|
||||||
|
ewarn "site-packages dir missing for ${impl}: ${ROOT}${site_dir}"
|
||||||
|
echo "${site_dir}"
|
||||||
|
}
|
||||||
|
|
||||||
|
python_compileall() {
|
||||||
|
[[ ${EPYTHON} ]] || die 'No Python implementation set (EPYTHON is null).'
|
||||||
|
local d=$1 PYTHON=/usr/bin/${EPYTHON}
|
||||||
|
local d_image=${D}${d#/}
|
||||||
|
[[ -d ${d_image} ]] || die "directory does not exist: ${d_image}"
|
||||||
|
case "${EPYTHON}" in
|
||||||
|
python*)
|
||||||
|
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
|
||||||
|
# Note: Using -OO breaks emaint, since it requires __doc__,
|
||||||
|
# and __doc__ is None when -OO is used.
|
||||||
|
"${PYTHON}" -O -m compileall -q -f -d "${d}" "${d_image}" || die
|
||||||
|
;;
|
||||||
|
pypy*)
|
||||||
|
"${PYTHON}" -m compileall -q -f -d "${d}" "${d_image}" || die
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
die "Unrecognized EPYTHON value: ${EPYTHON}"
|
||||||
|
esac
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_setup() {
|
pkg_setup() {
|
||||||
@ -155,12 +208,16 @@ pkg_setup() {
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# We use EPYTHON to designate the active python interpreter,
|
||||||
|
# but we only export when needed, via call_with_python_impl.
|
||||||
|
EPYTHON=python
|
||||||
|
export -n EPYTHON
|
||||||
if use python3; then
|
if use python3; then
|
||||||
python_set_active_version 3
|
EPYTHON=python3
|
||||||
elif use python2; then
|
elif use python2; then
|
||||||
python_set_active_version 2
|
EPYTHON=python2
|
||||||
elif use pypy2_0; then
|
elif use pypy2_0; then
|
||||||
python_set_active_version 2.7-pypy-2.0
|
EPYTHON=pypy-c2.0
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,15 +250,23 @@ src_prepare() {
|
|||||||
|| die "failed to append to make.globals"
|
|| die "failed to append to make.globals"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
local set_shebang=
|
||||||
if use python3; then
|
if use python3; then
|
||||||
einfo "Converting shebangs for python3..."
|
set_shebang=python3
|
||||||
python_convert_shebangs -r 3 .
|
|
||||||
elif use python2; then
|
elif use python2; then
|
||||||
einfo "Converting shebangs for python2..."
|
set_shebang=python2
|
||||||
python_convert_shebangs -r 2 .
|
|
||||||
elif use pypy2_0; then
|
elif use pypy2_0; then
|
||||||
einfo "Converting shebangs for pypy-c2.0..."
|
set_shebang=pypy-c2.0
|
||||||
python_convert_shebangs -r 2.7-pypy-2.0 .
|
fi
|
||||||
|
if [[ -n ${set_shebang} ]] ; then
|
||||||
|
einfo "Converting shebangs for ${set_shebang}..."
|
||||||
|
while read -r -d $'\0' ; do
|
||||||
|
local shebang=$(head -n1 "$REPLY")
|
||||||
|
if [[ ${shebang} == "#!/usr/bin/python"* ]] ; then
|
||||||
|
sed -i -e "1s:python:${set_shebang}:" "$REPLY" || \
|
||||||
|
die "sed failed"
|
||||||
|
fi
|
||||||
|
done < <(find . -type f -print0)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cd "${S}/cnf" || die
|
cd "${S}/cnf" || die
|
||||||
@ -218,20 +283,24 @@ src_prepare() {
|
|||||||
|
|
||||||
src_compile() {
|
src_compile() {
|
||||||
if use doc; then
|
if use doc; then
|
||||||
|
call_with_python_impl \
|
||||||
emake docbook || die
|
emake docbook || die
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if use epydoc; then
|
if use epydoc; then
|
||||||
einfo "Generating api docs"
|
einfo "Generating api docs"
|
||||||
|
call_with_python_impl \
|
||||||
emake epydoc || die
|
emake epydoc || die
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
src_test() {
|
src_test() {
|
||||||
|
call_with_python_impl \
|
||||||
emake test || die
|
emake test || die
|
||||||
}
|
}
|
||||||
|
|
||||||
src_install() {
|
src_install() {
|
||||||
|
call_with_python_impl \
|
||||||
emake DESTDIR="${D}" \
|
emake DESTDIR="${D}" \
|
||||||
sysconfdir="/etc" \
|
sysconfdir="/etc" \
|
||||||
prefix="/usr" \
|
prefix="/usr" \
|
||||||
@ -252,17 +321,23 @@ src_install() {
|
|||||||
# (this used to be done with PYTHONPATH setting in /etc/env.d).
|
# (this used to be done with PYTHONPATH setting in /etc/env.d).
|
||||||
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
|
# For each of PYTHON_TARGETS, install a tree of *.py symlinks in
|
||||||
# site-packages, and compile with the corresponding interpreter.
|
# site-packages, and compile with the corresponding interpreter.
|
||||||
local impl files mod_dir dest_mod_dir python relative_path files x
|
local impl files mod_dir dest_mod_dir python relative_path x
|
||||||
for impl in "${PYTHON_COMPAT[@]}" ; do
|
for impl in "${PYTHON_COMPAT[@]}" ; do
|
||||||
use "python_targets_${impl}" || continue
|
use "python_targets_${impl}" || continue
|
||||||
|
if use build && [[ ${ROOT} == / &&
|
||||||
|
! -x /usr/bin/$(get_python_interpreter ${impl}) ]] ; then
|
||||||
|
# Tolerate --nodeps at beginning of stage1 for catalyst
|
||||||
|
ewarn "skipping python_targets_${impl}, interpreter not found"
|
||||||
|
continue
|
||||||
|
fi
|
||||||
while read -r mod_dir ; do
|
while read -r mod_dir ; do
|
||||||
cd "${S}/pym/${mod_dir}" || die
|
cd "${D}/usr/lib/portage/pym/${mod_dir}" || die
|
||||||
files=$(echo *.py)
|
files=$(echo *.py)
|
||||||
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
|
if [ -z "${files}" ] || [ "${files}" = "*.py" ]; then
|
||||||
# __pycache__ directories contain no py files
|
# __pycache__ directories contain no py files
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
dest_mod_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages/${mod_dir}
|
dest_mod_dir=$(get_python_sitedir ${impl})/${mod_dir}
|
||||||
dodir "${dest_mod_dir}" || die
|
dodir "${dest_mod_dir}" || die
|
||||||
relative_path=../../../lib/portage/pym/${mod_dir}
|
relative_path=../../../lib/portage/pym/${mod_dir}
|
||||||
x=/${mod_dir}
|
x=/${mod_dir}
|
||||||
@ -274,22 +349,15 @@ src_install() {
|
|||||||
dosym "${relative_path}/${x}" \
|
dosym "${relative_path}/${x}" \
|
||||||
"${dest_mod_dir}/${x}" || die
|
"${dest_mod_dir}/${x}" || die
|
||||||
done
|
done
|
||||||
done < <(cd "${S}"/pym || die ; find * -type d ! -path "portage/tests*")
|
done < <(cd "${D}"/usr/lib/portage/pym || die ; find * -type d ! -path "portage/tests*")
|
||||||
dest_mod_dir=/usr/$(get_libdir)/${impl/_/.}/site-packages
|
cd "${S}" || die
|
||||||
case "${impl}" in
|
EPYTHON=$(get_python_interpreter ${impl}) \
|
||||||
python*)
|
python_compileall "$(get_python_sitedir ${impl})"
|
||||||
python=${impl/_/.}
|
|
||||||
python=/usr/bin/${python}
|
|
||||||
"${python}" -m compileall -q -f -d "${dest_mod_dir}" "${D}${dest_mod_dir#/}" || die
|
|
||||||
"${python}" -OO -m compileall -q -f -d "${dest_mod_dir}" "${D}${dest_mod_dir#/}" || die
|
|
||||||
;;
|
|
||||||
pypy*)
|
|
||||||
python=${impl/_/.}
|
|
||||||
python=/usr/bin/${python/pypy/pypy-c}
|
|
||||||
"${python}" -m compileall -q -f -d "${dest_mod_dir}" "${D}${dest_mod_dir#/}" || die
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Compile /usr/lib/portage/pym with the active interpreter, since portage
|
||||||
|
# internal commands force this directory to the beginning of sys.path.
|
||||||
|
python_compileall /usr/lib/portage/pym
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_preinst() {
|
pkg_preinst() {
|
||||||
@ -325,7 +393,3 @@ pkg_preinst() {
|
|||||||
ewarn "files that have not been modified since they were installed."
|
ewarn "files that have not been modified since they were installed."
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg_postrm() {
|
|
||||||
python_mod_cleanup /usr/lib/portage/pym
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user