I have updated my patch. It now works for root AND non-privileged users.
For root the setting "recommends as dependencies" is now stored
in /etc/apt/apt.conf.d/99synaptic AND in /root/.synaptic/synaptic.conf.
The first has priority over the latter when reading the configuration.
For a normal user the "recommends as dependencies" is stored in
~/.synaptic/synaptic.conf of the user. When the configuration is read
from this file but the setting is missing then the patch tries to read
it from root's /etc/apt/apt.conf.d/99synaptic.
For comments about successful testing and why non-privileged users may
want to use synaptic see https://bugs.launchpad.net/synaptic/+bug/154349
=== modified file 'common/rconfiguration.cc'
--- common/rconfiguration.cc 2006-02-24 11:27:00 +0000
+++ common/rconfiguration.cc 2010-03-27 06:06:20 +0000
@@ -82,6 +82,31 @@
if(_config->FindB("Volatile::Non-Interactive", false) == true)
return true;
+ // store option 'consider recommended packages as dependencies'
+ // to config of apt if we run as root
+ if (getuid() == 0) {
+ string aptConfPath = _config->Find("Dir", "/")
+ + _config->Find("Dir::Etc", "etc/apt/")
+ + _config->Find("Dir::Etc:parts", "apt.conf.d")
+ + "/99synaptic";
+ ofstream aptfile(aptConfPath.c_str(), ios::out);
+ if (!aptfile != 0) {
+ cerr << "cannot open " << aptConfPath.c_str() <<
+ " to write APT::Install-Recommends" << endl;
+ } else {
+ if (_config->FindB("APT::Install-Recommends", false))
+ aptfile << "APT::Install-Recommends \"true\";" << endl;
+ else
+ aptfile << "APT::Install-Recommends \"false\";" << endl;
+ aptfile.close();
+ }
+ }
+ // and backup Install-Recommends to config of synaptic
+ _config->Set("Synaptic::Install-Recommends",
+ _config->FindB("APT::Install-Recommends",
+ _config->FindB("Synaptic::Install-Recommends",
+ false)));
+
ofstream cfile(ConfigFilePath.c_str(), ios::out);
if (!cfile != 0)
return _error->Errno("ofstream",
@@ -211,6 +236,20 @@
_error->Discard();
}
+ // read Install-Recommends, preferably from APT:: if we run as root
+ // or from Synaptic:: otherwise
+ if(getuid() == 0) {
+ _config->Set("APT::Install-Recommends",
+ _config->FindB("APT::Install-Recommends",
+ _config->FindB("Synaptic::Install-Recommends",
+ false)));
+ } else {
+ _config->Set("APT::Install-Recommends",
+ _config->FindB("Synaptic::Install-Recommends",
+ _config->FindB("APT::Install-Recommends",
+ false)));
+ }
+
return true;
}
=== modified file 'debian/changelog'
--- debian/changelog 2010-03-25 20:34:44 +0000
+++ debian/changelog 2010-03-27 06:09:28 +0000
@@ -17,7 +17,12 @@
* Change 'Icon Legend' dialog to fixed size (LP: #374376)
* add tooltip to 'properties' and 'search' buttons (LP: #202681)
- -- Michael Vogt <[email protected]> Tue, 16 Feb 2010 11:13:45 +0100
+ [ Oliver Joos ]
+ * common/rconfiguration.cc:
+ - fix to store setting "Consider recommended packages as dependencies"
+ (closes debian #440027 and LP: #154349)
+
+ -- Oliver Joos <[email protected]> Sat, 27 Mar 2010 07:07:05 +0100
synaptic (0.63.1) unstable; urgency=low