Date: Mon, 20 Jan 2014 22:17:31 +0100 (CET) From: Marcus von Appen <mva@FreeBSD.org> To: FreeBSD-gnats-submit@freebsd.org Cc: portmgr@FreeBSD.org Subject: ports/185947: [exp-run] unique file and package name support for python ports Message-ID: <201401202117.s0KLHVLL048118@medusa.sysfault.org> Resent-Message-ID: <201401202120.s0KLK0C5042271@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 185947 >Category: ports >Synopsis: [exp-run] unique file and package name support for python ports >Confidential: no >Severity: non-critical >Priority: medium >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Mon Jan 20 21:20:00 UTC 2014 >Closed-Date: >Last-Modified: >Originator: Marcus von Appen >Release: FreeBSD 9.2-STABLE amd64 >Organization: >Environment: System: FreeBSD medusa.sysfault.org 9.2-STABLE FreeBSD 9.2-STABLE #14 r260254: Sat Jan 4 14:59:59 CET 2014 root@medusa.sysfault.org:/usr/obj/usr/src/sys/MEDUSA amd64 >Description: The attached patch enables python ports (modules or packages), which use distutils as primary installation method to install themselves in a collision-free manner for different python versions at the same time. To keep issues with the change at a minimum, an exp-run is needed to detect and fix ports, which are configured in a way that will break them with the patch. >How-To-Repeat: >Fix: --- python_unique_ports_v8.diff begins here --- Index: Mk/bsd.python.mk =================================================================== --- Mk/bsd.python.mk (revision 340230) +++ Mk/bsd.python.mk (working copy) @@ -78,8 +78,8 @@ # for ${PYTHON_PKGNAMEPREFIX}. # # PYTHON_VERSION - Version of the python binary in your ${PATH}, in the -# format "python2.0". Set this in your makefile in case you -# want to build extensions with an older binary. +# format "python2.0". Set this in your makefile in case +# you want to build extensions with an older binary. # default: depends on the version of your python binary # # PYTHON_VER - Version of the python binary in your ${PATH}, in the @@ -86,16 +86,16 @@ # format "2.7". # # PYTHON_DEFAULT_VERSION -# - Version of the default python binary in your ${PATH}, in -# the format "python2.7". +# - Version of the default python binary in your ${PATH}, +# in the format "python2.7". # # PYTHON2_DEFAULT_VERSION -# - Version of the default python2 binary in your ${PATH}, in -# the format "python2.7". +# - Version of the default python2 binary in your ${PATH}, +# in the format "python2.7". # # PYTHON3_DEFAULT_VERSION -# - Version of the default python3 binary in your ${PATH}, in -# the format "python3.2". +# - Version of the default python3 binary in your ${PATH}, +# in the format "python3.2". # # PYTHON_MAJOR_VER - Python version major number. 2 for python-2.x, # 3 for python-3.x and so on. @@ -125,22 +125,41 @@ # USE_PYTHON_PREFIX - Says that the port installs in ${PYTHONBASE}. # # USE_PYDISTUTILS - Use distutils as do-configure, do-build and do-install -# targets. +# targets. Using distutils also will cause the port to +# use a unique prefix for certain directories +# using USES=uniquefiles:dirs (see the +# uniquefiles.mk Uses for details). The values for +# the uniquefiles USES are set as follows: # +# UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX} +# UNIQUE_SUFFIX= -${PYTHON_VER} +# +# If the port is installed for the current default +# python version, scripts and binaries in +# +# ${PREFIX}/bin +# ${PREFIX}/sbin +# ${PREFIX}/libexec +# +# are linked from the prefixed version to the +# prefix-less original name, e.g. bin/foo-2.7 --> bin/foo. +# # PYSETUP - Name of the setup script used by the distutils package. # default: setup.py # # PYDISTUTILS_AUTOPLIST -# - Automatically generates the packaging list for a port that uses -# distutils or setuptools (easy_install) when defined. -# requires: USE_PYDISTUTILS +# - Automatically generates the packaging list for a port +# that uses distutils or setuptools (easy_install) when +# defined. +# requires: USE_PYDISTUTILS # # PYTHON_PY3K_PLIST_HACK -# - Automatically generates Python 3.x compatible __pycache__ entries -# from a Python 2.x packaging list when defined. Use this for ports that -# do *not* use standard Python packaging mechanisms such as distutils -# or setuptools, and support *both* Python 2.x and 3.x. Not needed when -# PYDISTUTILS_AUTOPLIST is defined. +# - Automatically generates Python 3.x compatible +# __pycache__ entries from a Python 2.x packaging list +# when defined. Use this for ports that do *not* use +# standard Python packaging mechanisms such as distutils +# or setuptools, and support *both* Python 2.x and 3.x. +# Not needed when PYDISTUTILS_AUTOPLIST is defined. # # PYDISTUTILS_PKGNAME # - Internal name in the distutils for egg-info. @@ -411,6 +430,44 @@ PYTHONPREFIX_LIBDIR= ${PYTHON_LIBDIR:S;${PYTHONBASE};${PREFIX};} PYTHONPREFIX_SITELIBDIR= ${PYTHON_SITELIBDIR:S;${PYTHONBASE};${PREFIX};} +# Used for recording the installed files. +_PYTHONPKGLIST= ${WRKDIR}/.PLIST.pymodtmp + +# Ports bound to a certain python version MUST +# - use the PYTHON_PKGNAMEPREFIX +# - use directories using the PYTHON_PKGNAMEPREFIX +# - will install binaries using the required PYTHON_PKGNAMEPREFIX, with +# the default python version creating a symlink to the original binary +# name (for staging-aware ports). +# +# What makes a port 'bound' to a certain python version? +# - it installs data into PYTHON_SITELIBDIR, PYTHON_INCLUDEDIR, ... +# - it links against libpython*.so +# - it uses USE_PYDISTUTILS +# +.if defined(NO_STAGE) && defined(UNIQUE_PYTHON_FILES) +BROKEN= UNIQUE_PYTHON_FILES uses USES=uniquefiles, which is not stage-safe +.endif +.if !defined(NO_STAGE) && (defined(USE_PYDISTUTILS) || defined(UNIQUE_PYTHON_FILES)) +_USES_POST+= uniquefiles:dirs +.if ${PYTHON_VERSION} == ${PYTHON_DEFAULT_VERSION} +UNIQUE_DEFAULT_LINKS= yes +.else +UNIQUE_DEFAULT_LINKS= no +.endif +UNIQUE_PREFIX= ${PYTHON_PKGNAMEPREFIX} +UNIQUE_SUFFIX= -${PYTHON_VER} + +.if defined(PYDISTUTILS_AUTOPLIST) +UNIQUE_FIND_SUFFIX_FILES= \ + ${SED} -e 's|^${PREFIX}/||' ${_PYTHONPKGLIST} ${TMPPLIST} | \ + ${GREP} -e '^bin/.*$$\|^sbin/.*$$\|^libexc/.*$$' +.else +UNIQUE_FIND_SUFFIX_FILES= \ + ${GREP} -he '^bin/.*$$\|^sbin/.*$$\|^libexec/.*$$' ${TMPPLIST} 2>/dev/null +.endif +.endif + _CURRENTPORT:= ${PKGNAMEPREFIX}${PORTNAME} .if defined(USE_PYDISTUTILS) && ${_CURRENTPORT} != ${PYTHON_PKGNAMEPREFIX}setuptools BUILD_DEPENDS+= ${PYTHON_PKGNAMEPREFIX}setuptools>0:${PORTSDIR}/devel/py-setuptools @@ -494,7 +551,6 @@ PYDISTUTILS_INSTALLARGS+= --root=${STAGEDIR} . endif .endif -_PYTHONPKGLIST= ${WRKDIR}/.PLIST.pymodtmp PYDISTUTILS_INSTALLARGS:= --record ${_PYTHONPKGLIST} \ ${PYDISTUTILS_INSTALLARGS} --- python_unique_ports_v8.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401202117.s0KLHVLL048118>