[PATCH] enhanced libzypp-backend to save more attributes

Ladislav Slezak lslezak at novell.com
Fri Jan 29 02:23:22 PST 2010


save also keeppackages, url and name attributes,
this is needed by WebYaST Repository Manager module
---
 backends/zypp/pk-backend-zypp.cpp |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)

diff --git a/backends/zypp/pk-backend-zypp.cpp b/backends/zypp/pk-backend-zypp.cpp
index e7edeb6..cace04a 100644
--- a/backends/zypp/pk-backend-zypp.cpp
+++ b/backends/zypp/pk-backend-zypp.cpp
@@ -1666,6 +1666,27 @@ backend_repo_set_data_thread (PkBackend *backend)
 			}
 
 			manager.modifyRepository (repo_id, repo);
+		}else if (g_ascii_strcasecmp (parameter, "keep") == 0) {
+			repo = manager.getRepositoryInfo (repo_id);
+
+			if (g_ascii_strcasecmp (value, "true") == 0) {
+				repo.setKeepPackages (TRUE);
+			}else if (g_ascii_strcasecmp (value, "false") == 0) {
+				repo.setKeepPackages (FALSE);
+			}else {
+				pk_backend_message (backend, PK_MESSAGE_ENUM_PARAMETER_INVALID, "Keep downloaded packages: Enter true or false");
+				bReturn = FALSE;
+			}
+
+			manager.modifyRepository (repo_id, repo);
+		}else if (g_ascii_strcasecmp (parameter, "url") == 0) {
+			repo = manager.getRepositoryInfo (repo_id);
+			repo.setBaseUrl (zypp::Url(value));
+			manager.modifyRepository (repo_id, repo);
+		}else if (g_ascii_strcasecmp (parameter, "name") == 0) {
+			repo = manager.getRepositoryInfo (repo_id);
+			repo.setName(value);
+			manager.modifyRepository (repo_id, repo);
 		}else if (g_ascii_strcasecmp (parameter, "prio") == 0) {
 			repo = manager.getRepositoryInfo (repo_id);
 			gint prio = 0;
@@ -1699,7 +1720,7 @@ backend_repo_set_data_thread (PkBackend *backend)
 			}
 
 		} else {
-			pk_backend_error_code (backend, PK_ERROR_ENUM_NOT_SUPPORTED, "Valid parameters for set_repo_data are remove/add/refresh/prio");
+			pk_backend_error_code (backend, PK_ERROR_ENUM_NOT_SUPPORTED, "Valid parameters for set_repo_data are remove/add/refresh/prio/keep/url/name");
 			bReturn = FALSE;
 		}
 
-- 
1.6.6.1


--------------060900000709090402030304--


More information about the PackageKit mailing list