diff --git a/libyui-3.3.1-CMake_warnings.patch b/libyui-3.3.1-CMake_warnings.patch deleted file mode 100644 index 4da2d0f..0000000 --- a/libyui-3.3.1-CMake_warnings.patch +++ /dev/null @@ -1,32 +0,0 @@ -From 45bc75ca188f52c92ffced79df69a7c15853e999 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= -Date: Fri, 14 Apr 2017 11:01:58 +0200 -Subject: [PATCH] Avoid several warnings from CMake - ---- - buildtools/CMakeLists.common | 12 ++++++++++++ - 1 file changed, 12 insertions(+) - -diff --git a/buildtools/CMakeLists.common b/buildtools/CMakeLists.common -index 55843f5..6038834 100644 ---- a/buildtools/CMakeLists.common -+++ b/buildtools/CMakeLists.common -@@ -6,6 +6,18 @@ if( POLICY CMP0053 ) - cmake_policy( SET CMP0053 OLD ) - endif() - -+# Avoid several warnings in cmake-files from Qt5. -+# CMP0043: Ignore COMPILE_DEFINITIONS_ properties -+if( POLICY CMP0043 ) -+ cmake_policy( SET CMP0043 OLD ) -+endif() -+ -+# Avoid several warnings when building qt-graph. -+# CMP0028: Double colon in target name means ALIAS or IMPORTED target -+if( POLICY CMP0028 ) -+ cmake_policy( SET CMP0028 OLD ) -+endif() -+ - INCLUDE( "${CMAKE_SOURCE_DIR}/PROJECTINFO.cmake" ) - - SET( BUILDTOOLS_DIR "buildtools/" ) diff --git a/libyui-3.3.1-env_YUI_PREFERED_BACKEND.patch b/libyui-3.3.1-env_YUI_PREFERED_BACKEND.patch deleted file mode 100644 index 54fb75f..0000000 --- a/libyui-3.3.1-env_YUI_PREFERED_BACKEND.patch +++ /dev/null @@ -1,318 +0,0 @@ -From 5e04743f9fb669d26d3814b1b9ba089d0a8c5b14 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Bj=C3=B6rn=20Esser?= -Date: Thu, 13 Apr 2017 21:11:26 +0200 -Subject: [PATCH] Add $(ENV:YUI_PREFERED_BACKEND) to set prefered UI-backend - ---- - README.md | 40 +++++++++++++++- - src/YUILoader.cc | 144 +++++++++++++++++++++++++++++++++++-------------------- - src/YUILoader.h | 41 ++++++++++++++-- - 3 files changed, 170 insertions(+), 55 deletions(-) - -diff --git a/README.md b/README.md -index 8b982cb..c3b91a0 100644 ---- a/README.md -+++ b/README.md -@@ -9,6 +9,45 @@ but it can be used in any independent project. - This part contains the base abstraction layer which is implemented in several - target frontends. - -+ -+### Selecting the used UI-plugin -+ -+By default LibYUI tries to load any of the available UI-plugins in this order: -+ -+* Qt: -+ - if $DISPLAY is set -+ - NCurses is user-selected and stdout is *not* a TTY -+ -+* Gtk: -+ - if $DISPLAY is set and Qt is not available, -+ - a GTK-based desktop environment is detected from the environment variable -+ XDG_CURRENT_DESKTOP -+ - any of the above pre-conditions are met and NCurses is user-selected, but -+ stdout is *not* a TTY -+ -+* NCurses: -+ - if $DISPLAY is *not* set and stdout is a TTY -+ - Qt and Gtk are not available and stdout is a TTY -+ -+This can be overridden by either: -+ -+* specifing one of the switches on the command-line of the program -+ - `--gtk`, -+ - `--ncurses`, or -+ - `--qt` -+ -+* setting the environment variable YUI_PREFERED_BACKEND to one of -+ - `gtk`, -+ - `ncurses`, or -+ - `qt` -+ -+If a command-line switch is given to the program, the setting from the environment -+variable will be overridden by the UI-plugin chosen with the switch. -+ -+If the user-selected UI-plugin is not installed on the system, an installed -+UI-plugin will be chosen by the above criteria. -+ -+ - ### Building - - Libyui uses CMake, driven by a slightly complex set of -@@ -29,4 +68,3 @@ Then to build the package run: - ``` - rake osc:build - ``` -- -diff --git a/src/YUILoader.cc b/src/YUILoader.cc -index 7933ae4..2370a61 100644 ---- a/src/YUILoader.cc -+++ b/src/YUILoader.cc -@@ -42,11 +42,29 @@ - void YUILoader::loadUI( bool withThreads ) - { - bool isGtk = false; -- const char * envDisplay = getenv( "DISPLAY" ); -- const char * envDesktop = getenv( "XDG_CURRENT_DESKTOP" ); -+ const char * envDesktop; -+ const char * envDisplay; -+ const char * envPreset; - std::string wantedGUI; - -- yuiMilestone () << "XDG_CURRENT_DESKTOP: \"" << envDesktop << "\"" << std::endl; -+ if( getenv( "DISPLAY" ) ) -+ envDisplay = getenv( "DISPLAY" ); -+ else -+ envDisplay = ""; -+ -+ if( getenv( "XDG_CURRENT_DESKTOP" ) ) -+ envDesktop = getenv( "XDG_CURRENT_DESKTOP" ); -+ else -+ envDesktop = ""; -+ -+ if( getenv( "YUI_PREFERED_BACKEND" ) ) -+ envPreset = getenv( "YUI_PREFERED_BACKEND" ); -+ else -+ envPreset = ""; -+ -+ yuiMilestone () << "DISPLAY: \"" << envDisplay << "\"" << std::endl; -+ yuiMilestone () << "XDG_CURRENT_DESKTOP: \"" << envDesktop << "\"" << std::endl; -+ yuiMilestone () << "YUI_PREFERED_BACKEND: \"" << envPreset << "\"" << std::endl; - - // Taken from: https://specifications.freedesktop.org/menu-spec/menu-spec-1.1.html#onlyshowin-registry - isGtk = ( ( strstr( envDesktop, "Cinnamon" ) != NULL ) || isGtk ); -@@ -58,74 +76,88 @@ void YUILoader::loadUI( bool withThreads ) - isGtk = ( ( strstr( envDesktop, "Unity" ) != NULL ) || isGtk ); - isGtk = ( ( strstr( envDesktop, "XFCE" ) != NULL ) || isGtk ); - -- if( isGtk ) -- { -- yuiMilestone () << "Detected a Gtk-based desktop environment." << std::endl; -- yuiMilestone () << "Prefering Gtk-UI if available." << std::endl; -- } -+ if( isGtk ) yuiMilestone () << "Detected a Gtk-based desktop environment." << std::endl -+ << "Prefering Gtk-UI if available and no" << std::endl -+ << "user-selected override is present." << std::endl; - - YCommandLine cmdline; - -- bool wantNcurses = cmdline.find("--ncurses") != -1; -- if( wantNcurses ) -- yuiMilestone () << "Using UI-backend: \"" << YUIPlugin_NCurses << "\". Forced on command-line." << std::endl; -- bool wantQt = cmdline.find("--qt") != -1; -- if( wantQt ) -- yuiMilestone () << "Using UI-backend: \"" << YUIPlugin_Qt << "\". Forced on command-line." << std::endl; -- bool wantGtk = cmdline.find("--gtk") != -1; -- if( wantGtk ) -- yuiMilestone () << "Using UI-backend: \"" << YUIPlugin_Gtk << "\". Forced on command-line." << std::endl; -+ bool wantGtk = ( cmdline.find( "--gtk" ) != -1 ); -+ bool wantNcurses = ( cmdline.find( "--ncurses" ) != -1 ); -+ bool wantQt = ( cmdline.find( "--qt" ) != -1 ); -+ wantGtk = ( wantGtk || ( strcmp( envPreset, YUIPlugin_Gtk ) == 0 ) ) && !( wantNcurses || wantQt ); -+ wantNcurses = ( wantNcurses || ( strcmp( envPreset, YUIPlugin_NCurses ) == 0 ) ) && !( wantGtk || wantQt ); -+ wantQt = ( wantQt || ( strcmp( envPreset, YUIPlugin_Qt ) == 0 ) ) && !( wantGtk || wantNcurses ); -+ -+ if( wantGtk ) wantedGUI = YUIPlugin_Gtk; -+ if( wantNcurses ) wantedGUI = YUIPlugin_NCurses; -+ if( wantQt ) wantedGUI = YUIPlugin_Qt; -+ -+ yuiMilestone () << "User-selected UI-plugin: \"" << wantedGUI << "\"" << std::endl; - -- bool haveQt = pluginExists( YUIPlugin_Qt ); -- bool haveGtk = pluginExists( YUIPlugin_Gtk ); -+ bool haveGtk = pluginExists( YUIPlugin_Gtk ); -+ bool haveNcurses = pluginExists( YUIPlugin_NCurses ); -+ bool haveQt = pluginExists( YUIPlugin_Qt ); - -- if ( envDisplay && !wantNcurses ) -+ wantedGUI=""; -+ -+ // Set the UI-Plugin -+ if ( ( haveGtk || haveQt ) && strcmp ( envDisplay, "" ) && -+ ( !wantNcurses || !isatty( STDOUT_FILENO ) ) ) - { - // Qt is default if available. - if ( haveQt ) -- wantedGUI = YUIPlugin_Qt; -+ wantedGUI = YUIPlugin_Qt; - - // Do we want to use Gtk instead? -- if ( haveGtk && ( isGtk || wantGtk ) && !wantQt ) -- wantedGUI = YUIPlugin_Gtk; -- -- if ( strcmp( wantedGUI.c_str(), "" ) ) -- { -- yuiMilestone () << "Using UI-backend: \"" << wantedGUI << "\""<< std::endl; -- try -- { -- YSettings::loadedUI( wantedGUI, true ); -- loadPlugin( wantedGUI, withThreads ); -- return; -- } -- catch ( YUIException & ex ) -- { -- YUI_CAUGHT( ex ); -- } -- } -+ if ( haveGtk && ( ( ( isGtk || wantGtk ) && !wantQt ) || !haveQt ) ) -+ wantedGUI = YUIPlugin_Gtk; - } - -- if ( isatty( STDOUT_FILENO ) ) -+ else if ( haveNcurses && isatty( STDOUT_FILENO ) ) - { -- // -- // NCurses UI -- // -- -+ // We use NCurses. - wantedGUI = YUIPlugin_NCurses; -- yuiMilestone () << "Using UI-backend: \"" << wantedGUI << "\""<< std::endl; -+ } -+ -+ // Load the wanted UI-plugin. -+ if( wantedGUI != "" ) -+ { -+ yuiMilestone () << "Using UI-plugin: \"" << wantedGUI << "\""<< std::endl; -+ YSettings::loadedUI( wantedGUI, true ); - - try - { -- YSettings::loadedUI( wantedGUI, true ); - loadPlugin( wantedGUI, withThreads ); - return; - } -+ - catch ( YUIException & ex ) - { - YUI_CAUGHT( ex ); -+ -+ // Default to NCurses, if possible. -+ if( wantedGUI != YUIPlugin_NCurses && haveNcurses && isatty( STDOUT_FILENO ) ) -+ { -+ yuiWarning () << "Defaulting to: \"" << YUIPlugin_NCurses << "\""<< std::endl; -+ YSettings::loadedUI( YUIPlugin_NCurses, true ); -+ -+ try -+ { -+ loadPlugin( YUIPlugin_NCurses, withThreads ); -+ return; -+ } -+ -+ catch ( YUIException & ex ) -+ { -+ YUI_CAUGHT( ex ); -+ } -+ } -+ - YUI_RETHROW( ex ); // what else to do here? - } - } -+ - else - { - YUI_THROW( YUICantLoadAnyUIException() ); -@@ -197,15 +229,25 @@ void YUILoader::loadExternalWidgets ( const std::string& name, const std::string - wantedGUI.append( "-" ); - wantedGUI.append( YSettings::loadedUI() ); - -- try -+ bool haveExternal = pluginExists( wantedGUI ); -+ -+ if( haveExternal ) - { -- loadExternalWidgetsPlugin(name, wantedGUI, symbol ); -- return; -+ try -+ { -+ loadExternalWidgetsPlugin(name, wantedGUI, symbol ); -+ return; -+ } -+ catch ( YUIException & ex ) -+ { -+ YUI_CAUGHT( ex ); -+ YUI_RETHROW( ex ); // what else to do here? -+ } - } -- catch ( YUIException & ex ) -+ -+ else - { -- YUI_CAUGHT( ex ); -- YUI_RETHROW( ex ); // what else to do here? -+ YUI_THROW( YUICantLoadAnyUIException() ); - } - } - -diff --git a/src/YUILoader.h b/src/YUILoader.h -index 1086b65..b5180b0 100644 ---- a/src/YUILoader.h -+++ b/src/YUILoader.h -@@ -46,9 +46,44 @@ class YUILoader - { - public: - /** -- * Load any of the available UI plug-ins in this order: -- * - Qt if $DISPLAY is set -- * - NCurses if stdout is a tty -+ * Load any of the available UI-plugins by this order and criteria: -+ * -+ * - Qt: -+ * - if $DISPLAY is set -+ * - NCurses is user-selected and stdout is *not* a TTY -+ * -+ * - Gtk: -+ * - if $DISPLAY is set and Qt is not available, -+ * - a GTK-based desktop environment is detected -+ * from the environment variable XDG_CURRENT_DESKTOP -+ * - any of the above pre-conditions are met and -+ * NCurses is user-selected, but stdout is *not* a TTY -+ * -+ * - NCurses: -+ * - if $DISPLAY is *not* set and stdout is a TTY -+ * - Qt and Gtk are not available and stdout is a TTY -+ * -+ * This can be overridden by either: -+ * -+ * - specifing one of the switches on the -+ * command-line of the program -+ * - '--gtk', -+ * - '--ncurses', or -+ * - '--qt' -+ * -+ * - setting the environment variable -+ * YUI_PREFERED_BACKEND to one of -+ * - 'gtk', -+ * - 'ncurses', or -+ * - 'qt' -+ * -+ * If a command-line switch is given to the program, the -+ * setting from the environment variable will be overridden -+ * by the UI-plugin chosen with the switch. -+ * -+ * If the user-selected UI-plugin is not installed on the -+ * system, an installed UI-plugin will be chosen by the -+ * above criteria. - **/ - static void loadUI( bool withThreads = false ); - diff --git a/libyui.spec b/libyui.spec index fe08db2..692e38b 100644 --- a/libyui.spec +++ b/libyui.spec @@ -13,19 +13,14 @@ %global _cmake_build_subdir build-%{_target_platform} Name: lib%{libsuffix} -Version: 3.3.1 -Release: 6%{?dist} +Version: 3.3.2 +Release: 1%{?dist} Summary: GUI-abstraction library License: (LGPLv2 or LGPLv3) and MIT URL: https://github.com/%{name}/%{name} Source0: %{url}/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz -# Improvements, submitted upstream. -# See: https://github.com/libyui/libyui/pull/115 -Patch0: https://github.com/besser82/libyui/commit/5e04743f9fb669d26d3814b1b9ba089d0a8c5b14.patch#/%{name}-3.3.1-env_YUI_PREFERED_BACKEND.patch -Patch1: https://github.com/besser82/libyui/commit/45bc75ca188f52c92ffced79df69a7c15853e999.patch#/%{name}-3.3.1-CMake_warnings.patch - BuildRequires: boost-devel BuildRequires: cmake @@ -96,8 +91,9 @@ pushd %{_cmake_build_subdir} %{__cat} << EOF > %{buildroot}/%{macrosdir}/macros.%{name} %_%{name}_major_so_ver %{major_so_ver} %_%{name}_datadir %%{_datadir}/%{name} -%_%{name}_themedir %%{_datadir}/%{name}/theme +%_%{name}_includedir %%{_includedir}/%{name} %_%{name}_plugindir %%{_libdir}/%{libsuffix} +%_%{name}_themedir %%{_datadir}/%{name}/theme EOF # Delete obsolete files. @@ -146,6 +142,11 @@ popd %changelog +* Tue Apr 18 2017 Björn Esser - 3.3.2-1 +- New upstream release +- Drop patches, merged upstream +- Improve macros-file + * Sun Apr 16 2017 Björn Esser - 3.3.1-6 - Updated patch diff --git a/sources b/sources index 21c7492..e742aa3 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (libyui-3.3.1.tar.gz) = 91d243135fc9f8770568239ea18a625eab45f26e0bb5eb348f92484c43c08a52fb2e0dba22135d2be9ac2fc533483d24000cafdd414df0423cb2451f29828802 +SHA512 (libyui-3.3.2.tar.gz) = 9231142ed48e7b214f683c7fda08ba8db019bc862e3309f5bd276a2734ac89dc0a570f4dbe920b27b51a5e289c24ecbbe1aa1020e2d9e21540f14a49c8e2321f