[PackageKit-commit] packagekit: Branch 'master' - 40 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Tue Feb 17 08:39:59 PST 2009
backends/conary/Makefile.am | 14 -
backends/conary/XMLCache.py | 50 ++++--
backends/conary/conaryBackend.py | 127 ++++++++++++-----
backends/conary/conaryCallback.py | 199 ++++++++++++++++++---------
backends/conary/conarypk.py | 2
backends/conary/pkConaryLog.py | 7
backends/dummy/pk-backend-dummy.c | 25 ++-
backends/yum/yumBackend.py | 2
client/pk-monitor.c | 27 ++-
configure.ac | 14 -
docs/api/spec/pk-introduction.xml | 6
docs/app-install-v1.draft | 126 +++++++++++++++++
docs/html/img/Makefile.am | 1
docs/html/img/author-zodman.png |binary
docs/html/pk-authors.html | 18 ++
docs/html/pk-faq.html | 14 +
docs/html/pk-matrix.html | 14 -
lib/packagekit-glib/pk-control.c | 39 +++++
lib/packagekit-glib/pk-control.h | 2
lib/packagekit-glib/pk-task-list.c | 4
lib/packagekit-qt/src/client.cpp | 121 ++++++++++++++++
lib/packagekit-qt/src/client.h | 46 ++++--
lib/packagekit-qt/src/clientprivate.cpp | 5
lib/packagekit-qt/src/clientprivate.h | 3
lib/packagekit-qt/src/transaction.cpp | 10 +
lib/packagekit-qt/src/transaction.h | 3
lib/packagekit-qt/src/transactionprivate.cpp | 8 -
lib/packagekit-qt/src/transactionprivate.h | 2
lib/packagekit-qt/test/main.cpp | 2
lib/packagekit-qt/test/transactiontest.cpp | 6
lib/packagekit-qt/test/transactiontest.h | 2
src/org.freedesktop.PackageKit.xml | 21 ++
src/pk-engine.c | 16 ++
src/pk-engine.h | 3
src/pk-transaction-list.c | 62 +++++++-
src/pk-transaction-list.h | 2
36 files changed, 826 insertions(+), 177 deletions(-)
New commits:
commit 3a050dc02a8f76dabcc964fd3525aa36ba38e46b
Merge: 5dd4d64... ff52bc2...
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 17 16:38:37 2009 +0000
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit 5dd4d648f0c0a0d047a2a814e1d4043463df0bff
Author: Richard Hughes <richard at hughsie.com>
Date: Tue Feb 17 16:38:03 2009 +0000
feature: add the basics of a draft standard for application install metadata handling
diff --git a/docs/app-install-v1.draft b/docs/app-install-v1.draft
new file mode 100644
index 0000000..0235fd1
--- /dev/null
+++ b/docs/app-install-v1.draft
@@ -0,0 +1,126 @@
+*** app-install version 1 ***
+
+Copyright (C) 2009 Richard Hughes <richard at hughsie.com>
+Copyright (C) 2009 Roderick B. Greening <roderick.greening at gmail.com>
+Copyright (C) 2009 Sebastian Heinlein <devel at glatzor.de>
+
+= Scope =
+
+* A cross-distro database that can be used by an end user application browser
+ rather than a package management tool
+* As software sources are added, new applications become available
+* Shared data format so that gnome-packagekit and KPackageKit can access the data
+* One package can contain, 0, 1, or many applications.
+
+= Past work =
+
+* gnome-app-install or Adept -- *need references and screenshots
+* Currently Debian and Ubuntu ship all desktop files and corrsponding icons in a
+ separate package. The download size is 6,5 MByte and it takes 20 MByte on the disk.
+ This package could conceivably be replaced with this one.
+
+= Design =
+
+This specification is not choosing to add extra information as package provides
+or package metadata. This is data that can be updated infrequently and would add
+significant size and complexity to the metadata.
+Providing this data out of band will allow the data to be shipped as a package
+which would be mirrored just like all the others. Another advantage of doing
+this out of band is that we do not need to using PackageKit for lots of small
+searches, and can query on the native DE groups using a fast .
+
+* This specification is designed around a single sqlite database
+* Applications must ship a 48x48 PNG format icon if one is provided.
+ Other sizes can optionally provided, although this is not recommended.
+* Applications should not ship extra data in the database. Functionality will
+ be increased in future versions of the standard and the database format will
+ be expanded.
+
+== Future ==
+
+Data currently being considered is popularity (from popcon and mugshot) and
+OnlyShowIn DE hinting.
+Distros can merge in supplimental updates to this main database. As long as the
+main db file is up to date, the frontend should not care.
+
+= Limitations =
+
+Shipping this as a seporate package means that repositories have to manually
+sync this every time a new package is added to the repo.
+This is not expected to be done for every package as new packages in the
+repository can wait until the next refresh
+It is expected that distros add the "create" scripts in packagekit.org git, and
+share as much as possible of the merge and re-create logic.
+Where possible, this should be automated as mush as possible using public
+scripts or integration into the distro buildsystem.
+The frontend should not try to use any heuristics to detect if the database
+is stale or old.
+All this data has to be generated by the distro rather than pre-seeded.
+For instance, Debian can't ship the firefox logo, and firefox might be in the
+package firefox-bin on Ubuntu and firefox in Fedora.
+
+= Specifics=
+
+PackageKit already has a /var/lib/PackageKit/desktop-files.db file that maps all
+the _installed_ package .desktop files to package names and vice-versa.
+This is used, for instance:
+
+* We installed a package and give a list of applications to run
+* We remove a package and give a list of applications that are removed
+* We can choose the 'best' icon using a (hacky) metric to put a themed icon next to the installed package
+
+== location of the files ==
+/var/lib/app-install/desktop.db
+/usr/share/app-install/icons/48x48/${application_id}.png (optional, recommended)
+/usr/share/app-install/icons/24x24/${application_id}.png (optional, not recommended)
+/usr/share/app-install/desktop/${application_id}.desktop (for Ubuntu compatibility, not recommended)
+
+== Schema ==
+
+TABLE localised:
+STRING application_id (name of the desktop file, with no extension)
+STRING application_name (Name in desktop file, in locale)
+STRING application_summary (Comment in desktop file, in locale)
+STRING locale
+
+TABLE general
+STRING application_id (name of the desktop file, with no extension)
+STRING package_name (to save on expensive SearchFile's)
+STRING icon_name (without path or extension)
+STRING group (Categories from desktop file, _not_ PK groups or PK categories)
+STRING application_name (Name in desktop file)
+STRING application_summary (Comment in desktop file)
+
+== Possible Commands ==
+pk-app-install-merge-cache --name=livna --source=/var/cache/yum/livna-apps.db --cache=/usr/share/app-install/cache/desktop.db
+pk-app-install-remove-cache --name=livna --cache=/usr/share/app-install/cache/desktop.db
+* need to do the latter then former in a spec file on upgrade
+
+all distro specific stuff to live in backends/, but typically:
+yum-app-install-generate --name=livna --cache=~/livna-apps.db
+
+== Open questions ===
+
+So, what does a frontend need to do to get a "list of applications"
+
+1. Query the uninstalled database
+2. For each entry, check it's not in the installed database, if so, mark "installed",
+ else mark "available" (does require the installed list to be kept up to date,
+ alternatively a resolve (via IsPackageInstalled) might be inexpensive in this case)
+
+When the package is clicked on then do a SearchDetails like normal (?), and show
+the localised application_summary
+
+== Fedora specific ==
+
+Would need to create yum script to disable all repos except 'fedora', iterate
+over all packages and get filelists. If filelist has .desktop, explode rpm file
+to temp directory and copy icons and desktop file to directory. Add desktop file
+to cache. Repeat.
+
+== Ubuntu specific ==
+
+Already got the infrastructure to generate parse the repo and extract the
+desktop files and icon data, albeit uncompressed.
+Should be trivial to generate and ship the cache database.
+
commit ff52bc2b42c3f51a78ae6b9cb0921e2b62b428f3
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 16:45:11 2009 +0100
PackageKit-Qt : Real code for b75d9205cb12037b6a1448933f7fe5f55258437d (sync API)
diff --git a/lib/packagekit-qt/src/transaction.h b/lib/packagekit-qt/src/transaction.h
index 60e80a5..39993c4 100644
--- a/lib/packagekit-qt/src/transaction.h
+++ b/lib/packagekit-qt/src/transaction.h
@@ -334,7 +334,7 @@ Q_SIGNALS:
* Indicates that a restart is required
* \p package is the package who triggered the restart signal
*/
- void requireRestart(PackageKit::Client::RestartType type, const QString& details);
+ void requireRestart(PackageKit::Client::RestartType type, Package* p);
/**
* Emitted when the transaction's status has changed
diff --git a/lib/packagekit-qt/src/transactionprivate.cpp b/lib/packagekit-qt/src/transactionprivate.cpp
index c41343c..7da4085 100644
--- a/lib/packagekit-qt/src/transactionprivate.cpp
+++ b/lib/packagekit-qt/src/transactionprivate.cpp
@@ -116,9 +116,9 @@ void TransactionPrivate::repoSignatureRequired(const QString& pid, const QString
t->repoSignatureRequired(i);
}
-void TransactionPrivate::requireRestart(const QString& type, const QString& details)
+void TransactionPrivate::requireRestart(const QString& type, const QString& pid)
{
- t->requireRestart((Client::RestartType)Util::enumFromString<Client>(type, "RestartType", "Restart"), details);
+ t->requireRestart((Client::RestartType)Util::enumFromString<Client>(type, "RestartType", "Restart"), new Package(pid));
}
void TransactionPrivate::statusChanged(const QString& status)
diff --git a/lib/packagekit-qt/src/transactionprivate.h b/lib/packagekit-qt/src/transactionprivate.h
index f15f622..1be0672 100644
--- a/lib/packagekit-qt/src/transactionprivate.h
+++ b/lib/packagekit-qt/src/transactionprivate.h
@@ -65,7 +65,7 @@ public slots:
void package(const QString& info, const QString& pid, const QString& summary);
void progressChanged(uint percentage, uint subpercentage, uint elapsed, uint remaining);
void repoSignatureRequired(const QString& pid, const QString& repoName, const QString& keyUrl, const QString& keyUserid, const QString& keyId, const QString& keyFingerprint, const QString& keyTimestamp, const QString& type);
- void requireRestart(const QString& type, const QString& details);
+ void requireRestart(const QString& type, const QString& pid);
void statusChanged(const QString& status);
void transaction(const QString& oldTid, const QString& timespec, bool succeeded, const QString& role, uint duration, const QString& data, uint uid, const QString& cmdline);
void updateDetail(const QString& pid, const QString& updates, const QString& obsoletes, const QString& vendorUrl, const QString& bugzillaUrl, const QString& cveUrl, const QString& restart, const QString& updateText, const QString& changelog, const QString& state, const QString& issued, const QString& updated);
commit 0e2ae206b201599a082c58ba6a05dd8761e689d1
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 16:40:08 2009 +0100
Revert "PackageKit-Qt : Sync with API (RequireRestart emits a package)" since it adds a dependency on qt4.5rc1
This reverts commit c8f44479261d9715678d3d827d7f52d4303da26c.
Conflicts:
lib/packagekit-qt/src/client.h
diff --git a/lib/packagekit-qt/src/daemonproxy.h b/lib/packagekit-qt/src/daemonproxy.h
index 3d721ba..45287c6 100644
--- a/lib/packagekit-qt/src/daemonproxy.h
+++ b/lib/packagekit-qt/src/daemonproxy.h
@@ -1,15 +1,15 @@
/*
- * This file was generated by qdbusxml2cpp version 0.7
- * Command line was: qdbusxml2cpp -c DaemonProxy -p daemonproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.xml org.freedesktop.PackageKit
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -c DaemonProxy -p daemonproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.xml org.freedesktop.PackageKit
*
- * qdbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * dbusxml2cpp is Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
-#ifndef DAEMONPROXY_H_1234879521
-#define DAEMONPROXY_H_1234879521
+#ifndef DAEMONPROXY_H_1228501948
+#define DAEMONPROXY_H_1228501948
#include <QtCore/QObject>
#include <QtCore/QByteArray>
@@ -38,17 +38,12 @@ public:
~DaemonProxy();
public Q_SLOTS: // METHODS
- inline QDBusPendingReply<QString> GetActions()
+ inline QDBusReply<QString> GetActions()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetActions"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetActions"), argumentList);
}
- inline QDBusPendingReply<QString, QString> GetBackendDetail()
- {
- QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetBackendDetail"), argumentList);
- }
inline QDBusReply<QString> GetBackendDetail(QString &author)
{
QList<QVariant> argumentList;
@@ -59,73 +54,67 @@ public Q_SLOTS: // METHODS
return reply;
}
- inline QDBusPendingReply<QString> GetDaemonState()
- {
- QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetDaemonState"), argumentList);
- }
-
- inline QDBusPendingReply<QString> GetFilters()
+ inline QDBusReply<QString> GetFilters()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetFilters"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetFilters"), argumentList);
}
- inline QDBusPendingReply<QString> GetGroups()
+ inline QDBusReply<QString> GetGroups()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetGroups"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetGroups"), argumentList);
}
- inline QDBusPendingReply<QString> GetMimeTypes()
+ inline QDBusReply<QString> GetMimeTypes()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetMimeTypes"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetMimeTypes"), argumentList);
}
- inline QDBusPendingReply<QString> GetNetworkState()
+ inline QDBusReply<QString> GetNetworkState()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetNetworkState"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetNetworkState"), argumentList);
}
- inline QDBusPendingReply<QString> GetTid()
+ inline QDBusReply<QString> GetTid()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetTid"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetTid"), argumentList);
}
- inline QDBusPendingReply<uint> GetTimeSinceAction(const QString &role)
+ inline QDBusReply<uint> GetTimeSinceAction(const QString &role)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(role);
- return asyncCallWithArgumentList(QLatin1String("GetTimeSinceAction"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetTimeSinceAction"), argumentList);
}
- inline QDBusPendingReply<QStringList> GetTransactionList()
+ inline QDBusReply<QStringList> GetTransactionList()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetTransactionList"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetTransactionList"), argumentList);
}
- inline QDBusPendingReply<> SetProxy(const QString &proxy_http, const QString &proxy_ftp)
+ inline QDBusReply<void> SetProxy(const QString &proxy_http, const QString &proxy_ftp)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(proxy_http) << qVariantFromValue(proxy_ftp);
- return asyncCallWithArgumentList(QLatin1String("SetProxy"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("SetProxy"), argumentList);
}
- inline QDBusPendingReply<> StateHasChanged(const QString &reason)
+ inline QDBusReply<void> StateHasChanged(const QString &reason)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(reason);
- return asyncCallWithArgumentList(QLatin1String("StateHasChanged"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("StateHasChanged"), argumentList);
}
- inline QDBusPendingReply<> SuggestDaemonQuit()
+ inline QDBusReply<void> SuggestDaemonQuit()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("SuggestDaemonQuit"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("SuggestDaemonQuit"), argumentList);
}
Q_SIGNALS: // SIGNALS
diff --git a/lib/packagekit-qt/src/transaction.h b/lib/packagekit-qt/src/transaction.h
index b01e2ea..60e80a5 100644
--- a/lib/packagekit-qt/src/transaction.h
+++ b/lib/packagekit-qt/src/transaction.h
@@ -334,7 +334,7 @@ Q_SIGNALS:
* Indicates that a restart is required
* \p package is the package who triggered the restart signal
*/
- void requireRestart(PackageKit::Client::RestartType type, PackageKit::Package* p);
+ void requireRestart(PackageKit::Client::RestartType type, const QString& details);
/**
* Emitted when the transaction's status has changed
diff --git a/lib/packagekit-qt/src/transactionprivate.cpp b/lib/packagekit-qt/src/transactionprivate.cpp
index 7da4085..c41343c 100644
--- a/lib/packagekit-qt/src/transactionprivate.cpp
+++ b/lib/packagekit-qt/src/transactionprivate.cpp
@@ -116,9 +116,9 @@ void TransactionPrivate::repoSignatureRequired(const QString& pid, const QString
t->repoSignatureRequired(i);
}
-void TransactionPrivate::requireRestart(const QString& type, const QString& pid)
+void TransactionPrivate::requireRestart(const QString& type, const QString& details)
{
- t->requireRestart((Client::RestartType)Util::enumFromString<Client>(type, "RestartType", "Restart"), new Package(pid));
+ t->requireRestart((Client::RestartType)Util::enumFromString<Client>(type, "RestartType", "Restart"), details);
}
void TransactionPrivate::statusChanged(const QString& status)
diff --git a/lib/packagekit-qt/src/transactionprivate.h b/lib/packagekit-qt/src/transactionprivate.h
index 1be0672..f15f622 100644
--- a/lib/packagekit-qt/src/transactionprivate.h
+++ b/lib/packagekit-qt/src/transactionprivate.h
@@ -65,7 +65,7 @@ public slots:
void package(const QString& info, const QString& pid, const QString& summary);
void progressChanged(uint percentage, uint subpercentage, uint elapsed, uint remaining);
void repoSignatureRequired(const QString& pid, const QString& repoName, const QString& keyUrl, const QString& keyUserid, const QString& keyId, const QString& keyFingerprint, const QString& keyTimestamp, const QString& type);
- void requireRestart(const QString& type, const QString& pid);
+ void requireRestart(const QString& type, const QString& details);
void statusChanged(const QString& status);
void transaction(const QString& oldTid, const QString& timespec, bool succeeded, const QString& role, uint duration, const QString& data, uint uid, const QString& cmdline);
void updateDetail(const QString& pid, const QString& updates, const QString& obsoletes, const QString& vendorUrl, const QString& bugzillaUrl, const QString& cveUrl, const QString& restart, const QString& updateText, const QString& changelog, const QString& state, const QString& issued, const QString& updated);
diff --git a/lib/packagekit-qt/src/transactionproxy.h b/lib/packagekit-qt/src/transactionproxy.h
index cf6d5ab..0444a0d 100644
--- a/lib/packagekit-qt/src/transactionproxy.h
+++ b/lib/packagekit-qt/src/transactionproxy.h
@@ -1,15 +1,15 @@
/*
- * This file was generated by qdbusxml2cpp version 0.7
- * Command line was: qdbusxml2cpp -c TransactionProxy -p transactionproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.Transaction.xml org.freedesktop.PackageKit.Transaction
+ * This file was generated by dbusxml2cpp version 0.6
+ * Command line was: dbusxml2cpp -c TransactionProxy -p transactionproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.Transaction.xml org.freedesktop.PackageKit.Transaction
*
- * qdbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+ * dbusxml2cpp is Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
-#ifndef TRANSACTIONPROXY_H_1234878562
-#define TRANSACTIONPROXY_H_1234878562
+#ifndef TRANSACTIONPROXY_H_1228504363
+#define TRANSACTIONPROXY_H_1228504363
#include <QtCore/QObject>
#include <QtCore/QByteArray>
@@ -38,90 +38,85 @@ public:
~TransactionProxy();
public Q_SLOTS: // METHODS
- inline QDBusPendingReply<> AcceptEula(const QString &eula_id)
+ inline QDBusReply<void> AcceptEula(const QString &eula_id)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(eula_id);
- return asyncCallWithArgumentList(QLatin1String("AcceptEula"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("AcceptEula"), argumentList);
}
- inline QDBusPendingReply<> Cancel()
+ inline QDBusReply<void> Cancel()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("Cancel"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("Cancel"), argumentList);
}
- inline QDBusPendingReply<> DownloadPackages(const QStringList &package_ids)
+ inline QDBusReply<void> DownloadPackages(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return asyncCallWithArgumentList(QLatin1String("DownloadPackages"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("DownloadPackages"), argumentList);
}
- inline QDBusPendingReply<bool> GetAllowCancel()
+ inline QDBusReply<bool> GetAllowCancel()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetAllowCancel"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetAllowCancel"), argumentList);
}
- inline QDBusPendingReply<> GetCategories()
+ inline QDBusReply<void> GetCategories()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetCategories"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetCategories"), argumentList);
}
- inline QDBusPendingReply<> GetDepends(const QString &filter, const QStringList &package_ids, bool recursive)
+ inline QDBusReply<void> GetDepends(const QString &filter, const QStringList &package_ids, bool recursive)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(package_ids) << qVariantFromValue(recursive);
- return asyncCallWithArgumentList(QLatin1String("GetDepends"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetDepends"), argumentList);
}
- inline QDBusPendingReply<> GetDetails(const QStringList &package_ids)
+ inline QDBusReply<void> GetDetails(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return asyncCallWithArgumentList(QLatin1String("GetDetails"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetDetails"), argumentList);
}
- inline QDBusPendingReply<> GetDistroUpgrades()
+ inline QDBusReply<void> GetDistroUpgrades()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetDistroUpgrades"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetDistroUpgrades"), argumentList);
}
- inline QDBusPendingReply<> GetFiles(const QStringList &package_ids)
+ inline QDBusReply<void> GetFiles(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return asyncCallWithArgumentList(QLatin1String("GetFiles"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetFiles"), argumentList);
}
- inline QDBusPendingReply<> GetOldTransactions(uint number)
+ inline QDBusReply<void> GetOldTransactions(uint number)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(number);
- return asyncCallWithArgumentList(QLatin1String("GetOldTransactions"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetOldTransactions"), argumentList);
}
- inline QDBusPendingReply<QString> GetPackageLast()
+ inline QDBusReply<QString> GetPackageLast()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetPackageLast"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetPackageLast"), argumentList);
}
- inline QDBusPendingReply<> GetPackages(const QString &filter)
+ inline QDBusReply<void> GetPackages(const QString &filter)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter);
- return asyncCallWithArgumentList(QLatin1String("GetPackages"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetPackages"), argumentList);
}
- inline QDBusPendingReply<uint, uint, uint, uint> GetProgress()
- {
- QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetProgress"), argumentList);
- }
inline QDBusReply<uint> GetProgress(uint &subpercentage, uint &elapsed, uint &remaining)
{
QList<QVariant> argumentList;
@@ -134,25 +129,20 @@ public Q_SLOTS: // METHODS
return reply;
}
- inline QDBusPendingReply<> GetRepoList(const QString &filter)
+ inline QDBusReply<void> GetRepoList(const QString &filter)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter);
- return asyncCallWithArgumentList(QLatin1String("GetRepoList"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetRepoList"), argumentList);
}
- inline QDBusPendingReply<> GetRequires(const QString &filter, const QStringList &package_ids, bool recursive)
+ inline QDBusReply<void> GetRequires(const QString &filter, const QStringList &package_ids, bool recursive)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(package_ids) << qVariantFromValue(recursive);
- return asyncCallWithArgumentList(QLatin1String("GetRequires"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetRequires"), argumentList);
}
- inline QDBusPendingReply<QString, QString> GetRole()
- {
- QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetRole"), argumentList);
- }
inline QDBusReply<QString> GetRole(QString &text)
{
QList<QVariant> argumentList;
@@ -163,148 +153,148 @@ public Q_SLOTS: // METHODS
return reply;
}
- inline QDBusPendingReply<QString> GetStatus()
+ inline QDBusReply<QString> GetStatus()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("GetStatus"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetStatus"), argumentList);
}
- inline QDBusPendingReply<> GetUpdateDetail(const QStringList &package_ids)
+ inline QDBusReply<void> GetUpdateDetail(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return asyncCallWithArgumentList(QLatin1String("GetUpdateDetail"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetUpdateDetail"), argumentList);
}
- inline QDBusPendingReply<> GetUpdates(const QString &filter)
+ inline QDBusReply<void> GetUpdates(const QString &filter)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter);
- return asyncCallWithArgumentList(QLatin1String("GetUpdates"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("GetUpdates"), argumentList);
}
- inline QDBusPendingReply<> InstallFiles(bool trusted, const QStringList &full_paths)
+ inline QDBusReply<void> InstallFiles(bool trusted, const QStringList &full_paths)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(trusted) << qVariantFromValue(full_paths);
- return asyncCallWithArgumentList(QLatin1String("InstallFiles"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("InstallFiles"), argumentList);
}
- inline QDBusPendingReply<> InstallPackages(const QStringList &package_ids)
+ inline QDBusReply<void> InstallPackages(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return asyncCallWithArgumentList(QLatin1String("InstallPackages"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("InstallPackages"), argumentList);
}
- inline QDBusPendingReply<> InstallSignature(const QString &sig_type, const QString &key_id, const QString &package_id)
+ inline QDBusReply<void> InstallSignature(const QString &sig_type, const QString &key_id, const QString &package_id)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(sig_type) << qVariantFromValue(key_id) << qVariantFromValue(package_id);
- return asyncCallWithArgumentList(QLatin1String("InstallSignature"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("InstallSignature"), argumentList);
}
- inline QDBusPendingReply<bool> IsCallerActive()
+ inline QDBusReply<bool> IsCallerActive()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("IsCallerActive"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("IsCallerActive"), argumentList);
}
- inline QDBusPendingReply<> RefreshCache(bool force)
+ inline QDBusReply<void> RefreshCache(bool force)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(force);
- return asyncCallWithArgumentList(QLatin1String("RefreshCache"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("RefreshCache"), argumentList);
}
- inline QDBusPendingReply<> RemovePackages(const QStringList &package_ids, bool allow_deps, bool autoremove)
+ inline QDBusReply<void> RemovePackages(const QStringList &package_ids, bool allow_deps, bool autoremove)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids) << qVariantFromValue(allow_deps) << qVariantFromValue(autoremove);
- return asyncCallWithArgumentList(QLatin1String("RemovePackages"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("RemovePackages"), argumentList);
}
- inline QDBusPendingReply<> RepoEnable(const QString &repo_id, bool enabled)
+ inline QDBusReply<void> RepoEnable(const QString &repo_id, bool enabled)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(repo_id) << qVariantFromValue(enabled);
- return asyncCallWithArgumentList(QLatin1String("RepoEnable"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("RepoEnable"), argumentList);
}
- inline QDBusPendingReply<> RepoSetData(const QString &repo_id, const QString ¶meter, const QString &value)
+ inline QDBusReply<void> RepoSetData(const QString &repo_id, const QString ¶meter, const QString &value)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(repo_id) << qVariantFromValue(parameter) << qVariantFromValue(value);
- return asyncCallWithArgumentList(QLatin1String("RepoSetData"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("RepoSetData"), argumentList);
}
- inline QDBusPendingReply<> Resolve(const QString &filter, const QStringList &package)
+ inline QDBusReply<void> Resolve(const QString &filter, const QStringList &package)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(package);
- return asyncCallWithArgumentList(QLatin1String("Resolve"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("Resolve"), argumentList);
}
- inline QDBusPendingReply<> Rollback(const QString &transaction_id)
+ inline QDBusReply<void> Rollback(const QString &transaction_id)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(transaction_id);
- return asyncCallWithArgumentList(QLatin1String("Rollback"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("Rollback"), argumentList);
}
- inline QDBusPendingReply<> SearchDetails(const QString &filter, const QString &search)
+ inline QDBusReply<void> SearchDetails(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return asyncCallWithArgumentList(QLatin1String("SearchDetails"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("SearchDetails"), argumentList);
}
- inline QDBusPendingReply<> SearchFile(const QString &filter, const QString &search)
+ inline QDBusReply<void> SearchFile(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return asyncCallWithArgumentList(QLatin1String("SearchFile"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("SearchFile"), argumentList);
}
- inline QDBusPendingReply<> SearchGroup(const QString &filter, const QString &search)
+ inline QDBusReply<void> SearchGroup(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return asyncCallWithArgumentList(QLatin1String("SearchGroup"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("SearchGroup"), argumentList);
}
- inline QDBusPendingReply<> SearchName(const QString &filter, const QString &search)
+ inline QDBusReply<void> SearchName(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return asyncCallWithArgumentList(QLatin1String("SearchName"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("SearchName"), argumentList);
}
- inline QDBusPendingReply<> SetLocale(const QString &code)
+ inline QDBusReply<void> SetLocale(const QString &code)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(code);
- return asyncCallWithArgumentList(QLatin1String("SetLocale"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("SetLocale"), argumentList);
}
- inline QDBusPendingReply<> UpdatePackages(const QStringList &package_ids)
+ inline QDBusReply<void> UpdatePackages(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return asyncCallWithArgumentList(QLatin1String("UpdatePackages"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("UpdatePackages"), argumentList);
}
- inline QDBusPendingReply<> UpdateSystem()
+ inline QDBusReply<void> UpdateSystem()
{
QList<QVariant> argumentList;
- return asyncCallWithArgumentList(QLatin1String("UpdateSystem"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("UpdateSystem"), argumentList);
}
- inline QDBusPendingReply<> WhatProvides(const QString &filter, const QString &type, const QString &search)
+ inline QDBusReply<void> WhatProvides(const QString &filter, const QString &type, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(type) << qVariantFromValue(search);
- return asyncCallWithArgumentList(QLatin1String("WhatProvides"), argumentList);
+ return callWithArgumentList(QDBus::Block, QLatin1String("WhatProvides"), argumentList);
}
Q_SIGNALS: // SIGNALS
@@ -323,7 +313,7 @@ Q_SIGNALS: // SIGNALS
void ProgressChanged(uint percentage, uint subpercentage, uint elapsed, uint remaining);
void RepoDetail(const QString &repo_id, const QString &description, bool enabled);
void RepoSignatureRequired(const QString &package_id, const QString &repository_name, const QString &key_url, const QString &key_userid, const QString &key_id, const QString &key_fingerprint, const QString &key_timestamp, const QString &type);
- void RequireRestart(const QString &type, const QString &package_id);
+ void RequireRestart(const QString &type, const QString &details);
void StatusChanged(const QString &status);
void Transaction(const QString &old_tid, const QString ×pec, bool succeeded, const QString &role, uint duration, const QString &data, uint uid, const QString &cmdline);
void UpdateDetail(const QString &package_id, const QString &updates, const QString &obsoletes, const QString &vendor_url, const QString &bugzilla_url, const QString &cve_url, const QString &restart, const QString &update_text, const QString &changelog, const QString &state, const QString &issued, const QString &updated);
commit b75d9205cb12037b6a1448933f7fe5f55258437d
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 16:23:15 2009 +0100
PackageKit-Qt : Sync API (RequireRestart)
diff --git a/lib/packagekit-qt/src/transaction.h b/lib/packagekit-qt/src/transaction.h
index 61e38d9..b01e2ea 100644
--- a/lib/packagekit-qt/src/transaction.h
+++ b/lib/packagekit-qt/src/transaction.h
@@ -332,6 +332,7 @@ Q_SIGNALS:
/**
* Indicates that a restart is required
+ * \p package is the package who triggered the restart signal
*/
void requireRestart(PackageKit::Client::RestartType type, PackageKit::Package* p);
commit d9dec18225b4b994ea878ab7f54d9b630d643d66
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 16:04:51 2009 +0100
PackageKit-Qt : Add missing implementation for uid and cmdline
diff --git a/lib/packagekit-qt/src/transaction.cpp b/lib/packagekit-qt/src/transaction.cpp
index 5f527b0..5e7056a 100644
--- a/lib/packagekit-qt/src/transaction.cpp
+++ b/lib/packagekit-qt/src/transaction.cpp
@@ -173,5 +173,15 @@ QString Transaction::data()
return d->data;
}
+uint Transaction::uid()
+{
+ return d->uid;
+}
+
+QString Transaction::cmdline()
+{
+ return d->cmdline;
+}
+
#include "transaction.moc"
commit a8f8fbf3edfd9fd8c3ef2ca63bd9a22fd6920610
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 15:46:03 2009 +0100
PackageKit-Qt : cosmetic fixes (indentation + doc)
diff --git a/lib/packagekit-qt/src/client.h b/lib/packagekit-qt/src/client.h
index 4d81ca5..aef5723 100644
--- a/lib/packagekit-qt/src/client.h
+++ b/lib/packagekit-qt/src/client.h
@@ -226,12 +226,12 @@ public:
* Describes the current network state
*/
typedef enum {
- Offline,
- Online,
- Mobile,
- Wifi,
+ Offline,
+ Online,
+ Mobile,
+ Wifi,
Wired,
- UnknownNetworkState = -1
+ UnknownNetworkState = -1
} NetworkState;
/**
@@ -560,7 +560,7 @@ public:
/**
* \brief Installs the local packages \p files
*
- * \trusted indicate if the packages are signed by a trusted authority
+ * \p trusted indicate if the packages are signed by a trusted authority
*/
Transaction* installFiles(const QStringList& files, bool trusted);
Transaction* installFile(const QString& file, bool trusted);
@@ -619,13 +619,13 @@ public:
*/
Transaction* rollback(Transaction* oldtrans);
- /**
- * \brief Search in the packages files
- *
- * \p filters can be used to restrict the returned packages
- */
- Transaction* searchFile(const QString& search, Filters filters = Filters() << NoFilter);
- Transaction* searchFile(const QString& search, Filter filter);
+ /**
+ * \brief Search in the packages files
+ *
+ * \p filters can be used to restrict the returned packages
+ */
+ Transaction* searchFile(const QString& search, Filters filters = Filters() << NoFilter);
+ Transaction* searchFile(const QString& search, Filter filter);
/**
* \brief Search in the packages details
@@ -633,7 +633,7 @@ public:
* \p filters can be used to restrict the returned packages
*/
Transaction* searchDetails(const QString& search, Filters filters = Filters() << NoFilter);
- Transaction* searchDetails(const QString& search, Filter filter);
+ Transaction* searchDetails(const QString& search, Filter filter);
/**
* \brief Lists all the packages in the given \p group
commit c8f44479261d9715678d3d827d7f52d4303da26c
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 15:07:31 2009 +0100
PackageKit-Qt : Sync with API (RequireRestart emits a package)
PackageKit-Qt : Switch the proxies to qdbusxml2cpp 0.7
diff --git a/lib/packagekit-qt/src/client.h b/lib/packagekit-qt/src/client.h
index f501260..4d81ca5 100644
--- a/lib/packagekit-qt/src/client.h
+++ b/lib/packagekit-qt/src/client.h
@@ -228,8 +228,9 @@ public:
typedef enum {
Offline,
Online,
- Slow,
- Fast,
+ Mobile,
+ Wifi,
+ Wired,
UnknownNetworkState = -1
} NetworkState;
diff --git a/lib/packagekit-qt/src/daemonproxy.h b/lib/packagekit-qt/src/daemonproxy.h
index 45287c6..3d721ba 100644
--- a/lib/packagekit-qt/src/daemonproxy.h
+++ b/lib/packagekit-qt/src/daemonproxy.h
@@ -1,15 +1,15 @@
/*
- * This file was generated by dbusxml2cpp version 0.6
- * Command line was: dbusxml2cpp -c DaemonProxy -p daemonproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.xml org.freedesktop.PackageKit
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c DaemonProxy -p daemonproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.xml org.freedesktop.PackageKit
*
- * dbusxml2cpp is Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * qdbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
-#ifndef DAEMONPROXY_H_1228501948
-#define DAEMONPROXY_H_1228501948
+#ifndef DAEMONPROXY_H_1234879521
+#define DAEMONPROXY_H_1234879521
#include <QtCore/QObject>
#include <QtCore/QByteArray>
@@ -38,12 +38,17 @@ public:
~DaemonProxy();
public Q_SLOTS: // METHODS
- inline QDBusReply<QString> GetActions()
+ inline QDBusPendingReply<QString> GetActions()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetActions"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetActions"), argumentList);
}
+ inline QDBusPendingReply<QString, QString> GetBackendDetail()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("GetBackendDetail"), argumentList);
+ }
inline QDBusReply<QString> GetBackendDetail(QString &author)
{
QList<QVariant> argumentList;
@@ -54,67 +59,73 @@ public Q_SLOTS: // METHODS
return reply;
}
- inline QDBusReply<QString> GetFilters()
+ inline QDBusPendingReply<QString> GetDaemonState()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("GetDaemonState"), argumentList);
+ }
+
+ inline QDBusPendingReply<QString> GetFilters()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetFilters"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetFilters"), argumentList);
}
- inline QDBusReply<QString> GetGroups()
+ inline QDBusPendingReply<QString> GetGroups()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetGroups"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetGroups"), argumentList);
}
- inline QDBusReply<QString> GetMimeTypes()
+ inline QDBusPendingReply<QString> GetMimeTypes()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetMimeTypes"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetMimeTypes"), argumentList);
}
- inline QDBusReply<QString> GetNetworkState()
+ inline QDBusPendingReply<QString> GetNetworkState()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetNetworkState"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetNetworkState"), argumentList);
}
- inline QDBusReply<QString> GetTid()
+ inline QDBusPendingReply<QString> GetTid()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetTid"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetTid"), argumentList);
}
- inline QDBusReply<uint> GetTimeSinceAction(const QString &role)
+ inline QDBusPendingReply<uint> GetTimeSinceAction(const QString &role)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(role);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetTimeSinceAction"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetTimeSinceAction"), argumentList);
}
- inline QDBusReply<QStringList> GetTransactionList()
+ inline QDBusPendingReply<QStringList> GetTransactionList()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetTransactionList"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetTransactionList"), argumentList);
}
- inline QDBusReply<void> SetProxy(const QString &proxy_http, const QString &proxy_ftp)
+ inline QDBusPendingReply<> SetProxy(const QString &proxy_http, const QString &proxy_ftp)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(proxy_http) << qVariantFromValue(proxy_ftp);
- return callWithArgumentList(QDBus::Block, QLatin1String("SetProxy"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("SetProxy"), argumentList);
}
- inline QDBusReply<void> StateHasChanged(const QString &reason)
+ inline QDBusPendingReply<> StateHasChanged(const QString &reason)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(reason);
- return callWithArgumentList(QDBus::Block, QLatin1String("StateHasChanged"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("StateHasChanged"), argumentList);
}
- inline QDBusReply<void> SuggestDaemonQuit()
+ inline QDBusPendingReply<> SuggestDaemonQuit()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("SuggestDaemonQuit"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("SuggestDaemonQuit"), argumentList);
}
Q_SIGNALS: // SIGNALS
diff --git a/lib/packagekit-qt/src/transaction.h b/lib/packagekit-qt/src/transaction.h
index 5f746c6..61e38d9 100644
--- a/lib/packagekit-qt/src/transaction.h
+++ b/lib/packagekit-qt/src/transaction.h
@@ -333,7 +333,7 @@ Q_SIGNALS:
/**
* Indicates that a restart is required
*/
- void requireRestart(PackageKit::Client::RestartType type, const QString& details);
+ void requireRestart(PackageKit::Client::RestartType type, PackageKit::Package* p);
/**
* Emitted when the transaction's status has changed
diff --git a/lib/packagekit-qt/src/transactionprivate.cpp b/lib/packagekit-qt/src/transactionprivate.cpp
index c41343c..7da4085 100644
--- a/lib/packagekit-qt/src/transactionprivate.cpp
+++ b/lib/packagekit-qt/src/transactionprivate.cpp
@@ -116,9 +116,9 @@ void TransactionPrivate::repoSignatureRequired(const QString& pid, const QString
t->repoSignatureRequired(i);
}
-void TransactionPrivate::requireRestart(const QString& type, const QString& details)
+void TransactionPrivate::requireRestart(const QString& type, const QString& pid)
{
- t->requireRestart((Client::RestartType)Util::enumFromString<Client>(type, "RestartType", "Restart"), details);
+ t->requireRestart((Client::RestartType)Util::enumFromString<Client>(type, "RestartType", "Restart"), new Package(pid));
}
void TransactionPrivate::statusChanged(const QString& status)
diff --git a/lib/packagekit-qt/src/transactionprivate.h b/lib/packagekit-qt/src/transactionprivate.h
index f15f622..1be0672 100644
--- a/lib/packagekit-qt/src/transactionprivate.h
+++ b/lib/packagekit-qt/src/transactionprivate.h
@@ -65,7 +65,7 @@ public slots:
void package(const QString& info, const QString& pid, const QString& summary);
void progressChanged(uint percentage, uint subpercentage, uint elapsed, uint remaining);
void repoSignatureRequired(const QString& pid, const QString& repoName, const QString& keyUrl, const QString& keyUserid, const QString& keyId, const QString& keyFingerprint, const QString& keyTimestamp, const QString& type);
- void requireRestart(const QString& type, const QString& details);
+ void requireRestart(const QString& type, const QString& pid);
void statusChanged(const QString& status);
void transaction(const QString& oldTid, const QString& timespec, bool succeeded, const QString& role, uint duration, const QString& data, uint uid, const QString& cmdline);
void updateDetail(const QString& pid, const QString& updates, const QString& obsoletes, const QString& vendorUrl, const QString& bugzillaUrl, const QString& cveUrl, const QString& restart, const QString& updateText, const QString& changelog, const QString& state, const QString& issued, const QString& updated);
diff --git a/lib/packagekit-qt/src/transactionproxy.h b/lib/packagekit-qt/src/transactionproxy.h
index 0444a0d..cf6d5ab 100644
--- a/lib/packagekit-qt/src/transactionproxy.h
+++ b/lib/packagekit-qt/src/transactionproxy.h
@@ -1,15 +1,15 @@
/*
- * This file was generated by dbusxml2cpp version 0.6
- * Command line was: dbusxml2cpp -c TransactionProxy -p transactionproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.Transaction.xml org.freedesktop.PackageKit.Transaction
+ * This file was generated by qdbusxml2cpp version 0.7
+ * Command line was: qdbusxml2cpp -c TransactionProxy -p transactionproxy.h /home/madcat/code/PackageKit/src/org.freedesktop.PackageKit.Transaction.xml org.freedesktop.PackageKit.Transaction
*
- * dbusxml2cpp is Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies).
+ * qdbusxml2cpp is Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
*
* This is an auto-generated file.
* Do not edit! All changes made to it will be lost.
*/
-#ifndef TRANSACTIONPROXY_H_1228504363
-#define TRANSACTIONPROXY_H_1228504363
+#ifndef TRANSACTIONPROXY_H_1234878562
+#define TRANSACTIONPROXY_H_1234878562
#include <QtCore/QObject>
#include <QtCore/QByteArray>
@@ -38,85 +38,90 @@ public:
~TransactionProxy();
public Q_SLOTS: // METHODS
- inline QDBusReply<void> AcceptEula(const QString &eula_id)
+ inline QDBusPendingReply<> AcceptEula(const QString &eula_id)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(eula_id);
- return callWithArgumentList(QDBus::Block, QLatin1String("AcceptEula"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("AcceptEula"), argumentList);
}
- inline QDBusReply<void> Cancel()
+ inline QDBusPendingReply<> Cancel()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("Cancel"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("Cancel"), argumentList);
}
- inline QDBusReply<void> DownloadPackages(const QStringList &package_ids)
+ inline QDBusPendingReply<> DownloadPackages(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return callWithArgumentList(QDBus::Block, QLatin1String("DownloadPackages"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("DownloadPackages"), argumentList);
}
- inline QDBusReply<bool> GetAllowCancel()
+ inline QDBusPendingReply<bool> GetAllowCancel()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetAllowCancel"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetAllowCancel"), argumentList);
}
- inline QDBusReply<void> GetCategories()
+ inline QDBusPendingReply<> GetCategories()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetCategories"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetCategories"), argumentList);
}
- inline QDBusReply<void> GetDepends(const QString &filter, const QStringList &package_ids, bool recursive)
+ inline QDBusPendingReply<> GetDepends(const QString &filter, const QStringList &package_ids, bool recursive)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(package_ids) << qVariantFromValue(recursive);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetDepends"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetDepends"), argumentList);
}
- inline QDBusReply<void> GetDetails(const QStringList &package_ids)
+ inline QDBusPendingReply<> GetDetails(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetDetails"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetDetails"), argumentList);
}
- inline QDBusReply<void> GetDistroUpgrades()
+ inline QDBusPendingReply<> GetDistroUpgrades()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetDistroUpgrades"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetDistroUpgrades"), argumentList);
}
- inline QDBusReply<void> GetFiles(const QStringList &package_ids)
+ inline QDBusPendingReply<> GetFiles(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetFiles"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetFiles"), argumentList);
}
- inline QDBusReply<void> GetOldTransactions(uint number)
+ inline QDBusPendingReply<> GetOldTransactions(uint number)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(number);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetOldTransactions"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetOldTransactions"), argumentList);
}
- inline QDBusReply<QString> GetPackageLast()
+ inline QDBusPendingReply<QString> GetPackageLast()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetPackageLast"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetPackageLast"), argumentList);
}
- inline QDBusReply<void> GetPackages(const QString &filter)
+ inline QDBusPendingReply<> GetPackages(const QString &filter)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetPackages"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetPackages"), argumentList);
}
+ inline QDBusPendingReply<uint, uint, uint, uint> GetProgress()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("GetProgress"), argumentList);
+ }
inline QDBusReply<uint> GetProgress(uint &subpercentage, uint &elapsed, uint &remaining)
{
QList<QVariant> argumentList;
@@ -129,20 +134,25 @@ public Q_SLOTS: // METHODS
return reply;
}
- inline QDBusReply<void> GetRepoList(const QString &filter)
+ inline QDBusPendingReply<> GetRepoList(const QString &filter)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetRepoList"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetRepoList"), argumentList);
}
- inline QDBusReply<void> GetRequires(const QString &filter, const QStringList &package_ids, bool recursive)
+ inline QDBusPendingReply<> GetRequires(const QString &filter, const QStringList &package_ids, bool recursive)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(package_ids) << qVariantFromValue(recursive);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetRequires"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetRequires"), argumentList);
}
+ inline QDBusPendingReply<QString, QString> GetRole()
+ {
+ QList<QVariant> argumentList;
+ return asyncCallWithArgumentList(QLatin1String("GetRole"), argumentList);
+ }
inline QDBusReply<QString> GetRole(QString &text)
{
QList<QVariant> argumentList;
@@ -153,148 +163,148 @@ public Q_SLOTS: // METHODS
return reply;
}
- inline QDBusReply<QString> GetStatus()
+ inline QDBusPendingReply<QString> GetStatus()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("GetStatus"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetStatus"), argumentList);
}
- inline QDBusReply<void> GetUpdateDetail(const QStringList &package_ids)
+ inline QDBusPendingReply<> GetUpdateDetail(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetUpdateDetail"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetUpdateDetail"), argumentList);
}
- inline QDBusReply<void> GetUpdates(const QString &filter)
+ inline QDBusPendingReply<> GetUpdates(const QString &filter)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter);
- return callWithArgumentList(QDBus::Block, QLatin1String("GetUpdates"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("GetUpdates"), argumentList);
}
- inline QDBusReply<void> InstallFiles(bool trusted, const QStringList &full_paths)
+ inline QDBusPendingReply<> InstallFiles(bool trusted, const QStringList &full_paths)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(trusted) << qVariantFromValue(full_paths);
- return callWithArgumentList(QDBus::Block, QLatin1String("InstallFiles"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("InstallFiles"), argumentList);
}
- inline QDBusReply<void> InstallPackages(const QStringList &package_ids)
+ inline QDBusPendingReply<> InstallPackages(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return callWithArgumentList(QDBus::Block, QLatin1String("InstallPackages"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("InstallPackages"), argumentList);
}
- inline QDBusReply<void> InstallSignature(const QString &sig_type, const QString &key_id, const QString &package_id)
+ inline QDBusPendingReply<> InstallSignature(const QString &sig_type, const QString &key_id, const QString &package_id)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(sig_type) << qVariantFromValue(key_id) << qVariantFromValue(package_id);
- return callWithArgumentList(QDBus::Block, QLatin1String("InstallSignature"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("InstallSignature"), argumentList);
}
- inline QDBusReply<bool> IsCallerActive()
+ inline QDBusPendingReply<bool> IsCallerActive()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("IsCallerActive"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("IsCallerActive"), argumentList);
}
- inline QDBusReply<void> RefreshCache(bool force)
+ inline QDBusPendingReply<> RefreshCache(bool force)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(force);
- return callWithArgumentList(QDBus::Block, QLatin1String("RefreshCache"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("RefreshCache"), argumentList);
}
- inline QDBusReply<void> RemovePackages(const QStringList &package_ids, bool allow_deps, bool autoremove)
+ inline QDBusPendingReply<> RemovePackages(const QStringList &package_ids, bool allow_deps, bool autoremove)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids) << qVariantFromValue(allow_deps) << qVariantFromValue(autoremove);
- return callWithArgumentList(QDBus::Block, QLatin1String("RemovePackages"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("RemovePackages"), argumentList);
}
- inline QDBusReply<void> RepoEnable(const QString &repo_id, bool enabled)
+ inline QDBusPendingReply<> RepoEnable(const QString &repo_id, bool enabled)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(repo_id) << qVariantFromValue(enabled);
- return callWithArgumentList(QDBus::Block, QLatin1String("RepoEnable"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("RepoEnable"), argumentList);
}
- inline QDBusReply<void> RepoSetData(const QString &repo_id, const QString ¶meter, const QString &value)
+ inline QDBusPendingReply<> RepoSetData(const QString &repo_id, const QString ¶meter, const QString &value)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(repo_id) << qVariantFromValue(parameter) << qVariantFromValue(value);
- return callWithArgumentList(QDBus::Block, QLatin1String("RepoSetData"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("RepoSetData"), argumentList);
}
- inline QDBusReply<void> Resolve(const QString &filter, const QStringList &package)
+ inline QDBusPendingReply<> Resolve(const QString &filter, const QStringList &package)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(package);
- return callWithArgumentList(QDBus::Block, QLatin1String("Resolve"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("Resolve"), argumentList);
}
- inline QDBusReply<void> Rollback(const QString &transaction_id)
+ inline QDBusPendingReply<> Rollback(const QString &transaction_id)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(transaction_id);
- return callWithArgumentList(QDBus::Block, QLatin1String("Rollback"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("Rollback"), argumentList);
}
- inline QDBusReply<void> SearchDetails(const QString &filter, const QString &search)
+ inline QDBusPendingReply<> SearchDetails(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return callWithArgumentList(QDBus::Block, QLatin1String("SearchDetails"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("SearchDetails"), argumentList);
}
- inline QDBusReply<void> SearchFile(const QString &filter, const QString &search)
+ inline QDBusPendingReply<> SearchFile(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return callWithArgumentList(QDBus::Block, QLatin1String("SearchFile"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("SearchFile"), argumentList);
}
- inline QDBusReply<void> SearchGroup(const QString &filter, const QString &search)
+ inline QDBusPendingReply<> SearchGroup(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return callWithArgumentList(QDBus::Block, QLatin1String("SearchGroup"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("SearchGroup"), argumentList);
}
- inline QDBusReply<void> SearchName(const QString &filter, const QString &search)
+ inline QDBusPendingReply<> SearchName(const QString &filter, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(search);
- return callWithArgumentList(QDBus::Block, QLatin1String("SearchName"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("SearchName"), argumentList);
}
- inline QDBusReply<void> SetLocale(const QString &code)
+ inline QDBusPendingReply<> SetLocale(const QString &code)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(code);
- return callWithArgumentList(QDBus::Block, QLatin1String("SetLocale"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("SetLocale"), argumentList);
}
- inline QDBusReply<void> UpdatePackages(const QStringList &package_ids)
+ inline QDBusPendingReply<> UpdatePackages(const QStringList &package_ids)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(package_ids);
- return callWithArgumentList(QDBus::Block, QLatin1String("UpdatePackages"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("UpdatePackages"), argumentList);
}
- inline QDBusReply<void> UpdateSystem()
+ inline QDBusPendingReply<> UpdateSystem()
{
QList<QVariant> argumentList;
- return callWithArgumentList(QDBus::Block, QLatin1String("UpdateSystem"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("UpdateSystem"), argumentList);
}
- inline QDBusReply<void> WhatProvides(const QString &filter, const QString &type, const QString &search)
+ inline QDBusPendingReply<> WhatProvides(const QString &filter, const QString &type, const QString &search)
{
QList<QVariant> argumentList;
argumentList << qVariantFromValue(filter) << qVariantFromValue(type) << qVariantFromValue(search);
- return callWithArgumentList(QDBus::Block, QLatin1String("WhatProvides"), argumentList);
+ return asyncCallWithArgumentList(QLatin1String("WhatProvides"), argumentList);
}
Q_SIGNALS: // SIGNALS
@@ -313,7 +323,7 @@ Q_SIGNALS: // SIGNALS
void ProgressChanged(uint percentage, uint subpercentage, uint elapsed, uint remaining);
void RepoDetail(const QString &repo_id, const QString &description, bool enabled);
void RepoSignatureRequired(const QString &package_id, const QString &repository_name, const QString &key_url, const QString &key_userid, const QString &key_id, const QString &key_fingerprint, const QString &key_timestamp, const QString &type);
- void RequireRestart(const QString &type, const QString &details);
+ void RequireRestart(const QString &type, const QString &package_id);
void StatusChanged(const QString &status);
void Transaction(const QString &old_tid, const QString ×pec, bool succeeded, const QString &role, uint duration, const QString &data, uint uid, const QString &cmdline);
void UpdateDetail(const QString &package_id, const QString &updates, const QString &obsoletes, const QString &vendor_url, const QString &bugzilla_url, const QString &cve_url, const QString &restart, const QString &update_text, const QString &changelog, const QString &state, const QString &issued, const QString &updated);
commit 217f411173f442071392157185cbc1dd317091ae
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 14:45:36 2009 +0100
PackageKit-Qt : add a getLastError method to get the last daemon error.
diff --git a/lib/packagekit-qt/src/client.cpp b/lib/packagekit-qt/src/client.cpp
index 098b20d..0bf727e 100644
--- a/lib/packagekit-qt/src/client.cpp
+++ b/lib/packagekit-qt/src/client.cpp
@@ -166,6 +166,11 @@ void Client::suggestDaemonQuit()
d->daemon->SuggestDaemonQuit();
}
+Client::DaemonError Client::getLastError ()
+{
+ return d->lastError;
+}
+
////// Transaction functions
Transaction* Client::acceptEula(EulaInfo info)
@@ -692,6 +697,7 @@ Transaction* Client::updateSystem()
Transaction* t = d->createNewTransaction();
if (!t) {
emit daemonError(DaemonUnreachable);
+ d->lastError = DaemonUnreachable;
return NULL;
}
diff --git a/lib/packagekit-qt/src/client.h b/lib/packagekit-qt/src/client.h
index b5f775b..f501260 100644
--- a/lib/packagekit-qt/src/client.h
+++ b/lib/packagekit-qt/src/client.h
@@ -405,10 +405,17 @@ public:
UnknownUpgradeType = -1
} UpgradeType;
+ /**
+ * Describes an error at the daemon level (for example, PackageKit crashes or is unreachable)
+ */
typedef enum {
DaemonUnreachable,
UnkownDaemonError = -1
} DaemonError;
+ /**
+ * Returns the last daemon error that was caught
+ */
+ DaemonError getLastError();
/**
* Describes a software update
@@ -671,7 +678,7 @@ Q_SIGNALS:
/**
* Emitted when the PackageKit daemon is not reachable anymore
*/
- void daemonError(DaemonError e);
+ void daemonError(PackageKit::Client::DaemonError e);
/**
* Emitted when the daemon's locked state changes
diff --git a/lib/packagekit-qt/src/clientprivate.h b/lib/packagekit-qt/src/clientprivate.h
index e5911a2..f593681 100644
--- a/lib/packagekit-qt/src/clientprivate.h
+++ b/lib/packagekit-qt/src/clientprivate.h
@@ -22,6 +22,7 @@
#define CLIENTPRIVATE_H
#include <QtCore>
+#include "client.h"
namespace PackageKit {
@@ -47,6 +48,8 @@ public:
// Get a tid, creates a new transaction and sets it up (ie call SetLocale)
Transaction* createNewTransaction();
+ Client::DaemonError lastError;
+
public slots:
// org.freedesktop.PackageKit
void transactionListChanged(const QStringList& tids);
diff --git a/lib/packagekit-qt/test/transactiontest.cpp b/lib/packagekit-qt/test/transactiontest.cpp
index 47474e5..be31fcf 100644
--- a/lib/packagekit-qt/test/transactiontest.cpp
+++ b/lib/packagekit-qt/test/transactiontest.cpp
@@ -5,7 +5,7 @@ using namespace PackageKit;
TransactionTest::TransactionTest(QObject* parent) : QObject(parent)
{
currentPackage = NULL;
- connect (PackageKit::Client::instance(), SIGNAL(daemonError(DaemonError)), this, SLOT(error()));
+ connect (PackageKit::Client::instance(), SIGNAL(daemonError(PackageKit::Client::DaemonError)), this, SLOT(error()));
}
TransactionTest::~TransactionTest()
commit 8eb89bb7994a68ad0d368f400d4e3711e73eb101
Author: Adrien BUSTANY <madcat at mymadcat.com>
Date: Tue Feb 17 14:34:14 2009 +0100
PackageKit-Qt : Handle daemon errors more gracefully. An unreachable daemon previously resulted in a segfault.
diff --git a/lib/packagekit-qt/src/client.cpp b/lib/packagekit-qt/src/client.cpp
index 010dcd3..098b20d 100644
--- a/lib/packagekit-qt/src/client.cpp
+++ b/lib/packagekit-qt/src/client.cpp
@@ -176,6 +176,11 @@ Transaction* Client::acceptEula(EulaInfo info)
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
+
t->d->p->AcceptEula(info.id);
return t;
@@ -184,6 +189,11 @@ Transaction* Client::acceptEula(EulaInfo info)
Transaction* Client::downloadPackages(const QList<Package*>& packages)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
+
t->d->p->DownloadPackages(Util::packageListToPids(packages));
return t;
@@ -197,6 +207,11 @@ Transaction* Client::downloadPackage(Package* package)
Transaction* Client::getDepends(const QList<Package*>& packages, Filters filters, bool recursive)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
+
t->d->p->GetDepends(Util::filtersToString(filters), Util::packageListToPids(packages), recursive);
@@ -221,6 +236,10 @@ Transaction* Client::getDepends(Package* package, Filter filter, bool recursive)
Transaction* Client::getDetails(const QList<Package*>& packages)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
foreach(Package* p, packages) {
t->d->packageMap.insert(p->id(), p);
@@ -239,6 +258,10 @@ Transaction* Client::getDetails(Package* package)
Transaction* Client::getFiles(const QList<Package*>& packages)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetFiles(Util::packageListToPids(packages));
@@ -253,6 +276,10 @@ Transaction* Client::getFiles(Package* package)
Transaction* Client::getOldTransactions(uint number)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetOldTransactions(number);
@@ -262,6 +289,10 @@ Transaction* Client::getOldTransactions(uint number)
Transaction* Client::getPackages(Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetPackages(Util::filtersToString(filters));
@@ -276,6 +307,10 @@ Transaction* Client::getPackages(Filter filter)
Transaction* Client::getRepoList(Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetRepoList(Util::filtersToString(filters));
@@ -290,6 +325,10 @@ Transaction* Client::getRepoList(Filter filter)
Transaction* Client::getRequires(const QList<Package*>& packages, Filters filters, bool recursive)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetRequires(Util::filtersToString(filters), Util::packageListToPids(packages), recursive);
@@ -314,6 +353,10 @@ Transaction* Client::getRequires(Package* package, Filter filter, bool recursive
Transaction* Client::getUpdateDetail(const QList<Package*>& packages)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetUpdateDetail(Util::packageListToPids(packages));
@@ -328,6 +371,10 @@ Transaction* Client::getUpdateDetail(Package* package)
Transaction* Client::getUpdates(Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetUpdates(Util::filtersToString(filters));
@@ -342,6 +389,10 @@ Transaction* Client::getUpdates(Filter filter)
Transaction* Client::getDistroUpgrades()
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->GetDistroUpgrades();
@@ -357,6 +408,10 @@ Transaction* Client::installFiles(const QStringList& files, bool trusted)
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->InstallFiles(trusted, files);
@@ -376,6 +431,10 @@ Transaction* Client::installPackages(const QList<Package*>& packages)
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->InstallPackages(Util::packageListToPids(packages));
@@ -395,6 +454,10 @@ Transaction* Client::installSignature(SignatureType type, const QString& key_id,
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->InstallSignature(Util::enumToString<Client>(type, "SignatureType"), key_id, p->id());
@@ -409,6 +472,10 @@ Transaction* Client::refreshCache(bool force)
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->RefreshCache(force);
@@ -423,6 +490,10 @@ Transaction* Client::removePackages(const QList<Package*>& packages, bool allow_
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->RemovePackages(Util::packageListToPids(packages), allow_deps, autoremove);
@@ -442,6 +513,10 @@ Transaction* Client::repoEnable(const QString& repo_id, bool enable)
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->RepoEnable(repo_id, enable);
@@ -456,6 +531,10 @@ Transaction* Client::repoSetData(const QString& repo_id, const QString& paramete
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->RepoSetData(repo_id, parameter, value);
@@ -465,6 +544,10 @@ Transaction* Client::repoSetData(const QString& repo_id, const QString& paramete
Transaction* Client::resolve(const QStringList& packageNames, Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->Resolve(Util::filtersToString(filters), packageNames);
@@ -494,6 +577,10 @@ Transaction* Client::rollback(Transaction* oldtrans)
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->Rollback(oldtrans->tid());
@@ -503,6 +590,10 @@ Transaction* Client::rollback(Transaction* oldtrans)
Transaction* Client::searchFile(const QString& search, Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->SearchFile(Util::filtersToString(filters), search);
@@ -517,6 +608,10 @@ Transaction* Client::searchFile(const QString& search, Filter filter)
Transaction* Client::searchDetails(const QString& search, Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->SearchDetails(Util::filtersToString(filters), search);
@@ -531,6 +626,10 @@ Transaction* Client::searchDetails(const QString& search, Filter filter)
Transaction* Client::searchGroup(Client::Group group, Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->SearchGroup(Util::filtersToString(filters), Util::enumToString<Client>(group, "Group"));
@@ -545,6 +644,10 @@ Transaction* Client::searchGroup(Client::Group group, Filter filter)
Transaction* Client::searchName(const QString& search, Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->SearchName(Util::filtersToString(filters), search);
@@ -564,6 +667,10 @@ Transaction* Client::updatePackages(const QList<Package*>& packages)
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->UpdatePackages(Util::packageListToPids(packages));
@@ -583,6 +690,10 @@ Transaction* Client::updateSystem()
}
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->UpdateSystem();
@@ -592,6 +703,10 @@ Transaction* Client::updateSystem()
Transaction* Client::whatProvides(ProvidesType type, const QString& search, Filters filters)
{
Transaction* t = d->createNewTransaction();
+ if (!t) {
+ emit daemonError(DaemonUnreachable);
+ return NULL;
+ }
t->d->p->WhatProvides(Util::filtersToString(filters), Util::enumToString<Client>(type, "ProvidesType", "Provides"), search);
diff --git a/lib/packagekit-qt/src/client.h b/lib/packagekit-qt/src/client.h
index 6490516..b5f775b 100644
--- a/lib/packagekit-qt/src/client.h
+++ b/lib/packagekit-qt/src/client.h
@@ -405,6 +405,11 @@ public:
UnknownUpgradeType = -1
} UpgradeType;
+ typedef enum {
+ DaemonUnreachable,
+ UnkownDaemonError = -1
+ } DaemonError;
+
/**
* Describes a software update
* \li \c package is the package which triggered the update
@@ -664,6 +669,11 @@ Q_SIGNALS:
void authError(const QString& action);
/**
+ * Emitted when the PackageKit daemon is not reachable anymore
+ */
+ void daemonError(DaemonError e);
+
+ /**
* Emitted when the daemon's locked state changes
*/
void locked(bool locked);
diff --git a/lib/packagekit-qt/src/clientprivate.cpp b/lib/packagekit-qt/src/clientprivate.cpp
index 5b58264..765b85d 100644
--- a/lib/packagekit-qt/src/clientprivate.cpp
+++ b/lib/packagekit-qt/src/clientprivate.cpp
@@ -38,6 +38,11 @@ Transaction* ClientPrivate::createNewTransaction()
{
QMutexLocker locker(&runningTransactionsLocker);
Transaction* t = new Transaction(daemon->GetTid(), c);
+ if (t->tid().isEmpty()) {
+ qDebug() << "empty tid, the daemon is probably not here anymore";
+ return NULL;
+ }
+
if(!locale.isNull())
t->setLocale(locale);
diff --git a/lib/packagekit-qt/test/main.cpp b/lib/packagekit-qt/test/main.cpp
index d49211c..27d800d 100644
--- a/lib/packagekit-qt/test/main.cpp
+++ b/lib/packagekit-qt/test/main.cpp
@@ -12,7 +12,7 @@ int main(int argc, char **argv)
PackageKit::Client::BackendDetail d = PackageKit::Client::instance()->getBackendDetail();
if(d.name != "Dummy") {
qWarning("Please use the dummy backend for testing");
- return 0;
+ //return 0;
}
CppUnit::TextUi::TestRunner runner;
diff --git a/lib/packagekit-qt/test/transactiontest.cpp b/lib/packagekit-qt/test/transactiontest.cpp
index c8e6d5e..47474e5 100644
--- a/lib/packagekit-qt/test/transactiontest.cpp
+++ b/lib/packagekit-qt/test/transactiontest.cpp
@@ -5,6 +5,7 @@ using namespace PackageKit;
TransactionTest::TransactionTest(QObject* parent) : QObject(parent)
{
currentPackage = NULL;
+ connect (PackageKit::Client::instance(), SIGNAL(daemonError(DaemonError)), this, SLOT(error()));
}
TransactionTest::~TransactionTest()
@@ -120,6 +121,11 @@ void TransactionTest::getRepos_cb(const QString& repoName, const QString& repoDe
success = TRUE;
}
+void TransactionTest::error ()
+{
+ qDebug() << "Aieeeeee";
+}
+
CPPUNIT_TEST_SUITE_REGISTRATION(TransactionTest);
#include "transactiontest.moc"
diff --git a/lib/packagekit-qt/test/transactiontest.h b/lib/packagekit-qt/test/transactiontest.h
index 55987fc..8eb6118 100644
--- a/lib/packagekit-qt/test/transactiontest.h
+++ b/lib/packagekit-qt/test/transactiontest.h
@@ -35,6 +35,8 @@ public slots:
void getDistroUpgrades_cb();
void getRepos_cb(const QString& repoName, const QString& repoDetail, bool enabled);
+ void error();
+
private:
bool success;
PackageKit::Package* currentPackage;
commit 09aede02e813cf531ee6c3ecb86c7c7d296a6971
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 16:07:23 2009 +0000
yum: don't backtrace with an internal error when the filename is not unicode. Fixes rh#480440
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index d0ee29f..502fe0d 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -1578,7 +1578,7 @@ class PackageKitYumBackend(PackageKitBaseBackend, PackagekitPackage):
self._checkForNewer(txmbr[0].po)
# Added the package to the transaction set
else:
- self.error(ERROR_LOCAL_INSTALL_FAILED, "Can't install %s" % inst_file)
+ self.error(ERROR_LOCAL_INSTALL_FAILED, "Can't install %s as no transaction" % _to_unicode(inst_file))
if len(self.yumbase.tsInfo) == 0:
self.error(ERROR_LOCAL_INSTALL_FAILED, "Can't install %s" % " or ".join(inst_files))
self._runYumTransaction()
commit 1ab2a9fc904f68706ca3d3b0e5899ea49ba73baf
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 15:37:47 2009 +0000
trivial: add a FAQ entry
diff --git a/docs/html/pk-faq.html b/docs/html/pk-faq.html
index 1616953..dc4fb3b 100644
--- a/docs/html/pk-faq.html
+++ b/docs/html/pk-faq.html
@@ -22,6 +22,7 @@
<h2>Table Of Contents</h2>
<ul>
<li><a href="#how-complete">How complete are the backends?</a></li>
+<li><a href="#repo-add-remove">Why can't I add or remove software sources</a></li>
<li><a href="#catalogs">What's a package catalog?</a></li>
<li><a href="#markup">Can I include formatting characters in package descriptions?</a></li>
<li><a href="#1-click-install">Does PackageKit support 1-Click Install?</a></li>
@@ -60,6 +61,19 @@ You can see the latest feature matrix <a href="pk-matrix.html">here</a>.
</p>
<hr>
+<h3><a name="repo-add-remove">Why can't I add or remove software sources?</a></h3>
+<p>
+In the software source viewer you can enable and disable repositories, but you
+cannot rename, add or remove them.
+This is a deliberate design choice chosen for the following reasons:
+</p>
+<ul>
+<li>The mirrorlist and source URL formats are very different between distributions</li>
+<li>There are better ways of adding sources, for instance installing the <code><i>repo</i>-release.rpm</code> package which also adds the GPG keys</li>
+<li>Removing the <code>repo-release.rpm</code> removes the repo and any temporary files</li>
+<li>Renaming a repo has no purpose</li>
+</ul>
+
<h3><a name="catalogs">What's a package catalog?</a></h3>
<p>
There's one use case that I'm very interested in, and that is getting new users with the correct
commit 0eaae40126032ec65b95225102155f9f48484284
Author: Balaji <balaji at localhost.localdomain>
Date: Mon Feb 16 19:38:01 2009 +0530
Updated with UseSyslog parameter
diff --git a/docs/api/spec/pk-introduction.xml b/docs/api/spec/pk-introduction.xml
index affb2ae..7696c54 100644
--- a/docs/api/spec/pk-introduction.xml
+++ b/docs/api/spec/pk-introduction.xml
@@ -86,6 +86,12 @@
although the daemon will start and stop less often.
</para>
</sect2>
+ <sect2 id="config-main-timeout">
+ <title>UseSyslog</title>
+ <para>
+ Syslog is used to audit and log actions wherever its available.
+ </para>
+ </sect2>
<sect2 id="config-main-default">
<title>DefaultBackend</title>
<para>
commit a612820f4fc5b3c9297e1e8fe5dce42d4ffe7bac
Merge: f445d38... e987575...
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 10:25:31 2009 +0000
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit f445d38784ef86b19535d1c10fcab2c925ab1850
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 10:12:43 2009 +0000
trivial: prefix different event types
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index c375d87..0a74ecb 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -564,19 +564,19 @@ pk_transaction_list_get_state (PkTransactionList *tlist)
/* wrong flags */
if (wrong != 0)
- g_string_append_printf (string, "%i have inconsistent flags\n", wrong);
+ g_string_append_printf (string, "ERROR: %i have inconsistent flags\n", wrong);
/* some are not committed */
if (no_commit != 0)
- g_string_append_printf (string, "%i have not been committed\n", no_commit);
+ g_string_append_printf (string, "WARNING: %i have not been committed\n", no_commit);
/* more than one running */
if (running > 1)
- g_string_append_printf (string, "%i are running\n", running);
+ g_string_append_printf (string, "ERROR: %i are running\n", running);
/* nothing running */
if (waiting == length)
- g_string_append_printf (string, "everything is waiting!\n");
+ g_string_append_printf (string, "WARNING: everything is waiting!\n");
out:
return g_string_free (string, FALSE);
}
commit 309f969ba6c3d5be7c9bf67955a05da0b78d75f9
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 09:59:39 2009 +0000
feature: Print the daeon state when using pkmon in verbose mode
diff --git a/client/pk-monitor.c b/client/pk-monitor.c
index c111644..e2d1d40 100644
--- a/client/pk-monitor.c
+++ b/client/pk-monitor.c
@@ -32,6 +32,9 @@
#include "egg-debug.h"
+static PkControl *control = NULL;
+static gboolean verbose = FALSE;
+
/**
* pk_monitor_task_list_changed_cb:
**/
@@ -41,6 +44,7 @@ pk_monitor_task_list_changed_cb (PkTaskList *tlist, gpointer data)
guint i;
PkTaskListItem *item;
guint length;
+ gchar *state;
length = pk_task_list_get_size (tlist);
g_print ("Tasks:\n");
@@ -53,13 +57,20 @@ pk_monitor_task_list_changed_cb (PkTaskList *tlist, gpointer data)
g_print ("#%i\t%s\t%s (%s)\t%s\n", i+1, item->tid, pk_role_enum_to_text (item->role),
pk_status_enum_to_text (item->status), item->text);
}
+
+ /* only print state when verbose */
+ if (verbose) {
+ state = pk_control_get_daemon_state (control, NULL);
+ g_print ("%s", state);
+ g_free (state);
+ }
}
/**
* pk_monitor_repo_list_changed_cb:
**/
static void
-pk_monitor_repo_list_changed_cb (PkControl *control, gpointer data)
+pk_monitor_repo_list_changed_cb (PkControl *_control, gpointer data)
{
g_print ("repo-list-changed\n");
}
@@ -68,7 +79,7 @@ pk_monitor_repo_list_changed_cb (PkControl *control, gpointer data)
* pk_monitor_updates_changed_cb:
**/
static void
-pk_monitor_updates_changed_cb (PkControl *control, gpointer data)
+pk_monitor_updates_changed_cb (PkControl *_control, gpointer data)
{
g_print ("updates-changed\n");
}
@@ -86,7 +97,7 @@ pk_connection_changed_cb (PkConnection *pconnection, gboolean connected, gpointe
* pk_monitor_locked_cb:
**/
static void
-pk_monitor_locked_cb (PkControl *control, gboolean is_locked, gpointer data)
+pk_monitor_locked_cb (PkControl *_control, gboolean is_locked, gpointer data)
{
if (is_locked)
g_print ("locked\n");
@@ -101,13 +112,12 @@ int
main (int argc, char *argv[])
{
PkTaskList *tlist;
- PkControl *control;
gboolean ret;
GMainLoop *loop;
PkConnection *pconnection;
gboolean connected;
- gboolean verbose = FALSE;
gboolean program_version = FALSE;
+ gchar *state;
GOptionContext *context;
const GOptionEntry options[] = {
@@ -171,6 +181,13 @@ main (int argc, char *argv[])
g_error ("cannot refresh transaction list");
pk_task_list_print (tlist);
+ /* only print state when verbose */
+ if (verbose) {
+ state = pk_control_get_daemon_state (control, NULL);
+ g_print ("%s", state);
+ g_free (state);
+ }
+
/* spin */
g_main_loop_run (loop);
diff --git a/lib/packagekit-glib/pk-control.c b/lib/packagekit-glib/pk-control.c
index e75dd67..b2cfdd9 100644
--- a/lib/packagekit-glib/pk-control.c
+++ b/lib/packagekit-glib/pk-control.c
@@ -315,6 +315,45 @@ out:
}
/**
+ * pk_control_get_daemon_state:
+ * @control: a valid #PkControl instance
+ * @error: a %GError to put the error code and message in, or %NULL
+ *
+ * The engine state debugging output
+ *
+ * Return value: a string of debugging data of unspecified format
+ **/
+gchar *
+pk_control_get_daemon_state (PkControl *control, GError **error)
+{
+ gboolean ret;
+ GError *error_local = NULL;
+ gchar *state = NULL;
+
+ g_return_val_if_fail (PK_IS_CONTROL (control), NULL);
+ g_return_val_if_fail (error == NULL || *error == NULL, NULL);
+
+ /* check to see if we have a valid proxy */
+ if (control->priv->proxy == NULL) {
+ egg_warning ("No proxy for manager");
+ goto out;
+ }
+ ret = dbus_g_proxy_call (control->priv->proxy, "GetDaemonState", &error_local,
+ G_TYPE_INVALID,
+ G_TYPE_STRING, &state,
+ G_TYPE_INVALID);
+ if (!ret) {
+ /* abort as the DBUS method failed */
+ egg_warning ("GetDaemonState failed :%s", error_local->message);
+ pk_control_error_set (error, PK_CONTROL_ERROR_FAILED, error_local->message);
+ g_error_free (error_local);
+ goto out;
+ }
+out:
+ return state;
+}
+
+/**
* pk_control_get_network_state:
* @control: a valid #PkControl instance
* @error: a %GError to put the error code and message in, or %NULL
diff --git a/lib/packagekit-glib/pk-control.h b/lib/packagekit-glib/pk-control.h
index b7d3403..d99eb74 100644
--- a/lib/packagekit-glib/pk-control.h
+++ b/lib/packagekit-glib/pk-control.h
@@ -106,6 +106,8 @@ PkBitfield pk_control_get_groups (PkControl *control,
GError **error);
gchar **pk_control_get_mime_types (PkControl *control,
GError **error);
+gchar *pk_control_get_daemon_state (PkControl *control,
+ GError **error);
PkNetworkEnum pk_control_get_network_state (PkControl *control,
GError **error);
gboolean pk_control_get_backend_detail (PkControl *control,
commit 55bce54005a0dcfbf0bf5e7f0eb4ede75bcc8462
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 09:59:03 2009 +0000
feature: Add a new method GetDaemonState to the main interface to help debugging on live systems
diff --git a/src/org.freedesktop.PackageKit.xml b/src/org.freedesktop.PackageKit.xml
index b8768d3..33e4499 100644
--- a/src/org.freedesktop.PackageKit.xml
+++ b/src/org.freedesktop.PackageKit.xml
@@ -256,6 +256,27 @@
</method>
<!--*****************************************************************************************-->
+ <method name="GetDaemonState">
+ <doc:doc>
+ <doc:description>
+ <doc:para>
+ Gets the debugging state from the daemon.
+ No secure state will be shown, and all information is for reference only.
+ </doc:para>
+ </doc:description>
+ </doc:doc>
+ <arg type="s" name="state" direction="out">
+ <doc:doc>
+ <doc:summary>
+ <doc:para>
+ The state of the dameon at this specific moment.
+ </doc:para>
+ </doc:summary>
+ </doc:doc>
+ </arg>
+ </method>
+
+ <!--*****************************************************************************************-->
<method name="SetProxy">
<annotation name="org.freedesktop.DBus.GLib.Async" value=""/>
<doc:doc>
diff --git a/src/pk-engine.c b/src/pk-engine.c
index e3b5631..718b60e 100644
--- a/src/pk-engine.c
+++ b/src/pk-engine.c
@@ -294,6 +294,22 @@ pk_engine_get_network_state (PkEngine *engine, gchar **state, GError **error)
}
/**
+ * pk_engine_get_daemon_state:
+ **/
+gboolean
+pk_engine_get_daemon_state (PkEngine *engine, gchar **state, GError **error)
+{
+ g_return_val_if_fail (PK_IS_ENGINE (engine), FALSE);
+
+ *state = pk_transaction_list_get_state (engine->priv->transaction_list);
+
+ /* reset the timer */
+ pk_engine_reset_timer (engine);
+
+ return TRUE;
+}
+
+/**
* pk_engine_get_transaction_list:
**/
gboolean
diff --git a/src/pk-engine.h b/src/pk-engine.h
index 4dc367d..f45b5fa 100644
--- a/src/pk-engine.h
+++ b/src/pk-engine.h
@@ -94,6 +94,9 @@ void pk_engine_get_tid (PkEngine *engine,
gboolean pk_engine_get_network_state (PkEngine *engine,
gchar **state,
GError **error);
+gboolean pk_engine_get_daemon_state (PkEngine *engine,
+ gchar **state,
+ GError **error);
gboolean pk_engine_get_time_since_action (PkEngine *engine,
const gchar *role_text,
guint *seconds,
commit f57c6459553c36992855d63bc09a095781493232
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 09:57:37 2009 +0000
trivial: add pk_transaction_list_get_state() to get the engine state
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 8d61ef9..c375d87 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -523,26 +523,74 @@ pk_transaction_list_get_size (PkTransactionList *tlist)
}
/**
- * pk_transaction_list_print:
+ * pk_transaction_list_get_state:
**/
-static void
-pk_transaction_list_print (PkTransactionList *tlist)
+gchar *
+pk_transaction_list_get_state (PkTransactionList *tlist)
{
guint i;
guint length;
+ guint running = 0;
+ guint waiting = 0;
+ guint wrong = 0;
+ guint no_commit = 0;
PkRoleEnum role;
PkTransactionItem *item;
+ GString *string;
length = tlist->priv->array->len;
+ string = g_string_new ("State:\n");
if (length == 0)
- return;
+ goto out;
+
+ /* iterate tasks */
for (i=0; i<length; i++) {
item = (PkTransactionItem *) g_ptr_array_index (tlist->priv->array, i);
+ if (item->running)
+ running++;
+ if (item->committed && !item->finished && !item->running)
+ waiting++;
+ if (!item->committed && !item->finished && !item->running)
+ no_commit++;
+ if (!item->committed && item->finished)
+ wrong++;
+ if (item->running && item->finished)
+ wrong++;
role = pk_transaction_priv_get_role (item->transaction);
- g_print ("%0i\t%s\t%s\trunning[%i] committed[%i] finished[%i]\n", i,
- pk_role_enum_to_text (role), item->tid, item->running,
- item->committed, item->finished);
+ g_string_append_printf (string, "%0i\t%s\t%s\trunning[%i] committed[%i] finished[%i]\n", i,
+ pk_role_enum_to_text (role), item->tid, item->running,
+ item->committed, item->finished);
}
+
+ /* wrong flags */
+ if (wrong != 0)
+ g_string_append_printf (string, "%i have inconsistent flags\n", wrong);
+
+ /* some are not committed */
+ if (no_commit != 0)
+ g_string_append_printf (string, "%i have not been committed\n", no_commit);
+
+ /* more than one running */
+ if (running > 1)
+ g_string_append_printf (string, "%i are running\n", running);
+
+ /* nothing running */
+ if (waiting == length)
+ g_string_append_printf (string, "everything is waiting!\n");
+out:
+ return g_string_free (string, FALSE);
+}
+
+/**
+ * pk_transaction_list_print:
+ **/
+static void
+pk_transaction_list_print (PkTransactionList *tlist)
+{
+ gchar *state;
+ state = pk_transaction_list_get_state (tlist);
+ g_print ("%s", state);
+ g_free (state);
}
/**
diff --git a/src/pk-transaction-list.h b/src/pk-transaction-list.h
index 48b5808..07e9862 100644
--- a/src/pk-transaction-list.h
+++ b/src/pk-transaction-list.h
@@ -66,6 +66,8 @@ gboolean pk_transaction_list_role_present (PkTransactionList *tlist,
PkRoleEnum role);
gchar **pk_transaction_list_get_array (PkTransactionList *tlist)
G_GNUC_WARN_UNUSED_RESULT;
+gchar *pk_transaction_list_get_state (PkTransactionList *tlist)
+ G_GNUC_WARN_UNUSED_RESULT;
guint pk_transaction_list_get_size (PkTransactionList *tlist);
G_END_DECLS
commit 262b8c3fa52c509f9a3d2fd3245a6e7ca619d649
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 16 09:44:34 2009 +0000
trivial: actually print in pk_task_list_print(), not add to debug log
diff --git a/lib/packagekit-glib/pk-task-list.c b/lib/packagekit-glib/pk-task-list.c
index a98411c..9574144 100644
--- a/lib/packagekit-glib/pk-task-list.c
+++ b/lib/packagekit-glib/pk-task-list.c
@@ -93,12 +93,12 @@ pk_task_list_print (PkTaskList *tlist)
length = tlist->priv->task_list->len;
egg_debug ("Tasks:");
if (length == 0) {
- egg_debug ("[none]...");
+ g_print ("[none]...\n");
return TRUE;
}
for (i=0; i<length; i++) {
item = g_ptr_array_index (tlist->priv->task_list, i);
- egg_debug ("%s\t%s:%s %s", item->tid, pk_role_enum_to_text (item->role),
+ g_print ("%s\t%s:%s %s\n", item->tid, pk_role_enum_to_text (item->role),
pk_status_enum_to_text (item->status), item->text);
}
return TRUE;
commit e987575c33ad4921b875c1728443147188cba13c
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Mon Feb 16 02:47:28 2009 -0600
conary: add subpercent for minitasks
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index 49c3ed2..712fdd3 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -47,8 +47,8 @@ class UpdateCallback(callbacks.UpdateCallback):
def downloadingChangeSet(self, got, need):
log.info("Callback ........ STATUS_DOWNLOAD Changeset %s percent %s/%s bytes" % ( got*100/float(need), got,need) )
- self.progress.set_subpercent( got*100 / float(need) )
- self.backend.percentage(self.progress.percent)
+ #self.progress.set_subpercent( got*100 / float(need) )
+ self.backend.sub_percentage( got*100/float(need) )
log.info( "%s percent" % self.progress.percent)
@@ -109,8 +109,7 @@ class UpdateCallback(callbacks.UpdateCallback):
if troveNum > 0 and troveCount > 0:
sub_percent = (add + troveNum) / (2 * float(troveCount)) * 100
self.progress.set_subpercent(sub_percent)
- p = self.progress.percent
- self.backend.percentage(p)
+ self.backend.sub_percentage(sub_percent)
if self.smallUpdate:
self.backend.percentage(self.progress.percent)
@@ -144,10 +143,9 @@ class UpdateCallback(callbacks.UpdateCallback):
def creatingDatabaseTransaction(self, troveNum, troveCount):
log.info("callback. .......... creating Database Transactions")
self.progress.step()
- self.preparingUpdate(troveNum, troveCount, add=troveCount)
self.backend.percentage(self.progress.percent)
-
log.info(self.progress.percent)
+ self.preparingUpdate(troveNum, troveCount, add=troveCount)
# 9
def committingTransaction(self):
commit 598509ed3c1a8c55e067dfea69bff63293d4debc
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Mon Feb 16 02:34:47 2009 -0600
conary: remove the subpercent signal only percente signal
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 6444ab2..70687a5 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -497,7 +497,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info((name, version, flavor, installed ))
self.allow_cancel(True)
- self.percentage(None)
+ self.percentage(0)
self.status(STATUS_RUNNING)
if name:
@@ -702,7 +702,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@ExceptionHandler
def get_updates(self, filters):
self.allow_cancel(True)
- self.percentage(None)
+ self.percentage(0)
self.status(STATUS_INFO)
log.info("============== get_updates ========================")
cli = ConaryPk()
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index 1eb8109..49c3ed2 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -41,29 +41,33 @@ class UpdateCallback(callbacks.UpdateCallback):
def requestingChangeSet(self):
log.info("Callback ........ STATUS_REQUEST changeset ")
self.backend.status(STATUS_DOWNLOAD)
- self.progress.step()
self.backend.percentage(self.progress.percent)
+ log.info(self.progress.percent)
+ self.progress.step()
def downloadingChangeSet(self, got, need):
+ log.info("Callback ........ STATUS_DOWNLOAD Changeset %s percent %s/%s bytes" % ( got*100/float(need), got,need) )
self.progress.set_subpercent( got*100 / float(need) )
- self.backend.sub_percentage(self.progress.percent)
+ self.backend.percentage(self.progress.percent)
+ log.info( "%s percent" % self.progress.percent)
- log.info("Callback ........ STATUS_DOWNLOAD Changeset %s percent" % self.progress.percent )
# 2
def resolvingDependencies(self):
#self.backend.status('Resolving Dependencies')
log.info("Callback ........ STATUS_DEP_RESOLVE ")
- self.backend.sub_percentage(self.progress.percent)
+ self.backend.percentage(self.progress.percent)
self.backend.status(STATUS_DEP_RESOLVE)
self.progress.step()
self.backend.percentage(self.progress.percent)
+ log.info(self.progress.percent)
# 3
def setChangesetHunk(self, num, total):
log.info("callback. .......... set Changeset HUnk %s/%s" % (num, total ) )
self.progress.step()
self.backend.percentage(self.progress.percent)
+ log.info(self.progress.percent)
# 5
def setUpdateHunk(self, hunk, hunkCount):
@@ -77,12 +81,14 @@ class UpdateCallback(callbacks.UpdateCallback):
else:
self.smallUpdate = True
+ log.info(self.progress.percent)
# 6
def setUpdateJob(self, job):
log.info("callback. .......... set update Job")
self.currentJob = job
self.progress.step()
self.backend.percentage(self.progress.percent)
+ log.info(self.progress.percent)
#7
def creatingRollback(self):
@@ -91,6 +97,7 @@ class UpdateCallback(callbacks.UpdateCallback):
self.backend.status(STATUS_ROLLBACK)
self.progress.step()
self.backend.percentage(self.progress.percent)
+ log.info(self.progress.percent)
def preparingUpdate(self, troveNum, troveCount, add=0):
@@ -103,7 +110,7 @@ class UpdateCallback(callbacks.UpdateCallback):
sub_percent = (add + troveNum) / (2 * float(troveCount)) * 100
self.progress.set_subpercent(sub_percent)
p = self.progress.percent
- self.backend.sub_percentage(p)
+ self.backend.percentage(p)
if self.smallUpdate:
self.backend.percentage(self.progress.percent)
@@ -132,6 +139,7 @@ class UpdateCallback(callbacks.UpdateCallback):
self.backend.status(STATUS_INSTALL)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_INSTALLING, '')
+ log.info(self.progress.percent)
#8
def creatingDatabaseTransaction(self, troveNum, troveCount):
log.info("callback. .......... creating Database Transactions")
@@ -139,6 +147,7 @@ class UpdateCallback(callbacks.UpdateCallback):
self.preparingUpdate(troveNum, troveCount, add=troveCount)
self.backend.percentage(self.progress.percent)
+ log.info(self.progress.percent)
# 9
def committingTransaction(self):
@@ -148,6 +157,7 @@ class UpdateCallback(callbacks.UpdateCallback):
self.backend.status(STATUS_COMMIT)
self.progress.step()
self.backend.percentage(self.progress.percent)
+ log.info(self.progress.percent)
#10
def updateDone(self):
@@ -155,6 +165,7 @@ class UpdateCallback(callbacks.UpdateCallback):
self.progress.step()
self.backend.percentage(self.progress.percent)
self.currentJob = None
+ log.info(self.progress.percent)
commit 2d1b9c16339c38f8580cc1869f1ba941453a7ace
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Mon Feb 16 02:02:57 2009 -0600
conary: add a percent progress on install packages
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index ad137b9..6444ab2 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -208,12 +208,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
def _get_update(self, applyList, cache=True):
from conary.conaryclient.update import NoNewTrovesError
updJob = self.client.newUpdateJob()
- log.info("prepareUpdateJob")
try:
suggMap = self.client.prepareUpdateJob(updJob, applyList)
except NoNewTrovesError:
self.error(ERROR_NO_PACKAGES_TO_UPDATE, "No new apps were found")
- log.info("END >>> prepareUpdateJob")
if cache:
Cache().cacheUpdateJob(applyList, updJob)
return updJob, suggMap
@@ -231,6 +229,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
else:
updJob = self._get_update(applyList, cache=False)
self.allow_cancel(False)
+
restartDir = self.client.applyUpdateJob(updJob)
return updJob
@@ -498,7 +497,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info((name, version, flavor, installed ))
self.allow_cancel(True)
- self.percentage(0)
+ self.percentage(None)
self.status(STATUS_RUNNING)
if name:
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index d7b9922..1eb8109 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -17,75 +17,85 @@
#
# Copyright (C) 2007 Elliot Peele <elliot at bentlogic.net>
# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
-
from conary import callbacks
from packagekit.backend import *
from packagekit.progress import PackagekitProgress
from pkConaryLog import log
class UpdateCallback(callbacks.UpdateCallback):
- # 3P >>> ( prepare Update end )
+
+ def __init__(self, backend, cfg=None):
+ callbacks.UpdateCallback.__init__(self)
+ log.info("==== callback ==== ")
+ if cfg:
+ self.setTrustThreshold(cfg.trustThreshold)
+
+ self.backend = backend
+ self.currentJob = None
+ self.smallUpdate = False
+ self.error = []
+ self.progress = PackagekitProgress()
+ self.progress.set_steps( range( 1, 101,10) )
+ # 1
+ # 4
+ def requestingChangeSet(self):
+ log.info("Callback ........ STATUS_REQUEST changeset ")
+ self.backend.status(STATUS_DOWNLOAD)
+ self.progress.step()
+ self.backend.percentage(self.progress.percent)
+
+ def downloadingChangeSet(self, got, need):
+ self.progress.set_subpercent( got*100 / float(need) )
+ self.backend.sub_percentage(self.progress.percent)
+
+ log.info("Callback ........ STATUS_DOWNLOAD Changeset %s percent" % self.progress.percent )
+
+
+ # 2
def resolvingDependencies(self):
#self.backend.status('Resolving Dependencies')
log.info("Callback ........ STATUS_DEP_RESOLVE ")
+ self.backend.sub_percentage(self.progress.percent)
self.backend.status(STATUS_DEP_RESOLVE)
self.progress.step()
- #5A >> status_install preparing Update
- def creatingRollback(self):
- #self.backend.status('Creating Rollback')
- log.info("Callback ........ STATUS_ROLLBACK ")
- self.backend.status(STATUS_ROLLBACK)
- # 7A >> update done
- def committingTransaction(self):
- #self.backend.status('Committing Transaction')
- log.info("Callback ........ STATUS_COMMIT transactions ")
+ self.backend.percentage(self.progress.percent)
+ # 3
+ def setChangesetHunk(self, num, total):
+ log.info("callback. .......... set Changeset HUnk %s/%s" % (num, total ) )
+ self.progress.step()
+ self.backend.percentage(self.progress.percent)
- self.backend.status(STATUS_COMMIT)
+ # 5
+ def setUpdateHunk(self, hunk, hunkCount):
+ log.info("callback. .......... set update HUnk %s/%s" % ( hunk, hunkCount))
+ self.progress.step()
- def downloadingFileContents(self, got, need):
- #self.backend.status('Downloading files for changeset')
- log.info("Callback ........ STATUS_DOWNLOAD FIle Contents %s " % str( got*100/need ))
- self.backend.status(STATUS_DOWNLOAD)
- #self.backend.sub_percentage(got*100/need)
- # 2P >> dep_resolve
- # 2 A >>> set Update Hunk
- def downloadingChangeSet(self, got, need):
- self.backend.status(STATUS_DOWNLOAD)
- self.progress.set_subpercent( got*100 / float(need) )
+ if hunk < hunkCount:
+ p = hunk / float(hunkCount) * 100.0
+ #self.progress.set_subpercent(p)
+ self.backend.percentage(self.progress.percent)
+ else:
+ self.smallUpdate = True
- p = self.progress.percent
- self.backend.sub_percentage(p)
- log.info("Callback ........ STATUS_DOWNLOAD Changeset %s" % p )
+ # 6
+ def setUpdateJob(self, job):
+ log.info("callback. .......... set update Job")
+ self.currentJob = job
+ self.progress.step()
+ self.backend.percentage(self.progress.percent)
- def requestingFileContents(self):
- #self.backend.status('Requesting File Contents')
- log.info("Callback ........ STATUS_REQUEST request File contents ")
- self.backend.status(STATUS_REQUEST)
- # 1(P)repare >> download a change set
- # 1(A)pply >> donwload a changeset
- def requestingChangeSet(self):
- log.info("Callback ........ STATUS_REQUEST changeset ")
- self.backend.status(STATUS_REQUEST)
+ #7
+ def creatingRollback(self):
+ #self.backend.status('Creating Rollback')
+ log.info("Callback ........ STATUS_ROLLBACK ")
+ self.backend.status(STATUS_ROLLBACK)
self.progress.step()
+ self.backend.percentage(self.progress.percent)
- def removeFiles(self, filenum, total):
- log.info("Callback ........ STATUS_REMOVE %s/%sfiles" %( filenum, total) )
- self.backend.status(STATUS_REMOVE)
- self.preparingUpdate(filenum, total, add=total)
- def done(self):
- #self.backend.status('Done')
- log.info("DONEEEEEEEEEEEE")
- """
- e = ""
- for i in self.error:
- e = e + i
- log.error(i)
- if self.error:
- self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e)
- """
- # 6 A >>> transactions
def preparingUpdate(self, troveNum, troveCount, add=0):
+ log.info("callback ....... preparing Update trove %s/%s" % (troveNum, troveCount) )
+ self.progress.step()
if not self.currentJob or len(self.currentJob) == 0 or troveNum > troveCount:
return
@@ -98,9 +108,10 @@ class UpdateCallback(callbacks.UpdateCallback):
if self.smallUpdate:
self.backend.percentage(self.progress.percent)
- if troveNum != 0:
+ if troveNum > 0:
troveNum -= 1
-
+ log.info("currentJob")
+ log.info(self.currentJob[troveNum])
job = self.currentJob[troveNum]
name = job[0]
oldVersion, oldFlavor = job[1]
@@ -121,35 +132,61 @@ class UpdateCallback(callbacks.UpdateCallback):
self.backend.status(STATUS_INSTALL)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_INSTALLING, '')
-
+ #8
def creatingDatabaseTransaction(self, troveNum, troveCount):
log.info("callback. .......... creating Database Transactions")
+ self.progress.step()
self.preparingUpdate(troveNum, troveCount, add=troveCount)
+ self.backend.percentage(self.progress.percent)
- def setChangesetHunk(self, num, total):
- log.info("callback. .......... set Changeset HUnk")
- pass
- # 3A >> set update Job
- def setUpdateHunk(self, hunk, hunkCount):
- log.info("callback. .......... set update HUnk")
- self.progress.step()
- if hunk > 0 and hunkCount > 0:
- percentage = hunk / float(hunkCount) * 100.0
- self.progress.set_subpercent(percentage)
- p = self.progress.percent
- self.backend.sub_percentage(p)
- else:
- self.smallUpdate = True
- # 4A >> Status rollback
- def setUpdateJob(self, job):
- log.info("callback. .......... set update Job")
- self.currentJob = job
+
+ # 9
+ def committingTransaction(self):
+ #self.backend.status('Committing Transaction')
+ log.info("Callback ........ STATUS_COMMIT transactions ")
+
+ self.backend.status(STATUS_COMMIT)
self.progress.step()
- # 8 A >> termina
+ self.backend.percentage(self.progress.percent)
+
+ #10
def updateDone(self):
log.info("callback. .......... update done")
- self.currentJob = None
self.progress.step()
+ self.backend.percentage(self.progress.percent)
+ self.currentJob = None
+
+
+
+ def downloadingFileContents(self, got, need):
+ #self.backend.status('Downloading files for changeset')
+ log.info("Callback ........ STATUS_DOWNLOAD FIle Contents %s " % str( got*100/need ))
+ self.backend.status(STATUS_DOWNLOAD)
+ #self.backend.sub_percentage(got*100/need)
+
+ def requestingFileContents(self):
+ #self.backend.status('Requesting File Contents')
+ log.info("Callback ........ STATUS_REQUEST request File contents ")
+ self.backend.status(STATUS_REQUEST)
+
+ def removeFiles(self, filenum, total):
+ log.info("Callback ........ STATUS_REMOVE %s/%sfiles" %( filenum, total) )
+ self.backend.status(STATUS_REMOVE)
+ self.preparingUpdate(filenum, total, add=total)
+
+ def done(self):
+ #self.backend.status('Done')
+ # self.progress.step()
+ log.info("DONEEEEEEEEEEEE")
+ """
+ e = ""
+ for i in self.error:
+ e = e + i
+ log.error(i)
+ if self.error:
+ self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e)
+ """
+
def warning(self, msg, *args, **kwargs):
e = msg %args
log.error("<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
@@ -165,15 +202,4 @@ class UpdateCallback(callbacks.UpdateCallback):
def troveScriptFailure(self, typ, errcode):
pass
- def __init__(self, backend, cfg=None):
- callbacks.UpdateCallback.__init__(self)
- log.info("==== callback ==== ")
- if cfg:
- self.setTrustThreshold(cfg.trustThreshold)
-
- self.backend = backend
- self.currentJob = None
- self.smallUpdate = False
- self.error = []
- self.progress = PackagekitProgress()
- self.progress.set_steps( range( 1, 100, 9) )
+
commit f4d67447de6e553f82fdbc5882e997320df5ae66
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Mon Feb 16 00:15:01 2009 -0600
conary: change the error signal for groups not found
diff --git a/backends/conary/XMLCache.py b/backends/conary/XMLCache.py
index d9a57c4..d517ab5 100644
--- a/backends/conary/XMLCache.py
+++ b/backends/conary/XMLCache.py
@@ -14,10 +14,19 @@ from pkConaryLog import log
from conarypk import ConaryPk
from conaryEnums import groupMap
-def getGroup(categorieList):
+def getGroup( categorieList ):
+ where = mapGroup( categorieList )
+ if where.values():
+ return max( where.iteritems())[0]
+ else:
+ return None
+
+
+
+def mapGroup(categorieList):
where = {}
if not categorieList:
- return None
+ return where
log.info(categorieList)
for cat in categorieList:
for group,categories in groupMap.items():
@@ -26,11 +35,7 @@ def getGroup(categorieList):
where[group] = where[group] +1
else:
where[group] = 1
- if where.values():
- return max( where.iteritems())[0]
- else:
- return None
-
+ return where
class XMLRepo:
xml_path = ""
@@ -282,12 +287,14 @@ class XMLCache:
categories.sort()
return set( categories )
+
if __name__ == '__main__':
# print ">>> name"
# print XMLCache().search('music', 'name' )
# print ">> details"
- l= XMLCache().search('Internet', 'group' )
- for v,p in enumerate(l):
- print v,p["name"]
- # print XMLCache().getGroup(['GTK', 'Graphics', 'Photography', 'Viewer'])
+ # l= XMLCache().search('Internet', 'group' )
+
+ #for v,p in enumerate(l):
+ # print v,p["name"]
+ print XMLCache().getGroup(['GTK', 'Graphics', 'Photography', 'Viewer'])
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index dc1656c..ad137b9 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -193,7 +193,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
troveTupleList = pk.query( searchlist)
log.info(troveTupleList)
if not troveTupleList:
- self.error(ERROR_PACKAGE_NOT_FOUND, "Not Found %s " % searchlist )
+ error = {}
+ error["group"] = ERROR_GROUP_NOT_FOUND
+ error["details"] = ERROR_PACKAGE_NOT_FOUND
+ error["name"] = error["details"]
+ self.error(error[where], "Not Found %s " % searchlist )
else:
troveTupleList = cache.convertTroveToDict( troveTupleList )
log.info("convert")
commit 714a04a5bc917cdcbed97994225fbc736b390eef
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Sun Feb 15 12:30:50 2009 -0600
fix the group search
diff --git a/backends/conary/XMLCache.py b/backends/conary/XMLCache.py
index d0b52b2..d9a57c4 100644
--- a/backends/conary/XMLCache.py
+++ b/backends/conary/XMLCache.py
@@ -16,8 +16,9 @@ from conaryEnums import groupMap
def getGroup(categorieList):
where = {}
- if categorieList:
+ if not categorieList:
return None
+ log.info(categorieList)
for cat in categorieList:
for group,categories in groupMap.items():
if cat in categories:
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 5f87bd9..dc1656c 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -177,9 +177,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info("where %s" % where)
self.error(ERROR_UNKNOWN, "DORK---- search where not found")
cache = Cache()
- log.debug((searchlist, fltlist))
+ log.debug((searchlist, where))
troveTupleList = cache.search(searchlist, where )
+ log.info("XMLCACHE results:")
+ log.info(troveTupleList)
if len(troveTupleList) > 0 :
for i in troveTupleList:
commit dace515bf30b37eca0962deadfa6aed0e567b5c6
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Sun Feb 15 04:15:22 2009 -0600
Fix get-updates command.
add resolve from packages not own of repos from installLabelPath
Add Validation to update-system ( update )
diff --git a/backends/conary/XMLCache.py b/backends/conary/XMLCache.py
index bf28770..d0b52b2 100644
--- a/backends/conary/XMLCache.py
+++ b/backends/conary/XMLCache.py
@@ -1,5 +1,4 @@
import os
-import sys
from xml.dom.minidom import parse
import urllib as url
@@ -15,17 +14,21 @@ from pkConaryLog import log
from conarypk import ConaryPk
from conaryEnums import groupMap
-def getGroup( categorieList):
+def getGroup(categorieList):
where = {}
+ if categorieList:
+ return None
for cat in categorieList:
for group,categories in groupMap.items():
if cat in categories:
- if where.has_key(group):
+ if group in where:
where[group] = where[group] +1
else:
where[group] = 1
-
- return max( where.iteritems())[0]
+ if where.values():
+ return max( where.iteritems())[0]
+ else:
+ return None
class XMLRepo:
@@ -117,6 +120,7 @@ class XMLRepo:
group = getGroup(pkg["category"])
if name.lower() == group:
results_name.append(pkg["name"])
+ log.info(results_name)
return [ self._getPackage(i) for i in set(results_name) ]
def _searchDetailsPackage(self, name):
@@ -191,8 +195,16 @@ class XMLCache:
os.mkdir(jobPath)
updJob.freeze(jobPath)
- def getTroves(self):
- pass
+ def convertTroveToDict(self, troveTupleList):
+ mList = []
+ for troveTuple in troveTupleList:
+ pkg = {}
+ pkg["name"] = troveTuple[0]
+ pkg["version"] = troveTuple[1].trailingRevision()
+ pkg["label"] = troveTuple[1].trailingLabel()
+ mList.append(pkg)
+ return mList
+
def searchByGroups(self, groups):
pass
def refresh(self):
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 6aac099..5f87bd9 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -44,7 +44,7 @@ from conarypk import ConaryPk
pkpackage = PackagekitPackage()
-from pkConaryLog import log, pdb
+from pkConaryLog import *
from conary.lib import util
@@ -153,6 +153,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
"""
log.info("=========== get package from package_id ======================")
name, verString, archString, data = pkpackage.get_package_from_id(package_id)
+ log.info( archString )
summary = data.split("#")
repo = summary[0]
if summary[1]:
@@ -160,7 +161,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
else:
metadata = {}
cli = ConaryPk()
- return cli.request_query(name)
+ trove = cli.request_query(name)
+ if trove:
+ return trove
+ else:
+ return cli.query(name)
def _do_search(self, filters, searchlist, where = "name"):
"""
@@ -182,19 +187,35 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info("FOUND (%s) elements " % len(troveTupleList) )
else:
log.info("NOT FOUND %s " % searchlist )
- self.error(ERROR_PACKAGE_NOT_FOUND, "Not Found %s " % searchlist )
+ pk = ConaryPk()
+ troveTupleList = pk.query( searchlist)
+ log.info(troveTupleList)
+ if not troveTupleList:
+ self.error(ERROR_PACKAGE_NOT_FOUND, "Not Found %s " % searchlist )
+ else:
+ troveTupleList = cache.convertTroveToDict( troveTupleList )
+ log.info("convert")
+ log.info(troveTupleList)
self._resolve_list( fltlist, troveTupleList )
def _get_update(self, applyList, cache=True):
+ from conary.conaryclient.update import NoNewTrovesError
updJob = self.client.newUpdateJob()
- suggMap = self.client.prepareUpdateJob(updJob, applyList)
+ log.info("prepareUpdateJob")
+ try:
+ suggMap = self.client.prepareUpdateJob(updJob, applyList)
+ except NoNewTrovesError:
+ self.error(ERROR_NO_PACKAGES_TO_UPDATE, "No new apps were found")
+ log.info("END >>> prepareUpdateJob")
if cache:
Cache().cacheUpdateJob(applyList, updJob)
return updJob, suggMap
def _do_update(self, applyList):
+ log.info("========= _do_update ========")
jobPath = Cache().checkCachedUpdateJob(applyList)
+ log.info(jobPath)
if jobPath:
updJob = self.client.newUpdateJob()
try:
@@ -231,7 +252,9 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
version = pkg["version"]
trove = name, None , cli.flavor
specList.append( trove )
- trovesList = cli.repos.findTroves(cli.default_label, specList )
+ log.info(specList)
+ trovesList = cli.repos.findTroves(cli.default_label, specList, allowMissing=True )
+ log.info(trovesList)
pkgFilter = ConaryFilter(filters)
troves = trovesList.values()
@@ -262,17 +285,28 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
cache = Cache()
pkg_dict = cache.resolve( package[0] )
-
+ log.info("doing a resolve")
+ conary_cli = ConaryPk()
+ solved = False
if pkg_dict is None:
- self.error(ERROR_INTERNAL_ERROR, "Package Not found on repository")
+ # verifica si esta en repositorios
+ troveTuple = conary_cli.query(package[0])
+ if not troveTuple:
+ self.error(ERROR_INTERNAL_ERROR, "Package Not found")
+ log.info("PackageNot found on resolve")
+
+ else:
+ pkg_dict = {}
+ pkg_dict["name"] = troveTuple[0][0]
+ solved = True
+
filter = ConaryFilter(filters)
installed = filter._pkg_is_installed( pkg_dict["name"] )
- conary_cli = ConaryPk()
-
- troveTuple = conary_cli.request_query( package[0] )
+ if solved == False:
+ troveTuple = conary_cli.request_query( package[0] )
log.info(">>> %s" % troveTuple)
@@ -300,9 +334,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
# split the list for get Determine info
summary = package_id.split(";")
- repo = summary[3].split("#")[0]
-
- metadata = eval(summary[3].split("#")[1])
+ data = summary[3].split("#")
+ if data[1]:
+ metadata = eval(summary[3].split("#")[1])
+ else:
+ metadata = {}
log.info("====== show the package ")
log.info(metadata)
if metadata.has_key("shortDesc"):
@@ -407,7 +443,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
def update_system(self):
self.allow_cancel(True)
updateItems = self.client.fullUpdateItemList()
+ pprint(updateItems)
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
+ pprint(applyList)
+ upJob, suggMap = self._get_update(applyList)
updJob, suggMap = self._do_update(applyList)
# @ExceptionHandler
@@ -478,10 +517,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.percentage(0)
self.status(STATUS_RUNNING)
log.info("========== Remove Packages ============ ")
+ log.info( allowDeps )
#for package_id in package_ids.split('%'):
for package_id in package_ids:
name, version, flavor, installed = self._findPackage(package_id)
-
if name:
if not installed == INFO_INSTALLED:
self.error(ERROR_PACKAGE_NOT_INSTALLED, 'The package %s is not installed' % name)
@@ -598,7 +637,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info(summary)
repo = summary[3].split("#")[0]
- metadata = eval(summary[3].split("#")[1])
+ if summary[3].split("#")[1]:
+ metadata = eval(summary[3].split("#")[1])
+ else:
+ metadata = {}
short_package_id = ""
for i in summary[0:3]:
short_package_id += i +';'
@@ -632,7 +674,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
''' Show info about package'''
package_id = self.get_package_id(name, version, flavor)
summary = package_id.split(";")
- metadata = eval(summary[3].split("#")[1])
+ if summary[3].split("#")[1]:
+ metadata = eval(summary[3].split("#")[1])
+ else:
+ metadata = {}
if metadata.has_key("shortDesc"):
meta = metadata["shortDesc"]
else:
@@ -655,7 +700,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.percentage(None)
self.status(STATUS_INFO)
log.info("============== get_updates ========================")
- updateItems = self.client.fullUpdateItemList()
+ cli = ConaryPk()
+ updateItems =cli.cli.fullUpdateItemList()
+# updateItems = cli.cli.getUpdateItemList()
+ for i in updateItems:
+ log.info(i[0])
log.info("============== end get_updates ========================")
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
log.info("_get_update ....")
@@ -685,6 +734,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
troveTuple.append(version)
installed = self.check_installed(troveTuple)
self._show_package(name, version, flavor, INFO_NORMAL)
+
def _findPackage(self, package_id):
'''
@@ -693,6 +743,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info("========== _findPackage ==========")
log.info(package_id)
troveTuples = self.get_package_from_id(package_id)
+ log.info(troveTuples)
for troveTuple in troveTuples:
log.info("======== trove ")
log.info(troveTuple)
diff --git a/backends/conary/conarypk.py b/backends/conary/conarypk.py
index 3581362..9ed2545 100644
--- a/backends/conary/conarypk.py
+++ b/backends/conary/conarypk.py
@@ -108,7 +108,7 @@ class ConaryPk:
if __name__ == "__main__":
conary = ConaryPk()
- print conary.query("dpaster")
+ print conary.query("vim-scripts")
#print conary.query("gimpasdas")
#print conary.request_query("dpaster",'zodyrepo.rpath.org at rpl:devel')
#print conary.request_query("gimp")
diff --git a/backends/conary/pkConaryLog.py b/backends/conary/pkConaryLog.py
index 5f0b3f4..695a7cc 100644
--- a/backends/conary/pkConaryLog.py
+++ b/backends/conary/pkConaryLog.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-
+import pprint as p
import logging as log
import pdb
log.basicConfig(level=log.DEBUG,
@@ -7,3 +7,8 @@ log.basicConfig(level=log.DEBUG,
filename='/tmp/conarybackend.log',
filemode='a'
)
+
+
+def pprint(str):
+ log.info(str)
+# log.info( p.pprint( str, width= 10) )
commit b84913321b1a0638541273c36dff8d4bd3a9794d
Merge: 00b1904... 1db4cdd...
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Sat Feb 14 01:23:57 2009 +0200
Merge branch 'master' of git+ssh://onestep_ua@git.packagekit.org/srv/git/PackageKit
commit 00b1904cb8dc98feacaf6874c65fe5e76dbf1e24
Author: Valeriy Lyasotskiy <onestep at ukr.net>
Date: Sat Feb 14 01:23:45 2009 +0200
site: updated alpm backend status in status matrix
diff --git a/docs/html/pk-matrix.html b/docs/html/pk-matrix.html
index dfb36a3..4910f36 100644
--- a/docs/html/pk-matrix.html
+++ b/docs/html/pk-matrix.html
@@ -50,7 +50,7 @@
<tr>
<td><b>DownloadPackages</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
@@ -64,7 +64,7 @@
<tr>
<td><b>GetDepends</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- opkg -->
@@ -162,7 +162,7 @@
<tr>
<td><b>GetUpdateDetail</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
@@ -176,7 +176,7 @@
<tr>
<td><b>GetUpdates</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- conary -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- opkg -->
@@ -344,7 +344,7 @@
<tr>
<td><b>SearchGroup</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- opkg -->
@@ -372,7 +372,7 @@
<tr>
<td><b>UpdatePackages</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- box -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- conary -->
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- opkg -->
@@ -400,7 +400,7 @@
<tr>
<td><b>WhatProvides</b></td>
<td><img src="img/status-good.png" alt="[yes]"/></td><!-- apt -->
-<td><img src="img/status-bad.png" alt="[no]"/></td><!-- alpm -->
+<td><img src="img/status-good.png" alt="[yes]"/></td><!-- alpm -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- box -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- conary -->
<td><img src="img/status-bad.png" alt="[no]"/></td><!-- opkg -->
commit 1db4cdd2b295c26252625c4e2638ebe09b094bcf
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Feb 13 23:01:34 2009 +0000
trivial: fix up conary makefile
diff --git a/backends/conary/Makefile.am b/backends/conary/Makefile.am
index 5b88383..6d7dd38 100644
--- a/backends/conary/Makefile.am
+++ b/backends/conary/Makefile.am
@@ -1,13 +1,13 @@
helperdir = $(datadir)/PackageKit/helpers/conary
dist_helper_DATA = \
conaryBackend.py \
- conaryFilter.py \
- conaryCallback.py \
- conaryInit.py \
- XMLCache.py \
- pkConaryLog.py \
- conarypk.py \
- conaryEnums.py
+ conaryFilter.py \
+ conaryCallback.py \
+ conaryInit.py \
+ XMLCache.py \
+ pkConaryLog.py \
+ conarypk.py \
+ conaryEnums.py
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_conary.la
commit 6989cef3728b764371b691dd95f5811993221de0
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Feb 13 22:59:46 2009 +0000
Revert "Revert "Merge branch 'master' of git+ssh://sde@git.packagekit.org/srv/git/PackageKit""
This reverts commit 21598c5a748373ff148141670f4069bcecfa3b71.
I don't know why sde reverted this, it's fine.
diff --git a/backends/conary/Cache.py b/backends/conary/Cache.py
deleted file mode 100644
index c3fc43a..0000000
--- a/backends/conary/Cache.py
+++ /dev/null
@@ -1,346 +0,0 @@
-#!/usr/bin/python
-# 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.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#
-# Copyright (C) 2007 Ken VanDine <ken at vandine.org>
-# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
-
-import os
-from conary import errors
-from conary.deps import deps
-from conary import conarycfg, conaryclient
-from conary import dbstore, queryrep, versions, updatecmd
-from conary.local import database
-from conary import trove
-
-
-
-from pkConaryLog import log
-
-class Cache(object):
- # Database name and path
- dbName = 'cache.db'
- # Someday we might want to make this writable by users
- #if 'HOME' in os.environ:
- # dbPath = '%s/.conary/cache/data/' % os.environ['HOME']
- #else:
- # dbPath = '/var/cache/conary/'
- dbPath = '/var/cache/conary/'
- jobPath = dbPath + 'jobs'
-
- def __init__(self):
- """ Class to retrieve and cache package information from label. """
-
- self.is_populate_database = False
- if not os.path.isdir(self.dbPath):
- os.makedirs(self.dbPath)
- if not os.path.isdir(self.jobPath):
- os.mkdir(self.jobPath)
-
- self.conn = dbstore.connect(os.path.join(self.dbPath, self.dbName))
- self.cursor = self.conn.cursor()
- self.cursor.execute("PRAGMA count_changes=0", start_transaction=False)
-
- if os.path.isfile(os.path.join(self.dbPath, self.dbName)):
- self._validate_tables()
-
- def _validate_tables(self):
- """ Validates that all tables are up to date. """
- #backend = PackageKitBaseBackend(self)
- stmt = ("select tbl_name from sqlite_master "
- "where type = 'table' and tbl_name like 'conary_%'")
- self.cursor.execute(stmt)
- # List of all tables with names that start with "conary_"
- tbllist = self.cursor.fetchall()
- if tbllist == [('conary_packages',)]:
- self.cursor.execute('DROP TABLE conary_packages')
- self.conn.commit()
- tbllist = []
- if tbllist != []:
- return True
- #print "Verified packages table"
- else:
- log.info("Creando tablas")
- # Create all tables if database is empty
- if len(tbllist) == 0:
- self._create_database()
- #ackend.status(STATUS_WAIT)
- self.is_populate_database = True
- self.populate_database()
- return True
-
- def _getJobCachePath(self, applyList):
- from conary.lib import sha1helper
- applyStr = '\0'.join(['%s=%s[%s]--%s[%s]%s' % (x[0], x[1][0], x[1][1], x[2][0], x[2][1], x[3]) for x in applyList])
- return self.jobPath + '/' + sha1helper.sha1ToString(sha1helper.sha1String(applyStr))
-
- def checkCachedUpdateJob(self, applyList):
- jobPath = self._getJobCachePath(applyList)
- if os.path.exists(jobPath):
- return jobPath
-
- def cacheUpdateJob(self, applyList, updJob):
- jobPath = self._getJobCachePath(applyList)
- if os.path.exists(jobPath):
- from conary.lib import util
- util.rmtree(jobPath)
- os.mkdir(jobPath)
- updJob.freeze(jobPath)
-
- def conaryquery(self):
- self.cfg = conarycfg.ConaryConfiguration()
- self.client = conaryclient.ConaryClient(self.cfg)
- self.cfg.readFiles()
- self.cfg.initializeFlavors()
- self.repos = self.client.getRepos()
- self.db = conaryclient.ConaryClient(self.cfg).db
-
- troves = queryrep.getTrovesToDisplay(self.repos, None, None, None,
- queryrep.VERSION_FILTER_LEAVES, queryrep.FLAVOR_FILTER_BEST,
- self.cfg.installLabelPath, self.cfg.flavor, None)
-
- packages = []
-
- for troveTuple in troves:
- # troveTuple is probably what we want to store in the cachedb
- # Then use the below methods to present them in a nicer fashion
- if troveTuple[0].endswith(':source'):
- continue
- if ":" in troveTuple[0]:
- fragments = troveTuple[0].split(":")
- trove = fragments[0]
- component = fragments[1]
- else:
- trove = troveTuple[0]
- component = ""
-
- installed = 0
- flavor = troveTuple[2].freeze()
- fullVersion = troveTuple[1].freeze()
- label = str(troveTuple[1].branch().label())
- description = ""
- category = ""
- packagegroup = ""
- size = ""
- packages.append([trove, component, fullVersion, label, flavor,
- description, category, packagegroup, size])
-
- return packages
-
- def connect_memory(self):
- return sqlite.connect(':memory:')
-
- def cursor(self, connection):
- return connection.cursor()
-
- def _create_database(self):
- #FIXME: delete the category column. it's not useful
- """ Creates a blank database. """
- sql = '''CREATE TABLE conary_packages (
- packageId INTEGER,
- trove text,
- component text,
- version text,
- label text,
- flavor text,
- description text,
- category text,
- packagegroup text,
- size text)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_categories (
- categoryId INTEGER,
- categoryName text)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_category_package_map (
- categoryId INTEGER,
- packageId INTEGER)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_licenses (
- licenseId INTEGER,
- licenseName text)'''
-
- self.cursor.execute(sql)
-
- sql = '''CREATE TABLE conary_license_package_map (
- licenseId INTEGER,
- packageId INTEGER)'''
-
- self.cursor.execute(sql)
-
- #self.conn.createIndex('conary_catagories', 'conary_category_name_idx', ['categoryName'])
- #self.conn.createIndex('conary_catagories', 'conary_category_id_idx', ['categoryId'])
- self.conn.commit()
-
-
-
- def commit(self):
- self.cursor.commit()
-
- def getTroves(self, label=None):
- """
- Returns all troves for now. Add filtering capability.
- """
- stmt = ("select distinct trove, version, flavor, description, "
- "category, packagegroup, size from conary_packages")
-
- self.cursor.execute(stmt)
- return self.cursor.fetchall()
-
- def search(self, package, fullVersion=None):
- """
- Returns all troves for now. Add filtering capability.
- """
- #log.debug(package)
- stmt = ("select distinct trove, version, flavor, description, "
- "category, packagegroup, size from conary_packages")
-
- if package and fullVersion:
- stmt = ("select distinct trove, version, flavor from "
- "conary_packages where trove ='%s' and version = '%s'"
- % (package, fullVersion))
- elif package:
- stmt += (" where trove like '%%%s%%' and component = '' order by "
- "version desc" % package)
-
- try:
- self.cursor.execute(stmt)
- results = self.cursor.fetchall()
- log.debug(results)
- return results
- except Exception, e:
- print str(e)
- return None
-
- def searchByGroups(self, groups):
- """
- Returns all troves for given groups. (trove, version, flavor)
- Needs filtering capability.
- ['all'] means all packages
- FIXME: No filtering done on group text - SQL injection
- """
- if not groups:
- groups = ["all"]
-
- if "all" in groups:
- stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
- " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
- " WHERE CCMap.packageId = CP.packageId"
- " AND CCMap.categoryId = CC.categoryId"
- " GROUP BY CP.trove, CP.version, CP.flavor"
- " ORDER BY CP.trove, CP.version DESC, CP.flavor")
- else:
- group_string = ", ".join(groups)
- stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
- " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
- " WHERE CC.categoryName IN (%s)"
- " AND CCMap.packageId = CP.packageId"
- " AND CCMap.categoryId = CC.categoryId"
- " GROUP BY CP.trove, CP.version, CP.flavor"
- " ORDER BY CP.trove, CP.version DESC, CP.flavor" % group_string)
-
- try:
- self.cursor.execute(stmt)
- return self.cursor.fetchall()
- except Exception, e:
- print str(e)
- return None
-
- def _insert(self, trove):
- """
- Insert trove into database.
- """
- res = self.cursor.execute("SELECT COALESCE(max(packageId), 0) + 1 FROM conary_packages")
- pkgId = res.fetchone()[0] + 1
- trove = [pkgId] + trove[:]
-
- values = [str(field) for field in trove]
- cols = ", ".join("?" * len(trove))
- sql = "INSERT INTO conary_packages VALUES (%s)" % cols
-
- try:
- self.cursor.execute(sql, values)
- #self.conn.commit()
- except Exception, e:
- print str(e)
-
- def _clear_table(self, tableName='conary_packages'):
- """
- Deletes * records from table.
- """
- stmt = "DELETE FROM %s" % tableName
- try:
- self.cursor.execute(stmt)
- except dbstore.sqlerrors.InvalidTable:
- pass
-
- def populate_database(self):
- packages = self.conaryquery()
- # Clear table first
- for tblName in ('conary_packages', 'conary_category_package_map',
- 'conary_categories'):
- self._clear_table(tblName)
- log.info("Insertando datos")
- for package in packages:
- self._insert(package)
- self.conn.commit()
- log.info("Datos insertados")
-
- def _addPackageCategory(self, trv, category):
- res = self.cursor.execute( \
- 'SELECT packageId FROM conary_packages WHERE trove=? and version=? and flavor = ?', trv.getName(), trv.getVersion().freeze(), trv.getFlavor().freeze())
- res = res.fetchone()
- if res:
- # we have a packageID
- pkgId = res[0]
- else:
- # we really should have had this data
- raise RuntimeError
-
- # now look up/make the categoryId
- res = self.cursor.execute('SELECT categoryId FROM conary_categories WHERE categoryName=?', category)
- res = res.fetchone()
- if not res:
- res = self.cursor.execute('SELECT COALESCE(MAX(categoryId), 0) + 1 FROM conary_categories')
- catId = res.fetchone()[0]
- self.cursor.execute('INSERT INTO conary_categories VALUES(?, ?)',
- catId, category)
- else:
- catId = category
-
- self.cursor.execute("INSERT INTO conary_category_package_map VALUES(?, ?)", catId, pkgId)
- self.conn.commit()
-
- def populate_metadata(self, csList):
- for cs in csList:
- for troveCS in cs.iterNewTroveList():
- trv = trove.Trove(troveCS)
- if ':' in trv.getName():
- # components aren't tracked at the moment
- continue
- metadata = trv.getMetadata()
- categories = metadata.get('categories', [])
- for category in categories:
- self._addPackageCategory(trv, category)
- #licenses = metadata.get('licenses', [])
- #for license in licenses:
- # self._addPackageLicense(trv, license)
diff --git a/backends/conary/Makefile.am b/backends/conary/Makefile.am
index 400f706..5b88383 100644
--- a/backends/conary/Makefile.am
+++ b/backends/conary/Makefile.am
@@ -4,8 +4,10 @@ dist_helper_DATA = \
conaryFilter.py \
conaryCallback.py \
conaryInit.py \
- Cache.py \
- pkConaryLog.py
+ XMLCache.py \
+ pkConaryLog.py \
+ conarypk.py \
+ conaryEnums.py
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_conary.la
diff --git a/backends/conary/XMLCache.py b/backends/conary/XMLCache.py
new file mode 100644
index 0000000..bf28770
--- /dev/null
+++ b/backends/conary/XMLCache.py
@@ -0,0 +1,280 @@
+import os
+import sys
+from xml.dom.minidom import parse
+import urllib as url
+
+
+from conary.lib import sha1helper
+from conary.lib import util
+
+from packagekit.backend import PackageKitBaseBackend
+from packagekit.enums import ERROR_NO_CACHE
+
+
+from pkConaryLog import log
+from conarypk import ConaryPk
+from conaryEnums import groupMap
+
+def getGroup( categorieList):
+ where = {}
+ for cat in categorieList:
+ for group,categories in groupMap.items():
+ if cat in categories:
+ if where.has_key(group):
+ where[group] = where[group] +1
+ else:
+ where[group] = 1
+
+ return max( where.iteritems())[0]
+
+
+class XMLRepo:
+ xml_path = ""
+ repository = ""
+ def __init__(self, repo, path ):
+ self.xml_path = path
+ self._setRepo(repo)
+
+ def resolve(self, search_trove):
+ """ resolve its a search with name """
+ trove = self._getPackage(search_trove)
+ if trove:
+ return trove
+ else:
+ return None
+
+ def search(self, search, where ):
+ if where == "name":
+ return self._searchNamePackage(search)
+ elif where == "details":
+ return self._searchDetailsPackage(search)
+ elif where == "group":
+ return self._searchGroupPackage(search)
+ else:
+ return self._searchPackage(search)
+
+ def _setRepo(self,repo):
+ self.repo = repo
+ doc = self._open()
+ self.label = str( doc.childNodes[0].getAttribute("label") )
+
+ def _open(self):
+ try:
+ return self._repo
+ except AttributeError:
+ self._repo = parse( open( self.xml_path + self.repo) )
+ return self._repo
+
+ def _generatePackage(self, package_node ):
+ """ convert from package_node to dictionary """
+ pkg = {}
+ cat = []
+ for node in package_node.childNodes:
+ if pkg.has_key('category'):
+ cat.append(str(node.childNodes[0].nodeValue))
+ else:
+ pkg[str(node.nodeName)] = str(node.childNodes[0].nodeValue)
+ pkg["category"] = cat
+ return pkg
+
+ def _getPackage(self, name):
+ doc = self._open()
+ results = []
+ for packages in doc.childNodes:
+ for package in packages.childNodes:
+ pkg = self._generatePackage(package)
+ pkg["label"] = self.label
+ if name == pkg["name"]:
+ return pkg
+ return None
+
+ def _searchNamePackage(self, name):
+ doc = self._open()
+ results = []
+ for packages in doc.childNodes:
+ for package in packages.childNodes:
+ pkg = self._generatePackage(package)
+ pkg["label"] = self.label
+ if name.lower() in pkg["name"]:
+ results.append(pkg['name'])
+ return [ self._getPackage(i) for i in set(results) ]
+
+ def _searchGroupPackage(self, name):
+ doc = self._open()
+ results_name = []
+ for packages in doc.childNodes:
+ for package in packages.childNodes:
+ pkg = self._generatePackage(package)
+ pkg["label"] = self.label
+ """
+ if not pkg.has_key("category"):
+ continue
+ for j in pkg["category"]:
+ if name.lower() in j.lower():
+ results_name.append(pkg['name'])
+ """
+ if pkg.has_key("category"):
+ group = getGroup(pkg["category"])
+ if name.lower() == group:
+ results_name.append(pkg["name"])
+ return [ self._getPackage(i) for i in set(results_name) ]
+
+ def _searchDetailsPackage(self, name):
+ return self._searchPackage(name)
+ def _searchPackage(self, name):
+ doc = self._open()
+ results = []
+ for packages in doc.childNodes:
+ for package in packages.childNodes:
+ pkg = self._generatePackage(package)
+ pkg["label"] = self.label
+ for i in pkg.keys():
+ if i == "label":
+ continue
+ if i =='category':
+ for j in pkg[i]:
+ if name.lower() in j.lower():
+ results.append(pkg['name'])
+ if name.lower() in pkg[i]:
+ results.append(pkg['name'])
+ return [ self._getPackage(i) for i in set(results) ]
+ def _getAllPackages(self):
+ doc = self._open()
+ results = []
+ for packages in doc.childNodes:
+ for package in packages.childNodes:
+ pkg = self._generatePackage(package)
+ pkg["label"] = self.label
+ results.append(pkg)
+ return results
+
+
+class XMLCache:
+ #xml_files = ["foresight.rpath.org at fl:2"]
+ xml_files = []
+ server = "http://packages.foresightlinux.org/cache/"
+ repos = []
+ dbPath = '/var/cache/conary/'
+ jobPath = dbPath + 'jobs'
+ xml_path = dbPath + "xmlrepo/"
+
+ def __init__(self):
+ con = ConaryPk()
+ labels = con.get_labels_from_config()
+
+ if not os.path.isdir(self.dbPath):
+ os.makedirs(self.dbPath)
+ if not os.path.isdir(self.jobPath):
+ os.mkdir(self.jobPath)
+ if not os.path.isdir( self.xml_path ):
+ os.makedirs(self.xml_path )
+
+ for xml_file in labels:
+ if not os.path.exists( self.xml_path + xml_file + ".xml" ):
+ self._fetchXML()
+ for xml_file in labels :
+ self.repos.append(XMLRepo( xml_file + ".xml", self.xml_path ))
+
+ def _getJobCachePath(self, applyList):
+ applyStr = '\0'.join(['%s=%s[%s]--%s[%s]%s' % (x[0], x[1][0], x[1][1], x[2][0], x[2][1], x[3]) for x in applyList])
+ return self.jobPath + '/' + sha1helper.sha1ToString(sha1helper.sha1String(applyStr))
+
+ def checkCachedUpdateJob(self, applyList):
+ jobPath = self._getJobCachePath(applyList)
+ if os.path.exists(jobPath):
+ return jobPath
+
+ def cacheUpdateJob(self, applyList, updJob):
+ jobPath = self._getJobCachePath(applyList)
+ if os.path.exists(jobPath):
+ util.rmtree(jobPath)
+ os.mkdir(jobPath)
+ updJob.freeze(jobPath)
+
+ def getTroves(self):
+ pass
+ def searchByGroups(self, groups):
+ pass
+ def refresh(self):
+ self._fetchXML()
+ def resolve(self, name ):
+ for repo in self.repos:
+ r = repo.resolve(name)
+ if r:
+ return r
+ else:
+ return None
+
+ def search(self, search, where = "name" ):
+ """
+ @where (string) values = name | details | group |
+ """
+ repositories_result = []
+ for repo in self.repos:
+ results = repo.search(search , where )
+ for i in results:
+ repositories_result.append(i)
+ return repositories_result
+
+ def _fetchXML(self ):
+ con = ConaryPk()
+ labels = con.get_labels_from_config()
+ for i in labels:
+ label = i + '.xml'
+ filename = self.xml_path + label
+ wwwfile = self.server + label
+ try:
+ wget = url.urlopen( wwwfile )
+ except:
+ Pk = PackageKitBaseBackend("")
+ Pk.error(ERROR_NO_CACHE," %s can not open" % wwwfile)
+ openfile = open( filename ,'w')
+ openfile.writelines(wget.readlines())
+ openfile.close()
+ def getGroup(self,categorieList):
+ return getGroup(categorieList)
+
+ def _getCategorieBase(self, mapDict, categorieList ):
+ if not categorieList:
+ return None
+
+ tempDict = {}
+ for cat in categorieList:
+
+ if mapDict.has_key(cat):
+ map = mapDict[cat]
+ else:
+ continue
+
+ if tempDict.has_key(map):
+ tempDict[map] = tempDict[map] + 1
+ else:
+ tempDict[map] = 1
+ tmp = 0
+ t_key = ""
+ for key, value in tempDict.items():
+ if value > tmp:
+ t_key = key
+ tmp = value
+ return t_key
+
+ def _getAllCategories(self):
+ categories = []
+ for i in self.repos:
+ pkgs = i._getAllPackages()
+ for pkg in pkgs:
+ if pkg.has_key('category'):
+ for cat in pkg["category"]:
+ categories.append(cat)
+ categories.sort()
+ return set( categories )
+
+
+if __name__ == '__main__':
+ # print ">>> name"
+ # print XMLCache().search('music', 'name' )
+ # print ">> details"
+ l= XMLCache().search('Internet', 'group' )
+ for v,p in enumerate(l):
+ print v,p["name"]
+ # print XMLCache().getGroup(['GTK', 'Graphics', 'Photography', 'Viewer'])
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
old mode 100644
new mode 100755
index 3cdd6d1..6aac099
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -28,96 +28,31 @@ from conary.deps import deps
from conary import dbstore, queryrep, versions, updatecmd
from conary.local import database
from conary import trove
+from conary.conaryclient import cmdline
from packagekit.backend import *
from packagekit.package import *
+from packagekit.progress import PackagekitProgress
from conaryCallback import UpdateCallback
from conaryFilter import *
-#from XMLCache import XMLCache as Cache
+from XMLCache import XMLCache as Cache
+from conaryInit import *
-# zodman fix
-from Cache import Cache
from conaryInit import init_conary_config, init_conary_client
from conary import conarycfg, conaryclient
+from conarypk import ConaryPk
pkpackage = PackagekitPackage()
from pkConaryLog import log, pdb
-groupMap = {
- '2DGraphics' : GROUP_GRAPHICS,
- 'Accessibility' : GROUP_ACCESSIBILITY,
- 'AdvancedSettings' : GROUP_ADMIN_TOOLS,
- 'Application' : GROUP_OTHER,
- 'ArcadeGame' : GROUP_GAMES,
- 'Audio' : GROUP_MULTIMEDIA,
- 'AudioVideo' : GROUP_MULTIMEDIA,
- 'BlocksGame' : GROUP_GAMES,
- 'BoardGame' : GROUP_GAMES,
- 'Calculator' : GROUP_ACCESSORIES,
- 'Calendar' : GROUP_ACCESSORIES,
- 'CardGame' : GROUP_GAMES,
- 'Compiz' : GROUP_SYSTEM,
- 'ContactManagement' : GROUP_ACCESSORIES,
- 'Core' : GROUP_SYSTEM,
- 'Database' : GROUP_SERVERS,
- 'DesktopSettings' : GROUP_ADMIN_TOOLS,
- 'Development' : GROUP_PROGRAMMING,
- 'Email' : GROUP_INTERNET,
- 'FileTransfer' : GROUP_INTERNET,
- 'Filesystem' : GROUP_SYSTEM,
- 'GNOME' : GROUP_DESKTOP_GNOME,
- 'GTK' : GROUP_DESKTOP_GNOME,
- 'GUIDesigner' : GROUP_PROGRAMMING,
- 'Game' : GROUP_GAMES,
- 'Graphics' : GROUP_GRAPHICS,
- 'HardwareSettings' : GROUP_ADMIN_TOOLS,
- 'IRCClient' : GROUP_INTERNET,
- 'InstantMessaging' : GROUP_INTERNET,
- 'LogicGame' : GROUP_GAMES,
- 'Monitor' : GROUP_ADMIN_TOOLS,
- 'Music' : GROUP_MULTIMEDIA,
- 'Network' : GROUP_INTERNET,
- 'News' : GROUP_INTERNET,
- 'Office' : GROUP_OFFICE,
- 'P2P' : GROUP_INTERNET,
- 'PackageManager' : GROUP_ADMIN_TOOLS,
- 'Photography' : GROUP_MULTIMEDIA,
- 'Player' : GROUP_MULTIMEDIA,
- 'Presentation' : GROUP_OFFICE,
- 'Publishing' : GROUP_OFFICE,
- 'RasterGraphics' : GROUP_GRAPHICS,
- 'Security' : GROUP_SECURITY,
- 'Settings' : GROUP_ADMIN_TOOLS,
- 'Spreadsheet' : GROUP_OFFICE,
- 'System' : GROUP_SYSTEM,
- 'Telephony' : GROUP_COMMUNICATION,
- 'TerminalEmulator' : GROUP_ACCESSORIES,
- 'TextEditor' : GROUP_ACCESSORIES,
- 'Utility' : GROUP_ACCESSORIES,
- 'VectorGraphics' : GROUP_GRAPHICS,
- 'Video' : GROUP_MULTIMEDIA,
- 'Viewer' : GROUP_MULTIMEDIA,
- 'WebBrowser' : GROUP_INTERNET,
- 'WebDevelopment' : GROUP_PROGRAMMING,
- 'WordProcessor' : GROUP_OFFICE
-}
-
-revGroupMap = {}
-
-for (con_cat, pk_group) in groupMap.items():
- if revGroupMap.has_key(pk_group):
- revGroupMap[pk_group].append(con_cat)
- else:
- revGroupMap[pk_group] = [con_cat]
-
-#from conary.lib import util
-#sys.excepthook = util.genExcepthook()
+from conary.lib import util
+sys.excepthook = util.genExcepthook()
def ExceptionHandler(func):
+ return func
def display(error):
return str(error).replace('\n', ' ')
-
def wrapper(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
@@ -133,7 +68,6 @@ def ExceptionHandler(func):
except Exception, e:
self.error(ERROR_UNKNOWN, display(e), exit=True)
return wrapper
-
def _format_str(str):
"""
Convert a multi line string to a list separated by ';'
@@ -171,8 +105,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
frzFlavor = flavor.freeze()
return ','.join([frzVersion, frzFlavor])
- def _thawData(self, data):
- frzVersion, frzFlavor = data.split(',')
+ def _thawData(self, frzVersion, frzFlavor ):
version = versions.ThawVersion(frzVersion)
flavor = deps.ThawFlavor(frzFlavor)
return version, flavor
@@ -185,80 +118,73 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
return ','.join(arches)
@ExceptionHandler
+ def check_installed(self, troveTuple):
+ log.debug("============check installed =========")
+ cli = ConaryPk()
+ result = cli.query(troveTuple[0])
+ if result:
+ installed = INFO_INSTALLED
+ else:
+ installed = INFO_AVAILABLE
+
+ return installed
+
+ @ExceptionHandler
def get_package_id(self, name, versionObj, flavor):
+
version = versionObj.trailingRevision()
+
arch = self._get_arch(flavor)
- data = self._freezeData(versionObj, flavor)
+
+ cache = Cache()
+ pkg = cache.resolve(name)
+ data = versionObj.asString() + "#"
+ if pkg:
+ try:
+ data +=str(pkg)
+ except:
+ pass
return pkpackage.get_package_id(name, version, arch, data)
@ExceptionHandler
def get_package_from_id(self, package_id):
""" package_id(string) =
- "pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
+ "dpaster;0.1-3-1;x86;/foresight.rpath.org at fl:2-qa/0.1-3-1#{'version': '0.1-3-1', 'category': [], 'name': 'dpaster', 'label': 'foresight.rpath.org at fl:2-qa'}"
"""
log.info("=========== get package from package_id ======================")
- log.info(package_id)
name, verString, archString, data = pkpackage.get_package_from_id(package_id)
- log.info(data)
- version, flavor = self._thawData(data)
- return name, version, flavor
+ summary = data.split("#")
+ repo = summary[0]
+ if summary[1]:
+ metadata = eval(summary[1])
+ else:
+ metadata = {}
+ cli = ConaryPk()
+ return cli.request_query(name)
- def _do_search(self, searchlist, filters):
+ def _do_search(self, filters, searchlist, where = "name"):
"""
- searchlist(str)ist as the package for search like
- filters(str) as the filter
+ searchlist(str)ist as the package for search like
+ filters(str) as the filter
"""
fltlist = filters.split(';')
- pkgfilter = ConaryFilter(fltlist)
- #pkgfilter = ConaryFilter()
-
- troveSpecs = [ updatecmd.parseTroveSpec(searchlist,
- allowEmptyName=False) ]
- # get a hold of cached data
+ if where != "name" and where != "details" and where != "group":
+ log.info("where %s" % where)
+ self.error(ERROR_UNKNOWN, "DORK---- search where not found")
cache = Cache()
log.debug((searchlist, fltlist))
- try:
- troveTupleList = cache.search(searchlist)
- log.info("FOUND!!!!!! %s"% str(troveTupleList))
- finally:
- pass
+ troveTupleList = cache.search(searchlist, where )
- # Remove dupes
- tempDict = {}
- try:
- for element in troveTupleList:
- tempDict[element] = None
- except TypeError:
- del tempDict # move on to the next method
+ if len(troveTupleList) > 0 :
+ for i in troveTupleList:
+ log.info("FOUND!!!!!! %s " % i["name"] )
+ log.info("FOUND (%s) elements " % len(troveTupleList) )
else:
- troveTupleList = tempDict.keys()
-
- # Get the latest first
- troveTupleList.sort()
- troveTupleList.reverse()
+ log.info("NOT FOUND %s " % searchlist )
+ self.error(ERROR_PACKAGE_NOT_FOUND, "Not Found %s " % searchlist )
- for troveTuple in troveTupleList:
- troveTuple = tuple([item.encode('UTF-8') for item in troveTuple])
- name = troveTuple[0]
- version = versions.ThawVersion(troveTuple[1])
- flavor = deps.ThawFlavor(troveTuple[2])
- troveTuple = tuple([name, version, flavor])
- log.info("TROVETUPLE %s" % str(troveTuple))
- installed = self.check_installed(troveTuple)
-
- if installed is "installed":
- pkgfilter.add_installed([troveTuple])
- log.info(" === Installed ========= %s" % name)
- else:
- pkgfilter.add_available([troveTuple])
- log.info("=== Available====== %s" % name)
-
- # we couldn't do this when generating the list
-
- package_list = pkgfilter.post_process()
- log.info("package_list %s" %package_list)
- self._show_package_list(package_list)
+ self._resolve_list( fltlist, troveTupleList )
def _get_update(self, applyList, cache=True):
updJob = self.client.newUpdateJob()
@@ -295,111 +221,133 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
applyList = [(name, (None, None), (version, flavor), True)]
return self._do_update(applyList)
+ def _resolve_list(self, filters, pkgsList ):
+ log.info("======= _resolve_list =====")
+ specList = []
+ cli = ConaryPk()
+ for pkg in pkgsList:
+ name = pkg["name"]
+ repo = pkg["label"]
+ version = pkg["version"]
+ trove = name, None , cli.flavor
+ specList.append( trove )
+ trovesList = cli.repos.findTroves(cli.default_label, specList )
+
+ pkgFilter = ConaryFilter(filters)
+ troves = trovesList.values()
+ for trovelst in troves:
+ t = trovelst[0]
+ installed = pkgFilter._pkg_is_installed( t[0] )
+ if installed:
+ pkgFilter.add_installed( trovelst )
+ else:
+ pkgFilter.add_available( trovelst )
+
+
+ package_list = pkgFilter.post_process()
+ self._show_package_list(package_list)
+
@ExceptionHandler
- def resolve(self, filters, packages):
+ def resolve(self, filters, package ):
+ """
+ @filters (list) list of filters
+ @package (list ) list with packages name for resolve
+ """
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
+
log.info("======== resolve =========")
- log.info("filters: %s package:%s " % (filters, packages))
- if len(packages):
- for i in packages:
- self._do_search(i, filters)
- else:
- self._do_search(packages, filters)
+ log.info("filters: %s package:%s " % (filters, package))
- @ExceptionHandler
- def check_installed(self, troveTuple):
- log.debug("============check installed =========")
- log.info(troveTuple)
- db = conaryclient.ConaryClient(self.cfg).db
- try:
- troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
- localInstall = db.findTrove(None, troveTuple)
- installed = INFO_INSTALLED
- except:
- installed = INFO_AVAILABLE
- log.info(installed)
- return installed
+ cache = Cache()
+ pkg_dict = cache.resolve( package[0] )
- def _pkg_is_installed(self, pkg):
- '''
- Return if the package is installed.
- '''
- return self.check_installed(pkg)
+ if pkg_dict is None:
+ self.error(ERROR_INTERNAL_ERROR, "Package Not found on repository")
- @ExceptionHandler
- def search_group(self, filters, key):
- '''
- Implement the {backend}-search-name functionality
- FIXME: Ignoring filters for now.
- '''
- self.allow_cancel(True)
- self.percentage(None)
- self.status(STATUS_QUERY)
+ filter = ConaryFilter(filters)
- fltlist = filters.split(';')
- pkgfilter = ConaryFilter(fltlist)
- pkgfilter = ConaryFilter(fltlist)
- cache = Cache()
+ installed = filter._pkg_is_installed( pkg_dict["name"] )
+
+ conary_cli = ConaryPk()
- try:
- troveTupleList = cache.searchByGroups(revGroupMap[key])
- finally:
- # FIXME: Really need to send an error here
- pass
+ troveTuple = conary_cli.request_query( package[0] )
- troveTupleList.sort()
- troveTupleList.reverse()
+ log.info(">>> %s" % troveTuple)
- for troveTuple in troveTupleList:
- troveTuple = tuple([item.encode('UTF-8') for item in troveTuple[0:2]])
- name = troveTuple[0]
- version = versions.ThawVersion(troveTuple[1])
- flavor = deps.ThawFlavor(troveTuple[2])
- category = troveTuple[3][0]
- category = category.encode('UTF-8')
- troveTuple = tuple([name, version, flavor])
- installed = self.check_installed(troveTuple)
- if installed:
- pkgfilter.add_installed([troveTuple])
- else:
- pkgfilter.add_available([troveTuple])
+ if installed:
+ filter.add_installed( troveTuple )
+ else:
+ filter.add_available( troveTuple )
- # we couldn't do this when generating the list
- package_list = pkgfilter.post_process()
+ package_list = filter.post_process()
log.info("package_list %s" % package_list)
self._show_package_list(package_list)
def _show_package_list(self, lst):
- log.info("------------- show_package_list ----------")
- log.info(lst)
+ """
+ HOW its showed on packageKit
+ @lst(list(tuple) = [ ( troveTuple, status ) ]
+ """
for troveTuple, status in lst:
+ # take the basic info
name = troveTuple[0]
version = troveTuple[1]
flavor = troveTuple[2]
+ # get the string id from packagekit
package_id = self.get_package_id(name, version, flavor)
- log.info("pkg id")
- log.info(package_id)
- summary = self._get_metadata(package_id, 'shortDesc') or " "
- #summary = " "
- log.info("####Package %s %s %s" % (package_id, status, summary ))
- self.package(package_id, status, summary)
+
+ # split the list for get Determine info
+ summary = package_id.split(";")
+ repo = summary[3].split("#")[0]
+
+ metadata = eval(summary[3].split("#")[1])
+ log.info("====== show the package ")
+ log.info(metadata)
+ if metadata.has_key("shortDesc"):
+ meta = metadata["shortDesc"]
+ else:
+ meta = " "
+ self.package(package_id, status, meta )
+
+ @ExceptionHandler
+ def search_group(self, options, searchlist):
+ '''
+ Implement the {backend}-search-group functionality
+ '''
+ log.info("============= search_group ========")
+ self.allow_cancel(True)
+ self.percentage(None)
+ self.status(STATUS_QUERY)
+ log.info("options: %s searchlist:%s "%(options, searchlist))
+ self._do_search(options, searchlist, 'group')
+
@ExceptionHandler
def search_name(self, options, searchlist):
'''
Implement the {backend}-search-name functionality
'''
+ log.info("============= search_name ========")
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
- log.info("============= search_name ========")
log.info("options: %s searchlist:%s "%(options, searchlist))
- self._do_search(searchlist, options)
+ self._do_search(options, searchlist, 'name')
- def search_details(self, opt, key):
- pass
+ @ExceptionHandler
+ def search_details(self, options, search):
+ '''
+ Implement the {backend}-search-details functionality
+ '''
+ log.info("============= search_details ========")
+ self.allow_cancel(True)
+ #self.percentage(None)
+ self.status(STATUS_QUERY)
+ log.info("options: %s searchlist:%s "%(options, search))
+ self._do_search(options, search, 'details' )
+
def get_requires(self, filters, package_ids, recursive_text):
pass
@@ -443,15 +391,17 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
withFiles = True):
files.append(path)
return files
+
+ for package in package_id.split("&"):
+ log.info(package)
+ name, version, flavor, installed = self._findPackage(package)
- name, version, flavor, installed = self._findPackage(package_id)
-
- if installed == INFO_INSTALLED:
- files = _get_files(self.client.db, name, version, flavor)
- else:
- files = _get_files(self.client.repos, name, version, flavor)
+ if installed == INFO_INSTALLED:
+ files = _get_files(self.client.db, name, version, flavor)
+ else:
+ files = _get_files(self.client.repos, name, version, flavor)
- self.files(package_id, ';'.join(files))
+ self.files(package_id, ';'.join(files))
@ExceptionHandler
def update_system(self):
@@ -460,15 +410,13 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
updJob, suggMap = self._do_update(applyList)
- @ExceptionHandler
+# @ExceptionHandler
def refresh_cache(self):
#log.debug("refresh-cache command ")
self.percentage()
self.status(STATUS_REFRESH_CACHE)
cache = Cache()
- if not cache.is_populate_database:
- self.status(STATUS_WAIT)
- cache.populate_database()
+ cache.refresh()
@ExceptionHandler
def update(self, package_ids):
@@ -478,11 +426,13 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(0)
self.status(STATUS_RUNNING)
-
+
for package in package_ids.split(" "):
name, version, flavor, installed = self._findPackage(package)
if name:
- self._do_package_update(name, version, flavor)
+ # self._do_package_update(name, version, flavor)
+ cli = ConaryPk()
+ cli.update(name)
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'No available updates')
@@ -497,12 +447,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
Implement the {backend}-{install, update}-packages functionality
'''
- log.info(package_ids)
- #for package_id in package_ids.split('%'):
+
for package_id in package_ids:
- log.info(package_id)
name, version, flavor, installed = self._findPackage(package_id)
- log.info((name, version))
+ log.info((name, version, flavor, installed ))
self.allow_cancel(True)
self.percentage(0)
@@ -514,7 +462,9 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'Package already installed')
self.status(INFO_INSTALLING)
+ log.info(">>> Prepare Update")
self._get_package_update(name, version, flavor)
+ log.info(">>> end Prepare Update")
self._do_package_update(name, version, flavor)
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'Package was not found')
@@ -625,11 +575,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
#vendor_url = _format_list(urls['vendor'])
vendor_url = ""
reboot = "none"
- desc = self._get_metadata(package_id, 'longDesc') or " "
+ desc = " "
self.update_detail(package_id, update, obsolete, vendor_url, bz_url, cve_url,
reboot, desc, changelog="", state="", issued="", updated="")
- @ExceptionHandler
+ # @ExceptionHandler
def get_details(self, package_ids):
'''
Print a detailed description for a given package
@@ -642,26 +592,52 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info(package_ids[0])
package_id = package_ids[0]
name, version, flavor, installed = self._findPackage(package_id)
+
+ summary = package_id.split(";")
+ log.info("====== summar")
+ log.info(summary)
- log.info("name--------------------")
- log.info((package_id, name))
+ repo = summary[3].split("#")[0]
+ metadata = eval(summary[3].split("#")[1])
+ short_package_id = ""
+ for i in summary[0:3]:
+ short_package_id += i +';'
+
+ log.info("Metadata--------------------")
+ log.info(metadata)
if name:
- shortDesc = self._get_metadata(package_id, 'shortDesc') or name
- longDesc = self._get_metadata(package_id, 'longDesc') or ""
- url = "http://www.foresightlinux.org/packages/" + name + ".html"
- categories = self._get_metadata(package_id, 'categories') or "unknown"
+ if metadata.has_key("shortDesc"):
+ shortDesc = metadata["shortDesc"]
+ else:
+ shortDesc = ""
+ if metadata.has_key("longDesc"):
+ longDesc = metadata["longDesc"]
+ else:
+ longDesc = ""
+ url = "http://www.foresightlinux.org/packages/%s.html" % name
+
+ categories = ""
+ if metadata.has_key("category"):
+ categories = Cache().getGroup( metadata['category'])
+ else:
+ categories = None
# Package size goes here, but I don't know how to find that for conary packages.
- self.details(package_id, None, categories, longDesc, url, 0)
+ self.details(short_package_id, None, categories, longDesc, url, 0)
else:
self.error(ERROR_PACKAGE_NOT_FOUND, 'Package was not found')
def _show_package(self, name, version, flavor, status):
''' Show info about package'''
package_id = self.get_package_id(name, version, flavor)
- summary = self._get_metadata(package_id, 'shortDesc') or ""
- self.package(package_id, status, summary)
+ summary = package_id.split(";")
+ metadata = eval(summary[3].split("#")[1])
+ if metadata.has_key("shortDesc"):
+ meta = metadata["shortDesc"]
+ else:
+ meta = " "
+ self.package(package_id, status, meta)
def _get_status(self, notice):
# We need to figure out how to get this info, this is a place holder
@@ -680,14 +656,19 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.status(STATUS_INFO)
log.info("============== get_updates ========================")
updateItems = self.client.fullUpdateItemList()
+ log.info("============== end get_updates ========================")
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
+ log.info("_get_update ....")
updJob, suggMap = self._get_update(applyList)
+ log.info("_get_update ....end.")
jobLists = updJob.getJobs()
+ log.info("get Jobs")
totalJobs = len(jobLists)
for num, job in enumerate(jobLists):
status = '2'
+ log.info( (num, job) )
name = job[0][0]
# On an erase display the old version/flavor information.
@@ -711,12 +692,16 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
log.info("========== _findPackage ==========")
log.info(package_id)
- name, version, flavor = self.get_package_from_id(package_id)
- troveTuple = (name, version, flavor)
- log.info("======== trove ")
- log.info(troveTuple)
- installed = self.check_installed(troveTuple)
- return name, version, flavor, installed
+ troveTuples = self.get_package_from_id(package_id)
+ for troveTuple in troveTuples:
+ log.info("======== trove ")
+ log.info(troveTuple)
+ installed = self.check_installed(troveTuple)
+ log.info(installed)
+ name, version, flavor = troveTuple
+ return name, version, flavor, installed
+ else:
+ self.error(ERROR_INTERNAL_ERROR, "package_id Not Correct ")
def repo_set_data(self, repoid, parameter, value):
'''
@@ -736,10 +721,12 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
pass
+from pkConaryLog import pdb
+
def main():
backend = PackageKitConaryBackend('')
log.info("======== argv =========== ")
- log.info(sys.argv)
+ log.info(sys.argv[1:])
backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index 464e42f..d7b9922 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -20,63 +20,83 @@
from conary import callbacks
from packagekit.backend import *
+from packagekit.progress import PackagekitProgress
from pkConaryLog import log
class UpdateCallback(callbacks.UpdateCallback):
+ # 3P >>> ( prepare Update end )
def resolvingDependencies(self):
#self.backend.status('Resolving Dependencies')
+ log.info("Callback ........ STATUS_DEP_RESOLVE ")
self.backend.status(STATUS_DEP_RESOLVE)
-
+ self.progress.step()
+ #5A >> status_install preparing Update
def creatingRollback(self):
#self.backend.status('Creating Rollback')
- log.info("Callback ........ STATUS_ROLLBACK ")
+ log.info("Callback ........ STATUS_ROLLBACK ")
self.backend.status(STATUS_ROLLBACK)
-
+ # 7A >> update done
def committingTransaction(self):
#self.backend.status('Committing Transaction')
- log.info("Callback ........ STATUS_COMMIT ")
+ log.info("Callback ........ STATUS_COMMIT transactions ")
self.backend.status(STATUS_COMMIT)
def downloadingFileContents(self, got, need):
#self.backend.status('Downloading files for changeset')
- log.info("Callback ........ STATUS_DOWNLOAD ")
+ log.info("Callback ........ STATUS_DOWNLOAD FIle Contents %s " % str( got*100/need ))
self.backend.status(STATUS_DOWNLOAD)
-
+ #self.backend.sub_percentage(got*100/need)
+ # 2P >> dep_resolve
+ # 2 A >>> set Update Hunk
def downloadingChangeSet(self, got, need):
- log.info("Callback ........ STATUS_DOWNLOAD changeset")
self.backend.status(STATUS_DOWNLOAD)
+ self.progress.set_subpercent( got*100 / float(need) )
+
+ p = self.progress.percent
+ self.backend.sub_percentage(p)
+ log.info("Callback ........ STATUS_DOWNLOAD Changeset %s" % p )
def requestingFileContents(self):
#self.backend.status('Requesting File Contents')
- log.info("Callback ........ STATUS_REQUEST ")
+ log.info("Callback ........ STATUS_REQUEST request File contents ")
self.backend.status(STATUS_REQUEST)
-
+ # 1(P)repare >> download a change set
+ # 1(A)pply >> donwload a changeset
def requestingChangeSet(self):
- #self.backend.status('Requesting Changeset')
log.info("Callback ........ STATUS_REQUEST changeset ")
self.backend.status(STATUS_REQUEST)
+ self.progress.step()
def removeFiles(self, filenum, total):
- log.info("Callback ........ STATUS_REMOVE")
+ log.info("Callback ........ STATUS_REMOVE %s/%sfiles" %( filenum, total) )
self.backend.status(STATUS_REMOVE)
self.preparingUpdate(filenum, total, add=total)
+
def done(self):
#self.backend.status('Done')
-
- log.info("Callback ........ done! ")
- pass
-
+ log.info("DONEEEEEEEEEEEE")
+ """
+ e = ""
+ for i in self.error:
+ e = e + i
+ log.error(i)
+ if self.error:
+ self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e)
+ """
+ # 6 A >>> transactions
def preparingUpdate(self, troveNum, troveCount, add=0):
if not self.currentJob or len(self.currentJob) == 0 or troveNum > troveCount:
return
if troveNum > 0 and troveCount > 0:
sub_percent = (add + troveNum) / (2 * float(troveCount)) * 100
- self.backend.sub_percentage(sub_percent)
+ self.progress.set_subpercent(sub_percent)
+ p = self.progress.percent
+ self.backend.sub_percentage(p)
if self.smallUpdate:
- self.backend.percentage(sub_percent)
+ self.backend.percentage(self.progress.percent)
if troveNum != 0:
troveNum -= 1
@@ -85,42 +105,57 @@ class UpdateCallback(callbacks.UpdateCallback):
name = job[0]
oldVersion, oldFlavor = job[1]
newVersion, newFlavor = job[2]
- log.info((oldVersion, newVersion))
+ #log.info("JOB>>>>>>>> %s " % str(job) )
if oldVersion and newVersion:
- log.info("Callback ........ STATUS_UPDATE ")
+ log.info("Callback ........ STATUS_UPDATE preparing Update ")
self.backend.status(STATUS_UPDATE)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_UPDATING, '')
elif oldVersion and not newVersion:
- log.info("Callback ........ STATUS_REMOVE ")
+ log.info("Callback ........ STATUS_REMOVE preparing Update ")
self.backend.status(STATUS_REMOVE)
package_id = self.backend.get_package_id(name, oldVersion, oldFlavor)
self.backend.package(package_id, INFO_REMOVING, '')
elif not oldVersion and newVersion:
- log.info("Callback ........ STATUS_INSTALL ")
+ log.info("Callback ........ STATUS_INSTALL preparing Update")
self.backend.status(STATUS_INSTALL)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_INSTALLING, '')
def creatingDatabaseTransaction(self, troveNum, troveCount):
+ log.info("callback. .......... creating Database Transactions")
self.preparingUpdate(troveNum, troveCount, add=troveCount)
def setChangesetHunk(self, num, total):
+ log.info("callback. .......... set Changeset HUnk")
pass
-
+ # 3A >> set update Job
def setUpdateHunk(self, hunk, hunkCount):
+ log.info("callback. .......... set update HUnk")
+ self.progress.step()
if hunk > 0 and hunkCount > 0:
percentage = hunk / float(hunkCount) * 100.0
- self.backend.percentage(percentage)
+ self.progress.set_subpercent(percentage)
+ p = self.progress.percent
+ self.backend.sub_percentage(p)
else:
self.smallUpdate = True
-
+ # 4A >> Status rollback
def setUpdateJob(self, job):
+ log.info("callback. .......... set update Job")
self.currentJob = job
-
+ self.progress.step()
+ # 8 A >> termina
def updateDone(self):
+ log.info("callback. .......... update done")
self.currentJob = None
-
+ self.progress.step()
+ def warning(self, msg, *args, **kwargs):
+ e = msg %args
+ log.error("<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
+ log.error(e)
+ self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e, False )
+
def tagHandlerOutput(self, tag, msg, stderr = False):
pass
@@ -139,3 +174,6 @@ class UpdateCallback(callbacks.UpdateCallback):
self.backend = backend
self.currentJob = None
self.smallUpdate = False
+ self.error = []
+ self.progress = PackagekitProgress()
+ self.progress.set_steps( range( 1, 100, 9) )
diff --git a/backends/conary/conaryEnums.py b/backends/conary/conaryEnums.py
new file mode 100644
index 0000000..6584ddd
--- /dev/null
+++ b/backends/conary/conaryEnums.py
@@ -0,0 +1,68 @@
+from packagekit.enums import GROUP_ACCESSIBILITY, GROUP_ACCESSORIES, GROUP_EDUCATION, GROUP_GAMES, GROUP_GRAPHICS, GROUP_INTERNET, GROUP_MULTIMEDIA, GROUP_OFFICE, GROUP_OTHER, GROUP_PROGRAMMING, GROUP_SYSTEM
+
+"""
+Classify the Categories and help me to make a backend
+
+# from XMLCache import XMLCache
+# print "categoryMap = {",
+# for i in XMLCache()._getAllCategories():
+# print "'%s':" % i
+# print "}",
+
+"""
+
+categoryMap = {
+'VectorGraphics': GROUP_GRAPHICS,
+'Network': GROUP_INTERNET,
+'Spreadsheet': GROUP_OFFICE,
+'Application': GROUP_OTHER,
+'X-GNOME-NetworkSettings': GROUP_INTERNET,
+'Music': GROUP_MULTIMEDIA,
+'P2P': GROUP_INTERNET,
+'WordProcessor': GROUP_OFFICE,
+'X-GNOME-PersonalSettings': GROUP_SYSTEM,
+'Presentation': GROUP_OFFICE,
+'Email': GROUP_OFFICE,
+'Monitor': GROUP_SYSTEM,
+'Development': GROUP_PROGRAMMING,
+'Core': GROUP_SYSTEM,
+'RasterGraphics': GROUP_GRAPHICS,
+'Telephony': GROUP_INTERNET,
+'Photography': GROUP_GRAPHICS,
+'HardwareSettings': GROUP_SYSTEM,
+'News': GROUP_INTERNET,
+'X-SuSE-Core-Office': GROUP_SYSTEM,
+'X-Red-Hat-Base': GROUP_SYSTEM,
+#'GNOME': GROUP_OTHER,
+'Settings': GROUP_SYSTEM,
+#'GTK': GROUP_OTHER,
+'System': GROUP_SYSTEM,
+'Graphics': GROUP_GRAPHICS,
+'X-Ximian-Main': GROUP_OFFICE,
+'Security': GROUP_SYSTEM,
+'Audio': GROUP_MULTIMEDIA,
+'ContactManagement': GROUP_ACCESSORIES,
+'X-Novell-Main': GROUP_OFFICE,
+'AudioVideo': GROUP_MULTIMEDIA,
+'WebDevelopment': GROUP_PROGRAMMING,
+'X-GNOME-SystemSettings': GROUP_SYSTEM,
+'Office': GROUP_OFFICE,
+'Viewer': GROUP_ACCESSORIES,
+'Player': GROUP_OTHER,
+'DesktopSettings': GROUP_SYSTEM,
+'WebBrowser': GROUP_INTERNET,
+'Utility': GROUP_ACCESSORIES,
+'GUIDesigner': GROUP_PROGRAMMING,
+'TerminalEmulator': GROUP_ACCESSORIES,
+}
+
+groupMap = {}
+
+for (con_cat, pk_group) in categoryMap.items():
+ if groupMap.has_key(pk_group):
+ groupMap[pk_group].append(con_cat)
+ else:
+ groupMap[pk_group] = [con_cat]
+
+if __name__ == "__main__":
+ print groupMap
diff --git a/backends/conary/conaryFilter.py b/backends/conary/conaryFilter.py
index 635e0e2..20bd4bf 100644
--- a/backends/conary/conaryFilter.py
+++ b/backends/conary/conaryFilter.py
@@ -24,7 +24,8 @@ from packagekit.filter import *
import re
from pkConaryLog import log
-from conaryInit import conary_db
+from conarypk import ConaryPk
+
class ConaryFilter(PackagekitFilter):
def _pkg_get_unique(self, pkg):
@@ -44,18 +45,12 @@ class ConaryFilter(PackagekitFilter):
'''
Return if the packages are installed
'''
- log.info("======= FILTER ===== " )
- log.info(pkg)
- troveTuple = pkg
- db = conary_db()
- try:
- troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
- localInstall = db.findTrove(None, troveTuple)
- installed = True
- except:
- installed = False
- log.info("Installed ???")
- log.info(installed)
- return installed
+ conary_cli = ConaryPk()
+ result = conary_cli.query(pkg)
+
+ if result:
+ return True
+ else:
+ return False
diff --git a/backends/conary/conarypk.py b/backends/conary/conarypk.py
new file mode 100644
index 0000000..3581362
--- /dev/null
+++ b/backends/conary/conarypk.py
@@ -0,0 +1,118 @@
+#!/usr/bin/python
+### compatible with conary 2.0.35
+### greets mkj
+### zodman at foresightlinux.org under the WTFPL http://sam.zoy.org/wtfpl/
+
+from conary.conaryclient import ConaryClient, cmdline
+from conary import conarycfg
+from conary.versions import Label
+from conary.errors import TroveNotFound
+from conary.conaryclient.update import NoNewTrovesError
+
+
+class ConaryPk:
+ def __init__(self):
+ # get configs from /etc/conary
+ cfg = conarycfg.ConaryConfiguration( readConfigFiles = True)
+ # get if the machine its x86 or x86_64
+ cfg.initializeFlavors()
+ self.cfg = cfg
+
+ cli = ConaryClient(cfg)
+
+ # labels enable on /etc/conary/config.d/
+ self.default_label = self.cfg.installLabelPath
+
+ # get if x86 or x86_64
+ self.flavor = self.cfg.flavor[0]
+ # for client
+ self.cli = cli
+ # for query on system (database)
+ self.db = cli.db
+ # for request query on repository (repos)
+ self.repos = cli.repos
+
+ def _get_db(self):
+ """ get the database for do querys """
+ return self.db
+
+ def _get_repos(self):
+ """ get repos for do request query """
+ return self.repos
+
+ def label(self, installLabel = None):
+ """ get label from config or custom installLabel """
+ if installLabel:
+ return Label(installLabel)
+ return self.default_label
+ def get_labels_from_config(self):
+ labels = []
+ for i in self.default_label:
+ if "foresight.rpath.org" in i.asString():
+ labels.append(i.asString())
+ return labels
+
+ def query(self, name):
+ """ do a conary query """
+ if name is None or name == "":
+ return []
+ db = self._get_db()
+ try:
+ troves = db.findTrove( None ,(name , None, None ))
+ #return db.getTroves(troves)
+ return troves
+ except TroveNotFound:
+ return []
+
+ def request_query(self, name, installLabel = None):
+ """ Do a conary request query """
+ label = self.label( installLabel )
+ repos = self._get_repos()
+ try:
+ troves = repos.findTrove( label ,( name, None ,self.flavor ) )
+ #return repos.getTroves(troves)
+ return troves
+ except TroveNotFound:
+ return []
+
+ def get_metadata( self, name , installLabel = None):
+ pass
+
+ def remove(self, name):
+ return self.update(name, remove = True )
+ def update(self, name, installLabel= None, remove = False ):
+ cli = self.cli
+ #get a trove
+ troves = self.request_query(name, installLabel)
+ for trove in troves:
+ trovespec = self.trove_to_spec( trove, remove )
+ try:
+ # create a Job
+ job = cli.newUpdateJob()
+ # Add Update task to Job
+ cli.prepareUpdateJob(job, cmdline.parseChangeList(trovespec))
+ # Apply the Job
+ cli.applyUpdateJob(job)
+ # im rulz
+ return "Update Success of %s" % trovespec
+ except NoNewTrovesError:
+ return "no new Troves Found by %s " % trovespec
+
+ def trove_to_spec(self, trove, remove = False ):
+ # add a -app=blah.rpath.org at rpl:devel for remove packages
+ if remove:
+ tmp = '-'
+ else:
+ tmp = ""
+ return tmp + cmdline.toTroveSpec( trove[0], str(trove[1]), None)
+
+if __name__ == "__main__":
+ conary = ConaryPk()
+ print conary.query("dpaster")
+ #print conary.query("gimpasdas")
+ #print conary.request_query("dpaster",'zodyrepo.rpath.org at rpl:devel')
+ #print conary.request_query("gimp")
+ #print conary.request_query("gimpasdasd")
+ #print conary.update("amsn")
+ #print conary.remove("amsn")
+
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index 936e190..df3c9a6 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -239,6 +239,32 @@ backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search
}
/**
+ pk_backend_search_groups
+*/
+static void
+backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
+{
+ gchar *filters_text;
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "conaryBackend.py", "search-group", filters_text, search, NULL);
+ g_free (filters_text);
+}
+
+
+
+/**
+ pk_backend_search_details
+*/
+static void
+backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
+{
+ gchar *filters_text;
+ filters_text = pk_filter_bitfield_to_text (filters);
+ pk_backend_spawn_helper (spawn, "conaryBackend.py", "search-details", filters_text, search, NULL);
+ g_free (filters_text);
+}
+
+/**
* pk_backend_update_packages:
*/
static void
@@ -324,9 +350,9 @@ PK_BACKEND_OPTIONS (
NULL, /* repo_set_data */
backend_resolve, /* resolve */
NULL, /* rollback */
- NULL, /* search_details */
+ backend_search_details, /* search_details */
NULL, /* search_file */
- NULL, /* search_group */
+ backend_search_group, /* search_group */
backend_search_name, /* search_name */
backend_update_packages, /* update_packages */
backend_update_system, /* update_system */
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 1c53ed8..25d4ebb 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -240,10 +240,10 @@ backend_get_update_detail_timeout (gpointer data)
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344",
"", PK_RESTART_ENUM_NONE, "Update to newest upstream source",
"", PK_UPDATE_STATE_ENUM_STABLE, "2008-07-31", NULL);
- }
- if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
+ } else if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
pk_backend_update_detail (backend, package_id,
- "kernel;2.6.22-0.104.rc3.git6.fc8;i386;installed^"
+ "kernel;2.6.22-0.104.rc3.git6.fc8;i386;installed"
+ PK_PACKAGE_IDS_DELIM
"kernel;2.6.22-0.105.rc3.git7.fc8;i386;installed", "",
"http://www.distro-update.org/page?moo;Bugfix release for kernel",
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344;"
@@ -251,8 +251,7 @@ backend_get_update_detail_timeout (gpointer data)
"http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-3381;CVE-2007-3381",
PK_RESTART_ENUM_SYSTEM, "Update to newest version",
"", PK_UPDATE_STATE_ENUM_UNSTABLE, "2008-06-28", NULL);
- }
- if (egg_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora")) {
+ } else if (egg_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora")) {
pk_backend_update_detail (backend, package_id,
"gtkhtml2;2.18.1-22.fc8;i386;installed", "",
"http://www.distro-update.org/page?moo;Bugfix release for gtkhtml",
@@ -263,6 +262,22 @@ backend_get_update_detail_timeout (gpointer data)
"* something else\n"
"- and that new thing",
"", PK_UPDATE_STATE_ENUM_UNKNOWN, "2008-07-25", NULL);
+
+ } else if (egg_strequal (package_id, "vino;2.24.2.fc9;i386;fedora")) {
+ pk_backend_update_detail (backend, package_id,
+ "vino;2.24.1.fc9;i386;fedora", "",
+ "", "", NULL, PK_RESTART_ENUM_NONE,
+ "Cannot get update as update conflics with vncviewer",
+ "", PK_UPDATE_STATE_ENUM_UNKNOWN, "2008-07-25", NULL);
+
+
+ pk_backend_package (backend, PK_INFO_ENUM_BLOCKED,
+ "",
+ "Remote desktop server for the desktop");
+
+ } else {
+ /* signal to UI */
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, "the package update detail was not found for %s", package_id);
}
}
pk_backend_finished (backend);
diff --git a/docs/html/img/Makefile.am b/docs/html/img/Makefile.am
index cbf61f9..0786318 100644
--- a/docs/html/img/Makefile.am
+++ b/docs/html/img/Makefile.am
@@ -16,6 +16,7 @@ IMAGE_FILES = \
author-timlau.png \
author-tomparker.png \
author-unknown.png \
+ author-zodman.png \
dialog-information.png \
gpk-added-deps.png \
gpk-application-groups.png \
diff --git a/docs/html/img/author-zodman.png b/docs/html/img/author-zodman.png
new file mode 100644
index 0000000..dc6ed2e
Binary files /dev/null and b/docs/html/img/author-zodman.png differ
diff --git a/docs/html/pk-authors.html b/docs/html/pk-authors.html
index 1c2e79d..8105e94 100644
--- a/docs/html/pk-authors.html
+++ b/docs/html/pk-authors.html
@@ -297,6 +297,24 @@
</td>
</tr>
+<tr>
+ <td>
+ <img src="img/author-zodman.png" alt=""/><!-- image should be 120px wide -->
+ </td>
+ <td>
+ <h2>Andrés Vargas</h2>
+ <p>
+ Andres is a Computer Science Engineer mexican what enjoy working with Free Software and Open Source.
+ He rewrote the conary backend and implement a new Cache. Write a <a href="http://github.com/zodman/conary-lib">conary-lib</a> what
+ provide a easy way to use conary public API. He is a developer
+ for the <a href="http://foresightlinux.org/">Foresight Linux</a> project.
+ Her blog <a href="http://vampiritio.com.mx">vampirito.com.mx</a>
+ </p>
+ <p>
+ <b>Responsible for: conary backend</b>
+ </p>
+ </td>
+</tr>
</table>
diff --git a/lib/packagekit-qt/src/transactionprivate.cpp b/lib/packagekit-qt/src/transactionprivate.cpp
index a549a9f..c41343c 100644
--- a/lib/packagekit-qt/src/transactionprivate.cpp
+++ b/lib/packagekit-qt/src/transactionprivate.cpp
@@ -136,12 +136,12 @@ void TransactionPrivate::updateDetail(const QString& pid, const QString& updates
Client::UpdateInfo i;
i.package = new Package(pid);
if( !updates.isEmpty() ) {
- foreach(const QString p, updates.split("^")) {
+ foreach(const QString p, updates.split("&")) {
i.updates.append(new Package(p));
}
}
if( !obsoletes.isEmpty() ) {
- foreach(const QString p, obsoletes.split("^")) {
+ foreach(const QString p, obsoletes.split("&")) {
i.obsoletes.append(new Package(p));
}
}
commit 21598c5a748373ff148141670f4069bcecfa3b71
Author: Stephane Delcroix <stephane at delcroix.org>
Date: Fri Feb 13 20:51:06 2009 +0100
Revert "Merge branch 'master' of git+ssh://sde@git.packagekit.org/srv/git/PackageKit"
This reverts commit 3d3dde2c284873a33307d38fee0ebad25e95d54f.
diff --git a/backends/conary/Cache.py b/backends/conary/Cache.py
new file mode 100644
index 0000000..c3fc43a
--- /dev/null
+++ b/backends/conary/Cache.py
@@ -0,0 +1,346 @@
+#!/usr/bin/python
+# 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.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+#
+# Copyright (C) 2007 Ken VanDine <ken at vandine.org>
+# Copyright (C) 2008 Richard Hughes <richard at hughsie.com>
+
+import os
+from conary import errors
+from conary.deps import deps
+from conary import conarycfg, conaryclient
+from conary import dbstore, queryrep, versions, updatecmd
+from conary.local import database
+from conary import trove
+
+
+
+from pkConaryLog import log
+
+class Cache(object):
+ # Database name and path
+ dbName = 'cache.db'
+ # Someday we might want to make this writable by users
+ #if 'HOME' in os.environ:
+ # dbPath = '%s/.conary/cache/data/' % os.environ['HOME']
+ #else:
+ # dbPath = '/var/cache/conary/'
+ dbPath = '/var/cache/conary/'
+ jobPath = dbPath + 'jobs'
+
+ def __init__(self):
+ """ Class to retrieve and cache package information from label. """
+
+ self.is_populate_database = False
+ if not os.path.isdir(self.dbPath):
+ os.makedirs(self.dbPath)
+ if not os.path.isdir(self.jobPath):
+ os.mkdir(self.jobPath)
+
+ self.conn = dbstore.connect(os.path.join(self.dbPath, self.dbName))
+ self.cursor = self.conn.cursor()
+ self.cursor.execute("PRAGMA count_changes=0", start_transaction=False)
+
+ if os.path.isfile(os.path.join(self.dbPath, self.dbName)):
+ self._validate_tables()
+
+ def _validate_tables(self):
+ """ Validates that all tables are up to date. """
+ #backend = PackageKitBaseBackend(self)
+ stmt = ("select tbl_name from sqlite_master "
+ "where type = 'table' and tbl_name like 'conary_%'")
+ self.cursor.execute(stmt)
+ # List of all tables with names that start with "conary_"
+ tbllist = self.cursor.fetchall()
+ if tbllist == [('conary_packages',)]:
+ self.cursor.execute('DROP TABLE conary_packages')
+ self.conn.commit()
+ tbllist = []
+ if tbllist != []:
+ return True
+ #print "Verified packages table"
+ else:
+ log.info("Creando tablas")
+ # Create all tables if database is empty
+ if len(tbllist) == 0:
+ self._create_database()
+ #ackend.status(STATUS_WAIT)
+ self.is_populate_database = True
+ self.populate_database()
+ return True
+
+ def _getJobCachePath(self, applyList):
+ from conary.lib import sha1helper
+ applyStr = '\0'.join(['%s=%s[%s]--%s[%s]%s' % (x[0], x[1][0], x[1][1], x[2][0], x[2][1], x[3]) for x in applyList])
+ return self.jobPath + '/' + sha1helper.sha1ToString(sha1helper.sha1String(applyStr))
+
+ def checkCachedUpdateJob(self, applyList):
+ jobPath = self._getJobCachePath(applyList)
+ if os.path.exists(jobPath):
+ return jobPath
+
+ def cacheUpdateJob(self, applyList, updJob):
+ jobPath = self._getJobCachePath(applyList)
+ if os.path.exists(jobPath):
+ from conary.lib import util
+ util.rmtree(jobPath)
+ os.mkdir(jobPath)
+ updJob.freeze(jobPath)
+
+ def conaryquery(self):
+ self.cfg = conarycfg.ConaryConfiguration()
+ self.client = conaryclient.ConaryClient(self.cfg)
+ self.cfg.readFiles()
+ self.cfg.initializeFlavors()
+ self.repos = self.client.getRepos()
+ self.db = conaryclient.ConaryClient(self.cfg).db
+
+ troves = queryrep.getTrovesToDisplay(self.repos, None, None, None,
+ queryrep.VERSION_FILTER_LEAVES, queryrep.FLAVOR_FILTER_BEST,
+ self.cfg.installLabelPath, self.cfg.flavor, None)
+
+ packages = []
+
+ for troveTuple in troves:
+ # troveTuple is probably what we want to store in the cachedb
+ # Then use the below methods to present them in a nicer fashion
+ if troveTuple[0].endswith(':source'):
+ continue
+ if ":" in troveTuple[0]:
+ fragments = troveTuple[0].split(":")
+ trove = fragments[0]
+ component = fragments[1]
+ else:
+ trove = troveTuple[0]
+ component = ""
+
+ installed = 0
+ flavor = troveTuple[2].freeze()
+ fullVersion = troveTuple[1].freeze()
+ label = str(troveTuple[1].branch().label())
+ description = ""
+ category = ""
+ packagegroup = ""
+ size = ""
+ packages.append([trove, component, fullVersion, label, flavor,
+ description, category, packagegroup, size])
+
+ return packages
+
+ def connect_memory(self):
+ return sqlite.connect(':memory:')
+
+ def cursor(self, connection):
+ return connection.cursor()
+
+ def _create_database(self):
+ #FIXME: delete the category column. it's not useful
+ """ Creates a blank database. """
+ sql = '''CREATE TABLE conary_packages (
+ packageId INTEGER,
+ trove text,
+ component text,
+ version text,
+ label text,
+ flavor text,
+ description text,
+ category text,
+ packagegroup text,
+ size text)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_categories (
+ categoryId INTEGER,
+ categoryName text)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_category_package_map (
+ categoryId INTEGER,
+ packageId INTEGER)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_licenses (
+ licenseId INTEGER,
+ licenseName text)'''
+
+ self.cursor.execute(sql)
+
+ sql = '''CREATE TABLE conary_license_package_map (
+ licenseId INTEGER,
+ packageId INTEGER)'''
+
+ self.cursor.execute(sql)
+
+ #self.conn.createIndex('conary_catagories', 'conary_category_name_idx', ['categoryName'])
+ #self.conn.createIndex('conary_catagories', 'conary_category_id_idx', ['categoryId'])
+ self.conn.commit()
+
+
+
+ def commit(self):
+ self.cursor.commit()
+
+ def getTroves(self, label=None):
+ """
+ Returns all troves for now. Add filtering capability.
+ """
+ stmt = ("select distinct trove, version, flavor, description, "
+ "category, packagegroup, size from conary_packages")
+
+ self.cursor.execute(stmt)
+ return self.cursor.fetchall()
+
+ def search(self, package, fullVersion=None):
+ """
+ Returns all troves for now. Add filtering capability.
+ """
+ #log.debug(package)
+ stmt = ("select distinct trove, version, flavor, description, "
+ "category, packagegroup, size from conary_packages")
+
+ if package and fullVersion:
+ stmt = ("select distinct trove, version, flavor from "
+ "conary_packages where trove ='%s' and version = '%s'"
+ % (package, fullVersion))
+ elif package:
+ stmt += (" where trove like '%%%s%%' and component = '' order by "
+ "version desc" % package)
+
+ try:
+ self.cursor.execute(stmt)
+ results = self.cursor.fetchall()
+ log.debug(results)
+ return results
+ except Exception, e:
+ print str(e)
+ return None
+
+ def searchByGroups(self, groups):
+ """
+ Returns all troves for given groups. (trove, version, flavor)
+ Needs filtering capability.
+ ['all'] means all packages
+ FIXME: No filtering done on group text - SQL injection
+ """
+ if not groups:
+ groups = ["all"]
+
+ if "all" in groups:
+ stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
+ " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
+ " WHERE CCMap.packageId = CP.packageId"
+ " AND CCMap.categoryId = CC.categoryId"
+ " GROUP BY CP.trove, CP.version, CP.flavor"
+ " ORDER BY CP.trove, CP.version DESC, CP.flavor")
+ else:
+ group_string = ", ".join(groups)
+ stmt = ("SELECT DISTINCT CP.trove, CP.version, CP.flavor, CC.categoryName"
+ " FROM conary_packages CP, conary_categories CC, conary_category_package_map CCMap"
+ " WHERE CC.categoryName IN (%s)"
+ " AND CCMap.packageId = CP.packageId"
+ " AND CCMap.categoryId = CC.categoryId"
+ " GROUP BY CP.trove, CP.version, CP.flavor"
+ " ORDER BY CP.trove, CP.version DESC, CP.flavor" % group_string)
+
+ try:
+ self.cursor.execute(stmt)
+ return self.cursor.fetchall()
+ except Exception, e:
+ print str(e)
+ return None
+
+ def _insert(self, trove):
+ """
+ Insert trove into database.
+ """
+ res = self.cursor.execute("SELECT COALESCE(max(packageId), 0) + 1 FROM conary_packages")
+ pkgId = res.fetchone()[0] + 1
+ trove = [pkgId] + trove[:]
+
+ values = [str(field) for field in trove]
+ cols = ", ".join("?" * len(trove))
+ sql = "INSERT INTO conary_packages VALUES (%s)" % cols
+
+ try:
+ self.cursor.execute(sql, values)
+ #self.conn.commit()
+ except Exception, e:
+ print str(e)
+
+ def _clear_table(self, tableName='conary_packages'):
+ """
+ Deletes * records from table.
+ """
+ stmt = "DELETE FROM %s" % tableName
+ try:
+ self.cursor.execute(stmt)
+ except dbstore.sqlerrors.InvalidTable:
+ pass
+
+ def populate_database(self):
+ packages = self.conaryquery()
+ # Clear table first
+ for tblName in ('conary_packages', 'conary_category_package_map',
+ 'conary_categories'):
+ self._clear_table(tblName)
+ log.info("Insertando datos")
+ for package in packages:
+ self._insert(package)
+ self.conn.commit()
+ log.info("Datos insertados")
+
+ def _addPackageCategory(self, trv, category):
+ res = self.cursor.execute( \
+ 'SELECT packageId FROM conary_packages WHERE trove=? and version=? and flavor = ?', trv.getName(), trv.getVersion().freeze(), trv.getFlavor().freeze())
+ res = res.fetchone()
+ if res:
+ # we have a packageID
+ pkgId = res[0]
+ else:
+ # we really should have had this data
+ raise RuntimeError
+
+ # now look up/make the categoryId
+ res = self.cursor.execute('SELECT categoryId FROM conary_categories WHERE categoryName=?', category)
+ res = res.fetchone()
+ if not res:
+ res = self.cursor.execute('SELECT COALESCE(MAX(categoryId), 0) + 1 FROM conary_categories')
+ catId = res.fetchone()[0]
+ self.cursor.execute('INSERT INTO conary_categories VALUES(?, ?)',
+ catId, category)
+ else:
+ catId = category
+
+ self.cursor.execute("INSERT INTO conary_category_package_map VALUES(?, ?)", catId, pkgId)
+ self.conn.commit()
+
+ def populate_metadata(self, csList):
+ for cs in csList:
+ for troveCS in cs.iterNewTroveList():
+ trv = trove.Trove(troveCS)
+ if ':' in trv.getName():
+ # components aren't tracked at the moment
+ continue
+ metadata = trv.getMetadata()
+ categories = metadata.get('categories', [])
+ for category in categories:
+ self._addPackageCategory(trv, category)
+ #licenses = metadata.get('licenses', [])
+ #for license in licenses:
+ # self._addPackageLicense(trv, license)
diff --git a/backends/conary/Makefile.am b/backends/conary/Makefile.am
index 5b88383..400f706 100644
--- a/backends/conary/Makefile.am
+++ b/backends/conary/Makefile.am
@@ -4,10 +4,8 @@ dist_helper_DATA = \
conaryFilter.py \
conaryCallback.py \
conaryInit.py \
- XMLCache.py \
- pkConaryLog.py \
- conarypk.py \
- conaryEnums.py
+ Cache.py \
+ pkConaryLog.py
plugindir = $(PK_PLUGIN_DIR)
plugin_LTLIBRARIES = libpk_backend_conary.la
diff --git a/backends/conary/XMLCache.py b/backends/conary/XMLCache.py
deleted file mode 100644
index bf28770..0000000
--- a/backends/conary/XMLCache.py
+++ /dev/null
@@ -1,280 +0,0 @@
-import os
-import sys
-from xml.dom.minidom import parse
-import urllib as url
-
-
-from conary.lib import sha1helper
-from conary.lib import util
-
-from packagekit.backend import PackageKitBaseBackend
-from packagekit.enums import ERROR_NO_CACHE
-
-
-from pkConaryLog import log
-from conarypk import ConaryPk
-from conaryEnums import groupMap
-
-def getGroup( categorieList):
- where = {}
- for cat in categorieList:
- for group,categories in groupMap.items():
- if cat in categories:
- if where.has_key(group):
- where[group] = where[group] +1
- else:
- where[group] = 1
-
- return max( where.iteritems())[0]
-
-
-class XMLRepo:
- xml_path = ""
- repository = ""
- def __init__(self, repo, path ):
- self.xml_path = path
- self._setRepo(repo)
-
- def resolve(self, search_trove):
- """ resolve its a search with name """
- trove = self._getPackage(search_trove)
- if trove:
- return trove
- else:
- return None
-
- def search(self, search, where ):
- if where == "name":
- return self._searchNamePackage(search)
- elif where == "details":
- return self._searchDetailsPackage(search)
- elif where == "group":
- return self._searchGroupPackage(search)
- else:
- return self._searchPackage(search)
-
- def _setRepo(self,repo):
- self.repo = repo
- doc = self._open()
- self.label = str( doc.childNodes[0].getAttribute("label") )
-
- def _open(self):
- try:
- return self._repo
- except AttributeError:
- self._repo = parse( open( self.xml_path + self.repo) )
- return self._repo
-
- def _generatePackage(self, package_node ):
- """ convert from package_node to dictionary """
- pkg = {}
- cat = []
- for node in package_node.childNodes:
- if pkg.has_key('category'):
- cat.append(str(node.childNodes[0].nodeValue))
- else:
- pkg[str(node.nodeName)] = str(node.childNodes[0].nodeValue)
- pkg["category"] = cat
- return pkg
-
- def _getPackage(self, name):
- doc = self._open()
- results = []
- for packages in doc.childNodes:
- for package in packages.childNodes:
- pkg = self._generatePackage(package)
- pkg["label"] = self.label
- if name == pkg["name"]:
- return pkg
- return None
-
- def _searchNamePackage(self, name):
- doc = self._open()
- results = []
- for packages in doc.childNodes:
- for package in packages.childNodes:
- pkg = self._generatePackage(package)
- pkg["label"] = self.label
- if name.lower() in pkg["name"]:
- results.append(pkg['name'])
- return [ self._getPackage(i) for i in set(results) ]
-
- def _searchGroupPackage(self, name):
- doc = self._open()
- results_name = []
- for packages in doc.childNodes:
- for package in packages.childNodes:
- pkg = self._generatePackage(package)
- pkg["label"] = self.label
- """
- if not pkg.has_key("category"):
- continue
- for j in pkg["category"]:
- if name.lower() in j.lower():
- results_name.append(pkg['name'])
- """
- if pkg.has_key("category"):
- group = getGroup(pkg["category"])
- if name.lower() == group:
- results_name.append(pkg["name"])
- return [ self._getPackage(i) for i in set(results_name) ]
-
- def _searchDetailsPackage(self, name):
- return self._searchPackage(name)
- def _searchPackage(self, name):
- doc = self._open()
- results = []
- for packages in doc.childNodes:
- for package in packages.childNodes:
- pkg = self._generatePackage(package)
- pkg["label"] = self.label
- for i in pkg.keys():
- if i == "label":
- continue
- if i =='category':
- for j in pkg[i]:
- if name.lower() in j.lower():
- results.append(pkg['name'])
- if name.lower() in pkg[i]:
- results.append(pkg['name'])
- return [ self._getPackage(i) for i in set(results) ]
- def _getAllPackages(self):
- doc = self._open()
- results = []
- for packages in doc.childNodes:
- for package in packages.childNodes:
- pkg = self._generatePackage(package)
- pkg["label"] = self.label
- results.append(pkg)
- return results
-
-
-class XMLCache:
- #xml_files = ["foresight.rpath.org at fl:2"]
- xml_files = []
- server = "http://packages.foresightlinux.org/cache/"
- repos = []
- dbPath = '/var/cache/conary/'
- jobPath = dbPath + 'jobs'
- xml_path = dbPath + "xmlrepo/"
-
- def __init__(self):
- con = ConaryPk()
- labels = con.get_labels_from_config()
-
- if not os.path.isdir(self.dbPath):
- os.makedirs(self.dbPath)
- if not os.path.isdir(self.jobPath):
- os.mkdir(self.jobPath)
- if not os.path.isdir( self.xml_path ):
- os.makedirs(self.xml_path )
-
- for xml_file in labels:
- if not os.path.exists( self.xml_path + xml_file + ".xml" ):
- self._fetchXML()
- for xml_file in labels :
- self.repos.append(XMLRepo( xml_file + ".xml", self.xml_path ))
-
- def _getJobCachePath(self, applyList):
- applyStr = '\0'.join(['%s=%s[%s]--%s[%s]%s' % (x[0], x[1][0], x[1][1], x[2][0], x[2][1], x[3]) for x in applyList])
- return self.jobPath + '/' + sha1helper.sha1ToString(sha1helper.sha1String(applyStr))
-
- def checkCachedUpdateJob(self, applyList):
- jobPath = self._getJobCachePath(applyList)
- if os.path.exists(jobPath):
- return jobPath
-
- def cacheUpdateJob(self, applyList, updJob):
- jobPath = self._getJobCachePath(applyList)
- if os.path.exists(jobPath):
- util.rmtree(jobPath)
- os.mkdir(jobPath)
- updJob.freeze(jobPath)
-
- def getTroves(self):
- pass
- def searchByGroups(self, groups):
- pass
- def refresh(self):
- self._fetchXML()
- def resolve(self, name ):
- for repo in self.repos:
- r = repo.resolve(name)
- if r:
- return r
- else:
- return None
-
- def search(self, search, where = "name" ):
- """
- @where (string) values = name | details | group |
- """
- repositories_result = []
- for repo in self.repos:
- results = repo.search(search , where )
- for i in results:
- repositories_result.append(i)
- return repositories_result
-
- def _fetchXML(self ):
- con = ConaryPk()
- labels = con.get_labels_from_config()
- for i in labels:
- label = i + '.xml'
- filename = self.xml_path + label
- wwwfile = self.server + label
- try:
- wget = url.urlopen( wwwfile )
- except:
- Pk = PackageKitBaseBackend("")
- Pk.error(ERROR_NO_CACHE," %s can not open" % wwwfile)
- openfile = open( filename ,'w')
- openfile.writelines(wget.readlines())
- openfile.close()
- def getGroup(self,categorieList):
- return getGroup(categorieList)
-
- def _getCategorieBase(self, mapDict, categorieList ):
- if not categorieList:
- return None
-
- tempDict = {}
- for cat in categorieList:
-
- if mapDict.has_key(cat):
- map = mapDict[cat]
- else:
- continue
-
- if tempDict.has_key(map):
- tempDict[map] = tempDict[map] + 1
- else:
- tempDict[map] = 1
- tmp = 0
- t_key = ""
- for key, value in tempDict.items():
- if value > tmp:
- t_key = key
- tmp = value
- return t_key
-
- def _getAllCategories(self):
- categories = []
- for i in self.repos:
- pkgs = i._getAllPackages()
- for pkg in pkgs:
- if pkg.has_key('category'):
- for cat in pkg["category"]:
- categories.append(cat)
- categories.sort()
- return set( categories )
-
-
-if __name__ == '__main__':
- # print ">>> name"
- # print XMLCache().search('music', 'name' )
- # print ">> details"
- l= XMLCache().search('Internet', 'group' )
- for v,p in enumerate(l):
- print v,p["name"]
- # print XMLCache().getGroup(['GTK', 'Graphics', 'Photography', 'Viewer'])
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
old mode 100755
new mode 100644
index 6aac099..3cdd6d1
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -28,31 +28,96 @@ from conary.deps import deps
from conary import dbstore, queryrep, versions, updatecmd
from conary.local import database
from conary import trove
-from conary.conaryclient import cmdline
from packagekit.backend import *
from packagekit.package import *
-from packagekit.progress import PackagekitProgress
from conaryCallback import UpdateCallback
from conaryFilter import *
-from XMLCache import XMLCache as Cache
-from conaryInit import *
+#from XMLCache import XMLCache as Cache
+# zodman fix
+from Cache import Cache
from conaryInit import init_conary_config, init_conary_client
from conary import conarycfg, conaryclient
-from conarypk import ConaryPk
pkpackage = PackagekitPackage()
from pkConaryLog import log, pdb
+groupMap = {
+ '2DGraphics' : GROUP_GRAPHICS,
+ 'Accessibility' : GROUP_ACCESSIBILITY,
+ 'AdvancedSettings' : GROUP_ADMIN_TOOLS,
+ 'Application' : GROUP_OTHER,
+ 'ArcadeGame' : GROUP_GAMES,
+ 'Audio' : GROUP_MULTIMEDIA,
+ 'AudioVideo' : GROUP_MULTIMEDIA,
+ 'BlocksGame' : GROUP_GAMES,
+ 'BoardGame' : GROUP_GAMES,
+ 'Calculator' : GROUP_ACCESSORIES,
+ 'Calendar' : GROUP_ACCESSORIES,
+ 'CardGame' : GROUP_GAMES,
+ 'Compiz' : GROUP_SYSTEM,
+ 'ContactManagement' : GROUP_ACCESSORIES,
+ 'Core' : GROUP_SYSTEM,
+ 'Database' : GROUP_SERVERS,
+ 'DesktopSettings' : GROUP_ADMIN_TOOLS,
+ 'Development' : GROUP_PROGRAMMING,
+ 'Email' : GROUP_INTERNET,
+ 'FileTransfer' : GROUP_INTERNET,
+ 'Filesystem' : GROUP_SYSTEM,
+ 'GNOME' : GROUP_DESKTOP_GNOME,
+ 'GTK' : GROUP_DESKTOP_GNOME,
+ 'GUIDesigner' : GROUP_PROGRAMMING,
+ 'Game' : GROUP_GAMES,
+ 'Graphics' : GROUP_GRAPHICS,
+ 'HardwareSettings' : GROUP_ADMIN_TOOLS,
+ 'IRCClient' : GROUP_INTERNET,
+ 'InstantMessaging' : GROUP_INTERNET,
+ 'LogicGame' : GROUP_GAMES,
+ 'Monitor' : GROUP_ADMIN_TOOLS,
+ 'Music' : GROUP_MULTIMEDIA,
+ 'Network' : GROUP_INTERNET,
+ 'News' : GROUP_INTERNET,
+ 'Office' : GROUP_OFFICE,
+ 'P2P' : GROUP_INTERNET,
+ 'PackageManager' : GROUP_ADMIN_TOOLS,
+ 'Photography' : GROUP_MULTIMEDIA,
+ 'Player' : GROUP_MULTIMEDIA,
+ 'Presentation' : GROUP_OFFICE,
+ 'Publishing' : GROUP_OFFICE,
+ 'RasterGraphics' : GROUP_GRAPHICS,
+ 'Security' : GROUP_SECURITY,
+ 'Settings' : GROUP_ADMIN_TOOLS,
+ 'Spreadsheet' : GROUP_OFFICE,
+ 'System' : GROUP_SYSTEM,
+ 'Telephony' : GROUP_COMMUNICATION,
+ 'TerminalEmulator' : GROUP_ACCESSORIES,
+ 'TextEditor' : GROUP_ACCESSORIES,
+ 'Utility' : GROUP_ACCESSORIES,
+ 'VectorGraphics' : GROUP_GRAPHICS,
+ 'Video' : GROUP_MULTIMEDIA,
+ 'Viewer' : GROUP_MULTIMEDIA,
+ 'WebBrowser' : GROUP_INTERNET,
+ 'WebDevelopment' : GROUP_PROGRAMMING,
+ 'WordProcessor' : GROUP_OFFICE
+}
+
+revGroupMap = {}
+
+for (con_cat, pk_group) in groupMap.items():
+ if revGroupMap.has_key(pk_group):
+ revGroupMap[pk_group].append(con_cat)
+ else:
+ revGroupMap[pk_group] = [con_cat]
+
+#from conary.lib import util
+#sys.excepthook = util.genExcepthook()
-from conary.lib import util
-sys.excepthook = util.genExcepthook()
def ExceptionHandler(func):
- return func
def display(error):
return str(error).replace('\n', ' ')
+
def wrapper(self, *args, **kwargs):
try:
return func(self, *args, **kwargs)
@@ -68,6 +133,7 @@ def ExceptionHandler(func):
except Exception, e:
self.error(ERROR_UNKNOWN, display(e), exit=True)
return wrapper
+
def _format_str(str):
"""
Convert a multi line string to a list separated by ';'
@@ -105,7 +171,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
frzFlavor = flavor.freeze()
return ','.join([frzVersion, frzFlavor])
- def _thawData(self, frzVersion, frzFlavor ):
+ def _thawData(self, data):
+ frzVersion, frzFlavor = data.split(',')
version = versions.ThawVersion(frzVersion)
flavor = deps.ThawFlavor(frzFlavor)
return version, flavor
@@ -118,73 +185,80 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
return ','.join(arches)
@ExceptionHandler
- def check_installed(self, troveTuple):
- log.debug("============check installed =========")
- cli = ConaryPk()
- result = cli.query(troveTuple[0])
- if result:
- installed = INFO_INSTALLED
- else:
- installed = INFO_AVAILABLE
-
- return installed
-
- @ExceptionHandler
def get_package_id(self, name, versionObj, flavor):
-
version = versionObj.trailingRevision()
-
arch = self._get_arch(flavor)
-
- cache = Cache()
- pkg = cache.resolve(name)
- data = versionObj.asString() + "#"
- if pkg:
- try:
- data +=str(pkg)
- except:
- pass
+ data = self._freezeData(versionObj, flavor)
return pkpackage.get_package_id(name, version, arch, data)
@ExceptionHandler
def get_package_from_id(self, package_id):
""" package_id(string) =
- "dpaster;0.1-3-1;x86;/foresight.rpath.org at fl:2-qa/0.1-3-1#{'version': '0.1-3-1', 'category': [], 'name': 'dpaster', 'label': 'foresight.rpath.org at fl:2-qa'}"
+ "pastebinit;0.7-1-1;x86;/foresight.rpath.org at fl:2-qa/1222042924.172:0.7-1-1,1#x86"
"""
log.info("=========== get package from package_id ======================")
+ log.info(package_id)
name, verString, archString, data = pkpackage.get_package_from_id(package_id)
- summary = data.split("#")
- repo = summary[0]
- if summary[1]:
- metadata = eval(summary[1])
- else:
- metadata = {}
- cli = ConaryPk()
- return cli.request_query(name)
+ log.info(data)
+ version, flavor = self._thawData(data)
+ return name, version, flavor
- def _do_search(self, filters, searchlist, where = "name"):
+ def _do_search(self, searchlist, filters):
"""
- searchlist(str)ist as the package for search like
- filters(str) as the filter
+ searchlist(str)ist as the package for search like
+ filters(str) as the filter
"""
fltlist = filters.split(';')
- if where != "name" and where != "details" and where != "group":
- log.info("where %s" % where)
- self.error(ERROR_UNKNOWN, "DORK---- search where not found")
+ pkgfilter = ConaryFilter(fltlist)
+ #pkgfilter = ConaryFilter()
+
+ troveSpecs = [ updatecmd.parseTroveSpec(searchlist,
+ allowEmptyName=False) ]
+ # get a hold of cached data
cache = Cache()
log.debug((searchlist, fltlist))
- troveTupleList = cache.search(searchlist, where )
+ try:
+ troveTupleList = cache.search(searchlist)
+ log.info("FOUND!!!!!! %s"% str(troveTupleList))
+ finally:
+ pass
- if len(troveTupleList) > 0 :
- for i in troveTupleList:
- log.info("FOUND!!!!!! %s " % i["name"] )
- log.info("FOUND (%s) elements " % len(troveTupleList) )
+ # Remove dupes
+ tempDict = {}
+ try:
+ for element in troveTupleList:
+ tempDict[element] = None
+ except TypeError:
+ del tempDict # move on to the next method
else:
- log.info("NOT FOUND %s " % searchlist )
- self.error(ERROR_PACKAGE_NOT_FOUND, "Not Found %s " % searchlist )
+ troveTupleList = tempDict.keys()
+
+ # Get the latest first
+ troveTupleList.sort()
+ troveTupleList.reverse()
- self._resolve_list( fltlist, troveTupleList )
+ for troveTuple in troveTupleList:
+ troveTuple = tuple([item.encode('UTF-8') for item in troveTuple])
+ name = troveTuple[0]
+ version = versions.ThawVersion(troveTuple[1])
+ flavor = deps.ThawFlavor(troveTuple[2])
+ troveTuple = tuple([name, version, flavor])
+ log.info("TROVETUPLE %s" % str(troveTuple))
+ installed = self.check_installed(troveTuple)
+
+ if installed is "installed":
+ pkgfilter.add_installed([troveTuple])
+ log.info(" === Installed ========= %s" % name)
+ else:
+ pkgfilter.add_available([troveTuple])
+ log.info("=== Available====== %s" % name)
+
+ # we couldn't do this when generating the list
+
+ package_list = pkgfilter.post_process()
+ log.info("package_list %s" %package_list)
+ self._show_package_list(package_list)
def _get_update(self, applyList, cache=True):
updJob = self.client.newUpdateJob()
@@ -221,133 +295,111 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
applyList = [(name, (None, None), (version, flavor), True)]
return self._do_update(applyList)
- def _resolve_list(self, filters, pkgsList ):
- log.info("======= _resolve_list =====")
- specList = []
- cli = ConaryPk()
- for pkg in pkgsList:
- name = pkg["name"]
- repo = pkg["label"]
- version = pkg["version"]
- trove = name, None , cli.flavor
- specList.append( trove )
- trovesList = cli.repos.findTroves(cli.default_label, specList )
-
- pkgFilter = ConaryFilter(filters)
- troves = trovesList.values()
- for trovelst in troves:
- t = trovelst[0]
- installed = pkgFilter._pkg_is_installed( t[0] )
- if installed:
- pkgFilter.add_installed( trovelst )
- else:
- pkgFilter.add_available( trovelst )
-
-
- package_list = pkgFilter.post_process()
- self._show_package_list(package_list)
-
@ExceptionHandler
- def resolve(self, filters, package ):
- """
- @filters (list) list of filters
- @package (list ) list with packages name for resolve
- """
+ def resolve(self, filters, packages):
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_INFO)
-
log.info("======== resolve =========")
- log.info("filters: %s package:%s " % (filters, package))
+ log.info("filters: %s package:%s " % (filters, packages))
+ if len(packages):
+ for i in packages:
+ self._do_search(i, filters)
+ else:
+ self._do_search(packages, filters)
- cache = Cache()
- pkg_dict = cache.resolve( package[0] )
+ @ExceptionHandler
+ def check_installed(self, troveTuple):
+ log.debug("============check installed =========")
+ log.info(troveTuple)
+ db = conaryclient.ConaryClient(self.cfg).db
+ try:
+ troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
+ localInstall = db.findTrove(None, troveTuple)
+ installed = INFO_INSTALLED
+ except:
+ installed = INFO_AVAILABLE
+ log.info(installed)
+ return installed
- if pkg_dict is None:
- self.error(ERROR_INTERNAL_ERROR, "Package Not found on repository")
+ def _pkg_is_installed(self, pkg):
+ '''
+ Return if the package is installed.
+ '''
+ return self.check_installed(pkg)
- filter = ConaryFilter(filters)
+ @ExceptionHandler
+ def search_group(self, filters, key):
+ '''
+ Implement the {backend}-search-name functionality
+ FIXME: Ignoring filters for now.
+ '''
+ self.allow_cancel(True)
+ self.percentage(None)
+ self.status(STATUS_QUERY)
- installed = filter._pkg_is_installed( pkg_dict["name"] )
-
- conary_cli = ConaryPk()
+ fltlist = filters.split(';')
+ pkgfilter = ConaryFilter(fltlist)
+ pkgfilter = ConaryFilter(fltlist)
+ cache = Cache()
- troveTuple = conary_cli.request_query( package[0] )
+ try:
+ troveTupleList = cache.searchByGroups(revGroupMap[key])
+ finally:
+ # FIXME: Really need to send an error here
+ pass
- log.info(">>> %s" % troveTuple)
+ troveTupleList.sort()
+ troveTupleList.reverse()
- if installed:
- filter.add_installed( troveTuple )
- else:
- filter.add_available( troveTuple )
+ for troveTuple in troveTupleList:
+ troveTuple = tuple([item.encode('UTF-8') for item in troveTuple[0:2]])
+ name = troveTuple[0]
+ version = versions.ThawVersion(troveTuple[1])
+ flavor = deps.ThawFlavor(troveTuple[2])
+ category = troveTuple[3][0]
+ category = category.encode('UTF-8')
+ troveTuple = tuple([name, version, flavor])
+ installed = self.check_installed(troveTuple)
+ if installed:
+ pkgfilter.add_installed([troveTuple])
+ else:
+ pkgfilter.add_available([troveTuple])
- package_list = filter.post_process()
+ # we couldn't do this when generating the list
+ package_list = pkgfilter.post_process()
log.info("package_list %s" % package_list)
self._show_package_list(package_list)
def _show_package_list(self, lst):
- """
- HOW its showed on packageKit
- @lst(list(tuple) = [ ( troveTuple, status ) ]
- """
+ log.info("------------- show_package_list ----------")
+ log.info(lst)
for troveTuple, status in lst:
- # take the basic info
name = troveTuple[0]
version = troveTuple[1]
flavor = troveTuple[2]
- # get the string id from packagekit
package_id = self.get_package_id(name, version, flavor)
-
- # split the list for get Determine info
- summary = package_id.split(";")
- repo = summary[3].split("#")[0]
-
- metadata = eval(summary[3].split("#")[1])
- log.info("====== show the package ")
- log.info(metadata)
- if metadata.has_key("shortDesc"):
- meta = metadata["shortDesc"]
- else:
- meta = " "
- self.package(package_id, status, meta )
-
- @ExceptionHandler
- def search_group(self, options, searchlist):
- '''
- Implement the {backend}-search-group functionality
- '''
- log.info("============= search_group ========")
- self.allow_cancel(True)
- self.percentage(None)
- self.status(STATUS_QUERY)
- log.info("options: %s searchlist:%s "%(options, searchlist))
- self._do_search(options, searchlist, 'group')
-
+ log.info("pkg id")
+ log.info(package_id)
+ summary = self._get_metadata(package_id, 'shortDesc') or " "
+ #summary = " "
+ log.info("####Package %s %s %s" % (package_id, status, summary ))
+ self.package(package_id, status, summary)
@ExceptionHandler
def search_name(self, options, searchlist):
'''
Implement the {backend}-search-name functionality
'''
- log.info("============= search_name ========")
self.allow_cancel(True)
self.percentage(None)
self.status(STATUS_QUERY)
+ log.info("============= search_name ========")
log.info("options: %s searchlist:%s "%(options, searchlist))
- self._do_search(options, searchlist, 'name')
+ self._do_search(searchlist, options)
- @ExceptionHandler
- def search_details(self, options, search):
- '''
- Implement the {backend}-search-details functionality
- '''
- log.info("============= search_details ========")
- self.allow_cancel(True)
- #self.percentage(None)
- self.status(STATUS_QUERY)
- log.info("options: %s searchlist:%s "%(options, search))
- self._do_search(options, search, 'details' )
-
+ def search_details(self, opt, key):
+ pass
def get_requires(self, filters, package_ids, recursive_text):
pass
@@ -391,17 +443,15 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
withFiles = True):
files.append(path)
return files
-
- for package in package_id.split("&"):
- log.info(package)
- name, version, flavor, installed = self._findPackage(package)
- if installed == INFO_INSTALLED:
- files = _get_files(self.client.db, name, version, flavor)
- else:
- files = _get_files(self.client.repos, name, version, flavor)
+ name, version, flavor, installed = self._findPackage(package_id)
+
+ if installed == INFO_INSTALLED:
+ files = _get_files(self.client.db, name, version, flavor)
+ else:
+ files = _get_files(self.client.repos, name, version, flavor)
- self.files(package_id, ';'.join(files))
+ self.files(package_id, ';'.join(files))
@ExceptionHandler
def update_system(self):
@@ -410,13 +460,15 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
updJob, suggMap = self._do_update(applyList)
-# @ExceptionHandler
+ @ExceptionHandler
def refresh_cache(self):
#log.debug("refresh-cache command ")
self.percentage()
self.status(STATUS_REFRESH_CACHE)
cache = Cache()
- cache.refresh()
+ if not cache.is_populate_database:
+ self.status(STATUS_WAIT)
+ cache.populate_database()
@ExceptionHandler
def update(self, package_ids):
@@ -426,13 +478,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.allow_cancel(True)
self.percentage(0)
self.status(STATUS_RUNNING)
-
+
for package in package_ids.split(" "):
name, version, flavor, installed = self._findPackage(package)
if name:
- # self._do_package_update(name, version, flavor)
- cli = ConaryPk()
- cli.update(name)
+ self._do_package_update(name, version, flavor)
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'No available updates')
@@ -447,10 +497,12 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
Implement the {backend}-{install, update}-packages functionality
'''
-
+ log.info(package_ids)
+ #for package_id in package_ids.split('%'):
for package_id in package_ids:
+ log.info(package_id)
name, version, flavor, installed = self._findPackage(package_id)
- log.info((name, version, flavor, installed ))
+ log.info((name, version))
self.allow_cancel(True)
self.percentage(0)
@@ -462,9 +514,7 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'Package already installed')
self.status(INFO_INSTALLING)
- log.info(">>> Prepare Update")
self._get_package_update(name, version, flavor)
- log.info(">>> end Prepare Update")
self._do_package_update(name, version, flavor)
else:
self.error(ERROR_PACKAGE_ALREADY_INSTALLED, 'Package was not found')
@@ -575,11 +625,11 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
#vendor_url = _format_list(urls['vendor'])
vendor_url = ""
reboot = "none"
- desc = " "
+ desc = self._get_metadata(package_id, 'longDesc') or " "
self.update_detail(package_id, update, obsolete, vendor_url, bz_url, cve_url,
reboot, desc, changelog="", state="", issued="", updated="")
- # @ExceptionHandler
+ @ExceptionHandler
def get_details(self, package_ids):
'''
Print a detailed description for a given package
@@ -592,52 +642,26 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
log.info(package_ids[0])
package_id = package_ids[0]
name, version, flavor, installed = self._findPackage(package_id)
-
- summary = package_id.split(";")
- log.info("====== summar")
- log.info(summary)
- repo = summary[3].split("#")[0]
- metadata = eval(summary[3].split("#")[1])
- short_package_id = ""
- for i in summary[0:3]:
- short_package_id += i +';'
-
- log.info("Metadata--------------------")
- log.info(metadata)
+ log.info("name--------------------")
+ log.info((package_id, name))
if name:
- if metadata.has_key("shortDesc"):
- shortDesc = metadata["shortDesc"]
- else:
- shortDesc = ""
- if metadata.has_key("longDesc"):
- longDesc = metadata["longDesc"]
- else:
- longDesc = ""
+ shortDesc = self._get_metadata(package_id, 'shortDesc') or name
+ longDesc = self._get_metadata(package_id, 'longDesc') or ""
+ url = "http://www.foresightlinux.org/packages/" + name + ".html"
+ categories = self._get_metadata(package_id, 'categories') or "unknown"
- url = "http://www.foresightlinux.org/packages/%s.html" % name
-
- categories = ""
- if metadata.has_key("category"):
- categories = Cache().getGroup( metadata['category'])
- else:
- categories = None
# Package size goes here, but I don't know how to find that for conary packages.
- self.details(short_package_id, None, categories, longDesc, url, 0)
+ self.details(package_id, None, categories, longDesc, url, 0)
else:
self.error(ERROR_PACKAGE_NOT_FOUND, 'Package was not found')
def _show_package(self, name, version, flavor, status):
''' Show info about package'''
package_id = self.get_package_id(name, version, flavor)
- summary = package_id.split(";")
- metadata = eval(summary[3].split("#")[1])
- if metadata.has_key("shortDesc"):
- meta = metadata["shortDesc"]
- else:
- meta = " "
- self.package(package_id, status, meta)
+ summary = self._get_metadata(package_id, 'shortDesc') or ""
+ self.package(package_id, status, summary)
def _get_status(self, notice):
# We need to figure out how to get this info, this is a place holder
@@ -656,19 +680,14 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
self.status(STATUS_INFO)
log.info("============== get_updates ========================")
updateItems = self.client.fullUpdateItemList()
- log.info("============== end get_updates ========================")
applyList = [ (x[0], (None, None), x[1:], True) for x in updateItems ]
- log.info("_get_update ....")
updJob, suggMap = self._get_update(applyList)
- log.info("_get_update ....end.")
jobLists = updJob.getJobs()
- log.info("get Jobs")
totalJobs = len(jobLists)
for num, job in enumerate(jobLists):
status = '2'
- log.info( (num, job) )
name = job[0][0]
# On an erase display the old version/flavor information.
@@ -692,16 +711,12 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
log.info("========== _findPackage ==========")
log.info(package_id)
- troveTuples = self.get_package_from_id(package_id)
- for troveTuple in troveTuples:
- log.info("======== trove ")
- log.info(troveTuple)
- installed = self.check_installed(troveTuple)
- log.info(installed)
- name, version, flavor = troveTuple
- return name, version, flavor, installed
- else:
- self.error(ERROR_INTERNAL_ERROR, "package_id Not Correct ")
+ name, version, flavor = self.get_package_from_id(package_id)
+ troveTuple = (name, version, flavor)
+ log.info("======== trove ")
+ log.info(troveTuple)
+ installed = self.check_installed(troveTuple)
+ return name, version, flavor, installed
def repo_set_data(self, repoid, parameter, value):
'''
@@ -721,12 +736,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'''
pass
-from pkConaryLog import pdb
-
def main():
backend = PackageKitConaryBackend('')
log.info("======== argv =========== ")
- log.info(sys.argv[1:])
+ log.info(sys.argv)
backend.dispatcher(sys.argv[1:])
if __name__ == "__main__":
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index d7b9922..464e42f 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -20,83 +20,63 @@
from conary import callbacks
from packagekit.backend import *
-from packagekit.progress import PackagekitProgress
from pkConaryLog import log
class UpdateCallback(callbacks.UpdateCallback):
- # 3P >>> ( prepare Update end )
def resolvingDependencies(self):
#self.backend.status('Resolving Dependencies')
- log.info("Callback ........ STATUS_DEP_RESOLVE ")
self.backend.status(STATUS_DEP_RESOLVE)
- self.progress.step()
- #5A >> status_install preparing Update
+
def creatingRollback(self):
#self.backend.status('Creating Rollback')
- log.info("Callback ........ STATUS_ROLLBACK ")
+ log.info("Callback ........ STATUS_ROLLBACK ")
self.backend.status(STATUS_ROLLBACK)
- # 7A >> update done
+
def committingTransaction(self):
#self.backend.status('Committing Transaction')
- log.info("Callback ........ STATUS_COMMIT transactions ")
+ log.info("Callback ........ STATUS_COMMIT ")
self.backend.status(STATUS_COMMIT)
def downloadingFileContents(self, got, need):
#self.backend.status('Downloading files for changeset')
- log.info("Callback ........ STATUS_DOWNLOAD FIle Contents %s " % str( got*100/need ))
+ log.info("Callback ........ STATUS_DOWNLOAD ")
self.backend.status(STATUS_DOWNLOAD)
- #self.backend.sub_percentage(got*100/need)
- # 2P >> dep_resolve
- # 2 A >>> set Update Hunk
+
def downloadingChangeSet(self, got, need):
+ log.info("Callback ........ STATUS_DOWNLOAD changeset")
self.backend.status(STATUS_DOWNLOAD)
- self.progress.set_subpercent( got*100 / float(need) )
-
- p = self.progress.percent
- self.backend.sub_percentage(p)
- log.info("Callback ........ STATUS_DOWNLOAD Changeset %s" % p )
def requestingFileContents(self):
#self.backend.status('Requesting File Contents')
- log.info("Callback ........ STATUS_REQUEST request File contents ")
+ log.info("Callback ........ STATUS_REQUEST ")
self.backend.status(STATUS_REQUEST)
- # 1(P)repare >> download a change set
- # 1(A)pply >> donwload a changeset
+
def requestingChangeSet(self):
+ #self.backend.status('Requesting Changeset')
log.info("Callback ........ STATUS_REQUEST changeset ")
self.backend.status(STATUS_REQUEST)
- self.progress.step()
def removeFiles(self, filenum, total):
- log.info("Callback ........ STATUS_REMOVE %s/%sfiles" %( filenum, total) )
+ log.info("Callback ........ STATUS_REMOVE")
self.backend.status(STATUS_REMOVE)
self.preparingUpdate(filenum, total, add=total)
-
def done(self):
#self.backend.status('Done')
- log.info("DONEEEEEEEEEEEE")
- """
- e = ""
- for i in self.error:
- e = e + i
- log.error(i)
- if self.error:
- self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e)
- """
- # 6 A >>> transactions
+
+ log.info("Callback ........ done! ")
+ pass
+
def preparingUpdate(self, troveNum, troveCount, add=0):
if not self.currentJob or len(self.currentJob) == 0 or troveNum > troveCount:
return
if troveNum > 0 and troveCount > 0:
sub_percent = (add + troveNum) / (2 * float(troveCount)) * 100
- self.progress.set_subpercent(sub_percent)
- p = self.progress.percent
- self.backend.sub_percentage(p)
+ self.backend.sub_percentage(sub_percent)
if self.smallUpdate:
- self.backend.percentage(self.progress.percent)
+ self.backend.percentage(sub_percent)
if troveNum != 0:
troveNum -= 1
@@ -105,57 +85,42 @@ class UpdateCallback(callbacks.UpdateCallback):
name = job[0]
oldVersion, oldFlavor = job[1]
newVersion, newFlavor = job[2]
- #log.info("JOB>>>>>>>> %s " % str(job) )
+ log.info((oldVersion, newVersion))
if oldVersion and newVersion:
- log.info("Callback ........ STATUS_UPDATE preparing Update ")
+ log.info("Callback ........ STATUS_UPDATE ")
self.backend.status(STATUS_UPDATE)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_UPDATING, '')
elif oldVersion and not newVersion:
- log.info("Callback ........ STATUS_REMOVE preparing Update ")
+ log.info("Callback ........ STATUS_REMOVE ")
self.backend.status(STATUS_REMOVE)
package_id = self.backend.get_package_id(name, oldVersion, oldFlavor)
self.backend.package(package_id, INFO_REMOVING, '')
elif not oldVersion and newVersion:
- log.info("Callback ........ STATUS_INSTALL preparing Update")
+ log.info("Callback ........ STATUS_INSTALL ")
self.backend.status(STATUS_INSTALL)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_INSTALLING, '')
def creatingDatabaseTransaction(self, troveNum, troveCount):
- log.info("callback. .......... creating Database Transactions")
self.preparingUpdate(troveNum, troveCount, add=troveCount)
def setChangesetHunk(self, num, total):
- log.info("callback. .......... set Changeset HUnk")
pass
- # 3A >> set update Job
+
def setUpdateHunk(self, hunk, hunkCount):
- log.info("callback. .......... set update HUnk")
- self.progress.step()
if hunk > 0 and hunkCount > 0:
percentage = hunk / float(hunkCount) * 100.0
- self.progress.set_subpercent(percentage)
- p = self.progress.percent
- self.backend.sub_percentage(p)
+ self.backend.percentage(percentage)
else:
self.smallUpdate = True
- # 4A >> Status rollback
+
def setUpdateJob(self, job):
- log.info("callback. .......... set update Job")
self.currentJob = job
- self.progress.step()
- # 8 A >> termina
+
def updateDone(self):
- log.info("callback. .......... update done")
self.currentJob = None
- self.progress.step()
- def warning(self, msg, *args, **kwargs):
- e = msg %args
- log.error("<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
- log.error(e)
- self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e, False )
-
+
def tagHandlerOutput(self, tag, msg, stderr = False):
pass
@@ -174,6 +139,3 @@ class UpdateCallback(callbacks.UpdateCallback):
self.backend = backend
self.currentJob = None
self.smallUpdate = False
- self.error = []
- self.progress = PackagekitProgress()
- self.progress.set_steps( range( 1, 100, 9) )
diff --git a/backends/conary/conaryEnums.py b/backends/conary/conaryEnums.py
deleted file mode 100644
index 6584ddd..0000000
--- a/backends/conary/conaryEnums.py
+++ /dev/null
@@ -1,68 +0,0 @@
-from packagekit.enums import GROUP_ACCESSIBILITY, GROUP_ACCESSORIES, GROUP_EDUCATION, GROUP_GAMES, GROUP_GRAPHICS, GROUP_INTERNET, GROUP_MULTIMEDIA, GROUP_OFFICE, GROUP_OTHER, GROUP_PROGRAMMING, GROUP_SYSTEM
-
-"""
-Classify the Categories and help me to make a backend
-
-# from XMLCache import XMLCache
-# print "categoryMap = {",
-# for i in XMLCache()._getAllCategories():
-# print "'%s':" % i
-# print "}",
-
-"""
-
-categoryMap = {
-'VectorGraphics': GROUP_GRAPHICS,
-'Network': GROUP_INTERNET,
-'Spreadsheet': GROUP_OFFICE,
-'Application': GROUP_OTHER,
-'X-GNOME-NetworkSettings': GROUP_INTERNET,
-'Music': GROUP_MULTIMEDIA,
-'P2P': GROUP_INTERNET,
-'WordProcessor': GROUP_OFFICE,
-'X-GNOME-PersonalSettings': GROUP_SYSTEM,
-'Presentation': GROUP_OFFICE,
-'Email': GROUP_OFFICE,
-'Monitor': GROUP_SYSTEM,
-'Development': GROUP_PROGRAMMING,
-'Core': GROUP_SYSTEM,
-'RasterGraphics': GROUP_GRAPHICS,
-'Telephony': GROUP_INTERNET,
-'Photography': GROUP_GRAPHICS,
-'HardwareSettings': GROUP_SYSTEM,
-'News': GROUP_INTERNET,
-'X-SuSE-Core-Office': GROUP_SYSTEM,
-'X-Red-Hat-Base': GROUP_SYSTEM,
-#'GNOME': GROUP_OTHER,
-'Settings': GROUP_SYSTEM,
-#'GTK': GROUP_OTHER,
-'System': GROUP_SYSTEM,
-'Graphics': GROUP_GRAPHICS,
-'X-Ximian-Main': GROUP_OFFICE,
-'Security': GROUP_SYSTEM,
-'Audio': GROUP_MULTIMEDIA,
-'ContactManagement': GROUP_ACCESSORIES,
-'X-Novell-Main': GROUP_OFFICE,
-'AudioVideo': GROUP_MULTIMEDIA,
-'WebDevelopment': GROUP_PROGRAMMING,
-'X-GNOME-SystemSettings': GROUP_SYSTEM,
-'Office': GROUP_OFFICE,
-'Viewer': GROUP_ACCESSORIES,
-'Player': GROUP_OTHER,
-'DesktopSettings': GROUP_SYSTEM,
-'WebBrowser': GROUP_INTERNET,
-'Utility': GROUP_ACCESSORIES,
-'GUIDesigner': GROUP_PROGRAMMING,
-'TerminalEmulator': GROUP_ACCESSORIES,
-}
-
-groupMap = {}
-
-for (con_cat, pk_group) in categoryMap.items():
- if groupMap.has_key(pk_group):
- groupMap[pk_group].append(con_cat)
- else:
- groupMap[pk_group] = [con_cat]
-
-if __name__ == "__main__":
- print groupMap
diff --git a/backends/conary/conaryFilter.py b/backends/conary/conaryFilter.py
index 20bd4bf..635e0e2 100644
--- a/backends/conary/conaryFilter.py
+++ b/backends/conary/conaryFilter.py
@@ -24,8 +24,7 @@ from packagekit.filter import *
import re
from pkConaryLog import log
-from conarypk import ConaryPk
-
+from conaryInit import conary_db
class ConaryFilter(PackagekitFilter):
def _pkg_get_unique(self, pkg):
@@ -45,12 +44,18 @@ class ConaryFilter(PackagekitFilter):
'''
Return if the packages are installed
'''
- conary_cli = ConaryPk()
- result = conary_cli.query(pkg)
-
- if result:
- return True
- else:
- return False
+ log.info("======= FILTER ===== " )
+ log.info(pkg)
+ troveTuple = pkg
+ db = conary_db()
+ try:
+ troveTuple = troveTuple[0], troveTuple[1], troveTuple[2]
+ localInstall = db.findTrove(None, troveTuple)
+ installed = True
+ except:
+ installed = False
+ log.info("Installed ???")
+ log.info(installed)
+ return installed
diff --git a/backends/conary/conarypk.py b/backends/conary/conarypk.py
deleted file mode 100644
index 3581362..0000000
--- a/backends/conary/conarypk.py
+++ /dev/null
@@ -1,118 +0,0 @@
-#!/usr/bin/python
-### compatible with conary 2.0.35
-### greets mkj
-### zodman at foresightlinux.org under the WTFPL http://sam.zoy.org/wtfpl/
-
-from conary.conaryclient import ConaryClient, cmdline
-from conary import conarycfg
-from conary.versions import Label
-from conary.errors import TroveNotFound
-from conary.conaryclient.update import NoNewTrovesError
-
-
-class ConaryPk:
- def __init__(self):
- # get configs from /etc/conary
- cfg = conarycfg.ConaryConfiguration( readConfigFiles = True)
- # get if the machine its x86 or x86_64
- cfg.initializeFlavors()
- self.cfg = cfg
-
- cli = ConaryClient(cfg)
-
- # labels enable on /etc/conary/config.d/
- self.default_label = self.cfg.installLabelPath
-
- # get if x86 or x86_64
- self.flavor = self.cfg.flavor[0]
- # for client
- self.cli = cli
- # for query on system (database)
- self.db = cli.db
- # for request query on repository (repos)
- self.repos = cli.repos
-
- def _get_db(self):
- """ get the database for do querys """
- return self.db
-
- def _get_repos(self):
- """ get repos for do request query """
- return self.repos
-
- def label(self, installLabel = None):
- """ get label from config or custom installLabel """
- if installLabel:
- return Label(installLabel)
- return self.default_label
- def get_labels_from_config(self):
- labels = []
- for i in self.default_label:
- if "foresight.rpath.org" in i.asString():
- labels.append(i.asString())
- return labels
-
- def query(self, name):
- """ do a conary query """
- if name is None or name == "":
- return []
- db = self._get_db()
- try:
- troves = db.findTrove( None ,(name , None, None ))
- #return db.getTroves(troves)
- return troves
- except TroveNotFound:
- return []
-
- def request_query(self, name, installLabel = None):
- """ Do a conary request query """
- label = self.label( installLabel )
- repos = self._get_repos()
- try:
- troves = repos.findTrove( label ,( name, None ,self.flavor ) )
- #return repos.getTroves(troves)
- return troves
- except TroveNotFound:
- return []
-
- def get_metadata( self, name , installLabel = None):
- pass
-
- def remove(self, name):
- return self.update(name, remove = True )
- def update(self, name, installLabel= None, remove = False ):
- cli = self.cli
- #get a trove
- troves = self.request_query(name, installLabel)
- for trove in troves:
- trovespec = self.trove_to_spec( trove, remove )
- try:
- # create a Job
- job = cli.newUpdateJob()
- # Add Update task to Job
- cli.prepareUpdateJob(job, cmdline.parseChangeList(trovespec))
- # Apply the Job
- cli.applyUpdateJob(job)
- # im rulz
- return "Update Success of %s" % trovespec
- except NoNewTrovesError:
- return "no new Troves Found by %s " % trovespec
-
- def trove_to_spec(self, trove, remove = False ):
- # add a -app=blah.rpath.org at rpl:devel for remove packages
- if remove:
- tmp = '-'
- else:
- tmp = ""
- return tmp + cmdline.toTroveSpec( trove[0], str(trove[1]), None)
-
-if __name__ == "__main__":
- conary = ConaryPk()
- print conary.query("dpaster")
- #print conary.query("gimpasdas")
- #print conary.request_query("dpaster",'zodyrepo.rpath.org at rpl:devel')
- #print conary.request_query("gimp")
- #print conary.request_query("gimpasdasd")
- #print conary.update("amsn")
- #print conary.remove("amsn")
-
diff --git a/backends/conary/pk-backend-conary.c b/backends/conary/pk-backend-conary.c
index df3c9a6..936e190 100644
--- a/backends/conary/pk-backend-conary.c
+++ b/backends/conary/pk-backend-conary.c
@@ -239,32 +239,6 @@ backend_search_name (PkBackend *backend, PkBitfield filters, const gchar *search
}
/**
- pk_backend_search_groups
-*/
-static void
-backend_search_group (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "conaryBackend.py", "search-group", filters_text, search, NULL);
- g_free (filters_text);
-}
-
-
-
-/**
- pk_backend_search_details
-*/
-static void
-backend_search_details (PkBackend *backend, PkBitfield filters, const gchar *search)
-{
- gchar *filters_text;
- filters_text = pk_filter_bitfield_to_text (filters);
- pk_backend_spawn_helper (spawn, "conaryBackend.py", "search-details", filters_text, search, NULL);
- g_free (filters_text);
-}
-
-/**
* pk_backend_update_packages:
*/
static void
@@ -350,9 +324,9 @@ PK_BACKEND_OPTIONS (
NULL, /* repo_set_data */
backend_resolve, /* resolve */
NULL, /* rollback */
- backend_search_details, /* search_details */
+ NULL, /* search_details */
NULL, /* search_file */
- backend_search_group, /* search_group */
+ NULL, /* search_group */
backend_search_name, /* search_name */
backend_update_packages, /* update_packages */
backend_update_system, /* update_system */
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 25d4ebb..1c53ed8 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -240,10 +240,10 @@ backend_get_update_detail_timeout (gpointer data)
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344",
"", PK_RESTART_ENUM_NONE, "Update to newest upstream source",
"", PK_UPDATE_STATE_ENUM_STABLE, "2008-07-31", NULL);
- } else if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
+ }
+ if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
pk_backend_update_detail (backend, package_id,
- "kernel;2.6.22-0.104.rc3.git6.fc8;i386;installed"
- PK_PACKAGE_IDS_DELIM
+ "kernel;2.6.22-0.104.rc3.git6.fc8;i386;installed^"
"kernel;2.6.22-0.105.rc3.git7.fc8;i386;installed", "",
"http://www.distro-update.org/page?moo;Bugfix release for kernel",
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344;"
@@ -251,7 +251,8 @@ backend_get_update_detail_timeout (gpointer data)
"http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-3381;CVE-2007-3381",
PK_RESTART_ENUM_SYSTEM, "Update to newest version",
"", PK_UPDATE_STATE_ENUM_UNSTABLE, "2008-06-28", NULL);
- } else if (egg_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora")) {
+ }
+ if (egg_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora")) {
pk_backend_update_detail (backend, package_id,
"gtkhtml2;2.18.1-22.fc8;i386;installed", "",
"http://www.distro-update.org/page?moo;Bugfix release for gtkhtml",
@@ -262,22 +263,6 @@ backend_get_update_detail_timeout (gpointer data)
"* something else\n"
"- and that new thing",
"", PK_UPDATE_STATE_ENUM_UNKNOWN, "2008-07-25", NULL);
-
- } else if (egg_strequal (package_id, "vino;2.24.2.fc9;i386;fedora")) {
- pk_backend_update_detail (backend, package_id,
- "vino;2.24.1.fc9;i386;fedora", "",
- "", "", NULL, PK_RESTART_ENUM_NONE,
- "Cannot get update as update conflics with vncviewer",
- "", PK_UPDATE_STATE_ENUM_UNKNOWN, "2008-07-25", NULL);
-
-
- pk_backend_package (backend, PK_INFO_ENUM_BLOCKED,
- "",
- "Remote desktop server for the desktop");
-
- } else {
- /* signal to UI */
- pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, "the package update detail was not found for %s", package_id);
}
}
pk_backend_finished (backend);
diff --git a/docs/html/img/Makefile.am b/docs/html/img/Makefile.am
index 0786318..cbf61f9 100644
--- a/docs/html/img/Makefile.am
+++ b/docs/html/img/Makefile.am
@@ -16,7 +16,6 @@ IMAGE_FILES = \
author-timlau.png \
author-tomparker.png \
author-unknown.png \
- author-zodman.png \
dialog-information.png \
gpk-added-deps.png \
gpk-application-groups.png \
diff --git a/docs/html/img/author-zodman.png b/docs/html/img/author-zodman.png
deleted file mode 100644
index dc6ed2e..0000000
Binary files a/docs/html/img/author-zodman.png and /dev/null differ
diff --git a/docs/html/pk-authors.html b/docs/html/pk-authors.html
index 8105e94..1c2e79d 100644
--- a/docs/html/pk-authors.html
+++ b/docs/html/pk-authors.html
@@ -297,24 +297,6 @@
</td>
</tr>
-<tr>
- <td>
- <img src="img/author-zodman.png" alt=""/><!-- image should be 120px wide -->
- </td>
- <td>
- <h2>Andrés Vargas</h2>
- <p>
- Andres is a Computer Science Engineer mexican what enjoy working with Free Software and Open Source.
- He rewrote the conary backend and implement a new Cache. Write a <a href="http://github.com/zodman/conary-lib">conary-lib</a> what
- provide a easy way to use conary public API. He is a developer
- for the <a href="http://foresightlinux.org/">Foresight Linux</a> project.
- Her blog <a href="http://vampiritio.com.mx">vampirito.com.mx</a>
- </p>
- <p>
- <b>Responsible for: conary backend</b>
- </p>
- </td>
-</tr>
</table>
diff --git a/lib/packagekit-qt/src/transactionprivate.cpp b/lib/packagekit-qt/src/transactionprivate.cpp
index c41343c..a549a9f 100644
--- a/lib/packagekit-qt/src/transactionprivate.cpp
+++ b/lib/packagekit-qt/src/transactionprivate.cpp
@@ -136,12 +136,12 @@ void TransactionPrivate::updateDetail(const QString& pid, const QString& updates
Client::UpdateInfo i;
i.package = new Package(pid);
if( !updates.isEmpty() ) {
- foreach(const QString p, updates.split("&")) {
+ foreach(const QString p, updates.split("^")) {
i.updates.append(new Package(p));
}
}
if( !obsoletes.isEmpty() ) {
- foreach(const QString p, obsoletes.split("&")) {
+ foreach(const QString p, obsoletes.split("^")) {
i.obsoletes.append(new Package(p));
}
}
commit 3d3dde2c284873a33307d38fee0ebad25e95d54f
Merge: d64126d... 2a46bee...
Author: Stephane Delcroix <stephane at delcroix.org>
Date: Fri Feb 13 20:39:11 2009 +0100
Merge branch 'master' of git+ssh://sde@git.packagekit.org/srv/git/PackageKit
commit d64126da98fef0e2e1d3cb41c9628de33c73ccde
Author: Stephane Delcroix <stephane at delcroix.org>
Date: Fri Feb 13 20:38:27 2009 +0100
fix a typo
diff --git a/configure.ac b/configure.ac
index 2b55bd7..9324035 100644
--- a/configure.ac
+++ b/configure.ac
@@ -180,7 +180,7 @@ AM_CONDITIONAL(PK_BUILD_QT, test $build_qt = "yes")
dnl ---------------------------------------------------------------------------
dnl - Build packageKit-sharp
dnl ---------------------------------------------------------------------------
-AC_ARG_ENABLE(managed, AS_HELP_STRING([--enable-managed],[Build PackageKit-Sharp]),
+AC_ARG_ENABLE(managed, AC_HELP_STRING([--enable-managed],[Build PackageKit-Sharp]),
enable_managed=$enableval,enable_managed=false)
if test x$enable_managed = xyes; then
PKG_CHECK_MODULES(GLIBSHARP, glib-sharp-2.0)
commit 2a46beecd6ab00ebb8183451946018b245edd236
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Fri Feb 13 12:02:51 2009 -0600
fix some Unnecesary commit :S
Sorry its my fault.
diff --git a/backends/conary/XMLCache.py b/backends/conary/XMLCache.py
index 4c95908..bf28770 100644
--- a/backends/conary/XMLCache.py
+++ b/backends/conary/XMLCache.py
@@ -25,13 +25,7 @@ def getGroup( categorieList):
else:
where[group] = 1
- tmp = 0
- t_key = ""
- for key, value in where.items():
- if value > tmp:
- t_key = key
- tmp = value
- return t_key
+ return max( where.iteritems())[0]
class XMLRepo:
diff --git a/configure.ac b/configure.ac
index e2ef687..2b55bd7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -75,11 +75,11 @@ if test "$GCC" = "yes"; then
WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wformat-security"
WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wmissing-include-dirs"
WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wmissing-format-attribute"
- #WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wclobbered"
- #WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wempty-body"
- #WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wignored-qualifiers"
+ WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wclobbered"
+ WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wempty-body"
+ WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wignored-qualifiers"
WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wsign-compare"
- #WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wtype-limits"
+ WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wtype-limits"
WARNINGFLAGS_CPP="$WARNINGFLAGS_CPP -Wuninitialized"
# work only in C
@@ -89,8 +89,8 @@ if test "$GCC" = "yes"; then
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wshadow"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Wno-strict-aliasing"
WARNINGFLAGS_C="$WARNINGFLAGS_C -Winline"
- #WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type"
- #WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init"
+ WARNINGFLAGS_C="$WARNINGFLAGS_C -Wmissing-parameter-type"
+ WARNINGFLAGS_C="$WARNINGFLAGS_C -Woverride-init"
else
WARNINGFLAGS_C=""
WARNINGFLAGS_CPP=""
commit d2a6c40797284adf630a6f12d007d0025ea6eeb4
Merge: 7f45148... c2985a9...
Author: Andres Vargas ( zodman ) <zodman at foresightlinux.org>
Date: Fri Feb 13 11:41:34 2009 -0600
Merge branch 'master' of git+ssh://zodman@git.packagekit.org/srv/git/PackageKit
commit c2985a9882120dda45921ffaa515874cf942a908
Merge: e99eede... a6dabc9...
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Feb 13 15:10:28 2009 +0000
Merge branch 'master' of git+ssh://hughsie@git.packagekit.org/srv/git/PackageKit
commit e99eedea91525fa86b6aea23822f2bdf7c77ae00
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Feb 13 14:47:36 2009 +0000
dummy: add update detail for the blocked package, and raise an error if we can't find a match
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 84c2476..25d4ebb 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -240,8 +240,7 @@ backend_get_update_detail_timeout (gpointer data)
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344",
"", PK_RESTART_ENUM_NONE, "Update to newest upstream source",
"", PK_UPDATE_STATE_ENUM_STABLE, "2008-07-31", NULL);
- }
- if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
+ } else if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
pk_backend_update_detail (backend, package_id,
"kernel;2.6.22-0.104.rc3.git6.fc8;i386;installed"
PK_PACKAGE_IDS_DELIM
@@ -252,8 +251,7 @@ backend_get_update_detail_timeout (gpointer data)
"http://nvd.nist.gov/nvd.cfm?cvename=CVE-2007-3381;CVE-2007-3381",
PK_RESTART_ENUM_SYSTEM, "Update to newest version",
"", PK_UPDATE_STATE_ENUM_UNSTABLE, "2008-06-28", NULL);
- }
- if (egg_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora")) {
+ } else if (egg_strequal (package_id, "gtkhtml2;2.19.1-4.fc8;i386;fedora")) {
pk_backend_update_detail (backend, package_id,
"gtkhtml2;2.18.1-22.fc8;i386;installed", "",
"http://www.distro-update.org/page?moo;Bugfix release for gtkhtml",
@@ -264,6 +262,22 @@ backend_get_update_detail_timeout (gpointer data)
"* something else\n"
"- and that new thing",
"", PK_UPDATE_STATE_ENUM_UNKNOWN, "2008-07-25", NULL);
+
+ } else if (egg_strequal (package_id, "vino;2.24.2.fc9;i386;fedora")) {
+ pk_backend_update_detail (backend, package_id,
+ "vino;2.24.1.fc9;i386;fedora", "",
+ "", "", NULL, PK_RESTART_ENUM_NONE,
+ "Cannot get update as update conflics with vncviewer",
+ "", PK_UPDATE_STATE_ENUM_UNKNOWN, "2008-07-25", NULL);
+
+
+ pk_backend_package (backend, PK_INFO_ENUM_BLOCKED,
+ "",
+ "Remote desktop server for the desktop");
+
+ } else {
+ /* signal to UI */
+ pk_backend_error_code (backend, PK_ERROR_ENUM_INTERNAL_ERROR, "the package update detail was not found for %s", package_id);
}
}
pk_backend_finished (backend);
commit a6dabc94cf0397f7a99f6120f0ca85b196fbdcee
Author: Daniel Nicoletti <dantti85-pk at yahoo.com.br>
Date: Fri Feb 13 12:03:43 2009 -0200
Fix for the updates and obsoletes delimiter
diff --git a/lib/packagekit-qt/src/transactionprivate.cpp b/lib/packagekit-qt/src/transactionprivate.cpp
index a549a9f..c41343c 100644
--- a/lib/packagekit-qt/src/transactionprivate.cpp
+++ b/lib/packagekit-qt/src/transactionprivate.cpp
@@ -136,12 +136,12 @@ void TransactionPrivate::updateDetail(const QString& pid, const QString& updates
Client::UpdateInfo i;
i.package = new Package(pid);
if( !updates.isEmpty() ) {
- foreach(const QString p, updates.split("^")) {
+ foreach(const QString p, updates.split("&")) {
i.updates.append(new Package(p));
}
}
if( !obsoletes.isEmpty() ) {
- foreach(const QString p, obsoletes.split("^")) {
+ foreach(const QString p, obsoletes.split("&")) {
i.obsoletes.append(new Package(p));
}
}
commit 172828f9c106452c28560d42c2a80bf196c5d385
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Feb 13 13:41:54 2009 +0000
dummy: use the correct delimiter for the obsoletes in the kernel package
diff --git a/backends/dummy/pk-backend-dummy.c b/backends/dummy/pk-backend-dummy.c
index 1c53ed8..84c2476 100644
--- a/backends/dummy/pk-backend-dummy.c
+++ b/backends/dummy/pk-backend-dummy.c
@@ -243,7 +243,8 @@ backend_get_update_detail_timeout (gpointer data)
}
if (egg_strequal (package_id, "kernel;2.6.23-0.115.rc3.git1.fc8;i386;installed")) {
pk_backend_update_detail (backend, package_id,
- "kernel;2.6.22-0.104.rc3.git6.fc8;i386;installed^"
+ "kernel;2.6.22-0.104.rc3.git6.fc8;i386;installed"
+ PK_PACKAGE_IDS_DELIM
"kernel;2.6.22-0.105.rc3.git7.fc8;i386;installed", "",
"http://www.distro-update.org/page?moo;Bugfix release for kernel",
"http://bgzilla.fd.org/result.php?#12344;Freedesktop Bugzilla #12344;"
commit 7f45148a3bee721eb6c341d30a96037d6c5c0237
Author: zodman <zodman at cosmogirl.(none)>
Date: Fri Feb 13 02:48:23 2009 -0600
fix get-files from many troves
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 3b8cccd..6aac099 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -155,7 +155,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
name, verString, archString, data = pkpackage.get_package_from_id(package_id)
summary = data.split("#")
repo = summary[0]
- metadata = eval(summary[1])
+ if summary[1]:
+ metadata = eval(summary[1])
+ else:
+ metadata = {}
cli = ConaryPk()
return cli.request_query(name)
commit b272f257187f875e31f1825110b504815ac63db8
Author: zodman <zodman at cosmogirl.(none)>
Date: Fri Feb 13 02:41:04 2009 -0600
add more log info to callbacks
fix get-files
add a new Author :) yeah!!!
zodman - Andres Vargas
diff --git a/backends/conary/conaryBackend.py b/backends/conary/conaryBackend.py
index 5ea21f6..3b8cccd 100755
--- a/backends/conary/conaryBackend.py
+++ b/backends/conary/conaryBackend.py
@@ -38,7 +38,6 @@ from conaryFilter import *
from XMLCache import XMLCache as Cache
from conaryInit import *
-# zodman fix
from conaryInit import init_conary_config, init_conary_client
from conary import conarycfg, conaryclient
from conarypk import ConaryPk
@@ -48,8 +47,8 @@ pkpackage = PackagekitPackage()
from pkConaryLog import log, pdb
-#from conary.lib import util
-#sys.excepthook = util.genExcepthook()
+from conary.lib import util
+sys.excepthook = util.genExcepthook()
def ExceptionHandler(func):
return func
def display(error):
@@ -251,6 +250,10 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
@filters (list) list of filters
@package (list ) list with packages name for resolve
"""
+ self.allow_cancel(True)
+ self.percentage(None)
+ self.status(STATUS_INFO)
+
log.info("======== resolve =========")
log.info("filters: %s package:%s " % (filters, package))
@@ -385,15 +388,17 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
withFiles = True):
files.append(path)
return files
+
+ for package in package_id.split("&"):
+ log.info(package)
+ name, version, flavor, installed = self._findPackage(package)
- name, version, flavor, installed = self._findPackage(package_id)
-
- if installed == INFO_INSTALLED:
- files = _get_files(self.client.db, name, version, flavor)
- else:
- files = _get_files(self.client.repos, name, version, flavor)
+ if installed == INFO_INSTALLED:
+ files = _get_files(self.client.db, name, version, flavor)
+ else:
+ files = _get_files(self.client.repos, name, version, flavor)
- self.files(package_id, ';'.join(files))
+ self.files(package_id, ';'.join(files))
@ExceptionHandler
def update_system(self):
@@ -454,9 +459,8 @@ class PackageKitConaryBackend(PackageKitBaseBackend):
'Package already installed')
self.status(INFO_INSTALLING)
- log.info(">>> end Prepare Update")
+ log.info(">>> Prepare Update")
self._get_package_update(name, version, flavor)
- self.status(STATUS_WAIT)
log.info(">>> end Prepare Update")
self._do_package_update(name, version, flavor)
else:
diff --git a/backends/conary/conaryCallback.py b/backends/conary/conaryCallback.py
index 464e42f..d7b9922 100644
--- a/backends/conary/conaryCallback.py
+++ b/backends/conary/conaryCallback.py
@@ -20,63 +20,83 @@
from conary import callbacks
from packagekit.backend import *
+from packagekit.progress import PackagekitProgress
from pkConaryLog import log
class UpdateCallback(callbacks.UpdateCallback):
+ # 3P >>> ( prepare Update end )
def resolvingDependencies(self):
#self.backend.status('Resolving Dependencies')
+ log.info("Callback ........ STATUS_DEP_RESOLVE ")
self.backend.status(STATUS_DEP_RESOLVE)
-
+ self.progress.step()
+ #5A >> status_install preparing Update
def creatingRollback(self):
#self.backend.status('Creating Rollback')
- log.info("Callback ........ STATUS_ROLLBACK ")
+ log.info("Callback ........ STATUS_ROLLBACK ")
self.backend.status(STATUS_ROLLBACK)
-
+ # 7A >> update done
def committingTransaction(self):
#self.backend.status('Committing Transaction')
- log.info("Callback ........ STATUS_COMMIT ")
+ log.info("Callback ........ STATUS_COMMIT transactions ")
self.backend.status(STATUS_COMMIT)
def downloadingFileContents(self, got, need):
#self.backend.status('Downloading files for changeset')
- log.info("Callback ........ STATUS_DOWNLOAD ")
+ log.info("Callback ........ STATUS_DOWNLOAD FIle Contents %s " % str( got*100/need ))
self.backend.status(STATUS_DOWNLOAD)
-
+ #self.backend.sub_percentage(got*100/need)
+ # 2P >> dep_resolve
+ # 2 A >>> set Update Hunk
def downloadingChangeSet(self, got, need):
- log.info("Callback ........ STATUS_DOWNLOAD changeset")
self.backend.status(STATUS_DOWNLOAD)
+ self.progress.set_subpercent( got*100 / float(need) )
+
+ p = self.progress.percent
+ self.backend.sub_percentage(p)
+ log.info("Callback ........ STATUS_DOWNLOAD Changeset %s" % p )
def requestingFileContents(self):
#self.backend.status('Requesting File Contents')
- log.info("Callback ........ STATUS_REQUEST ")
+ log.info("Callback ........ STATUS_REQUEST request File contents ")
self.backend.status(STATUS_REQUEST)
-
+ # 1(P)repare >> download a change set
+ # 1(A)pply >> donwload a changeset
def requestingChangeSet(self):
- #self.backend.status('Requesting Changeset')
log.info("Callback ........ STATUS_REQUEST changeset ")
self.backend.status(STATUS_REQUEST)
+ self.progress.step()
def removeFiles(self, filenum, total):
- log.info("Callback ........ STATUS_REMOVE")
+ log.info("Callback ........ STATUS_REMOVE %s/%sfiles" %( filenum, total) )
self.backend.status(STATUS_REMOVE)
self.preparingUpdate(filenum, total, add=total)
+
def done(self):
#self.backend.status('Done')
-
- log.info("Callback ........ done! ")
- pass
-
+ log.info("DONEEEEEEEEEEEE")
+ """
+ e = ""
+ for i in self.error:
+ e = e + i
+ log.error(i)
+ if self.error:
+ self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e)
+ """
+ # 6 A >>> transactions
def preparingUpdate(self, troveNum, troveCount, add=0):
if not self.currentJob or len(self.currentJob) == 0 or troveNum > troveCount:
return
if troveNum > 0 and troveCount > 0:
sub_percent = (add + troveNum) / (2 * float(troveCount)) * 100
- self.backend.sub_percentage(sub_percent)
+ self.progress.set_subpercent(sub_percent)
+ p = self.progress.percent
+ self.backend.sub_percentage(p)
if self.smallUpdate:
- self.backend.percentage(sub_percent)
+ self.backend.percentage(self.progress.percent)
if troveNum != 0:
troveNum -= 1
@@ -85,42 +105,57 @@ class UpdateCallback(callbacks.UpdateCallback):
name = job[0]
oldVersion, oldFlavor = job[1]
newVersion, newFlavor = job[2]
- log.info((oldVersion, newVersion))
+ #log.info("JOB>>>>>>>> %s " % str(job) )
if oldVersion and newVersion:
- log.info("Callback ........ STATUS_UPDATE ")
+ log.info("Callback ........ STATUS_UPDATE preparing Update ")
self.backend.status(STATUS_UPDATE)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_UPDATING, '')
elif oldVersion and not newVersion:
- log.info("Callback ........ STATUS_REMOVE ")
+ log.info("Callback ........ STATUS_REMOVE preparing Update ")
self.backend.status(STATUS_REMOVE)
package_id = self.backend.get_package_id(name, oldVersion, oldFlavor)
self.backend.package(package_id, INFO_REMOVING, '')
elif not oldVersion and newVersion:
- log.info("Callback ........ STATUS_INSTALL ")
+ log.info("Callback ........ STATUS_INSTALL preparing Update")
self.backend.status(STATUS_INSTALL)
package_id = self.backend.get_package_id(name, newVersion, newFlavor)
self.backend.package(package_id, INFO_INSTALLING, '')
def creatingDatabaseTransaction(self, troveNum, troveCount):
+ log.info("callback. .......... creating Database Transactions")
self.preparingUpdate(troveNum, troveCount, add=troveCount)
def setChangesetHunk(self, num, total):
+ log.info("callback. .......... set Changeset HUnk")
pass
-
+ # 3A >> set update Job
def setUpdateHunk(self, hunk, hunkCount):
+ log.info("callback. .......... set update HUnk")
+ self.progress.step()
if hunk > 0 and hunkCount > 0:
percentage = hunk / float(hunkCount) * 100.0
- self.backend.percentage(percentage)
+ self.progress.set_subpercent(percentage)
+ p = self.progress.percent
+ self.backend.sub_percentage(p)
else:
self.smallUpdate = True
-
+ # 4A >> Status rollback
def setUpdateJob(self, job):
+ log.info("callback. .......... set update Job")
self.currentJob = job
-
+ self.progress.step()
+ # 8 A >> termina
def updateDone(self):
+ log.info("callback. .......... update done")
self.currentJob = None
-
+ self.progress.step()
+ def warning(self, msg, *args, **kwargs):
+ e = msg %args
+ log.error("<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
+ log.error(e)
+ self.backend.error(ERROR_DEP_RESOLUTION_FAILED, e, False )
+
def tagHandlerOutput(self, tag, msg, stderr = False):
pass
@@ -139,3 +174,6 @@ class UpdateCallback(callbacks.UpdateCallback):
self.backend = backend
self.currentJob = None
self.smallUpdate = False
+ self.error = []
+ self.progress = PackagekitProgress()
+ self.progress.set_steps( range( 1, 100, 9) )
diff --git a/docs/html/img/Makefile.am b/docs/html/img/Makefile.am
index cbf61f9..0786318 100644
--- a/docs/html/img/Makefile.am
+++ b/docs/html/img/Makefile.am
@@ -16,6 +16,7 @@ IMAGE_FILES = \
author-timlau.png \
author-tomparker.png \
author-unknown.png \
+ author-zodman.png \
dialog-information.png \
gpk-added-deps.png \
gpk-application-groups.png \
diff --git a/docs/html/img/author-zodman.png b/docs/html/img/author-zodman.png
new file mode 100644
index 0000000..dc6ed2e
Binary files /dev/null and b/docs/html/img/author-zodman.png differ
diff --git a/docs/html/pk-authors.html b/docs/html/pk-authors.html
index 1c2e79d..8105e94 100644
--- a/docs/html/pk-authors.html
+++ b/docs/html/pk-authors.html
@@ -297,6 +297,24 @@
</td>
</tr>
+<tr>
+ <td>
+ <img src="img/author-zodman.png" alt=""/><!-- image should be 120px wide -->
+ </td>
+ <td>
+ <h2>Andrés Vargas</h2>
+ <p>
+ Andres is a Computer Science Engineer mexican what enjoy working with Free Software and Open Source.
+ He rewrote the conary backend and implement a new Cache. Write a <a href="http://github.com/zodman/conary-lib">conary-lib</a> what
+ provide a easy way to use conary public API. He is a developer
+ for the <a href="http://foresightlinux.org/">Foresight Linux</a> project.
+ Her blog <a href="http://vampiritio.com.mx">vampirito.com.mx</a>
+ </p>
+ <p>
+ <b>Responsible for: conary backend</b>
+ </p>
+ </td>
+</tr>
</table>
More information about the PackageKit-commit
mailing list