[packagekit] [PATCH 2/5] zypp: Remove leftover PK_TMP_DIR if transaction was aborted

Thomas Perl thomas.perl at jolla.com
Wed Jan 22 02:31:49 PST 2014


PK_TMP_DIR is a repository that is created by PackageKit for installing
single-file RPM packages. In some cases (e.g. power failure or
PackageKit being killed for some other reason), PK_TMP_DIR was not
removed. This led to failures the next time PackageKit tried to create
PK_TMP_DIR, so just always try to remove it before adding it.
---
 backends/zypp/pk-backend-zypp.cpp | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index 3f2290b..64524f8 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -2327,6 +2327,14 @@ backend_install_files_thread (PkBackendJob *job, GVariant *params, gpointer user
 		}
 	}
 
+	// Remove a possibly leftover temporary repository
+	try {
+		RepoInfo oldRepo = manager.getRepositoryInfo("PK_TMP_DIR");
+		manager.removeRepository(oldRepo);
+	} catch (const Exception &ex) {
+		// Repo doesn't exist - this is good, we can create it below
+	}
+
 	// create a plaindir-repo and cache it
 	RepoInfo tmpRepo;
 
-- 
1.8.5.2



More information about the PackageKit mailing list