[packagekit] packagekit: Branch 'master' - 3 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Aug 30 02:13:39 PDT 2007
helpers/conary-get-updates.py | 1
helpers/conary-install.py | 5 +++-
helpers/conary-refresh-cache.py | 1
helpers/conary-search-name-live.py | 1
helpers/conary-search-name.py | 1
helpers/conaryBackend.py | 38 ++++++++++++++++++++++++++++++++++---
src/pk-task-apt.cpp | 10 ---------
7 files changed, 44 insertions(+), 13 deletions(-)
New commits:
diff-tree 86e44697191580428b81a292d11f8ceb46aa55cb (from 7704e6cdafb7f216939bf1ad971bad9c68ead44f)
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Aug 30 10:13:23 2007 +0100
apt can't do all the actions, only advertise the ones it can
diff --git a/src/pk-task-apt.cpp b/src/pk-task-apt.cpp
index 64f5f54..856e569 100644
--- a/src/pk-task-apt.cpp
+++ b/src/pk-task-apt.cpp
@@ -100,18 +100,10 @@ gchar *
pk_task_get_actions (void)
{
gchar *actions;
- actions = pk_task_action_build (PK_TASK_ACTION_INSTALL,
- PK_TASK_ACTION_REMOVE,
- PK_TASK_ACTION_UPDATE,
- PK_TASK_ACTION_GET_UPDATES,
- PK_TASK_ACTION_REFRESH_CACHE,
+ actions = pk_task_action_build (PK_TASK_ACTION_REFRESH_CACHE,
PK_TASK_ACTION_UPDATE_SYSTEM,
PK_TASK_ACTION_SEARCH_NAME,
PK_TASK_ACTION_SEARCH_DETAILS,
- PK_TASK_ACTION_SEARCH_GROUP,
- PK_TASK_ACTION_SEARCH_FILE,
- PK_TASK_ACTION_GET_DEPS,
- PK_TASK_ACTION_GET_DESCRIPTION,
0);
return actions;
}
diff-tree 7704e6cdafb7f216939bf1ad971bad9c68ead44f (from 9be5acc8c411bed0f2f296b1aaffb5aefec3b26d)
Author: Ken VanDine <ken at vandine.org>
Date: Wed Aug 29 23:06:40 2007 -0400
The beginings of install/update
diff --git a/helpers/conaryBackend.py b/helpers/conaryBackend.py
index 82eff26..f6ee825 100644
--- a/helpers/conaryBackend.py
+++ b/helpers/conaryBackend.py
@@ -66,7 +66,8 @@ class PackageKitConaryBackend(PackageKit
troveTuple = tuple([item.encode('UTF-8') for item in troveTuple])
name = troveTuple[0]
version = versions.ThawVersion(troveTuple[1]).trailingRevision()
- fullVersion = versions.ThawVersion(troveTuple[1])
+ fullVersion = troveTuple[1]
+ #fullVersion = versions.ThawVersion(troveTuple[1])
flavor = deps.ThawFlavor(troveTuple[2])
# We don't have summary data yet... so leave it blank for now
summary = " "
@@ -129,6 +130,7 @@ class PackageKitConaryBackend(PackageKit
def check_installed(self, troveTuple):
db = conaryclient.ConaryClient(self.cfg).db
try:
+ troveTuple = troveTuple[0], versions.ThawVersion(troveTuple[1]), troveTuple[2]
localInstall = db.findTrove(None, troveTuple)
installed = 1
except:
@@ -161,6 +163,21 @@ class PackageKitConaryBackend(PackageKit
cache.populate_database()
def install(self, package_id):
+ '''
+ Implement the {backend}-install functionality
+ '''
+ pkg,inst = self._findPackage(package_id)
+
+ if pkg:
+ if inst:
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,'Package already installed')
+ try:
+ print "FOOOOO"
+ except:
+ pass
+ else:
+ self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"Package was not found")
+
pass
def remove(self, allowdep, package_id):
@@ -238,6 +255,19 @@ class PackageKitConaryBackend(PackageKit
#
return isDevel == wantDevel
+ def _findPackage(self,id):
+ '''
+ find a package based on a package id (name;version;arch;repoid)
+ '''
+ # Split up the id
+ (name,version,arch,fullVersion) = self.get_package_from_id(id)
+ cache = Cache()
+ troveTuple = cache.search(name,fullVersion)
+ troveTuple = [item.encode('UTF-8') for item in troveTuple[0]]
+
+ installed = self.check_installed(troveTuple)
+ return name,installed
+
class Cache(object):
# Database name and path
dbName = 'cache.db'
@@ -357,14 +387,16 @@ class Cache(object):
print str(e)
return None
- def search(self, package):
+ def search(self, package, fullVersion=None):
"""
Returns all troves for now. Add filtering capability.
"""
stmt = "select distinct trove, version, flavor, description, category, packagegroup, size" \
" from conary_packages"
- if package:
+ if package and fullVersion:
+ stmt = "select distinct trove, version, flavor from conary_packages where trove ='" + package + "' and version = '" + fullVersion +"'"
+ elif package:
stmt = stmt + " where trove like '%" + package + "%' and component = '' order by version desc"
try:
diff-tree 9be5acc8c411bed0f2f296b1aaffb5aefec3b26d (from 5ad657f34bbc90646a36ad188ab722fe413a2bab)
Author: Ken VanDine <ken at vandine.org>
Date: Wed Aug 29 23:05:16 2007 -0400
Added sys.exit
diff --git a/helpers/conary-get-updates.py b/helpers/conary-get-updates.py
index 2bf4990..12c3be8 100755
--- a/helpers/conary-get-updates.py
+++ b/helpers/conary-get-updates.py
@@ -14,3 +14,4 @@ from conaryBackend import PackageKitCona
backend = PackageKitConaryBackend(sys.argv[1:])
backend.get_updates()
+sys.exit(1)
diff --git a/helpers/conary-install.py b/helpers/conary-install.py
index 7240171..8c9a62f 100755
--- a/helpers/conary-install.py
+++ b/helpers/conary-install.py
@@ -10,6 +10,9 @@
# (at your option) any later version.
import sys
+from conaryBackend import PackageKitConaryBackend
+package = sys.argv[1]
+backend = PackageKitConaryBackend(sys.argv[1:])
+backend.install(package)
sys.exit(1)
-
diff --git a/helpers/conary-refresh-cache.py b/helpers/conary-refresh-cache.py
index f853b48..a42369e 100755
--- a/helpers/conary-refresh-cache.py
+++ b/helpers/conary-refresh-cache.py
@@ -14,3 +14,4 @@ from conaryBackend import PackageKitCona
backend = PackageKitConaryBackend(sys.argv[1:])
backend.refresh_cache()
+sys.exit(1)
diff --git a/helpers/conary-search-name-live.py b/helpers/conary-search-name-live.py
index 2556f8d..a1baa2b 100755
--- a/helpers/conary-search-name-live.py
+++ b/helpers/conary-search-name-live.py
@@ -18,3 +18,4 @@ from conaryBackend import PackageKitCona
backend = PackageKitConaryBackend(sys.argv[1:])
backend.search_name_live(options,searchlist)
+sys.exit(1)
diff --git a/helpers/conary-search-name.py b/helpers/conary-search-name.py
index d96d4cb..8259105 100755
--- a/helpers/conary-search-name.py
+++ b/helpers/conary-search-name.py
@@ -18,3 +18,4 @@ from conaryBackend import PackageKitCona
backend = PackageKitConaryBackend(sys.argv[1:])
backend.search_name(options,searchlist)
+sys.exit(1)
More information about the PackageKit
mailing list