aboutsummaryrefslogtreecommitdiffstats
path: root/x11
diff options
context:
space:
mode:
authorrakuco <rakuco@FreeBSD.org>2015-12-19 02:10:24 +0800
committerrakuco <rakuco@FreeBSD.org>2015-12-19 02:10:24 +0800
commit1fbb49301df2c49d6bbdfb0b586139b7be91a987 (patch)
tree8ec566a424d281e234173b7ada1742bf2225876f /x11
parent0bf0ddcf43499a09987adf677ac1738338f41c14 (diff)
downloadfreebsd-ports-gnome-1fbb49301df2c49d6bbdfb0b586139b7be91a987.tar.gz
freebsd-ports-gnome-1fbb49301df2c49d6bbdfb0b586139b7be91a987.tar.zst
freebsd-ports-gnome-1fbb49301df2c49d6bbdfb0b586139b7be91a987.zip
Remove ${STAGEDIR} from pyc/pyo files installed with kdelibs's CMake macros.
Bug 200018 is caused by the .pyc/.pyo files installed by devel/py-pykde4 containing references to the stage directory in them. When editors/kate-plugin-pate is built by a user with write-access to those PyKDE4 .pyc/.pyo files, they are rewritten automatically by Python to point to their current location, which most of the times is different from the staging location of where devel/py-pykde4 was built. This at the very least leads to a filesystem violation in Poudriere. The fix I landed upstream involves making kdelibs's PythonCompile.py accept a --destination-dir parameter with the directory we want to register in the .pyc/.pyo files, just like several ports do in their build or post-install targets by calling Python's compileall.py module with -d. The patches in files/ look somewhat confusing because we already patch PythonMacros.cmake to build .pyo files and had to integrate the other patches into it. At least I have added some context to patch-cmake_modules_PythonMacros.cmake to reduce the confusion. Bump PORTREVISION in affected ports: - devel/py-pykde4: Install .pyc/.pyo files with ${STAGEDIR} in them. - games/kajongg: The plist now includes .pyo files, and was adjusted to work with Python 3 in the future if necessary. - x11/kdelibs4: Install new CMake files. - x11/plasma-scriptengine-python: Install .pyc/.pyo files with ${STAGEDIR} in them. PR: 200018 MFH: 2015Q4
Diffstat (limited to 'x11')
-rw-r--r--x11/kdelibs4/Makefile2
-rw-r--r--x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake43
-rw-r--r--x11/kdelibs4/files/patch-git_016841a78
-rw-r--r--x11/kdelibs4/files/patch-git_94f1d2f67
-rw-r--r--x11/plasma-scriptengine-python/Makefile1
5 files changed, 178 insertions, 13 deletions
diff --git a/x11/kdelibs4/Makefile b/x11/kdelibs4/Makefile
index f7e921b64e99..0ee8bcec117d 100644
--- a/x11/kdelibs4/Makefile
+++ b/x11/kdelibs4/Makefile
@@ -3,7 +3,7 @@
PORTNAME= kdelibs
PORTVERSION= ${KDE4_VERSION}
-PORTREVISION= 3
+PORTREVISION= 4
CATEGORIES= x11 kde
MASTER_SITES= KDE/${KDE4_BRANCH}/${PORTVERSION}/src
DIST_SUBDIR= KDE/${PORTVERSION}
diff --git a/x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake b/x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake
index d93570912c61..457c4a5741b5 100644
--- a/x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake
+++ b/x11/kdelibs4/files/patch-cmake_modules_PythonMacros.cmake
@@ -1,6 +1,13 @@
---- cmake/modules/PythonMacros.cmake.orig 2013-01-23 22:44:16.000000000 +0100
-+++ cmake/modules/PythonMacros.cmake 2013-02-27 13:39:48.000000000 +0100
-@@ -43,9 +43,11 @@
+The pyo-related changes are (at least for now) FreeBSD-specific and are present
+in order to install .pyo files in addition to .pyc files when installing Python
+modules.
+
+The "--destination-dir" changes are required to fix PR 200018 and come from a
+change landed upstream, 94f1d2f ("PythonMacros: specify destination directory
+in byte-compiled files"). See patch-git_94f1d2f for more information.
+--- cmake/modules/PythonMacros.cmake
++++ cmake/modules/PythonMacros.cmake
+@@ -41,16 +41,18 @@ macro(PYTHON_INSTALL SOURCE_FILE DESTINATION_DIR)
if(PYTHON_VERSION_STRING VERSION_GREATER 3.1)
# To get the right version for suffix
set(_bin_pyc "${CMAKE_CURRENT_BINARY_DIR}/${_basepath}/__pycache__/${_filenamebase}.cpython-${PYTHON_VERSION_MAJOR}${PYTHON_VERSION_MINOR}.pyc")
@@ -12,25 +19,37 @@
set(_py_install_dir "${DESTINATION_DIR}")
endif()
-@@ -60,6 +62,7 @@
- TARGET compile_python_files
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath})
+
+ # Setting because it will be displayed later, in compile_python_files
+- set(_message "Byte-compiling ${_bin_py} to ${_bin_pyc}")
++ set(_message "Byte-compiling ${_bin_py} to ${_bin_pyc} and ${_bin_pyo}")
+
+ string(REPLACE "/" "_" _rule_name "${_basepath}/${_bin_pyc}")
+ add_custom_target("${_rule_name}" ALL)
+@@ -60,7 +62,8 @@ macro(PYTHON_INSTALL SOURCE_FILE DESTINATION_DIR)
+ add_custom_command(
+ TARGET "${_rule_name}"
COMMAND "${CMAKE_COMMAND}" -E echo "${_message}"
- COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "${_bin_py}"
-+ COMMAND "${PYTHON_EXECUTABLE}" -O "${_python_compile_py}" "${_bin_py}"
+- COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "${_bin_py}"
++ COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
++ COMMAND "${PYTHON_EXECUTABLE}" -O "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
DEPENDS "${_absfilename}"
)
else()
-@@ -68,11 +71,13 @@
+@@ -68,12 +71,13 @@ macro(PYTHON_INSTALL SOURCE_FILE DESTINATION_DIR)
+ TARGET "${_rule_name}"
COMMAND "${CMAKE_COMMAND}" -E echo "${_message}"
COMMAND "${CMAKE_COMMAND}" -E copy "${_absfilename}" "${_bin_py}"
- COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "${_bin_py}"
-+ COMMAND "${PYTHON_EXECUTABLE}" -O "${_python_compile_py}" "${_bin_py}"
+- COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "${_bin_py}"
++ COMMAND "${PYTHON_EXECUTABLE}" "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
++ COMMAND "${PYTHON_EXECUTABLE}" -O "${_python_compile_py}" "--destination-dir" "${DESTINATION_DIR}" "${_bin_py}"
DEPENDS "${_absfilename}"
)
endif()
- install(FILES ${_bin_pyc} DESTINATION "${_py_install_dir}")
-+ install(FILES ${_bin_pyo} DESTINATION "${_py_install_dir}")
+- install(FILES ${_bin_pyc} DESTINATION "${_py_install_dir}")
++ install(FILES ${_bin_pyc} ${_bin_pyo} DESTINATION "${_py_install_dir}")
unset(_py_install_dir)
unset(_message)
diff --git a/x11/kdelibs4/files/patch-git_016841a b/x11/kdelibs4/files/patch-git_016841a
new file mode 100644
index 000000000000..d5897fa3a0d6
--- /dev/null
+++ b/x11/kdelibs4/files/patch-git_016841a
@@ -0,0 +1,78 @@
+commit 016841aeb0b180981122085e9b1d49ae66951670
+Author: Raphael Kubo da Costa <rakuco@FreeBSD.org>
+Date: Fri Dec 18 13:35:35 2015 +0100
+
+ FindPyKDE4: Make PYKDE4_INSTALL_PYTHON_FILES use PYTHON_INSTALL.
+
+ Commit 94f1d2f ("PythonMacros: specify destination directory in
+ byte-compiled files") broke Kajongg's build because it uses the
+ PYKDE4_INSTALL_PYTHON_FILES() macro, whose use of PythonCompile.py had
+ not been updated.
+
+ Instead of just passing --destination-dir in FindPyKDE4.cmake, rewrite
+ the PYKDE4_INSTALL_PYTHON_FILES() macro to use PythonMacros's
+ PYTHON_INSTALL(). Not only does this fix Kajongg's build, but it also
+ removes a lot of code duplication and makes
+ PYKDE4_INSTALL_PYTHON_FILES() work with Python 3.2+'s different .pyc
+ location.
+
+ REVIEW: 126413
+
+Required for PR 200018.
+--- cmake/modules/FindPyKDE4.cmake
++++ cmake/modules/FindPyKDE4.cmake
+@@ -9,6 +9,7 @@
+ # This file is in the public domain.
+
+ INCLUDE(FindPythonInterp)
++include(PythonMacros)
+
+ SET(PYKDE4_FOUND FALSE)
+
+@@ -104,45 +105,8 @@ ENDIF(PYTHONINTERP_FOUND)
+ # project..
+ #
+ MACRO(PYKDE4_INSTALL_PYTHON_FILES)
+-
+- ADD_CUSTOM_TARGET(pysupport ALL)
+ FOREACH (_current_file ${ARGN})
+-
+- # Install the source file.
+- INSTALL(FILES ${_current_file} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
+-
+- # Byte compile and install the .pyc file.
+- GET_FILENAME_COMPONENT(_absfilename ${_current_file} ABSOLUTE)
+- GET_FILENAME_COMPONENT(_filename ${_current_file} NAME)
+- GET_FILENAME_COMPONENT(_filenamebase ${_current_file} NAME_WE)
+- GET_FILENAME_COMPONENT(_basepath ${_current_file} PATH)
+- SET(_bin_py ${CMAKE_BINARY_DIR}/${_basepath}/${_filename})
+- SET(_bin_pyc ${CMAKE_BINARY_DIR}/${_basepath}/${_filenamebase}.pyc)
+-
+- FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_basepath})
+-
+- SET(_message "-DMESSAGE=Byte-compiling ${_bin_py}")
+-
+- GET_FILENAME_COMPONENT(_abs_bin_py ${_bin_py} ABSOLUTE)
+- IF(_abs_bin_py STREQUAL ${_absfilename}) # Don't copy the file onto itself.
+- ADD_CUSTOM_COMMAND(
+- TARGET pysupport
+- COMMAND ${CMAKE_COMMAND} -E echo ${message}
+- COMMAND ${PYTHON_EXECUTABLE} ${current_module_dir}/PythonCompile.py ${_bin_py}
+- DEPENDS ${_absfilename}
+- )
+- ELSE(_abs_bin_py STREQUAL ${_absfilename})
+- ADD_CUSTOM_COMMAND(
+- TARGET pysupport
+- COMMAND ${CMAKE_COMMAND} -E echo ${message}
+- COMMAND ${CMAKE_COMMAND} -E copy ${_absfilename} ${_bin_py}
+- COMMAND ${PYTHON_EXECUTABLE} ${current_module_dir}/PythonCompile.py ${_bin_py}
+- DEPENDS ${_absfilename}
+- )
+- ENDIF(_abs_bin_py STREQUAL ${_absfilename})
+-
+- INSTALL(FILES ${_bin_pyc} DESTINATION ${DATA_INSTALL_DIR}/${PROJECT_NAME})
+-
++ python_install(${_current_file} ${DATA_INSTALL_DIR}/${PROJECT_NAME})
+ ENDFOREACH (_current_file)
+ ENDMACRO(PYKDE4_INSTALL_PYTHON_FILES)
+
diff --git a/x11/kdelibs4/files/patch-git_94f1d2f b/x11/kdelibs4/files/patch-git_94f1d2f
new file mode 100644
index 000000000000..ee387ceb8a0e
--- /dev/null
+++ b/x11/kdelibs4/files/patch-git_94f1d2f
@@ -0,0 +1,67 @@
+commit 94f1d2fa9582a2942d5154b85c849cc3c6140e31
+Author: Raphael Kubo da Costa <rakuco@FreeBSD.org>
+Date: Wed Dec 16 18:25:13 2015 +0100
+
+ PythonMacros: specify destination directory in byte-compiled files.
+
+ The PYTHON_INSTALL() macro is a wrapper around the py_compile Python
+ module that also installs the byte-code (.pyc) file it generates.
+
+ However, when a .py file is passed to py_compile without any additional
+ arguments, its full path is recorded in the .pyc file. This is
+ problematic, as most distributions install all files into a build root
+ instead of simply copying files to / as part of the packaging process.
+ In this case, the generated .pyc file will have something like
+ /wrkdir/buildroot/usr/lib/python2.7/site-packages/Foo/my_module.py
+ in it. Not only does this show up in exception tracebacks, but if the
+ user later invokes my_module.py and has write access to my_module's
+ directory, my_module.pyc will be rewritten with the right path to
+ my_module.py (without the build root). This can lead to uninstallation
+ errors if the package management system checks each file before removal,
+ for example.
+
+ Fix it by rewritting the PythonCompile.py script so that it takes a
+ --destination-dir argument that we use to pass the full path to
+ my_module.py instead of letting it be (wrongly) deduced.
+
+ It is important to note that PythonCompile.py now uses the argparse
+ module, which is not present in Python <= 2.6, Python 3.0 and Python
+ 3.1.
+
+ REVIEW: 126345
+
+Required for PR 200018. Part of this commit is in patch-cmake_modules_PythonMacros.py.
+--- cmake/modules/PythonCompile.py
++++ cmake/modules/PythonCompile.py
+@@ -1,4 +1,29 @@
+ # By Simon Edwards <simon@simonzone.com>
+ # This file is in the public domain.
+-import py_compile, sys
+-sys.exit(py_compile.main())
++
++"""
++Byte-compiles a given Python source file, generating a .pyc file or, if the
++Python executable was invoked with -O, a .pyo file from it.
++It uses the --destination-dir option to set the path to the source file (which
++will appear in tracebacks, for example), so that if the .py file was in a build
++root will appear with the right path.
++"""
++
++import argparse
++import os
++import py_compile
++
++
++if __name__ == '__main__':
++ parser = argparse.ArgumentParser('Byte-compiles a Python source file.')
++ parser.add_argument('-d', '--destination-dir', required=True,
++ help='Location where the source file will be '
++ 'installed, without any build roots.')
++ parser.add_argument('source_file',
++ help='Source file to byte-compile.')
++
++ args = parser.parse_args()
++
++ dfile = os.path.join(args.destination_dir,
++ os.path.basename(args.source_file))
++ py_compile.compile(args.source_file, dfile=dfile)
diff --git a/x11/plasma-scriptengine-python/Makefile b/x11/plasma-scriptengine-python/Makefile
index 379df2c07da3..cb701337d47c 100644
--- a/x11/plasma-scriptengine-python/Makefile
+++ b/x11/plasma-scriptengine-python/Makefile
@@ -2,6 +2,7 @@
PORTNAME= plasma-scriptengine-python
PORTVERSION= ${KDE4_WORKSPACE_VERSION}
+PORTREVISION= 1
CATEGORIES= x11 kde
MASTER_SITES= KDE/${KDE4_BRANCH}/${KDE4_VERSION}/src
DISTNAME= kde-workspace-${PORTVERSION}