[SCM] KDE Development Platform Libraries module packaging branch, master, updated. debian/4.6.2-1-26-g663d23d

Modestas Vainius modax at alioth.debian.org
Wed May 25 20:01:55 UTC 2011


The following commit has been merged in the master branch:
commit 7d387fa7e959e0523b84854bd13fcaed7efc0c06
Author: Modestas Vainius <modax at debian.org>
Date:   Wed May 25 14:34:12 2011 +0300

    Add DLRestrictions support.
    
    Add DLRestrictions library checking to the plugin loader and other helper utils
    to ease DLRestrictions support in other KDE packages which ship shared
    libraries (patch add_dlrestrictions_support.diff).
---
 debian/changelog                               |    3 +
 debian/control                                 |    2 +-
 debian/patches/add_dlrestrictions_support.diff |  118 ++++++++++++++++++++++++
 debian/patches/series                          |    1 +
 4 files changed, 123 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 094d9a3..90d92d3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,6 +13,9 @@ kde4libs (4:4.6.3-0r2) UNRELEASED; urgency=low
     See #624432 for more information.
   * Break kdevelop (<< 4:4.2) in kdelibs5-plugins. Prior kdevelop versions do
     not work due to removed kate interfaces in 4.6. (Closes: #625937)
+  * Add DLRestrictions library checking to the plugin loader and other helper
+    utils to ease DLRestrictions support in other KDE packages which ship
+    shared libraries (patch add_dlrestrictions_support.diff).
 
   [ José Manuel Santamaría Lema ]
   * Update symbols files.
diff --git a/debian/control b/debian/control
index 532ed7e..07d9d1e 100644
--- a/debian/control
+++ b/debian/control
@@ -5,7 +5,7 @@ Maintainer: Debian Qt/KDE Maintainers <debian-qt-kde at lists.debian.org>
 Uploaders: Sune Vuorela <sune at debian.org>, Fathi Boudra <fabo at debian.org>, Armin Berres <armin+debian at space-based.de>,
  Modestas Vainius <modax at debian.org>, George Kiagiadakis <kiagiadakis.george at gmail.com>,
  José Manuel Santamaría Lema <panfaust at gmail.com>
-Build-Depends: debhelper (>= 7.3.16), cmake (>= 2.6.4), pkg-kde-tools (>= 0.12),
+Build-Depends: debhelper (>= 7.3.16), cmake (>= 2.6.4), pkg-kde-tools (>= 0.14), libdlrestrictions-dev (>= 0.14),
  shared-mime-info (>= 0.30), dpkg-dev (>= 1.15.5), libphonon-dev (>= 4:4.6.0really4.3.80),
  libqt4-dev (>= 4:4.7.0), libqt4-opengl-dev (>= 4:4.7.0), libqtwebkit-dev,
  libpng-dev, libssl-dev, libsm-dev, flex, bison,
diff --git a/debian/patches/add_dlrestrictions_support.diff b/debian/patches/add_dlrestrictions_support.diff
new file mode 100644
index 0000000..2f36b02
--- /dev/null
+++ b/debian/patches/add_dlrestrictions_support.diff
@@ -0,0 +1,118 @@
+From: Modestas Vainius <modax at debian.org>
+Subject: Add DLRestrictions support
+Forwarded: not-needed
+Origin: vendor
+Last-Update: 2011-05-25
+
+The patch adds DLRestrictions compatibility checks to the KPluginLoader::load()
+function. Moreover, a new helper CMake macro is introduced to ease addition of
+the special DLRestrictions symbol to the KDE 4 shared objects (shared library
+and module targets) defined in the project with kde4_add_library() macro.
+
+In order to define DLRestrictions expressions for the shared objects in your
+project, you may add something like this to the bottom of the main
+CMakeLists.txt:
+
+find_package(DLRestrictions REQUIRED)
+kde4deb_dlrestrictions_process_libraries()
+
+Please that either DEFAULT_DLRESTRICTIONS variable or DLRESTRICITIONS target
+property must have set beforehand. Otherwise, this snippet will have no effect
+on all (or some) the targets.
+
+--- a/cmake/modules/KDE4Macros.cmake
++++ b/cmake/modules/KDE4Macros.cmake
+@@ -1026,10 +1026,14 @@ macro (KDE4_ADD_LIBRARY _target_NAME _li
+    if (${_lib_TYPE} STREQUAL "SHARED")
+       set(_first_SRC)
+       set(_add_lib_param SHARED)
++      # Keep a list of SO targets in the global property
++      set_property(GLOBAL PROPERTY KDE4DEB_SO_TARGETS ${_target_NAME} APPEND)
+    endif (${_lib_TYPE} STREQUAL "SHARED")
+    if (${_lib_TYPE} STREQUAL "MODULE")
+       set(_first_SRC)
+       set(_add_lib_param MODULE)
++      # Keep a list of SO targets in the global property
++      set_property(GLOBAL PROPERTY KDE4DEB_SO_TARGETS ${_target_NAME} APPEND)
+    endif (${_lib_TYPE} STREQUAL "MODULE")
+ 
+    set(_SRCS ${_first_SRC} ${ARGN})
+@@ -1341,6 +1345,13 @@ function(KDE4_INSTALL_AUTH_ACTIONS HELPE
+ 
+ endfunction(KDE4_INSTALL_AUTH_ACTIONS)
+ 
++macro(KDE4DEB_DLRESTRICTIONS_PROCESS_LIBRARIES)
++    if (NOT DLRESTRICTIONS_FOUND)
++        MESSAGE(SEND_ERROR "Install and find_package() DLRestrictions before using it")
++    endif (NOT DLRESTRICTIONS_FOUND)
++    get_property(_all_kde4_so_targets GLOBAL PROPERTY KDE4DEB_SO_TARGETS)
++    dlrestrictions_process_targets(${_all_kde4_so_targets})
++endmacro(KDE4DEB_DLRESTRICTIONS_PROCESS_LIBRARIES)
+ 
+ macro(_KDE4_EXPORT_LIBRARY_DEPENDENCIES _append_or_write _filename)
+    message(FATAL_ERROR "_KDE4_EXPORT_LIBRARY_DEPENDENCIES() was an internal macro and has been removed again. Just remove the code which calls it, there is no substitute.")
+--- a/kdecore/CMakeLists.txt
++++ b/kdecore/CMakeLists.txt
+@@ -382,6 +382,14 @@ kde4_add_library(kdecore ${LIBRARY_TYPE}
+ 
+ target_link_libraries(kdecore ${QT_QTCORE_LIBRARY} ${QT_QTNETWORK_LIBRARY} ${QT_QTDBUS_LIBRARY} ${QT_QTXML_LIBRARY} ${ZLIB_LIBRARY} ${kdecore_OPTIONAL_LIBS})
+ 
++# Enable DLRestrictions library checking for Debian only
++if (CMAKE_BUILD_TYPE STREQUAL "Debian")
++    find_package(DLRestrictions REQUIRED)
++    macro_log_feature(DLRESTRICTIONS_FOUND "DLRestrictions" "Needed for kdecore plugin loader (Debian specific)" "http://packages.debian.org/search?keywords=libdlrestrictions-dev" TRUE "" "")
++    set_property(TARGET kdecore PROPERTY COMPILE_DEFINITIONS HAVE_DLRESTRICTIONS)
++    target_link_libraries(kdecore dlrestrictions)
++endif (CMAKE_BUILD_TYPE STREQUAL "Debian")
++
+ if(WINCE)
+   target_link_libraries(kdecore ${WCECOMPAT_LIBRARIES} Ceshell.lib)
+ endif(WINCE)
+--- a/kdecore/util/kpluginloader.cpp
++++ b/kdecore/util/kpluginloader.cpp
+@@ -31,6 +31,14 @@
+ #include <QtCore/QDir>
+ #include <QtCore/QFileInfo>
+ 
++#ifdef HAVE_DLRESTRICTIONS
++extern "C" {
++#include <dlrestrictions.h>
++}
++#include <errno.h>
++#include <QtCore/QFile>
++#endif
++
+ extern int kLibraryDebugArea();
+ 
+ class KPluginLoaderPrivate
+@@ -259,6 +267,30 @@ bool KPluginLoader::load()
+     else
+         d->pluginVersion = ~0U;
+ 
++#ifdef HAVE_DLRESTRICTIONS
++    QByteArray enLibFileName = QFile::encodeName(lib.fileName());
++    int dlr_plugstatus = dlr_check_file_compatibility(enLibFileName.data(), NULL);
++    if (dlr_plugstatus == -ENOENT) {
++        // Something was wrong with the given filename
++        kWarning(kLibraryDebugArea()) << "DLRestrictions was unable to load plugin" <<
++            d->name << "(filename: " << lib.fileName() << ") for compatibility checking. "
++            "Error was" << QString::fromLocal8Bit(dlr_error()) << ". Accepting anyway.";
++    } else if (dlr_plugstatus < 0) {
++        /* Do not fail if DLRestrictions specific error occurs */
++        char dlr_buf[4096];
++        dlr_buf[0] = 0;
++        dlr_snprintf_pretty_error(dlr_buf, sizeof(dlr_buf), d->name.toLocal8Bit().data());
++        kWarning(kLibraryDebugArea()) << dlr_buf << ". Accepting" << d->name << "plugin anyway.";
++    } else if (dlr_plugstatus == 0) {
++        /* Plugin or its shared library dependencies are not compatible */
++        d->errorString = i18n("The plugin '%1' or its library dependencies are not "
++                "compatible with currently loaded libraries: %2", d->name,
++                QString::fromLocal8Bit(dlr_error()));
++        unload();
++        return false;
++    } /* Else plugin passed DLRestrictions checks. Fine */
++#endif
++
+     return true;
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
index 5d8e749..124e163 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -17,3 +17,4 @@ hurd_support.diff
 kfileshare_kdesu_fileshareset.diff
 relax_plugin_kde_version_check.diff
 upstream_fix_job-on-hold_reuse_logic.diff
+add_dlrestrictions_support.diff

-- 
KDE Development Platform Libraries module packaging



More information about the pkg-kde-commits mailing list