[packagekit] packagekit: Branch 'master' - 10 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Oct 30 10:55:08 PDT 2007
backends/alpm/pk-backend-alpm.c | 1
backends/apt/helpers/aptBackend.py | 40 ++++-
backends/apt/pk-backend-apt.c | 1
backends/box/pk-backend-box.c | 1
backends/conary/pk-backend-conary.c | 1
backends/dummy/pk-backend-dummy.c | 1
backends/pisi/helpers/Makefile.am | 2
backends/pisi/helpers/get-files.py | 19 ++
backends/pisi/helpers/get-repo-list.py | 2
backends/pisi/helpers/pisiBackend.py | 255 ++++++++++++++++++--------------
backends/pisi/helpers/resolve.py | 2
backends/pisi/helpers/search-file.py | 19 ++
backends/pisi/pk-backend-pisi.c | 21 ++
backends/smart/pk-backend-smart.c | 1
backends/test/pk-backend-test-fail.c | 1
backends/test/pk-backend-test-nop.c | 1
backends/test/pk-backend-test-spawn.c | 1
backends/test/pk-backend-test-succeed.c | 1
backends/test/pk-backend-test-thread.c | 1
backends/yum/helpers/yumBackend.py | 226 ++++++++++++++--------------
backends/yum/pk-backend-yum.c | 1
html/pk-faq.html | 4
libpackagekit/pk-client.c | 9 -
libpackagekit/pk-client.h | 3
libpackagekit/pk-common.c | 1
libpackagekit/pk-enum.c | 7
libpackagekit/pk-enum.h | 7
python/packagekit/backend.py | 8 -
src/pk-backend-internal.h | 3
src/pk-backend.c | 5
src/pk-backend.h | 4
src/pk-engine.c | 4
src/pk-engine.h | 1
src/pk-interface.xml | 1
34 files changed, 388 insertions(+), 267 deletions(-)
New commits:
commit 24720d006f0ad83bcd8270f561b58925aca4a652
Merge: 3bceb42... 7f80db6...
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 30 17:42:31 2007 +0000
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 3bceb42fbba63b9dd2e3d58c7b6a88175978896f
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Oct 30 17:42:12 2007 +0000
add some more group enums
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 13dfaf6..b0e0b7a 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -44,11 +44,11 @@ yumbase = None
progress = PackagekitProgress() # Progress object to store the progress
groupMap = {
-'desktops;gnome-desktop' : GROUP_SYSTEM,
-'desktops;window-managers' : GROUP_SYSTEM,
-'desktops;kde-desktop' : GROUP_SYSTEM,
-'desktops;xfce-desktop' : GROUP_SYSTEM,
-'apps;authoring-and-publishing' : GROUP_OFFICE,
+'desktops;gnome-desktop' : GROUP_DESKTOPS,
+'desktops;window-managers' : GROUP_DESKTOPS,
+'desktops;kde-desktop' : GROUP_DESKTOPS,
+'desktops;xfce-desktop' : GROUP_DESKTOPS,
+'apps;authoring-and-publishing' : GROUP_PUBLISHING,
'apps;office' : GROUP_OFFICE,
'apps;sound-and-video' : GROUP_MULTIMEDIA,
'apps;editors' : GROUP_OFFICE,
@@ -69,120 +69,120 @@ groupMap = {
'development;ruby' : GROUP_PROGRAMMING,
'development;java-development' : GROUP_PROGRAMMING,
'development;xfce-software-development' : GROUP_PROGRAMMING,
-'servers;clustering' : GROUP_OTHER,
-'servers;dns-server' : GROUP_OTHER,
-'servers;server-cfg' : GROUP_OTHER,
-'servers;news-server' : GROUP_OTHER,
-'servers;web-server' : GROUP_OTHER,
-'servers;smb-server' : GROUP_OTHER,
-'servers;sql-server' : GROUP_OTHER,
-'servers;ftp-server' : GROUP_OTHER,
-'servers;printing' : GROUP_OTHER,
-'servers;mysql' : GROUP_OTHER,
-'servers;mail-server' : GROUP_OTHER,
-'servers;network-server' : GROUP_OTHER,
-'servers;legacy-network-server' : GROUP_OTHER,
+'servers;clustering' : GROUP_SERVERS,
+'servers;dns-server' : GROUP_SERVERS,
+'servers;server-cfg' : GROUP_SERVERS,
+'servers;news-server' : GROUP_SERVERS,
+'servers;web-server' : GROUP_SERVERS,
+'servers;smb-server' : GROUP_SERVERS,
+'servers;sql-server' : GROUP_SERVERS,
+'servers;ftp-server' : GROUP_SERVERS,
+'servers;printing' : GROUP_SERVERS,
+'servers;mysql' : GROUP_SERVERS,
+'servers;mail-server' : GROUP_SERVERS,
+'servers;network-server' : GROUP_SERVERS,
+'servers;legacy-network-server' : GROUP_SERVERS,
'base-system;java' : GROUP_SYSTEM,
'base-system;base-x' : GROUP_SYSTEM,
-'base-system;system-tools' : GROUP_SYSTEM,
-'base-system;fonts' : GROUP_SYSTEM,
+'base-system;system-tools' : GROUP_ADMIN_TOOLS,
+'base-system;fonts' : GROUP_FONTS,
'base-system;hardware-support' : GROUP_SYSTEM,
'base-system;dial-up' : GROUP_SYSTEM,
-'base-system;admin-tools' : GROUP_SYSTEM,
-'base-system;legacy-software-support' : GROUP_SYSTEM,
+'base-system;admin-tools' : GROUP_ADMIN_TOOLS,
+'base-system;legacy-software-support' : GROUP_LEGACY,
'base-system;base' : GROUP_SYSTEM,
'base-system;virtualization' : GROUP_SYSTEM,
-'base-system;legacy-fonts' : GROUP_SYSTEM,
-'language-support;khmer-support' : GROUP_OTHER,
-'language-support;persian-support' : GROUP_OTHER,
-'language-support;georgian-support' : GROUP_OTHER,
-'language-support;malay-support' : GROUP_OTHER,
-'language-support;tonga-support' : GROUP_OTHER,
-'language-support;portuguese-support' : GROUP_OTHER,
-'language-support;japanese-support' : GROUP_OTHER,
-'language-support;hungarian-support' : GROUP_OTHER,
-'language-support;somali-support' : GROUP_OTHER,
-'language-support;punjabi-support' : GROUP_OTHER,
-'language-support;bhutanese-support' : GROUP_OTHER,
-'language-support;british-support' : GROUP_OTHER,
-'language-support;korean-support' : GROUP_OTHER,
-'language-support;lao-support' : GROUP_OTHER,
-'language-support;inuktitut-support' : GROUP_OTHER,
-'language-support;german-support' : GROUP_OTHER,
-'language-support;hindi-support' : GROUP_OTHER,
-'language-support;faeroese-support' : GROUP_OTHER,
-'language-support;swedish-support' : GROUP_OTHER,
-'language-support;tsonga-support' : GROUP_OTHER,
-'language-support;russian-support' : GROUP_OTHER,
-'language-support;serbian-support' : GROUP_OTHER,
-'language-support;latvian-support' : GROUP_OTHER,
-'language-support;samoan-support' : GROUP_OTHER,
-'language-support;sinhala-support' : GROUP_OTHER,
-'language-support;catalan-support' : GROUP_OTHER,
-'language-support;lithuanian-support' : GROUP_OTHER,
-'language-support;turkish-support' : GROUP_OTHER,
-'language-support;arabic-support' : GROUP_OTHER,
-'language-support;vietnamese-support' : GROUP_OTHER,
-'language-support;mongolian-support' : GROUP_OTHER,
-'language-support;tswana-support' : GROUP_OTHER,
-'language-support;irish-support' : GROUP_OTHER,
-'language-support;italian-support' : GROUP_OTHER,
-'language-support;slovak-support' : GROUP_OTHER,
-'language-support;slovenian-support' : GROUP_OTHER,
-'language-support;belarusian-support' : GROUP_OTHER,
-'language-support;northern-sotho-support' : GROUP_OTHER,
-'language-support;kannada-support' : GROUP_OTHER,
-'language-support;malayalam-support' : GROUP_OTHER,
-'language-support;swati-support' : GROUP_OTHER,
-'language-support;breton-support' : GROUP_OTHER,
-'language-support;romanian-support' : GROUP_OTHER,
-'language-support;greek-support' : GROUP_OTHER,
-'language-support;tagalog-support' : GROUP_OTHER,
-'language-support;zulu-support' : GROUP_OTHER,
-'language-support;tibetan-support' : GROUP_OTHER,
-'language-support;danish-support' : GROUP_OTHER,
-'language-support;afrikaans-support' : GROUP_OTHER,
-'language-support;southern-sotho-support' : GROUP_OTHER,
-'language-support;bosnian-support' : GROUP_OTHER,
-'language-support;brazilian-support' : GROUP_OTHER,
-'language-support;basque-support' : GROUP_OTHER,
-'language-support;welsh-support' : GROUP_OTHER,
-'language-support;thai-support' : GROUP_OTHER,
-'language-support;telugu-support' : GROUP_OTHER,
-'language-support;low-saxon-support' : GROUP_OTHER,
-'language-support;urdu-support' : GROUP_OTHER,
-'language-support;tamil-support' : GROUP_OTHER,
-'language-support;indonesian-support' : GROUP_OTHER,
-'language-support;gujarati-support' : GROUP_OTHER,
-'language-support;xhosa-support' : GROUP_OTHER,
-'language-support;chinese-support' : GROUP_OTHER,
-'language-support;czech-support' : GROUP_OTHER,
-'language-support;venda-support' : GROUP_OTHER,
-'language-support;bulgarian-support' : GROUP_OTHER,
-'language-support;albanian-support' : GROUP_OTHER,
-'language-support;galician-support' : GROUP_OTHER,
-'language-support;armenian-support' : GROUP_OTHER,
-'language-support;dutch-support' : GROUP_OTHER,
-'language-support;oriya-support' : GROUP_OTHER,
-'language-support;maori-support' : GROUP_OTHER,
-'language-support;nepali-support' : GROUP_OTHER,
-'language-support;icelandic-support' : GROUP_OTHER,
-'language-support;ukrainian-support' : GROUP_OTHER,
-'language-support;assamese-support' : GROUP_OTHER,
-'language-support;bengali-support' : GROUP_OTHER,
-'language-support;spanish-support' : GROUP_OTHER,
-'language-support;hebrew-support' : GROUP_OTHER,
-'language-support;estonian-support' : GROUP_OTHER,
-'language-support;french-support' : GROUP_OTHER,
-'language-support;croatian-support' : GROUP_OTHER,
-'language-support;filipino-support' : GROUP_OTHER,
-'language-support;finnish-support' : GROUP_OTHER,
-'language-support;norwegian-support' : GROUP_OTHER,
-'language-support;southern-ndebele-support' : GROUP_OTHER,
-'language-support;polish-support' : GROUP_OTHER,
-'language-support;gaelic-support' : GROUP_OTHER,
-'language-support;marathi-support' : GROUP_OTHER,
-'language-support;ethiopic-support' : GROUP_OTHER
+'base-system;legacy-fonts' : GROUP_FONTS,
+'language-support;khmer-support' : GROUP_LOCALIZATION,
+'language-support;persian-support' : GROUP_LOCALIZATION,
+'language-support;georgian-support' : GROUP_LOCALIZATION,
+'language-support;malay-support' : GROUP_LOCALIZATION,
+'language-support;tonga-support' : GROUP_LOCALIZATION,
+'language-support;portuguese-support' : GROUP_LOCALIZATION,
+'language-support;japanese-support' : GROUP_LOCALIZATION,
+'language-support;hungarian-support' : GROUP_LOCALIZATION,
+'language-support;somali-support' : GROUP_LOCALIZATION,
+'language-support;punjabi-support' : GROUP_LOCALIZATION,
+'language-support;bhutanese-support' : GROUP_LOCALIZATION,
+'language-support;british-support' : GROUP_LOCALIZATION,
+'language-support;korean-support' : GROUP_LOCALIZATION,
+'language-support;lao-support' : GROUP_LOCALIZATION,
+'language-support;inuktitut-support' : GROUP_LOCALIZATION,
+'language-support;german-support' : GROUP_LOCALIZATION,
+'language-support;hindi-support' : GROUP_LOCALIZATION,
+'language-support;faeroese-support' : GROUP_LOCALIZATION,
+'language-support;swedish-support' : GROUP_LOCALIZATION,
+'language-support;tsonga-support' : GROUP_LOCALIZATION,
+'language-support;russian-support' : GROUP_LOCALIZATION,
+'language-support;serbian-support' : GROUP_LOCALIZATION,
+'language-support;latvian-support' : GROUP_LOCALIZATION,
+'language-support;samoan-support' : GROUP_LOCALIZATION,
+'language-support;sinhala-support' : GROUP_LOCALIZATION,
+'language-support;catalan-support' : GROUP_LOCALIZATION,
+'language-support;lithuanian-support' : GROUP_LOCALIZATION,
+'language-support;turkish-support' : GROUP_LOCALIZATION,
+'language-support;arabic-support' : GROUP_LOCALIZATION,
+'language-support;vietnamese-support' : GROUP_LOCALIZATION,
+'language-support;mongolian-support' : GROUP_LOCALIZATION,
+'language-support;tswana-support' : GROUP_LOCALIZATION,
+'language-support;irish-support' : GROUP_LOCALIZATION,
+'language-support;italian-support' : GROUP_LOCALIZATION,
+'language-support;slovak-support' : GROUP_LOCALIZATION,
+'language-support;slovenian-support' : GROUP_LOCALIZATION,
+'language-support;belarusian-support' : GROUP_LOCALIZATION,
+'language-support;northern-sotho-support' : GROUP_LOCALIZATION,
+'language-support;kannada-support' : GROUP_LOCALIZATION,
+'language-support;malayalam-support' : GROUP_LOCALIZATION,
+'language-support;swati-support' : GROUP_LOCALIZATION,
+'language-support;breton-support' : GROUP_LOCALIZATION,
+'language-support;romanian-support' : GROUP_LOCALIZATION,
+'language-support;greek-support' : GROUP_LOCALIZATION,
+'language-support;tagalog-support' : GROUP_LOCALIZATION,
+'language-support;zulu-support' : GROUP_LOCALIZATION,
+'language-support;tibetan-support' : GROUP_LOCALIZATION,
+'language-support;danish-support' : GROUP_LOCALIZATION,
+'language-support;afrikaans-support' : GROUP_LOCALIZATION,
+'language-support;southern-sotho-support' : GROUP_LOCALIZATION,
+'language-support;bosnian-support' : GROUP_LOCALIZATION,
+'language-support;brazilian-support' : GROUP_LOCALIZATION,
+'language-support;basque-support' : GROUP_LOCALIZATION,
+'language-support;welsh-support' : GROUP_LOCALIZATION,
+'language-support;thai-support' : GROUP_LOCALIZATION,
+'language-support;telugu-support' : GROUP_LOCALIZATION,
+'language-support;low-saxon-support' : GROUP_LOCALIZATION,
+'language-support;urdu-support' : GROUP_LOCALIZATION,
+'language-support;tamil-support' : GROUP_LOCALIZATION,
+'language-support;indonesian-support' : GROUP_LOCALIZATION,
+'language-support;gujarati-support' : GROUP_LOCALIZATION,
+'language-support;xhosa-support' : GROUP_LOCALIZATION,
+'language-support;chinese-support' : GROUP_LOCALIZATION,
+'language-support;czech-support' : GROUP_LOCALIZATION,
+'language-support;venda-support' : GROUP_LOCALIZATION,
+'language-support;bulgarian-support' : GROUP_LOCALIZATION,
+'language-support;albanian-support' : GROUP_LOCALIZATION,
+'language-support;galician-support' : GROUP_LOCALIZATION,
+'language-support;armenian-support' : GROUP_LOCALIZATION,
+'language-support;dutch-support' : GROUP_LOCALIZATION,
+'language-support;oriya-support' : GROUP_LOCALIZATION,
+'language-support;maori-support' : GROUP_LOCALIZATION,
+'language-support;nepali-support' : GROUP_LOCALIZATION,
+'language-support;icelandic-support' : GROUP_LOCALIZATION,
+'language-support;ukrainian-support' : GROUP_LOCALIZATION,
+'language-support;assamese-support' : GROUP_LOCALIZATION,
+'language-support;bengali-support' : GROUP_LOCALIZATION,
+'language-support;spanish-support' : GROUP_LOCALIZATION,
+'language-support;hebrew-support' : GROUP_LOCALIZATION,
+'language-support;estonian-support' : GROUP_LOCALIZATION,
+'language-support;french-support' : GROUP_LOCALIZATION,
+'language-support;croatian-support' : GROUP_LOCALIZATION,
+'language-support;filipino-support' : GROUP_LOCALIZATION,
+'language-support;finnish-support' : GROUP_LOCALIZATION,
+'language-support;norwegian-support' : GROUP_LOCALIZATION,
+'language-support;southern-ndebele-support' : GROUP_LOCALIZATION,
+'language-support;polish-support' : GROUP_LOCALIZATION,
+'language-support;gaelic-support' : GROUP_LOCALIZATION,
+'language-support;marathi-support' : GROUP_LOCALIZATION,
+'language-support;ethiopic-support' : GROUP_LOCALIZATION
}
class GPGKeyNotImported(exceptions.Exception):
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index e57efe9..de7ad33 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -137,6 +137,13 @@ static PkEnumMatch enum_group[] = {
{PK_GROUP_ENUM_PROGRAMMING, "programming"},
{PK_GROUP_ENUM_MULTIMEDIA, "multimedia"},
{PK_GROUP_ENUM_SYSTEM, "system"},
+ {PK_GROUP_ENUM_DESKTOPS, "desktops"},
+ {PK_GROUP_ENUM_PUBLISHING, "publishing"},
+ {PK_GROUP_ENUM_SERVERS, "servers"},
+ {PK_GROUP_ENUM_FONTS, "fonts"},
+ {PK_GROUP_ENUM_ADMIN_TOOLS, "admin-tools"},
+ {PK_GROUP_ENUM_LEGACY, "legacy"},
+ {PK_GROUP_ENUM_LOCALIZATION, "localization"},
{0, NULL},
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index 31d35db..e034b6c 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -134,6 +134,13 @@ typedef enum {
PK_GROUP_ENUM_PROGRAMMING,
PK_GROUP_ENUM_MULTIMEDIA,
PK_GROUP_ENUM_SYSTEM,
+ PK_GROUP_ENUM_DESKTOPS,
+ PK_GROUP_ENUM_PUBLISHING,
+ PK_GROUP_ENUM_SERVERS,
+ PK_GROUP_ENUM_FONTS,
+ PK_GROUP_ENUM_ADMIN_TOOLS,
+ PK_GROUP_ENUM_LEGACY,
+ PK_GROUP_ENUM_LOCALIZATION,
PK_GROUP_ENUM_UNKNOWN
} PkGroupEnum;
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index de0e4e6..dbe6504 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -88,7 +88,13 @@ GROUP_OTHER = "other"
GROUP_PROGRAMMING = "programming"
GROUP_MULTIMEDIA = "multimedia"
GROUP_SYSTEM = "system"
-
+GROUP_DESKTOPS = "desktops"
+GROUP_PUBLISHING = "publishing"
+GROUP_SERVERS = "servers"
+GROUP_FONTS = "fonts"
+GROUP_ADMIN_TOOLS = "admin-tools"
+GROUP_LEGACY = "legacy"
+GROUP_LOCALIZATION = "localization"
# Classes
commit 7f80db68ac8d6181d6d16e9d85180e59d6bcbe9a
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Tue Oct 30 19:26:55 2007 +0200
Remove "/" from pk_validate_input_char
diff --git a/libpackagekit/pk-common.c b/libpackagekit/pk-common.c
index 0898986..6d73f1c 100644
--- a/libpackagekit/pk-common.c
+++ b/libpackagekit/pk-common.c
@@ -132,7 +132,6 @@ pk_validate_input_char (gchar item)
case '}':
case '@':
case '#':
- case '/':
case '\\':
case '<':
case '>':
commit bebe14825f74e6b91c4e7b5abd7e532bdef9bdf6
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Tue Oct 30 16:44:39 2007 +0200
PiSi: Implement search-file
diff --git a/backends/pisi/helpers/Makefile.am b/backends/pisi/helpers/Makefile.am
index 188898b..b9eef2f 100644
--- a/backends/pisi/helpers/Makefile.am
+++ b/backends/pisi/helpers/Makefile.am
@@ -16,6 +16,7 @@ dist_helper_DATA = \
remove.py \
resolve.py \
repo-set-data.py \
+ search-file.py \
search-name.py \
update.py \
update-system.py \
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index c91aa9c..9e2e9de 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -27,6 +27,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
PackageKitBaseBackend.__init__(self, args)
self.componentdb = pisi.db.componentdb.ComponentDB()
+ self.filesdb = pisi.db.filesdb.FilesDB()
self.installdb = pisi.db.installdb.InstallDB()
self.packagedb = pisi.db.packagedb.PackageDB()
self.repodb = pisi.db.repodb.RepoDB()
@@ -51,12 +52,13 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
else:
self.error(ERROR_INTERNAL_ERROR, "Package was not found")
- filterlist = filters.split(';')
+ if filters:
+ filterlist = filters.split(';')
- if FILTER_INSTALLED in filterlist and status != INFO_INSTALLED:
- return
- if FILTER_NON_INSTALLED in filterlist and status != INFO_AVAILABLE:
- return
+ if FILTER_INSTALLED in filterlist and status != INFO_INSTALLED:
+ return
+ if FILTER_NON_INSTALLED in filterlist and status != INFO_AVAILABLE:
+ return
version = self.__get_package_version(pkg)
@@ -247,6 +249,17 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.__get_package(package, filters)
+ def search_file(self, filters, key):
+ """ Prints the installed package which contains the specified file """
+ self.allow_interrupt(True)
+ self.percentage(None)
+
+ # Internal FIXME: Why it is needed?
+ key = key.lstrip("/")
+
+ for pkg, files in pisi.api.search_file(key):
+ self.__get_package(pkg)
+
def search_name(self, filters, package):
""" Prints a list of packages contains search term """
self.allow_interrupt(True)
diff --git a/backends/pisi/helpers/search-file.py b/backends/pisi/helpers/search-file.py
new file mode 100644
index 0000000..e086a00
--- /dev/null
+++ b/backends/pisi/helpers/search-file.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2007 S.ÃaÄlar Onur <caglar at pardus.org.tr>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+import pisiBackend
+
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
+backend.search_file(sys.argv[1], sys.argv[2])
+
+sys.exit()
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 0859f80..356939c 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -58,7 +58,7 @@ PK_BACKEND_OPTIONS (
pk_backend_python_resolve, /* resolve */
NULL, /* rollback */
NULL, /* search_details */
- NULL, /* search_file */
+ pk_backend_python_search_file, /* search_file */
NULL, /* search_group */
pk_backend_python_search_name, /* search_name */
pk_backend_python_update_package, /* update_package */
diff --git a/html/pk-faq.html b/html/pk-faq.html
index 603d2f4..4f79315 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -31,7 +31,7 @@ get-updates | X | X | | X | | X | X |
update-system | X | X | | X | | X | X |
search-name | X | X | X | X | X | X | X |
search-details | | X | X | X | | | |
-search-file | | X | | X | | | |
+search-file | | X | | X | | | X |
search-group | | X | | | | | |
install-package | X | X | | X | X | X | X |
install-file | | X | | X | | | X |
commit 50a93c185956b04078f5764088b7b4d910a85490
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Tue Oct 30 10:58:11 2007 +0200
PiSi: Implement backend_get_filters
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index c16548e..c91aa9c 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -40,7 +40,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
version = "%s-%s" % (package.version, package.release)
return version
- def __get_package(self, package):
+ def __get_package(self, package, filters = None):
""" Returns package object suitable for other methods """
if self.installdb.has_package(package):
status = INFO_INSTALLED
@@ -51,6 +51,13 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
else:
self.error(ERROR_INTERNAL_ERROR, "Package was not found")
+ filterlist = filters.split(';')
+
+ if FILTER_INSTALLED in filterlist and status != INFO_INSTALLED:
+ return
+ if FILTER_NON_INSTALLED in filterlist and status != INFO_AVAILABLE:
+ return
+
version = self.__get_package_version(pkg)
id = self.get_package_id(pkg.name, version, pkg.architecture, "")
@@ -238,7 +245,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.allow_interrupt(True);
self.percentage(None)
- self.__get_package(package)
+ self.__get_package(package, filters)
def search_name(self, filters, package):
""" Prints a list of packages contains search term """
@@ -246,7 +253,7 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.percentage(None)
for pkg in pisi.api.search_package([package]):
- self.__get_package(pkg)
+ self.__get_package(pkg, filters)
def update(self, package_id):
""" Updates given package to its latest version """
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 0f7aab0..0859f80 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -23,13 +23,27 @@
#include <pk-backend.h>
#include <pk-backend-python.h>
+/**
+ * backend_get_filters:
+ */
+static void
+backend_get_filters (PkBackend *backend, PkEnumList *elist)
+{
+ g_return_if_fail (backend != NULL);
+ pk_enum_list_append_multiple (elist,
+ /* PK_FILTER_ENUM_GUI, */
+ PK_FILTER_ENUM_INSTALLED,
+ /* PK_FILTER_ENUM_DEVELOPMENT, */
+ -1);
+}
+
PK_BACKEND_OPTIONS (
"PiSi", /* description */
"S.ÃaÄlar Onur <caglar at pardus.org.tr>", /* author */
NULL, /* initalize */
NULL, /* destroy */
NULL, /* get_groups */
- NULL, /* get_filters */
+ backend_get_filters, /* get_filters */
NULL, /* cancel */
pk_backend_python_get_depends, /* get_depends */
pk_backend_python_get_description, /* get_description */
diff --git a/html/pk-faq.html b/html/pk-faq.html
index e1f733c..603d2f4 100644
--- a/html/pk-faq.html
+++ b/html/pk-faq.html
@@ -40,7 +40,7 @@ update-package | | X | | X | | X | X |
get-depends | | X | | X | | | X |
get-requires | X | | | X | | | X |
get-description | X | X | X | X | | X | X |
-get-files | | X | | X | | | |
+get-files | | X | | X | | | X |
get-update-detail | | | | | | | |
get-repo-list | | X | | X | X | X | X |
repo-enable | | X | | X | | X | |
commit 5858900bd1f0101691e9789e2877fc8262546de1
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Tue Oct 30 10:03:19 2007 +0200
Remove backend specific version values from libpackagekit
diff --git a/libpackagekit/pk-client.c b/libpackagekit/pk-client.c
index cc4cb49..e5447a5 100644
--- a/libpackagekit/pk-client.c
+++ b/libpackagekit/pk-client.c
@@ -2032,13 +2032,12 @@ pk_client_get_actions (PkClient *client)
* pk_client_get_backend_detail:
**/
gboolean
-pk_client_get_backend_detail (PkClient *client, gchar **name, gchar **author, gchar **version)
+pk_client_get_backend_detail (PkClient *client, gchar **name, gchar **author)
{
gboolean ret;
GError *error;
gchar *tname;
gchar *tauthor;
- gchar *tversion;
g_return_val_if_fail (client != NULL, FALSE);
g_return_val_if_fail (PK_IS_CLIENT (client), FALSE);
@@ -2048,7 +2047,7 @@ pk_client_get_backend_detail (PkClient *client, gchar **name, gchar **author, gc
G_TYPE_INVALID,
G_TYPE_STRING, &tname,
G_TYPE_STRING, &tauthor,
- G_TYPE_STRING, &tversion,
+ G_TYPE_INVALID,
G_TYPE_INVALID);
if (ret == FALSE) {
/* abort as the DBUS method failed */
@@ -2065,10 +2064,6 @@ pk_client_get_backend_detail (PkClient *client, gchar **name, gchar **author, gc
if (author != NULL) {
*author = g_strdup (tauthor);
}
- /* copy needed bits */
- if (version != NULL) {
- *version = g_strdup (tversion);
- }
return TRUE;
}
diff --git a/libpackagekit/pk-client.h b/libpackagekit/pk-client.h
index 3f81c51..130d1fc 100644
--- a/libpackagekit/pk-client.h
+++ b/libpackagekit/pk-client.h
@@ -149,8 +149,7 @@ gboolean pk_client_get_old_transactions (PkClient *client,
guint number);
gboolean pk_client_get_backend_detail (PkClient *client,
gchar **name,
- gchar **author,
- gchar **version);
+ gchar **author);
G_END_DECLS
diff --git a/src/pk-interface.xml b/src/pk-interface.xml
index 526ccc8..fbcf830 100644
--- a/src/pk-interface.xml
+++ b/src/pk-interface.xml
@@ -249,7 +249,6 @@
<method name="GetBackendDetail">
<arg type="s" name="name" direction="out"/>
<arg type="s" name="author" direction="out"/>
- <arg type="s" name="version" direction="out"/>
</method>
<method name="GetActions">
<arg type="s" name="actions" direction="out"/> <!-- list of supported actions -->
commit 3841cf57b7bb95a4e1a87bb008f13dadf8765191
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Tue Oct 30 09:54:09 2007 +0200
Remove backend specific version values
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 4373817..88f7db7 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -777,7 +777,6 @@ backend_get_repo_list (PkBackend *backend)
PK_BACKEND_OPTIONS (
"alpm", /* description */
- "0.0.1", /* version */
"Andreas Obergrusberger <tradiaz at yahoo.de>", /* author */
backend_initialize, /* initalize */
backend_destroy, /* destroy */
diff --git a/backends/apt/pk-backend-apt.c b/backends/apt/pk-backend-apt.c
index 9be3af3..bd2ea3f 100644
--- a/backends/apt/pk-backend-apt.c
+++ b/backends/apt/pk-backend-apt.c
@@ -195,7 +195,6 @@ backend_get_depends (PkBackend *backend, const gchar *package_id)
PK_BACKEND_OPTIONS (
"Apt", /* description */
- "0.0.1", /* version */
"Ali Sabil <ali.sabil at gmail.com>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/backends/box/pk-backend-box.c b/backends/box/pk-backend-box.c
index 4c2ef09..3bb4729 100644
--- a/backends/box/pk-backend-box.c
+++ b/backends/box/pk-backend-box.c
@@ -688,7 +688,6 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"Box", /* description */
- "0.0.1", /* version */
"Grzegorz DÄ
browski <gdx at o2.pl>", /* author */
backend_initalize, /* initalize */
backend_destroy, /* destroy */
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 3f0079e..db07f2b 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -62,7 +62,6 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
PK_BACKEND_OPTIONS (
"Conary", /* description */
- "0.0.1", /* version */
"Ken VanDine <ken at vandine.org>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 429fe72..9fa785e 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -472,7 +472,6 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"Dummy", /* description */
- "0.0.1", /* version */
"Richard Hughes <richard at hughsie.com>", /* author */
backend_initalize, /* initalize */
backend_destroy, /* destroy */
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index e979f99..0f7aab0 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -25,7 +25,6 @@
PK_BACKEND_OPTIONS (
"PiSi", /* description */
- "0.0.1", /* version */
"S.ÃaÄlar Onur <caglar at pardus.org.tr>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/backends/smart/pk-backend-smart.c b/backends/smart/pk-backend-smart.c
index d2b8345..34b913d 100644
--- a/backends/smart/pk-backend-smart.c
+++ b/backends/smart/pk-backend-smart.c
@@ -26,7 +26,6 @@
PK_BACKEND_OPTIONS (
"SMART", /* description */
- "0.0.1", /* version */
"James Bowes <jbowes at dangerouslyinc.com>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/backends/test/pk-backend-test-fail.c b/backends/test/pk-backend-test-fail.c
index 63d56d7..1ae9fb9 100644
--- a/backends/test/pk-backend-test-fail.c
+++ b/backends/test/pk-backend-test-fail.c
@@ -272,7 +272,6 @@ backend_update_system (PkBackend *backend)
PK_BACKEND_OPTIONS (
"Test Fail", /* description */
- "0.0.1", /* version */
"Richard Hughes <richard at hughsie.com>", /* author */
backend_initialize, /* initalize */
backend_destroy, /* destroy */
diff --git a/backends/test/pk-backend-test-nop.c b/backends/test/pk-backend-test-nop.c
index acdffe8..862fe2e 100644
--- a/backends/test/pk-backend-test-nop.c
+++ b/backends/test/pk-backend-test-nop.c
@@ -25,7 +25,6 @@
PK_BACKEND_OPTIONS (
"Test NOP", /* description */
- "0.0.1", /* version */
"Richard Hughes <richard at hughsie.com>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/backends/test/pk-backend-test-spawn.c b/backends/test/pk-backend-test-spawn.c
index 299dc03..d1d7f48 100644
--- a/backends/test/pk-backend-test-spawn.c
+++ b/backends/test/pk-backend-test-spawn.c
@@ -38,7 +38,6 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
PK_BACKEND_OPTIONS (
"Test Spawn", /* description */
- "0.0.1", /* version */
"Richard Hughes <richard at hughsie.com>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/backends/test/pk-backend-test-succeed.c b/backends/test/pk-backend-test-succeed.c
index 6893ee8..5fb9175 100644
--- a/backends/test/pk-backend-test-succeed.c
+++ b/backends/test/pk-backend-test-succeed.c
@@ -306,7 +306,6 @@ backend_repo_set_data (PkBackend *backend, const gchar *rid, const gchar *parame
PK_BACKEND_OPTIONS (
"Test Succeed", /* description */
- "0.0.1", /* version */
"Richard Hughes <richard at hughsie.com>", /* author */
backend_initalize, /* initalize */
backend_destroy, /* destroy */
diff --git a/backends/test/pk-backend-test-thread.c b/backends/test/pk-backend-test-thread.c
index d6bdeed..e80cfc9 100644
--- a/backends/test/pk-backend-test-thread.c
+++ b/backends/test/pk-backend-test-thread.c
@@ -85,7 +85,6 @@ backend_search_name (PkBackend *backend, const gchar *filter, const gchar *searc
PK_BACKEND_OPTIONS (
"Test Thread", /* description */
- "0.0.1", /* version */
"Richard Hughes <richard at hughsie.com>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/backends/yum/pk-backend-yum.c b/backends/yum/pk-backend-yum.c
index 3919fed..e28b4a7 100644
--- a/backends/yum/pk-backend-yum.c
+++ b/backends/yum/pk-backend-yum.c
@@ -52,7 +52,6 @@ backend_get_filters (PkBackend *backend, PkEnumList *elist)
PK_BACKEND_OPTIONS (
"YUM", /* description */
- "0.0.1", /* version */
"Tim Lauridsen <tla at rasmil.dk>", /* author */
NULL, /* initalize */
NULL, /* destroy */
diff --git a/src/pk-backend-internal.h b/src/pk-backend-internal.h
index 00991d8..7eb4a49 100644
--- a/src/pk-backend-internal.h
+++ b/src/pk-backend-internal.h
@@ -56,8 +56,7 @@ PkBackend *pk_backend_new (void);
PkEnumList *pk_backend_get_actions (PkBackend *backend);
gboolean pk_backend_get_backend_detail (PkBackend *backend,
gchar **name,
- gchar **author,
- gchar **version);
+ gchar **author);
PkEnumList *pk_backend_get_groups (PkBackend *backend);
PkEnumList *pk_backend_get_filters (PkBackend *backend);
guint pk_backend_get_runtime (PkBackend *backend);
diff --git a/src/pk-backend.c b/src/pk-backend.c
index da49896..a4c841c 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -1589,7 +1589,7 @@ pk_backend_repo_set_data (PkBackend *backend, const gchar *repo_id, const gchar
* pk_backend_get_backend_detail:
*/
gboolean
-pk_backend_get_backend_detail (PkBackend *backend, gchar **name, gchar **author, gchar **version)
+pk_backend_get_backend_detail (PkBackend *backend, gchar **name, gchar **author)
{
g_return_val_if_fail (backend != NULL, FALSE);
if (name != NULL && backend->desc->description != NULL) {
@@ -1598,9 +1598,6 @@ pk_backend_get_backend_detail (PkBackend *backend, gchar **name, gchar **author,
if (author != NULL && backend->desc->author != NULL) {
*author = g_strdup (backend->desc->author);
}
- if (version != NULL && backend->desc->version != NULL) {
- *version = g_strdup (backend->desc->version);
- }
return TRUE;
}
diff --git a/src/pk-backend.h b/src/pk-backend.h
index 81b91bb..d10f089 100644
--- a/src/pk-backend.h
+++ b/src/pk-backend.h
@@ -116,7 +116,6 @@ gboolean pk_backend_repo_set_data (PkBackend *backend,
*/
struct _PkBackendDesc {
const char *description;
- const char *version;
const char *author;
void (*initialize) (PkBackend *backend);
void (*destroy) (PkBackend *backend);
@@ -148,7 +147,7 @@ struct _PkBackendDesc {
gpointer padding[12];
};
-#define PK_BACKEND_OPTIONS(description, version, author, initialize, destroy, \
+#define PK_BACKEND_OPTIONS(description, author, initialize, destroy, \
get_groups, get_filters, cancel, get_depends, get_description, get_files, \
get_requires, get_update_detail, get_updates, install_package, install_file, \
refresh_cache, remove_package, resolve, rollback, search_details, \
@@ -156,7 +155,6 @@ struct _PkBackendDesc {
get_repo_list, repo_enable, repo_set_data) \
G_MODULE_EXPORT const PkBackendDesc pk_backend_desc = { \
description, \
- version, \
author, \
initialize, \
destroy, \
diff --git a/src/pk-engine.c b/src/pk-engine.c
index 63d49b0..30df52c 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -2365,7 +2365,7 @@ pk_engine_get_filters (PkEngine *engine, gchar **filters, GError **error)
* pk_engine_get_backend_detail:
**/
gboolean
-pk_engine_get_backend_detail (PkEngine *engine, gchar **name, gchar **author, gchar **version, GError **error)
+pk_engine_get_backend_detail (PkEngine *engine, gchar **name, gchar **author, GError **error)
{
PkBackend *backend;
@@ -2382,7 +2382,7 @@ pk_engine_get_backend_detail (PkEngine *engine, gchar **name, gchar **author, gc
return FALSE;
}
- pk_backend_get_backend_detail (backend, name, author, version);
+ pk_backend_get_backend_detail (backend, name, author);
g_object_unref (backend);
return TRUE;
diff --git a/src/pk-engine.h b/src/pk-engine.h
index aef12cd..0f3995e 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -186,7 +186,6 @@ gboolean pk_engine_cancel (PkEngine *engine,
gboolean pk_engine_get_backend_detail (PkEngine *engine,
gchar **name,
gchar **author,
- gchar **version,
GError **error);
gboolean pk_engine_get_actions (PkEngine *engine,
gchar **actions,
commit 1d02c05b69c24998373b0d97e052da24d90b4d11
Author: S.ÃaÄlar Onur <caglar at pardus.org.tr>
Date: Tue Oct 30 09:39:26 2007 +0200
PiSi: Implement get-files
diff --git a/backends/pisi/helpers/Makefile.am b/backends/pisi/helpers/Makefile.am
index 6087a38..188898b 100644
--- a/backends/pisi/helpers/Makefile.am
+++ b/backends/pisi/helpers/Makefile.am
@@ -5,6 +5,7 @@ NULL =
dist_helper_DATA = \
get-depends.py \
+ get-files.py \
get-description.py \
get-repo-list.py \
get-requires.py \
diff --git a/backends/pisi/helpers/get-files.py b/backends/pisi/helpers/get-files.py
new file mode 100644
index 0000000..7a1f178
--- /dev/null
+++ b/backends/pisi/helpers/get-files.py
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2007 S.ÃaÄlar Onur <caglar at pardus.org.tr>
+#
+# Licensed under the GNU General Public License Version 2
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+import sys
+import pisiBackend
+
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
+backend.get_files(sys.argv[1])
+
+sys.exit()
diff --git a/backends/pisi/helpers/get-repo-list.py b/backends/pisi/helpers/get-repo-list.py
index b14903d..db84d4a 100644
--- a/backends/pisi/helpers/get-repo-list.py
+++ b/backends/pisi/helpers/get-repo-list.py
@@ -13,7 +13,7 @@
import sys
import pisiBackend
-backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[2:])
backend.get_repo_list()
sys.exit()
diff --git a/backends/pisi/helpers/pisiBackend.py b/backends/pisi/helpers/pisiBackend.py
index 5e3c755..c16548e 100644
--- a/backends/pisi/helpers/pisiBackend.py
+++ b/backends/pisi/helpers/pisiBackend.py
@@ -26,8 +26,8 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
def __init__(self, args):
PackageKitBaseBackend.__init__(self, args)
- self.installdb = pisi.db.installdb.InstallDB()
self.componentdb = pisi.db.componentdb.ComponentDB()
+ self.installdb = pisi.db.installdb.InstallDB()
self.packagedb = pisi.db.packagedb.PackageDB()
self.repodb = pisi.db.repodb.RepoDB()
@@ -54,93 +54,56 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
version = self.__get_package_version(pkg)
id = self.get_package_id(pkg.name, version, pkg.architecture, "")
- return self.package(id, status, pkg.summary)
- def resolve(self, filter, package):
- """ Turns a single package name into a package_id suitable for the other methods """
-
- #FIXME: Use filter
- self.allow_interrupt(True);
- self.percentage(None)
- self.__get_package(package)
+ return self.package(id, status, pkg.summary)
- def remove(self, deps, package_id):
- """ Removes given package from system"""
- self.allow_interrupt(False);
+ def get_depends(self, package_id):
+ """ Prints a list of depends for a given package """
+ self.allow_interrupt(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
- if self.installdb.has_package(package):
- self.status(STATE_REMOVE)
- try:
- pisi.api.remove([package])
- except pisi.Error,e:
- # system.base packages cannot be removed from system
- self.error(ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE, e)
- else:
- self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is not installed")
+ for pkg in self.packagedb.get_package(package).runtimeDependencies():
+ # Internal FIXME: PiSi API has really inconsistent for return types and arguments!
+ self.__get_package(pkg.package)
- def install(self, package_id):
- """ Installs given package into system"""
- # FIXME: fetch/install progress
- self.allow_interrupt(False);
+ def get_description(self, package_id):
+ """ Prints a detailed description for a given package """
+ self.allow_interrupt(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
if self.packagedb.has_package(package):
- self.status(STATE_INSTALL)
- try:
- pisi.api.install([package])
- except pisi.Error,e:
- self.error(ERROR_INTERNAL_ERROR, e)
+ pkg = self.packagedb.get_package(package)
+ self.description("%s-%s" % (pkg.name, self.__get_package_version(pkg)),
+ pkg.license,
+ pkg.partOf,
+ pkg.description,
+ pkg.packageURI,
+ pkg.packageSize, "")
else:
- self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
-
- def install_file(self, file):
- """ Installs given package into system"""
- # FIXME: install progress
- self.allow_interrupt(False);
- self.percentage(None)
-
- try:
- self.status(STATE_INSTALL)
- pisi.api.install([file])
- except pisi.Error,e:
- # FIXME: Error: internal-error : Package re-install declined
- # Force needed?
- self.error(ERROR_PACKAGE_ALREADY_INSTALLED, e)
+ self.error(ERROR_INTERNAL_ERROR, "Package was not found")
- def update(self, package_id):
- """ Updates given package to its latest version """
- # FIXME: fetch/install progress
- self.allow_interrupt(False);
+ def get_files(self, package_id):
+ """ Prints a file list for a given package """
+ self.allow_interrupt(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
if self.installdb.has_package(package):
- try:
- pisi.api.upgrade([package])
- except pisi.Error,e:
- self.error(ERROR_INTERNAL_ERROR, e)
- else:
- self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
+ pkg = self.installdb.get_files(package)
+
+ # FIXME: Add "/" as suffix
+ files = map(lambda y: y.path, pkg.list)
- def update_system(self):
- """ Updates all available packages """
- # FIXME: fetch/install progress
- self.allow_interrupt(False);
- self.percentage(None)
-
- if not len(pisi.api.list_upgradable()) > 0:
- self.error(ERROR_INTERNAL_ERROR, "System is already up2date")
+ file_list = ";".join(files)
- try:
- pisi.api.upgrade(pisi.api.list_upgradable())
- except pisi.Error,e:
- self.error(ERROR_INTERNAL_ERROR, e)
+ self.files(package, file_list)
+ else:
+ self.error(ERROR_INTERNAL_ERROR, "Package was not found")
def get_repo_list(self):
""" Prints available repositories """
@@ -149,25 +112,19 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
for repo in pisi.api.list_repos():
# Internal FIXME: What an ugly way to get repo uri
+ # FIXME: Use repository enabled/disabled state
self.repo_detail(repo, self.repodb.get_repo(repo).indexuri.get_uri(), "true")
- def get_description(self, package_id):
- """ Prints a detailed description for a given package """
+ def get_requires(self, package_id):
+ """ Prints a list of requires for a given package """
self.allow_interrupt(True)
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
- pkg = self.packagedb.get_package(package)
-
- if pkg:
- self.description("%s-%s" % (pkg.name, self.__get_package_version(pkg)),
- pkg.license,
- pkg.partOf,
- pkg.description,
- pkg.packageURI,
- pkg.packageSize, "")
- else:
- self.error(ERROR_INTERNAL_ERROR, "Package was not found")
+
+ # FIXME: Handle packages which is not installed from repository
+ for pkg in self.packagedb.get_rev_deps(package):
+ self.__get_package(pkg[0])
def get_updates(self):
""" Prints available updates and types """
@@ -189,6 +146,37 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
else:
self.package(id, INFO_NORMAL, pkg.summary)
+ def install_file(self, file):
+ """ Installs given package into system"""
+ # FIXME: install progress
+ self.allow_interrupt(False);
+ self.percentage(None)
+
+ try:
+ self.status(STATE_INSTALL)
+ pisi.api.install([file])
+ except pisi.Error,e:
+ # FIXME: Error: internal-error : Package re-install declined
+ # Force needed?
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED, e)
+
+ def install(self, package_id):
+ """ Installs given package into system"""
+ # FIXME: fetch/install progress
+ self.allow_interrupt(False);
+ self.percentage(None)
+
+ package = self.get_package_from_id(package_id)[0]
+
+ if self.packagedb.has_package(package):
+ self.status(STATE_INSTALL)
+ try:
+ pisi.api.install([package])
+ except pisi.Error,e:
+ self.error(ERROR_INTERNAL_ERROR, e)
+ else:
+ self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
+
def refresh_cache(self):
""" Updates repository indexes """
self.allow_interrupt(False);
@@ -204,39 +192,25 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.percentage(100)
- def get_requires(self, package_id):
- """ Prints a list of requires for a given package """
- self.allow_interrupt(True)
- self.percentage(None)
-
- package = self.get_package_from_id(package_id)[0]
-
- # FIXME: Handle packages which is not installed from repository
- for pkg in self.packagedb.get_rev_deps(package):
- self.__get_package(pkg[0])
-
- def get_depends(self, package_id):
- """ Prints a list of depends for a given package """
- self.allow_interrupt(True)
+ def remove(self, deps, package_id):
+ """ Removes given package from system"""
+ self.allow_interrupt(False);
self.percentage(None)
package = self.get_package_from_id(package_id)[0]
- for pkg in self.packagedb.get_package(package).runtimeDependencies():
- # Internal FIXME: PiSi API has really inconsistent for return types and arguments!
- self.__get_package(pkg.package)
-
- def search_name(self, filters, package):
- """ Prints a list of packages contains search term """
-
- # FIXME: Use filter
- self.allow_interrupt(True)
- self.percentage(None)
-
- for pkg in pisi.api.search_package([package]):
- self.__get_package(pkg)
+ if self.installdb.has_package(package):
+ self.status(STATE_REMOVE)
+ try:
+ pisi.api.remove([package])
+ except pisi.Error,e:
+ # system.base packages cannot be removed from system
+ self.error(ERROR_CANNOT_REMOVE_SYSTEM_PACKAGE, e)
+ else:
+ self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is not installed")
def repo_set_data(self, repo_id, parameter, value):
+ """ Sets a parameter for the repository specified """
self.allow_interrupt(False)
self.percentage(None)
@@ -258,3 +232,48 @@ class PackageKitPisiBackend(PackageKitBaseBackend):
self.error(ERROR_REPO_NOT_FOUND, "Repository is not exists")
else:
self.error(ERROR_INTERNAL_ERROR, "Parameter not supported")
+
+ def resolve(self, filters, package):
+ """ Turns a single package name into a package_id suitable for the other methods """
+ self.allow_interrupt(True);
+ self.percentage(None)
+
+ self.__get_package(package)
+
+ def search_name(self, filters, package):
+ """ Prints a list of packages contains search term """
+ self.allow_interrupt(True)
+ self.percentage(None)
+
+ for pkg in pisi.api.search_package([package]):
+ self.__get_package(pkg)
+
+ def update(self, package_id):
+ """ Updates given package to its latest version """
+ # FIXME: fetch/install progress
+ self.allow_interrupt(False);
+ self.percentage(None)
+
+ package = self.get_package_from_id(package_id)[0]
+
+ if self.installdb.has_package(package):
+ try:
+ pisi.api.upgrade([package])
+ except pisi.Error,e:
+ self.error(ERROR_INTERNAL_ERROR, e)
+ else:
+ self.error(ERROR_PACKAGE_NOT_INSTALLED, "Package is already installed")
+
+ def update_system(self):
+ """ Updates all available packages """
+ # FIXME: fetch/install progress
+ self.allow_interrupt(False);
+ self.percentage(None)
+
+ if not len(pisi.api.list_upgradable()) > 0:
+ self.error(ERROR_INTERNAL_ERROR, "System is already up2date")
+
+ try:
+ pisi.api.upgrade(pisi.api.list_upgradable())
+ except pisi.Error,e:
+ self.error(ERROR_INTERNAL_ERROR, e)
diff --git a/backends/pisi/helpers/resolve.py b/backends/pisi/helpers/resolve.py
index ad630a6..1627bfa 100644
--- a/backends/pisi/helpers/resolve.py
+++ b/backends/pisi/helpers/resolve.py
@@ -13,7 +13,7 @@
import sys
import pisiBackend
-backend = pisiBackend.PackageKitPisiBackend(sys.argv[1:])
+backend = pisiBackend.PackageKitPisiBackend(sys.argv[2:])
backend.resolve(sys.argv[1], sys.argv[2])
sys.exit()
diff --git a/backends/pisi/pk-backend-pisi.c b/backends/pisi/pk-backend-pisi.c
index 0814000..e979f99 100644
--- a/backends/pisi/pk-backend-pisi.c
+++ b/backends/pisi/pk-backend-pisi.c
@@ -34,7 +34,7 @@ PK_BACKEND_OPTIONS (
NULL, /* cancel */
pk_backend_python_get_depends, /* get_depends */
pk_backend_python_get_description, /* get_description */
- NULL, /* get_files */
+ pk_backend_python_get_files, /* get_files */
pk_backend_python_get_requires, /* get_requires */
NULL, /* get_update_detail */
pk_backend_python_get_updates, /* get_updates */
commit 1ea5a5d4751058e0ec0266ce37c7bf067e753c59
Merge: 3b081f2... c1d4e64...
Author: Ali Sabil <ali.sabil at gmail.com>
Date: Tue Oct 30 02:09:50 2007 +0100
Merge branch 'master' of git+ssh://git.packagekit.org/srv/git/PackageKit
commit 3b081f216b1399c012a38a71dd42ffc67b3126b5
Author: Ali Sabil <ali.sabil at gmail.com>
Date: Sun Oct 28 14:38:03 2007 +0100
apt: added initial get-description support
diff --git a/backends/apt/helpers/aptBackend.py b/backends/apt/helpers/aptBackend.py
index 3fbfc62..a7a868b 100644
--- a/backends/apt/helpers/aptBackend.py
+++ b/backends/apt/helpers/aptBackend.py
@@ -56,7 +56,7 @@ class Package(object):
desc = ""
try:
s = unicode(self._records.LongDesc,"utf-8")
- except UnicodeDecodeError,e:
+ except UnicodeDecodeError, e:
s = _("Invalid unicode in description for '%s' (%s). "
"Please report.") % (self.name, e)
for line in s.splitlines():
@@ -81,6 +81,33 @@ class Package(object):
return self._pkg.Section
@property
+ def group(self):
+ section = self.section.split('/')[-1].lower()
+ #if section in ():
+ # return GROUP_ACCESSIBILITY
+ if section in ('utils',):
+ return GROUP_ACCESSORIES
+ #if section in ():
+ # return GROUP_EDUCATION
+ if section in ('games',):
+ return "games"
+ if section in ('graphics',):
+ return "graphics"
+ if section in ('net', 'news', 'web', 'comm'):
+ return "internet"
+ if section in ('editors', 'tex'):
+ return "office"
+ if section in ('misc',):
+ return "other"
+ if section in ('devel', 'libdevel', 'interpreters', 'perl', 'python'):
+ return "programming"
+ if section in ('sound',):
+ return "multimedia"
+ if section in ('base', 'admin'):
+ return "system"
+ return "unknown"
+
+ @property
def installed_version(self):
version = self._pkg.CurrentVer
if version != None:
@@ -109,7 +136,7 @@ class Package(object):
name = self.name.lower()
section = self.section.split('/')[-1].lower()
return name.endswith('-dev') or name.endswith('-dbg') or \
- section in ('devel', )
+ section in ('devel', 'libdevel')
@property
def is_gui(self):
@@ -240,6 +267,15 @@ class PackageKitAptBackend(PackageKitBaseBackend):
finally:
os.close(lock)
+ def get_description(self, package):
+ '''
+ Implement the {backend}-get-description functionality
+ '''
+ name, version, arch, data = self.get_package_from_id(package)
+ pkg = Package(self._apt_cache[name], self)
+ description = re.sub('\s+', ' ', pkg.description).strip()
+ self.description(package, 'unknown', pkg.group, description, '', 0, '')
+
### Helpers ###
def _emit_package(self, package):
id = self.get_package_id(package.name,
More information about the PackageKit
mailing list