[packagekit] [PATCH 1 of 4] Simple alterations to make PiSi work once more
Ikey Doherty
ikey at solusos.com
Sat Jun 8 05:55:59 PDT 2013
# HG changeset patch
# User Ikey Doherty <ikey at solusos.com>
# Date 1370656016 -3600
# Node ID 2db9a53fc49df8f5c1e3f3115ee33d2c951b1969
# Parent 1f562828e967dc88ad7520922f599f582afa6bac
Simple alterations to make PiSi work once more
diff --git a/backends/pisi/pisiBackend.py b/backends/pisi/pisiBackend.py
--- a/backends/pisi/pisiBackend.py
+++ b/backends/pisi/pisiBackend.py
@@ -170,14 +170,16 @@
if self.packagedb.has_package(package):
pkg = self.packagedb.get_package(package)
+ repo = self.packagedb.get_package_repo (pkg.name, None)
+ pkg_id = self.get_package_id (pkg.name, self.__get_package_version(pkg), pkg.architecture, repo[1])
if self.groups.has_key(pkg.partOf):
group = self.groups[pkg.partOf]
else:
group = GROUP_UNKNOWN
- self.details("%s-%s" % (pkg.name, self.__get_package_version(pkg)),
- pkg.license,
+ self.details(pkg_id,
+ ",".join (pkg.license),
group,
pkg.description,
pkg.packageURI,
@@ -193,14 +195,16 @@
package = self.get_package_from_id(package_ids[0])[0]
if self.installdb.has_package(package):
+ pkg = self.packagedb.get_package(package)
+ repo = self.packagedb.get_package_repo (pkg.name, None)
+ pkg_id = self.get_package_id (pkg.name, self.__get_package_version(pkg), pkg.architecture, repo[1])
+
pkg = self.installdb.get_files(package)
- # FIXME: Add "/" as suffix
- files = map(lambda y: y.path, pkg.list)
+ files = map(lambda y: "/%s" % y.path, pkg.list)
file_list = ";".join(files)
-
- self.files(package, file_list)
+ self.files(pkg_id, file_list)
def get_repo_list(self, filters):
""" Prints available repositories """
@@ -296,7 +300,7 @@
self.percentage(100)
- def remove_packages(self, allowdeps, autoremove, package_ids):
+ def remove_packages(self, transaction_flags, package_ids, allowdeps, autoremove):
""" Removes given package from system"""
self.allow_cancel(False)
self.percentage(None)
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -43,7 +43,7 @@
* pk_backend_initialize:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
+void
pk_backend_initialize (PkBackend *backend)
{
g_debug ("backend: initialize");
@@ -51,8 +51,8 @@
/* BACKEND MAINTAINER: feel free to remove this when you've
* added support for ONLY_DOWNLOAD and merged the simulate
* methods as specified in backends/PORTING.txt */
- g_error ("Backend needs to be ported to 0.8.x -- "
- "see backends/PORTING.txt for details");
+ /*g_error ("Backend needs to be ported to 0.8.x -- "
+ "see backends/PORTING.txt for details"); */
spawn = pk_backend_spawn_new ();
pk_backend_spawn_set_name (spawn, "pisi");
@@ -62,7 +62,7 @@
* pk_backend_destroy:
* This should only be run once per backend load, i.e. not every transaction
*/
-static void
+void
pk_backend_destroy (PkBackend *backend)
{
g_debug ("backend: destroy");
@@ -72,7 +72,7 @@
/**
* pk_backend_get_groups:
*/
-static PkBitfield
+PkBitfield
pk_backend_get_groups (PkBackend *backend)
{
return pk_bitfield_from_enums (
@@ -102,7 +102,7 @@
/**
* pk_backend_get_filters:
*/
-static PkBitfield
+PkBitfield
pk_backend_get_filters (PkBackend *backend)
{
return pk_bitfield_from_enums(
@@ -114,7 +114,7 @@
/**
* pk_backend_cancel:
*/
-static void
+void
pk_backend_cancel (PkBackend *backend, PkBackendJob *job)
{
/* this feels bad... */
@@ -124,7 +124,7 @@
/**
* pk_backend_get_depends:
*/
-static void
+void
pk_backend_get_depends (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *filters_text;
@@ -139,7 +139,7 @@
/**
* pk_backend_get_details:
*/
-static void
+void
pk_backend_get_details (PkBackend *backend, PkBackendJob *job, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -151,7 +151,7 @@
/**
* pk_backend_get_files:
*/
-static void
+void
pk_backend_get_files (PkBackend *backend, PkBackendJob *job, gchar **package_ids)
{
gchar *package_ids_temp;
@@ -163,7 +163,7 @@
/**
* pk_backend_get_requires:
*/
-static void
+void
pk_backend_get_requires (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **package_ids, gboolean recursive)
{
gchar *filters_text;
@@ -178,7 +178,7 @@
/**
* pk_backend_get_updates:
*/
-static void
+void
pk_backend_get_updates (PkBackend *backend, PkBackendJob *job, PkBitfield filters)
{
gchar *filters_text;
@@ -190,10 +190,11 @@
/**
* pk_backend_install_packages:
*/
-static void
+void
pk_backend_install_packages (PkBackend *backend, PkBackendJob *job, PkBitfield transaction_flags, gchar **package_ids)
{
gchar *package_ids_temp;
+ gchar *transaction_flags_temp;
/* check network state */
if (!pk_backend_is_online (backend)) {
@@ -204,28 +205,35 @@
/* send the complete list as stdin */
package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "install-packages", pk_backend_bool_to_string (only_trusted), package_ids_temp, NULL);
+ transaction_flags_temp = pk_transaction_flag_bitfield_to_string (transaction_flags);
+
+ pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "install-packages", transaction_flags_temp, package_ids_temp, NULL);
g_free (package_ids_temp);
+ g_free (transaction_flags_temp);
}
/**
* pk_backend_install_files:
*/
-static void
+void
pk_backend_install_files (PkBackend *backend, PkBackendJob *job, PkBitfield transaction_flags, gchar **full_paths)
{
gchar *package_ids_temp;
+ gchar *transaction_flags_temp;
/* send the complete list as stdin */
package_ids_temp = g_strjoinv (PK_BACKEND_SPAWN_FILENAME_DELIM, full_paths);
- pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "install-files", pk_backend_bool_to_string (only_trusted), package_ids_temp, NULL);
+ transaction_flags_temp = pk_transaction_flag_bitfield_to_string (transaction_flags);
+
+ pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "install-files", transaction_flags_temp, package_ids_temp, NULL);
g_free (package_ids_temp);
+ g_free (transaction_flags_temp);
}
/**
* pk_backend_refresh_cache:
*/
-static void
+void
pk_backend_refresh_cache (PkBackend *backend, PkBackendJob *job, gboolean force)
{
/* check network state */
@@ -241,21 +249,36 @@
/**
* pk_backend_remove_packages:
*/
-static void
-pk_backend_remove_packages (PkBackend *backend, PkBackendJob *job, gchar **package_ids, gboolean allow_deps, gboolean autoremove)
+void
+pk_backend_remove_packages (PkBackend *backend, PkBackendJob *job,
+ PkBitfield transaction_flags,
+ gchar **package_ids,
+ gboolean allow_deps,
+ gboolean autoremove)
{
gchar *package_ids_temp;
+ gchar *transaction_flags_temp;
/* send the complete list as stdin */
package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "remove-packages", pk_backend_bool_to_string (allow_deps), pk_backend_bool_to_string (autoremove), package_ids_temp, NULL);
+ transaction_flags_temp = pk_transaction_flag_bitfield_to_string (transaction_flags);
+ pk_backend_spawn_helper (spawn,
+ job, "pisiBackend.py",
+ "remove-packages",
+ transaction_flags_temp,
+ package_ids_temp,
+ pk_backend_bool_to_string (allow_deps),
+ pk_backend_bool_to_string (autoremove),
+ NULL);
+
+ g_free (transaction_flags_temp);
g_free (package_ids_temp);
}
/**
* pk_backend_search_details:
*/
-static void
+void
pk_backend_search_details (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **values)
{
gchar *filters_text;
@@ -270,7 +293,7 @@
/**
* pk_backend_search_files:
*/
-static void
+void
pk_backend_search_files (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **values)
{
gchar *filters_text;
@@ -285,7 +308,7 @@
/**
* pk_backend_search_groups:
*/
-static void
+void
pk_backend_search_groups (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **values)
{
gchar *filters_text;
@@ -300,7 +323,7 @@
/**
* pk_backend_search_names:
*/
-static void
+void
pk_backend_search_names (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **values)
{
gchar *filters_text;
@@ -315,10 +338,11 @@
/**
* pk_backend_update_packages:
*/
-static void
+void
pk_backend_update_packages (PkBackend *backend, PkBackendJob *job, PkBitfield transaction_flags, gchar **package_ids)
{
gchar *package_ids_temp;
+ gchar *transaction_flags_temp;
/* check network state */
if (!pk_backend_is_online (backend)) {
@@ -329,23 +353,31 @@
/* send the complete list as stdin */
package_ids_temp = pk_package_ids_to_string (package_ids);
- pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "update-packages", pk_backend_bool_to_string (only_trusted), package_ids_temp, NULL);
+ transaction_flags_temp = pk_transaction_flag_bitfield_to_string (transaction_flags);
+
+ pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "update-packages", transaction_flags_temp, package_ids_temp, NULL);
g_free (package_ids_temp);
+ g_free (transaction_flags_temp);
}
/**
* pk_backend_update_system:
*/
-static void
+void
pk_backend_update_system (PkBackend *backend, PkBackendJob *job, PkBitfield transaction_flags)
{
- pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "update-system", pk_backend_bool_to_string (only_trusted), NULL);
+ gchar *transaction_flags_temp;
+ transaction_flags_temp = pk_transaction_flag_bitfield_to_string (transaction_flags);
+
+ pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "update-system", transaction_flags_temp, NULL);
+
+ g_free (transaction_flags_temp);
}
/**
* pk_backend_resolve:
*/
-static void
+void
pk_backend_resolve (PkBackend *backend, PkBackendJob *job, PkBitfield filters, gchar **package_ids)
{
gchar *filters_text;
@@ -360,7 +392,7 @@
/**
* pk_backend_get_repo_list:
*/
-static void
+void
pk_backend_get_repo_list (PkBackend *backend, PkBackendJob *job, PkBitfield filters)
{
gchar *filters_text;
@@ -372,7 +404,7 @@
/**
* pk_backend_repo_set_data:
*/
-static void
+void
pk_backend_repo_set_data (PkBackend *backend, PkBackendJob *job, const gchar *rid, const gchar *parameter, const gchar *value)
{
pk_backend_spawn_helper (spawn, job, "pisiBackend.py", "repo-set-data", rid, parameter, value, NULL);
More information about the PackageKit
mailing list