Package: patchutils
Version: 0.3.2-1
Severity: normal
Hi,
'filterdiff -# 1 backup.patch' somewhy outputs first 4 hunks of the attached
file.
-- System Information:
Debian Release: wheezy/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'stable-updates'), (500, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.37-1-686 (SMP w/2 CPU cores)
Locale: LANG=fi_FI.UTF-8, LC_CTYPE=fi_FI.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages patchutils depends on:
ii debianutils 2.30 Miscellaneous utilities specific t
ii libc6 2.13-7 Embedded GNU C Library: Shared lib
ii patch 2.6-2 Apply a diff file to an original
ii perl 5.12.3-7+b1 Larry Wall's Practical Extraction
patchutils recommends no packages.
patchutils suggests no packages.
-- no debconf information
diff --git a/cpp/lib/include/cupt/system/state.hpp b/cpp/lib/include/cupt/system/state.hpp
index fb8f86f..103972c 100644
--- a/cpp/lib/include/cupt/system/state.hpp
+++ b/cpp/lib/include/cupt/system/state.hpp
@@ -85,6 +85,9 @@ class CUPT_API State
* @return array of package names
*/
vector< string > getInstalledPackageNames() const;
+ /// @cond
+ CUPT_LOCAL getReinstallRequiredPackageNames() const;
+ /// @endcond
};
}
diff --git a/cpp/lib/src/internal/nativeresolver/impl.cpp b/cpp/lib/src/internal/nativeresolver/impl.cpp
index 2aeac69..110f26c 100644
--- a/cpp/lib/src/internal/nativeresolver/impl.cpp
+++ b/cpp/lib/src/internal/nativeresolver/impl.cpp
@@ -52,6 +52,12 @@ void NativeResolverImpl::__import_installed_versions()
__old_packages[version->packageName] = version;
__initial_packages[version->packageName].version = version;
}
+
+ auto reinstallRequiredPackageNames = __cache->getSystemState()->getReinstallRequiredPackageNames();
+ FORIT(packageNameIt, reinstallRequiredPackageNames)
+ {
+ __initial_packages[*packageNameIt].version.reset(); // deleted by default
+ }
}
void __mydebug_wrapper(const Solution& solution, const string& message)
diff --git a/cpp/lib/src/internal/worker/setupandpreview.cpp b/cpp/lib/src/internal/worker/setupandpreview.cpp
index 57fa970..1b9ecc8 100644
--- a/cpp/lib/src/internal/worker/setupandpreview.cpp
+++ b/cpp/lib/src/internal/worker/setupandpreview.cpp
@@ -54,55 +54,44 @@ void SetupAndPreviewWorker::__generate_action_preview(const string& packageName,
fatal("internal error: the binary package '%s' does not exist", packageName.c_str());
}
auto installedVersion = package->getInstalledVersion();
- if (installedInfo->status != State::InstalledRecord::Status::ConfigFiles && !installedVersion)
+
+ if (!installedVersion)
{
- fatal("internal error: there is no installed version for the binary package '%s'",
- packageName.c_str());
+ action = Action::Install;
}
-
- switch (installedInfo->status)
+ else if (installedInfo->status == State::InstalledRecord::Status::Installed)
{
- case State::InstalledRecord::Status::ConfigFiles:
+ auto versionComparisonResult = compareVersionStrings(
+ supposedVersion->versionString, installedVersion->versionString);
+
+ if (versionComparisonResult > 0)
{
- // treat as the same as uninstalled
- action = Action::Install;
+ action = Action::Upgrade;
}
- break;
- case State::InstalledRecord::Status::Installed:
+ else if (versionComparisonResult < 0)
{
- auto versionComparisonResult = compareVersionStrings(
- supposedVersion->versionString, installedVersion->versionString);
-
- if (versionComparisonResult > 0)
- {
- action = Action::Upgrade;
- }
- else if (versionComparisonResult < 0)
- {
- action = Action::Downgrade;
- }
+ action = Action::Downgrade;
}
- break;
- default:
+ }
+ else
+ {
+ if (installedVersion->versionString == supposedVersion->versionString)
{
- if (installedVersion->versionString == supposedVersion->versionString)
+ // the same version, but the package was in some interim state
+ if (installedInfo->status == State::InstalledRecord::Status::TriggersPending)
{
- // the same version, but the package was in some interim state
- if (installedInfo->status == State::InstalledRecord::Status::TriggersPending)
- {
- action = Action::ProcessTriggers;
- }
- else if (installedInfo->status != State::InstalledRecord::Status::TriggersAwaited)
- {
- action = Action::Configure;
- }
+ action = Action::ProcessTriggers;
}
- else
+ else if (installedInfo->status != State::InstalledRecord::Status::TriggersAwaited)
{
- // some interim state, but other version
- action = Action::Install;
+ action = Action::Configure;
}
}
+ else
+ {
+ // some interim state, but other version
+ action = Action::Install;
+ }
}
}
}
diff --git a/cpp/lib/src/system/state.cpp b/cpp/lib/src/system/state.cpp
index 50899c5..b1da37d 100644
--- a/cpp/lib/src/system/state.cpp
+++ b/cpp/lib/src/system/state.cpp
@@ -120,7 +120,8 @@ void parseStatusSubstrings(const string& packageName, const string& input,
static bool canPackageBeConfigured(const InstalledRecord& record)
{
return (record.status != InstalledRecord::Status::NotInstalled &&
- record.status != InstalledRecord::Status::ConfigFiles);
+ record.status != InstalledRecord::Status::ConfigFiles &&
+ record.status != InstalledRecord::Status::HalfInstalled);
}
void StateData::parseDpkgStatus()
@@ -277,6 +278,22 @@ vector< string > State::getInstalledPackageNames() const
return result;
}
+vector< string > State::getReinstallRequiredPackageNames() const
+{
+ vector< string > result;
+
+ FORIT(it, __data->installedInfo)
+ {
+ const InstalledRecord::Flag& flag = it->second->flag;
+ if (flag == InstalledRecord::Flag::Reinstreq || flag == InstalledRecord::Flag::HoldAndReinstreq)
+ {
+ result.push_back(it->first);
+ }
+ }
+
+ return result;
+}
+
const string State::InstalledRecord::Status::strings[] = {
__("not installed"), __("unpacked"), __("half-configured"), __("half-installed"),
__("config files"), __("postinst failed"), __("removal failed"), __("installed")