summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/generic/apt/aptcache.cc24
-rw-r--r--src/generic/apt/aptcache.h12
2 files changed, 31 insertions, 5 deletions
diff --git a/src/generic/apt/aptcache.cc b/src/generic/apt/aptcache.cc
index 3bcf1c23..2331261f 100644
--- a/src/generic/apt/aptcache.cc
+++ b/src/generic/apt/aptcache.cc
@@ -326,6 +326,11 @@ bool aptitudeDepCache::build_selection_list(OpProgress &Prog, bool WithLock,
section.FindFlag("Upgrade", tmp, 1);
pkg_state.upgrade=(tmp==1);
+ unsigned long auto_new_install = 0;
+ section.FindFlag("Auto-New-Install", auto_new_install, 1);
+ if(auto_new_install)
+ pkg_state.previously_auto_package = true;
+
// The install reason is much more important to preserve
// from previous versions, so support the outdated name
// for it.
@@ -334,10 +339,7 @@ bool aptitudeDepCache::build_selection_list(OpProgress &Prog, bool WithLock,
section.FindI("Last-Change", manual));
if(install_reason != manual)
- {
- MarkAuto(pkg, true);
- dirty = true;
- }
+ pkg_state.previously_auto_package = true;
pkg_state.remove_reason=(changed_reason)
section.FindI("Remove-Reason", manual);
@@ -460,6 +462,12 @@ bool aptitudeDepCache::build_selection_list(OpProgress &Prog, bool WithLock,
break;
}
+ if(estate.previously_auto_package)
+ {
+ MarkAuto(i, true);
+ dirty = true;
+ }
+
++num;
Prog.OverallProgress(num, Head().PackageCount, 1, _("Initializing package states"));
}
@@ -603,6 +611,11 @@ bool aptitudeDepCache::save_selection_list(OpProgress &prog,
bool upgrade=(!i.CurrentVer().end()) && state.Install();
string upgradestr=upgrade ? "Upgrade: yes\n" : "";
+ bool auto_new_install = (i.CurrentVer().end() &&
+ state.Install() &&
+ ((state.Flags & Flag::Auto) != 0));
+ string autostr = auto_new_install ? "Auto-New-Install: yes\n" : "";
+
string tailstr;
if(state.Install() &&
@@ -613,13 +626,14 @@ bool aptitudeDepCache::save_selection_list(OpProgress &prog,
len=snprintf(buf,
400,
- "Package: %s\nUnseen: %s\nState: %i\nDselect-State: %i\nRemove-Reason: %i\n%s%s%s\n",
+ "Package: %s\nUnseen: %s\nState: %i\nDselect-State: %i\nRemove-Reason: %i\n%s%s%s%s\n",
i.Name(),
estate.new_package?"yes":"no",
estate.selection_state,
i->SelectedState,
estate.remove_reason,
upgradestr.c_str(),
+ autostr.c_str(),
forbidstr.c_str(),
tailstr.c_str());
if(len>=399)
diff --git a/src/generic/apt/aptcache.h b/src/generic/apt/aptcache.h
index e9ecd80e..24693dbd 100644
--- a/src/generic/apt/aptcache.h
+++ b/src/generic/apt/aptcache.h
@@ -92,6 +92,18 @@ public:
*/
bool new_package:1;
+ /** \brief True if an aptitude flag from the last run indicates
+ * that this package should be set to automatically installed.
+ *
+ * This flag is used to migrate old settings and to flag queued
+ * installations as automatic.
+ *
+ * \warning This value is stored here to get it from the code
+ * that interprets pkgstates to the code that sets up package
+ * states; user code should not assume that it is meaningful.
+ */
+ bool previously_auto_package:1;
+
/** If the package is in state Install and is upgradable, this
* field determines whether or not it should be upgraded. This
* field is not updated as the package is modified; it is used