[PackageKit-commit] packagekit: Branch 'master' - 5 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Fri Apr 18 01:46:09 PDT 2008
backends/yum/helpers/yumBackend.py | 42 ++++++++++++++++----------------
backends/yum2/helpers/yumDBUSBackend.py | 16 ++++++------
libpackagekit/pk-enum.c | 6 ++++
libpackagekit/pk-enum.h | 8 +++++-
python/packagekit/backend.py | 9 ------
python/packagekit/daemonBackend.py | 11 --------
6 files changed, 43 insertions(+), 49 deletions(-)
New commits:
commit d2ae5e11bc6645e5cd4f7e7675fdf8c06c523d04
Merge: 8b0f874... 805286e...
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Apr 17 18:02:53 2008 +0100
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 8b0f874c04dafa78191864b01dd565afd7e90108
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Apr 17 18:02:37 2008 +0100
convert the unused metadata signals into status signals. Now we get nice UI feedback
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 1ab0cc8..5c165e9 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -189,15 +189,12 @@ groupMap = {
}
MetaDataMap = {
-'repomd.xml' : "repository",
-'primary.sqlite.bz2' : "package",
-'primary.xml.gz' : "package",
-'filelists.sqlite.bz2' : "filelist",
-'filelists.xml.gz' : "filelist",
-'other.sqlite.bz2' : "changelog",
-'other.xml.gz' : "changelog",
-'comps.xml' : "group",
-'updateinfo.xml.gz' : "update"
+ 'repomd' : STATUS_DOWNLOAD_REPOSITORY,
+ 'primary' : STATUS_DOWNLOAD_PACKAGELIST,
+ 'filelists' : STATUS_DOWNLOAD_FILELIST,
+ 'other' : STATUS_DOWNLOAD_CHANGELOG,
+ 'comps' : STATUS_DOWNLOAD_GROUP,
+ 'updateinfo' : STATUS_DOWNLOAD_UPDATEINFO
}
GUI_KEYS = re.compile(r'(qt)|(gtk)')
@@ -1504,11 +1501,11 @@ class DownloadCallback( BaseMeter ):
if pkg: # show package to download
self.base._show_package(pkg,INFO_DOWNLOADING)
else:
- if name in MetaDataMap:
- typ = MetaDataMap[name]
- else:
- typ = 'unknown'
- self.base.metadata(typ,name)
+ for key in MetaDataMap.keys():
+ if key in name:
+ typ = MetaDataMap[key]
+ self.base.status(typ)
+ break
self.base.sub_percentage(0)
else:
if self.lastPct != pct and pct != 0 and pct != 100:
diff --git a/backends/yum2/helpers/yumDBUSBackend.py b/backends/yum2/helpers/yumDBUSBackend.py
index e74434c..1540755 100755
--- a/backends/yum2/helpers/yumDBUSBackend.py
+++ b/backends/yum2/helpers/yumDBUSBackend.py
@@ -210,12 +210,12 @@ groupMap = {
}
MetaDataMap = {
- 'repomd' : "repository",
- 'primary' : "package",
- 'filelists' : "filelist",
- 'other' : "changelog",
- 'comps' : "group",
- 'updateinfo' : "update"
+ 'repomd' : STATUS_DOWNLOAD_REPOSITORY,
+ 'primary' : STATUS_DOWNLOAD_PACKAGELIST,
+ 'filelists' : STATUS_DOWNLOAD_FILELIST,
+ 'other' : STATUS_DOWNLOAD_CHANGELOG,
+ 'comps' : STATUS_DOWNLOAD_GROUP,
+ 'updateinfo' : STATUS_DOWNLOAD_UPDATEINFO
}
GUI_KEYS = re.compile(r'(qt)|(gtk)')
@@ -1982,12 +1982,12 @@ class DownloadCallback( BaseMeter ):
if pkg: # show package to download
self.base._show_package(pkg,INFO_DOWNLOADING)
else:
- typ = 'unknown'
+ typ = STATUS_DOWNLOAD_REPOSITORY
for key in MetaDataMap.keys():
if key in name:
typ = MetaDataMap[key]
break
- self.base.MetaData(typ,name)
+ self.base.StatusChanged(typ)
self.base.SubPercentageChanged(0)
else:
if self.lastPct != pct and pct != 0 and pct != 100:
diff --git a/python/packagekit/backend.py b/python/packagekit/backend.py
index 0419830..712b2ef 100644
--- a/python/packagekit/backend.py
+++ b/python/packagekit/backend.py
@@ -127,15 +127,6 @@ class PackageKitBaseBackend:
print "data\t%s" % (data)
sys.stdout.flush()
- def metadata(self,typ,fname):
- '''
- send 'metadata' signal:
- @param type: The type of metadata (repository,package,filelist,changelog,group,unknown)
- @param fname: The filename being downloaded
- '''
- print "metadata\t%s\t%s" % (typ,fname)
- sys.stdout.flush()
-
def description(self,id,license,group,desc,url,bytes):
'''
Send 'description' signal
diff --git a/python/packagekit/daemonBackend.py b/python/packagekit/daemonBackend.py
index 0f69375..5382361 100644
--- a/python/packagekit/daemonBackend.py
+++ b/python/packagekit/daemonBackend.py
@@ -295,17 +295,6 @@ class PackageKitBaseBackend(dbus.service.Object):
@PKSignalHouseKeeper
@dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
signature='ss')
- def MetaData(self,typ,fname):
- '''
- send 'metadata' signal:
- @param type: The type of metadata (repository,package,filelist,changelog,group,unknown)
- @param fname: The filename being downloaded
- '''
- pklog.info("MetaData (%s, %s)" % (typ,fname))
-
- @PKSignalHouseKeeper
- @dbus.service.signal(dbus_interface=PACKAGEKIT_DBUS_INTERFACE,
- signature='ss')
def RequireRestart(self,type,details):
'''
send 'require-restart' signal:
commit 50b3b9e31aeadd3459c993f16abbd6d2debcd76e
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Apr 17 17:51:42 2008 +0100
add more status enums for downloading cache types
diff --git a/libpackagekit/pk-enum.c b/libpackagekit/pk-enum.c
index 333cd0e..93535fa 100644
--- a/libpackagekit/pk-enum.c
+++ b/libpackagekit/pk-enum.c
@@ -71,6 +71,12 @@ static PkEnumMatch enum_status[] = {
{PK_STATUS_ENUM_REQUEST, "request"},
{PK_STATUS_ENUM_FINISHED, "finished"},
{PK_STATUS_ENUM_CANCEL, "cancel"},
+ {PK_STATUS_ENUM_DOWNLOAD_REPOSITORY, "download-repository"},
+ {PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST, "download-package"},
+ {PK_STATUS_ENUM_DOWNLOAD_FILELIST, "download-filelist"},
+ {PK_STATUS_ENUM_DOWNLOAD_CHANGELOG, "download-changelog"},
+ {PK_STATUS_ENUM_DOWNLOAD_GROUP, "download-group"},
+ {PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO, "download-updateinfo"},
{0, NULL}
};
diff --git a/libpackagekit/pk-enum.h b/libpackagekit/pk-enum.h
index c7f5ad4..d4ab06a 100644
--- a/libpackagekit/pk-enum.h
+++ b/libpackagekit/pk-enum.h
@@ -122,7 +122,13 @@ typedef enum {
PK_STATUS_ENUM_REQUEST = 1 << 17,
PK_STATUS_ENUM_FINISHED = 1 << 18,
PK_STATUS_ENUM_CANCEL = 1 << 19,
- PK_STATUS_ENUM_UNKNOWN = 1 << 20
+ PK_STATUS_ENUM_DOWNLOAD_REPOSITORY = 1 << 20,
+ PK_STATUS_ENUM_DOWNLOAD_PACKAGELIST = 1 << 21,
+ PK_STATUS_ENUM_DOWNLOAD_FILELIST = 1 << 22,
+ PK_STATUS_ENUM_DOWNLOAD_CHANGELOG = 1 << 23,
+ PK_STATUS_ENUM_DOWNLOAD_GROUP = 1 << 24,
+ PK_STATUS_ENUM_DOWNLOAD_UPDATEINFO = 1 << 25,
+ PK_STATUS_ENUM_UNKNOWN = 1 << 26
} PkStatusEnum;
/**
commit 805286e86f7666fa46d8da7694ba8a7fef15949b
Merge: 67848c1... e472d73...
Author: Robin Norwood <rnorwood at redhat.com>
Date: Thu Apr 17 12:20:13 2008 -0400
Merge branch 'master' of git+ssh://rnorwood@git.packagekit.org/srv/git/PackageKit
commit 67848c1f4dab472fe30964d9166969ba470dbad4
Author: Robin Norwood <rnorwood at redhat.com>
Date: Thu Apr 17 12:20:02 2008 -0400
Catch errors when checking for updated packages during install_file method.
diff --git a/backends/yum/helpers/yumBackend.py b/backends/yum/helpers/yumBackend.py
index 1ab0cc8..3196b59 100644
--- a/backends/yum/helpers/yumBackend.py
+++ b/backends/yum/helpers/yumBackend.py
@@ -897,12 +897,17 @@ class PackageKitYumBackend(PackageKitBaseBackend):
self.error(ERROR_PACKAGE_ALREADY_INSTALLED,"This package could not be installed as it is already installed")
def _checkForNewer(self,po):
- pkgs = self.yumbase.pkgSack.returnNewestByName(name=po.name)
- if pkgs:
- newest = pkgs[0]
- if newest.EVR > po.EVR:
- #TODO Add code to send a message here
- self.message(MESSAGE_WARNING,"Newer version of %s, exist in the repositories " % po.name)
+ try:
+ pkgs = self.yumbase.pkgSack.returnNewestByName(name=po.name)
+ if pkgs:
+ newest = pkgs[0]
+ if newest.EVR > po.EVR:
+ #TODO Add code to send a message here
+ self.message(MESSAGE_WARNING,"A newer version of %s is available online." % po.name)
+ except (yum.Errors.RepoError, yum.Errors.PackageSackError):
+ # We might not be able to connect to the internet to get
+ # repository metadata, or the package might not exist.
+ pass
def install_file (self, inst_file):
'''
More information about the PackageKit-commit
mailing list