diff -Nru presage-0.9.1/debian/changelog presage-0.9.1/debian/changelog --- presage-0.9.1/debian/changelog 2016-11-07 15:48:35.000000000 +0000 +++ presage-0.9.1/debian/changelog 2016-12-08 09:54:36.000000000 +0000 @@ -1,3 +1,11 @@ +presage (0.9.1-2.1ubuntu4) zesty; urgency=medium + + * debian/patches/add_presage_config_environment_variable.patch: + - Replace use_presage_prefix_path_in_default_profile.patch with a new patch + making sure all works in snap environments + + -- Ɓukasz 'sil2100' Zemczak Thu, 08 Dec 2016 10:54:00 +0100 + presage (0.9.1-2.1ubuntu3) zesty; urgency=medium [ Michael Sheldon ] diff -Nru presage-0.9.1/debian/patches/add_presage_config_environment_variable.patch presage-0.9.1/debian/patches/add_presage_config_environment_variable.patch --- presage-0.9.1/debian/patches/add_presage_config_environment_variable.patch 1970-01-01 00:00:00.000000000 +0000 +++ presage-0.9.1/debian/patches/add_presage_config_environment_variable.patch 2016-12-08 09:05:24.000000000 +0000 @@ -0,0 +1,32 @@ +Description: Add PRESAGE_CONFIG environment variable + Provide an environment variable for setting the location that presage should + check for its system-wide configuration file. This allows for usage within + snap packages. +Author: Michael Sheldon +Forwarded: no +Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/presage/+bug/1639270 +Last-Update: 2016-12-07 + +--- presage-0.9.1.orig/src/lib/core/profileManager.cpp ++++ presage-0.9.1/src/lib/core/profileManager.cpp +@@ -121,10 +121,16 @@ void ProfileManager::init_profiles (cons + } + + +- // system etc directory +- profiles.push_back (get_system_etc_dir() + '/' + DefaultProfile::DEFAULT_PROFILE_FILENAME); +- // installation config directory +- profiles.push_back (static_cast(sysconfdir) + '/' + DefaultProfile::DEFAULT_PROFILE_FILENAME); ++ // config specified by environment overrides system config ++ char *env_profile = getenv("PRESAGE_CONFIG"); ++ if (env_profile != NULL) { ++ profiles.push_back(env_profile); ++ } else { ++ // system etc directory ++ profiles.push_back (get_system_etc_dir() + '/' + DefaultProfile::DEFAULT_PROFILE_FILENAME); ++ // installation config directory ++ profiles.push_back (static_cast(sysconfdir) + '/' + DefaultProfile::DEFAULT_PROFILE_FILENAME); ++ } + // home dir dotfile + profiles.push_back (get_user_home_dir() + "/.presage/" + DefaultProfile::DEFAULT_PROFILE_FILENAME); + // user specified profile (if any) diff -Nru presage-0.9.1/debian/patches/series presage-0.9.1/debian/patches/series --- presage-0.9.1/debian/patches/series 2016-11-07 15:48:04.000000000 +0000 +++ presage-0.9.1/debian/patches/series 2016-12-08 09:53:32.000000000 +0000 @@ -2,5 +2,5 @@ dont-tokenize-on-apostrophes.patch fix-bug-811758-gcc6.patch ubuntu_dont_require_wxpython.patch -use_presage_prefix_path_in_default_profile.patch +add_presage_config_environment_variable.patch add-missing-online-learning-configuration-value.patch diff -Nru presage-0.9.1/debian/patches/use_presage_prefix_path_in_default_profile.patch presage-0.9.1/debian/patches/use_presage_prefix_path_in_default_profile.patch --- presage-0.9.1/debian/patches/use_presage_prefix_path_in_default_profile.patch 2016-11-04 17:05:02.000000000 +0000 +++ presage-0.9.1/debian/patches/use_presage_prefix_path_in_default_profile.patch 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -Description: Use the PRESAGE_PREFIX_PATH environment variable in the default profile - To allow for usage within snaps the PRESAGE_PREFIX_PATH is prepended to any - data installation paths within the default profile. -Author: Michael Sheldon -Forwarded: no -Bug-Ubuntu: https://bugs.launchpad.net/ubuntu/+source/presage/+bug/1639270 -Last-Update: <31-10-2016 - ---- presage-0.9.1.orig/src/lib/core/defaultProfile.cpp -+++ presage-0.9.1/src/lib/core/defaultProfile.cpp -@@ -123,7 +123,7 @@ void DefaultProfile::build_xml_document - " " - " SmoothedNgramPredictor" - " ERROR" --" " pkgdatadir "/database_en.db" -+" ${PRESAGE_PREFIX_PATH}" pkgdatadir "/database_en.db" - " " - " 0.01 0.1 0.89" - " false" -@@ -162,19 +162,19 @@ void DefaultProfile::build_xml_document - " " - " AbbreviationExpansionPredictor" - " ERROR" --" " pkgdatadir "/abbreviations_en.txt" -+" ${PRESAGE_PREFIX_PATH}" pkgdatadir "/abbreviations_en.txt" - " " - " " - " DejavuPredictor" - " ERROR" --" " pkgdatadir "/dejavu_memory_en.txt" -+" ${PRESAGE_PREFIX_PATH}" pkgdatadir "/dejavu_memory_en.txt" - " 3" - " " - " " - " ARPAPredictor" - " ERROR" --" " pkgdatadir "/arpa_en.arpa" --" " pkgdatadir "/arpa_en.vocab" -+" ${PRESAGE_PREFIX_PATH}" pkgdatadir "/arpa_en.arpa" -+" ${PRESAGE_PREFIX_PATH}" pkgdatadir "/arpa_en.vocab" - " 100" - " " - " "