From 70eeb2d1a065d2c0a0e57bf99cb3a0eb8e1d6489 Mon Sep 17 00:00:00 2001 From: Dan Simmons Date: Mon, 18 Feb 2019 10:46:21 -0500 Subject: [PATCH] Remove the XDG patch files. --- debian/changelog | 2 +- debian/patches/xdg-support-1.patch | 95 ------------------------- debian/patches/xdg-support-2.patch | 110 ----------------------------- 3 files changed, 1 insertion(+), 206 deletions(-) delete mode 100644 debian/patches/xdg-support-1.patch delete mode 100644 debian/patches/xdg-support-2.patch diff --git a/debian/changelog b/debian/changelog index a53d082..85522fe 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,7 +5,7 @@ calamares (3.2.4-0ubuntu1) UNRELEASED; urgency=medium * Bump Standards-version to 4.3.0, no changes needed. * Remove patches applied for XDG directories that is no longer needed. - -- Dan Simmons Fri, 15 Feb 2019 18:26:56 -0500 + -- Dan Simmons Fri, 15 Feb 2019 18:26:56 -0500 calamares (3.2.2-0ubuntu4) disco; urgency=medium diff --git a/debian/patches/xdg-support-1.patch b/debian/patches/xdg-support-1.patch deleted file mode 100644 index d50d21a..0000000 --- a/debian/patches/xdg-support-1.patch +++ /dev/null @@ -1,95 +0,0 @@ -Description: Add option to obey XDG dirs - This is patch 1/2 adding XDG directory support. -Author: Adriaan de Groot -Origin: upstream -Bug: https://github.com/calamares/calamares/issues/941 -Applied-Upstream: commit:c489320 -Last-Update: 2018-11-15 ---- a/src/calamares/main.cpp -+++ b/src/calamares/main.cpp -@@ -44,6 +44,8 @@ handle_args( CalamaresApplication& a ) - "Verbose output for debugging purposes (0-8).", "level" ); - QCommandLineOption configOption( QStringList{ "c", "config"}, - "Configuration directory to use, for testing purposes.", "config" ); -+ QCommandLineOption xdgOption( QStringList{"X", "xdg-config"}, -+ "Use XDG_{CONFIG,DATA}_DIRS as well." ); - - QCommandLineParser parser; - parser.setApplicationDescription( "Distribution-independent installer framework" ); -@@ -53,6 +55,7 @@ handle_args( CalamaresApplication& a ) - parser.addOption( debugOption ); - parser.addOption( debugLevelOption ); - parser.addOption( configOption ); -+ parser.addOption( xdgOption ); - - parser.process( a ); - -@@ -72,6 +75,8 @@ handle_args( CalamaresApplication& a ) - } - if ( parser.isSet( configOption ) ) - CalamaresUtils::setAppDataDir( QDir( parser.value( configOption ) ) ); -+ if ( parser.isSet( xdgOption ) ) -+ CalamaresUtils::setXdgDirs(); - } - - int ---- a/src/libcalamares/utils/CalamaresUtils.cpp -+++ b/src/libcalamares/utils/CalamaresUtils.cpp -@@ -49,6 +49,9 @@ static QTranslator* s_brandingTranslator - static QTranslator* s_translator = nullptr; - static QString s_translatorLocaleName; - -+static bool s_haveExtraDirs = false; -+static QStringList s_extraConfigDirs; -+static QStringList s_extraDataDirs; - - static bool - isWritableDir( const QDir& dir ) -@@ -94,6 +97,31 @@ setAppDataDir( const QDir& dir ) - s_isAppDataDirOverridden = true; - } - -+void -+setXdgDirs() -+{ -+ s_haveExtraDirs = true; -+ s_extraConfigDirs.append( QString( qgetenv( "XDG_CONFIG_DIRS" ) ).split(':') ); -+ s_extraDataDirs.append( QString( qgetenv( "XDG_DATA_DIRS" ) ).split(':') ); -+} -+ -+QStringList -+extraConfigDirs() -+{ -+ if ( s_haveExtraDirs ) -+ return s_extraConfigDirs; -+ return QStringList(); -+} -+ -+QStringList -+extraDataDirs() -+{ -+ if ( s_haveExtraDirs ) -+ return s_extraDataDirs; -+ return QStringList(); -+} -+ -+ - - bool - isAppDataDirOverridden() ---- a/src/libcalamares/utils/CalamaresUtils.h -+++ b/src/libcalamares/utils/CalamaresUtils.h -@@ -79,6 +79,13 @@ namespace CalamaresUtils - - DLLEXPORT void setQmlModulesDir( const QDir& dir ); - -+ /** @brief Setup extra config and data dirs from the XDG variables. -+ * -+ */ -+ DLLEXPORT void setXdgDirs(); -+ DLLEXPORT QStringList extraConfigDirs(); -+ DLLEXPORT QStringList extraDataDirs(); -+ - /** - * @brief removeDiacritics replaces letters with diacritics and ligatures with - * alternative forms and digraphs. diff --git a/debian/patches/xdg-support-2.patch b/debian/patches/xdg-support-2.patch deleted file mode 100644 index f3d7625..0000000 --- a/debian/patches/xdg-support-2.patch +++ /dev/null @@ -1,110 +0,0 @@ -Description: Use XDG_{DATA,CONFIG}_DIRS as appropriate - This is patch 2/2 adding XDG directory support. -Author: Adriaan de Groot -Origin: upstream -Bug: https://github.com/calamares/calamares/issues/941 -Applied-Upstream: commit:3b8d283 -Last-Update: 2018-11-15 ---- a/src/calamares/CalamaresApplication.cpp -+++ b/src/calamares/CalamaresApplication.cpp -@@ -145,6 +145,9 @@ qmlDirCandidates( bool assumeBuilddir ) - { - if ( assumeBuilddir ) - qmlDirs << QDir::current().absoluteFilePath( "src/qml" ); // In build-dir -+ if ( CalamaresUtils::haveExtraDirs() ) -+ for ( auto s : CalamaresUtils::extraDataDirs() ) -+ qmlDirs << ( s + QML ); - qmlDirs << CalamaresUtils::appDataDir().absoluteFilePath( QML ); - } - -@@ -164,6 +167,9 @@ settingsFileCandidates( bool assumeBuild - { - if ( assumeBuilddir ) - settingsPaths << QDir::current().absoluteFilePath( settings ); -+ if ( CalamaresUtils::haveExtraDirs() ) -+ for ( auto s : CalamaresUtils::extraConfigDirs() ) -+ settingsPaths << ( s + settings ); - settingsPaths << CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/settings.conf"; // String concat - settingsPaths << CalamaresUtils::appDataDir().absoluteFilePath( settings ); - } -@@ -182,6 +188,9 @@ brandingFileCandidates( bool assumeBuild - { - if ( assumeBuilddir ) - brandingPaths << ( QDir::currentPath() + QStringLiteral( "/src/" ) + brandingFilename ); -+ if ( CalamaresUtils::haveExtraDirs() ) -+ for ( auto s : CalamaresUtils::extraDataDirs() ) -+ brandingPaths << ( s + brandingFilename ); - brandingPaths << QDir( CMAKE_INSTALL_FULL_SYSCONFDIR "/calamares/" ).absoluteFilePath( brandingFilename ); - brandingPaths << CalamaresUtils::appDataDir().absoluteFilePath( brandingFilename); - } ---- a/src/libcalamares/utils/CalamaresUtils.cpp -+++ b/src/libcalamares/utils/CalamaresUtils.cpp -@@ -97,12 +97,23 @@ setAppDataDir( const QDir& dir ) - s_isAppDataDirOverridden = true; - } - -+/* Split $ENV{@p name} on :, append to @p l, making sure each ends in / */ -+static void -+mungeEnvironment( QStringList& l, const char *name ) -+{ -+ for ( auto s : QString( qgetenv( name ) ).split(':') ) -+ if ( s.endsWith( '/' ) ) -+ l << s; -+ else -+ l << ( s + '/' ); -+} -+ - void - setXdgDirs() - { - s_haveExtraDirs = true; -- s_extraConfigDirs.append( QString( qgetenv( "XDG_CONFIG_DIRS" ) ).split(':') ); -- s_extraDataDirs.append( QString( qgetenv( "XDG_DATA_DIRS" ) ).split(':') ); -+ mungeEnvironment( s_extraConfigDirs, "XDG_CONFIG_DIRS" ); -+ mungeEnvironment( s_extraDataDirs, "XDG_DATA_DIRS" ); - } - - QStringList -@@ -121,7 +132,11 @@ extraDataDirs() - return QStringList(); - } - -- -+bool -+haveExtraDirs() -+{ -+ return s_haveExtraDirs && ( !s_extraConfigDirs.isEmpty() || !s_extraDataDirs.isEmpty() ); -+} - - bool - isAppDataDirOverridden() ---- a/src/libcalamares/utils/CalamaresUtils.h -+++ b/src/libcalamares/utils/CalamaresUtils.h -@@ -80,10 +80,13 @@ namespace CalamaresUtils - DLLEXPORT void setQmlModulesDir( const QDir& dir ); - - /** @brief Setup extra config and data dirs from the XDG variables. -- * - */ - DLLEXPORT void setXdgDirs(); -+ /** @brief Are any extra directories configured? */ -+ DLLEXPORT bool haveExtraDirs(); -+ /** @brief XDG_CONFIG_DIRS, each guaranteed to end with / */ - DLLEXPORT QStringList extraConfigDirs(); -+ /** @brief XDG_DATA_DIRS, each guaranteed to end with / */ - DLLEXPORT QStringList extraDataDirs(); - - /** ---- a/src/libcalamaresui/modulesystem/Module.cpp -+++ b/src/libcalamaresui/modulesystem/Module.cpp -@@ -148,6 +148,10 @@ moduleConfigurationCandidates( bool assu - if ( assumeBuildDir ) - paths << QDir().absoluteFilePath(QString( "src/modules/%1/%2" ).arg( moduleName ).arg( configFileName ) ); - -+ if ( CalamaresUtils::haveExtraDirs() ) -+ for ( auto s : CalamaresUtils::extraConfigDirs() ) -+ paths << ( s + QString( "modules/%1" ).arg( configFileName ) ); -+ - paths << QString( "/etc/calamares/modules/%1" ).arg( configFileName ); - paths << CalamaresUtils::appDataDir().absoluteFilePath( QString( "modules/%1" ).arg( configFileName ) ); - }