From c4c029f13c68e9e024ec51b060c4d13fdd05ad95 Mon Sep 17 00:00:00 2001
From: Guillem Jover <guillem@debian.org>
Date: Wed, 8 Oct 2014 13:07:03 +0200
Debbug: 764468
Status: applied
Subject: [PATCH] Update Status field values handling

Remove long obsolete (hold, hold-reinstreq, removal-failed) or just
wrong (post-inst-failed vs postinst-failed) values, that have been
autoconverted by dpkg at run-time to their new equivalents, so there
should not be any such instance in any recent system (removal-failed
since dpkg 1.1.4 in Apr 1996, hold and hold-reinstreq since dpkg
1.2.0 in May 1996). dpkg even stopped doing the mapping in 1.15.4
and 1.15.8 respectively.
---
 cpp/lib/include/cupt/system/state.hpp    | 4 ++--
 cpp/lib/src/internal/worker/packages.cpp | 2 +-
 cpp/lib/src/system/state.cpp             | 7 +------
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/cpp/lib/include/cupt/system/state.hpp b/cpp/lib/include/cupt/system/state.hpp
index ac6b904..d3c638f 100644
--- a/cpp/lib/include/cupt/system/state.hpp
+++ b/cpp/lib/include/cupt/system/state.hpp
@@ -54,14 +54,14 @@ class CUPT_API State
 		struct Flag
 		{
 			/// type
-			enum Type { Ok, Reinstreq, Hold, HoldAndReinstreq, Count };
+			enum Type { Ok, Reinstreq, Count };
 		};
 		/// package installation status
 		struct Status
 		{
 			/// type
 			enum Type { NotInstalled, Unpacked, HalfConfigured, HalfInstalled, ConfigFiles,
-				PostInstFailed, RemovalFailed, Installed, TriggersPending, TriggersAwaited, Count };
+				Installed, TriggersPending, TriggersAwaited, Count };
 			static const string strings[]; ///< string values of correspoding types
 		};
 		Want::Type want;
diff --git a/cpp/lib/src/internal/worker/packages.cpp b/cpp/lib/src/internal/worker/packages.cpp
index 9e06135..ccce442 100644
--- a/cpp/lib/src/internal/worker/packages.cpp
+++ b/cpp/lib/src/internal/worker/packages.cpp
@@ -1535,7 +1535,7 @@ void __set_force_options_for_removals_if_needed(const Cache& cache,
 								packageName);
 					}
 					typedef system::State::InstalledRecord::Flag IRFlag;
-					if (installedRecord->flag == IRFlag::Reinstreq || installedRecord->flag == IRFlag::HoldAndReinstreq)
+					if (installedRecord->flag == IRFlag::Reinstreq)
 					{
 						actionGroupIt->dpkgFlags.insert("--force-remove-reinstreq");
 						removeReinstreqFlagIsSet = true;
diff --git a/cpp/lib/src/system/state.cpp b/cpp/lib/src/system/state.cpp
index db8bb2b..122e688 100644
--- a/cpp/lib/src/system/state.cpp
+++ b/cpp/lib/src/system/state.cpp
@@ -84,8 +84,6 @@ void parseStatusSubstrings(const string& packageName, const string& input, Insta
 #define CHECK_FLAG(str, value) if (current.equal(BUFFER_AND_SIZE(str))) { installedRecord->flag = InstalledRecord::Flag:: value; } else
 		CHECK_FLAG("ok", Ok)
 		CHECK_FLAG("reinstreq", Reinstreq)
-		CHECK_FLAG("hold", Hold)
-		CHECK_FLAG("hold-reinstreq", HoldAndReinstreq)
 		{ // else
 			fatal2(__("malformed '%s' status indicator (for the package '%s')"), "error", packageName);
 		}
@@ -106,8 +104,6 @@ void parseStatusSubstrings(const string& packageName, const string& input, Insta
 		CHECK_STATUS("unpacked", Unpacked)
 		CHECK_STATUS("half-configured", HalfConfigured)
 		CHECK_STATUS("half-installed", HalfInstalled)
-		CHECK_STATUS("post-inst-failed", PostInstFailed)
-		CHECK_STATUS("removal-failed", RemovalFailed)
 		CHECK_STATUS("triggers-pending", TriggersPending)
 		CHECK_STATUS("triggers-awaited", TriggersAwaited)
 		{ // else
@@ -300,7 +296,6 @@ vector< string > State::getReinstallRequiredPackageNames() const
 		const InstalledRecord::Flag::Type& flag = it->second->flag;
 		const InstalledRecord::Status::Type& status = it->second->status;
 		if (flag == InstalledRecord::Flag::Reinstreq ||
-				flag == InstalledRecord::Flag::HoldAndReinstreq ||
 				status == InstalledRecord::Status::HalfInstalled)
 		{
 			result.push_back(it->first);
@@ -317,7 +312,7 @@ string State::getArchitecture() const
 
 const string State::InstalledRecord::Status::strings[] = {
 	N__("not installed"), N__("unpacked"), N__("half-configured"), N__("half-installed"),
-	N__("config files"), N__("postinst failed"), N__("removal failed"), N__("installed")
+	N__("config files"), N__("installed")
 };
 
 }
-- 
2.1.1.391.g7a54a76

