[PackageKit-commit] packagekit: Branch 'master' - 16 commits
Richard Hughes
hughsient at kemper.freedesktop.org
Thu Mar 3 03:25:37 PST 2011
backends/entropy/pk-backend-entropy.c | 2
backends/yum/yumBackend.py | 3
backends/zypp/zypp-utils.cpp | 207 ++++++++++------------------------
backends/zypp/zypp-utils.h | 1
src/pk-backend.c | 3
src/pk-network-stack-connman.c | 2
src/pk-network-stack-nm.c | 9 +
src/pk-self-test.c | 100 +++++++++-------
src/pk-transaction-db.c | 2
src/pk-transaction-extra.c | 2
src/pk-transaction-list.c | 2
11 files changed, 139 insertions(+), 194 deletions(-)
New commits:
commit bc795379399a7315fe9a1d3c3ffc03ecbbcbe904
Author: Dan Williams <dcbw at redhat.com>
Date: Wed Mar 2 17:32:47 2011 -0600
network: update for NetworkManager 0.9 snapshots
NM 0.9 consolidates modem devices as the hard separation between
access technology families is not flexible enough with all the
new multi-mode devices starting to show up.
Also, add support for WiMAX mobile broadband.
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/src/pk-network-stack-nm.c b/src/pk-network-stack-nm.c
index bb34d16..209bfb3 100644
--- a/src/pk-network-stack-nm.c
+++ b/src/pk-network-stack-nm.c
@@ -32,6 +32,10 @@
#include "pk-conf.h"
#include "pk-marshal.h"
+#ifndef NM_CHECK_VERSION
+#define NM_CHECK_VERSION(x,y,z) 0
+#endif
+
struct PkNetworkStackNmPrivate
{
EggDbusMonitor *dbus_monitor;
@@ -236,8 +240,13 @@ pk_network_stack_nm_get_state (PkNetworkStack *nstack)
case NM_DEVICE_TYPE_WIFI:
ret = PK_NETWORK_ENUM_WIFI;
break;
+#if NM_CHECK_VERSION(0,8,992)
+ case NM_DEVICE_TYPE_WIMAX:
+ case NM_DEVICE_TYPE_MODEM:
+#else
case NM_DEVICE_TYPE_GSM:
case NM_DEVICE_TYPE_CDMA:
+#endif
case NM_DEVICE_TYPE_BT:
ret = PK_NETWORK_ENUM_MOBILE;
break;
commit 891a5a49d8c7c34d31f7646d7da9cf897979aa3d
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Mar 3 11:12:43 2011 +0000
Revert "Work with NetworkManager >= 0.8.992 which has removed two enumerated types"
This reverts commit a9babc28659365f1c127f588b18c0ebad19d0f1a.
diff --git a/configure.ac b/configure.ac
index 76a75ed..4744bf5 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,7 +149,6 @@ GIO_REQUIRED=2.16.1
DBUS_REQUIRED=1.1.1
DBUS_GLIB_REQUIRED=0.74
NETWORK_MANAGER_REQUIRED=0.6.4
-NETWORK_MANAGER_PREFERED=0.8.992
POLKIT_GOBJECT_REQUIRED=0.92
QTCORE_REQUIRED=4.4.0
QTDBUS_REQUIRED=4.4.0
@@ -244,12 +243,6 @@ if test x$enable_networkmanager != xno; then
if test "x$PK_BUILD_NETWORKMANAGER" = "xyes"; then
networking_apis="${networking_apis},NetworkManager"
AC_DEFINE(PK_BUILD_NETWORKMANAGER, 1, [define if NetworkManager is installed])
-
- # new API?
- PKG_CHECK_MODULES(NETWORK_MANAGER_NEW, NetworkManager >= $NETWORK_MANAGER_PREFERED, PK_BUILD_NETWORKMANAGER_NEW="yes", PK_BUILD_NETWORKMANAGER_NEW="no")
- if test "x$PK_BUILD_NETWORKMANAGER_NEW" = "xyes"; then
- AC_DEFINE(PK_BUILD_NETWORKMANAGER_NEW, 1, [define if NetworkManager has new API])
- fi
else
if test x$enable_networkmanager = xyes; then
AC_MSG_ERROR([NetworkManager enabled but not found])
diff --git a/src/pk-network-stack-nm.c b/src/pk-network-stack-nm.c
index 4b0889d..bb34d16 100644
--- a/src/pk-network-stack-nm.c
+++ b/src/pk-network-stack-nm.c
@@ -236,12 +236,8 @@ pk_network_stack_nm_get_state (PkNetworkStack *nstack)
case NM_DEVICE_TYPE_WIFI:
ret = PK_NETWORK_ENUM_WIFI;
break;
-#if PK_BUILD_NETWORKMANAGER_NEW
- case NM_DEVICE_TYPE_MODEM:
-#else
case NM_DEVICE_TYPE_GSM:
case NM_DEVICE_TYPE_CDMA:
-#endif
case NM_DEVICE_TYPE_BT:
ret = PK_NETWORK_ENUM_MOBILE;
break;
commit 0b1ca77320db9a55e6aa6b231a12fb3c171eec40
Author: Panu Matilainen <pmatilai at laiskiainen.org>
Date: Tue Mar 1 10:27:02 2011 +0200
Enable use of new callback mode on yum versions that support it
The new callback mode saves (tens of) megabytes of memory on
larger transactions as it avoids keeping rpm headers loaded in
memory needlessly. This enables the new mode on yum versions that
support it, on older versions it does nothing at all. As PK callback
is inherited from yum.rpmtrans.RPMBaseCallback, it's shielded from the
underlying changes so no further modifications are needed for the new
callback mode.
Signed-off-by: Richard Hughes <richard at hughsie.com>
diff --git a/backends/yum/yumBackend.py b/backends/yum/yumBackend.py
index 9a98543..c9dcd96 100755
--- a/backends/yum/yumBackend.py
+++ b/backends/yum/yumBackend.py
@@ -3454,6 +3454,9 @@ class PackageKitYumBase(yum.YumBase):
self.backend = backend
self.mediagrabber = self.MediaGrabber
+ # Enable new callback mode on yum versions that support it
+ self.use_txmbr_in_callback = True
+
# setup Repo GPG support callbacks
#
# self.preconf may or may not exist at this point...
commit a9babc28659365f1c127f588b18c0ebad19d0f1a
Author: Richard Hughes <richard at hughsie.com>
Date: Mon Feb 28 10:46:12 2011 +0000
Work with NetworkManager >= 0.8.992 which has removed two enumerated types
diff --git a/configure.ac b/configure.ac
index 4744bf5..76a75ed 100644
--- a/configure.ac
+++ b/configure.ac
@@ -149,6 +149,7 @@ GIO_REQUIRED=2.16.1
DBUS_REQUIRED=1.1.1
DBUS_GLIB_REQUIRED=0.74
NETWORK_MANAGER_REQUIRED=0.6.4
+NETWORK_MANAGER_PREFERED=0.8.992
POLKIT_GOBJECT_REQUIRED=0.92
QTCORE_REQUIRED=4.4.0
QTDBUS_REQUIRED=4.4.0
@@ -243,6 +244,12 @@ if test x$enable_networkmanager != xno; then
if test "x$PK_BUILD_NETWORKMANAGER" = "xyes"; then
networking_apis="${networking_apis},NetworkManager"
AC_DEFINE(PK_BUILD_NETWORKMANAGER, 1, [define if NetworkManager is installed])
+
+ # new API?
+ PKG_CHECK_MODULES(NETWORK_MANAGER_NEW, NetworkManager >= $NETWORK_MANAGER_PREFERED, PK_BUILD_NETWORKMANAGER_NEW="yes", PK_BUILD_NETWORKMANAGER_NEW="no")
+ if test "x$PK_BUILD_NETWORKMANAGER_NEW" = "xyes"; then
+ AC_DEFINE(PK_BUILD_NETWORKMANAGER_NEW, 1, [define if NetworkManager has new API])
+ fi
else
if test x$enable_networkmanager = xyes; then
AC_MSG_ERROR([NetworkManager enabled but not found])
diff --git a/src/pk-network-stack-nm.c b/src/pk-network-stack-nm.c
index bb34d16..4b0889d 100644
--- a/src/pk-network-stack-nm.c
+++ b/src/pk-network-stack-nm.c
@@ -236,8 +236,12 @@ pk_network_stack_nm_get_state (PkNetworkStack *nstack)
case NM_DEVICE_TYPE_WIFI:
ret = PK_NETWORK_ENUM_WIFI;
break;
+#if PK_BUILD_NETWORKMANAGER_NEW
+ case NM_DEVICE_TYPE_MODEM:
+#else
case NM_DEVICE_TYPE_GSM:
case NM_DEVICE_TYPE_CDMA:
+#endif
case NM_DEVICE_TYPE_BT:
ret = PK_NETWORK_ENUM_MOBILE;
break;
commit 3ab29e709f7313221c2c5cac9d46c0f026671781
Author: Fabio Erculiani <lxnay at sabayon.org>
Date: Sat Feb 26 09:49:24 2011 +0100
entropy: update handled mime types
diff --git a/backends/entropy/pk-backend-entropy.c b/backends/entropy/pk-backend-entropy.c
index b97f088..cee6c65 100644
--- a/backends/entropy/pk-backend-entropy.c
+++ b/backends/entropy/pk-backend-entropy.c
@@ -165,7 +165,7 @@ backend_get_roles (PkBackend *backend)
static gchar *
backend_get_mime_types (PkBackend *backend)
{
- return g_strdup ("application/x-bzip-compressed-tar;application/x-tbz;application/x-tbz2");
+ return g_strdup ("application/entropy-package;application/entropy-webinstall");
}
/**
commit 7d66146b24f6550896e8ddb79090fd931f627f7b
Author: Duncan Mac-Vicar P <dmacvicar at suse.de>
Date: Fri Feb 18 12:35:56 2011 +0100
zypp: uses the standard system update algorithm from ZYpp, which
honours user policies. (bnc#637764)
zypp: Configurable HidePackages=true in [Updates] section in
/etc/PackageKit/ZYpp.conf to show only maintenance patches
instead of all packages with update candidates.
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index d2280c0..9000070 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -43,12 +43,15 @@
#include <zypp/Pathname.h>
#include <zypp/Patch.h>
#include <zypp/Package.h>
+#include <zypp/ui/Selectable.h>
#include <zypp/sat/Pool.h>
#include <zypp/target/rpm/RpmDb.h>
#include <zypp/target/rpm/RpmHeader.h>
#include <zypp/target/rpm/librpmDb.h>
#include <zypp/base/LogControl.h>
#include <zypp/base/String.h>
+#include <zypp/parser/IniDict.h>
+#include <zypp/PathInfo.h>
#include <zypp/base/Logger.h>
@@ -60,24 +63,9 @@
gchar * _repoName;
gboolean _updating_self = FALSE;
-/**
- * Collect items, select best edition. This is used to find the best
- * available or installed. The name of the class is a bit misleading though ...
- */
-class LookForArchUpdate : public zypp::resfilter::PoolItemFilterFunctor
-{
- public:
- zypp::PoolItem best;
- bool operator() (zypp::PoolItem provider)
- {
- if (!provider.status ().isLocked () && (!best || best->edition ().compare (provider->edition ()) < 0)) {
- best = provider;
- }
-
- return true;
- }
-};
+using zypp::filesystem::PathInfo;
+using zypp::InputStream;
/**
* Initialize Zypp (Factory method)
@@ -161,22 +149,22 @@ zypp_is_development_repo (PkBackend *backend, zypp::RepoInfo repo)
std::string repo_debug("-debug");
std::string repo_development("-development");
std::string repo_source ("-source");
-
+
std::string repo_name(repo.name());
- if (repo_name.length() > repo_debuginfo.length() &&
+ if (repo_name.length() > repo_debuginfo.length() &&
repo_name.compare(repo_name.length() - repo_debuginfo.length(), repo_debuginfo.length(), repo_debuginfo) == 0)
return TRUE;
- if (repo_name.length() > repo_debug.length() &&
+ if (repo_name.length() > repo_debug.length() &&
repo_name.compare(repo_name.length() - repo_debug.length(), repo_debug.length(), repo_debug) == 0)
return TRUE;
- if (repo_name.length() > repo_development.length() &&
+ if (repo_name.length() > repo_development.length() &&
repo_name.compare(repo_name.length() - repo_development.length(), repo_development.length(), repo_development) == 0)
return TRUE;
- if (repo_name.length() > repo_source.length() &&
+ if (repo_name.length() > repo_source.length() &&
repo_name.compare(repo_name.length() - repo_source.length(), repo_source.length(), repo_source) == 0)
return TRUE;
@@ -257,39 +245,6 @@ warn_outdated_repos(PkBackend *backend, const zypp::ResPool & pool)
}
}
-
-#if 0 // apparently unused
-/**
- * Build and return a ResPool that contains only the local resolvables.
- */
-zypp::ResPool
-zypp_build_local_pool (PkBackend *backend)
-{
- zypp::sat::Pool pool = zypp::sat::Pool::instance ();
- zypp::ZYpp::Ptr zypp = get_zypp (backend);
-
- try {
- for (zypp::detail::RepositoryIterator it = pool.reposBegin (); it != pool.reposEnd (); it++){
- if (! it->isSystemRepo ())
- pool.reposErase(it->alias ());
- }
-
- if (zypp::sat::Pool::instance().reposFind( zypp::sat::Pool::systemRepoAlias() ).solvablesEmpty ())
- {
- // Add local resolvables
- zypp::Target_Ptr target = zypp->target ();
- target->load ();
- }
-
- } catch (const zypp::Exception &ex) {
- g_error ("%s", ex.asUserString ().c_str ());
- }
-
- return zypp->pool ();
-
-}
-#endif
-
zypp::target::rpm::RpmHeader::constPtr
zypp_get_rpmHeader (std::string name, zypp::Edition edition)
{
@@ -495,7 +450,7 @@ gboolean
zypp_refresh_meta_and_cache (zypp::RepoManager &manager, zypp::RepoInfo &repo, bool force)
{
try {
- if (manager.checkIfToRefreshMetadata (repo, repo.url(),
+ if (manager.checkIfToRefreshMetadata (repo, repo.url(),
zypp::RepoManager::RefreshIfNeededIgnoreDelay)
!= zypp::RepoManager::REFRESH_NEEDED)
return TRUE;
@@ -661,7 +616,7 @@ zypp_filter_solvable (PkBitfield filters, const zypp::sat::Solvable &item)
return TRUE;
// FIXME: add more enums - cf. libzif logic and pk-enum.h
- // PK_FILTER_ENUM_SUPPORTED,
+ // PK_FILTER_ENUM_SUPPORTED,
// PK_FILTER_ENUM_NOT_SUPPORTED,
}
@@ -702,7 +657,7 @@ zypp_emit_filtered_packages_in_list (PkBackend *backend, const std::vector<zypp:
match = FALSE;
for (sat_it_t i = installed.begin (); !match && i != installed.end (); i++) {
- match = it->sameNVRA (*i) &&
+ match = it->sameNVRA (*i) &&
!(!zypp::isKind<zypp::SrcPackage>(*it) ^
!zypp::isKind<zypp::SrcPackage>(*i));
}
@@ -724,34 +679,6 @@ zypp_backend_package (PkBackend *backend, PkInfoEnum info,
}
/**
- * The following method was taken directly from zypper code
- *
- * Find best (according to edition) uninstalled item
- * with the same kind/name/arch as item.
- * Similar to zypp::solver::detail::Helper::findUpdateItem
- * but that allows changing the arch (#222140).
- */
-zypp::PoolItem
-zypp_find_arch_update_item (const zypp::ResPool & pool, zypp::PoolItem item)
-{
- LookForArchUpdate info;
-
- invokeOnEach (pool.byIdentBegin (item),
- pool.byIdentEnd (item),
- // get uninstalled, equal kind and arch, better edition
- zypp::functor::chain (
- zypp::functor::chain (
- zypp::functor::chain (
- zypp::resfilter::ByUninstalled (),
- zypp::resfilter::ByKind (item->kind ())),
- zypp::resfilter::byArch<zypp::CompareByEQ<zypp::Arch> > (item->arch ())),
- zypp::resfilter::byEdition<zypp::CompareByGT<zypp::Edition> > (item->edition ())),
- zypp::functor::functorRef<bool,zypp::PoolItem> (info));
-
- return info.best;
-}
-
-/**
* Returns a set of all packages the could be updated
* (you're able to exclude a single (normally the 'patch' repo)
*/
@@ -765,35 +692,16 @@ zypp_get_package_updates (std::string repo)
zypp::ResPool::byKind_iterator it = pool.byKindBegin (kind);
zypp::ResPool::byKind_iterator e = pool.byKindEnd (kind);
- for (; it != e; ++it) {
- if (it->status ().isUninstalled ())
- continue;
- zypp::PoolItem candidate = zypp_find_arch_update_item (pool, *it);
- if (!candidate.resolvable ())
- continue;
-
- gboolean system = false;
- for (zypp::ResPool::byName_iterator it = pool.byNameBegin (candidate->name());
- it != pool.byNameEnd (candidate->name()); it++) {
- if (!it->satSolvable().isSystem())
- continue;
- if (zypp_ver_and_arch_equal (it->satSolvable(), candidate->edition ().c_str (),candidate->arch ().c_str ())) {
- system = true;
- break;
- }
- }
- if (system == true)
- continue;
-
- if (repo.empty ()) {
- pks->insert (candidate);
- } else {
- if (candidate->repoInfo ().alias ().compare (repo) != 0)
- pks->insert (candidate);
- }
- }
-
- return pks;
+ zypp::getZYpp()->resolver()->doUpdate();
+ for (; it != e; ++it)
+ if (it->status().isToBeInstalled())
+ {
+ zypp::ui::Selectable::constPtr s =
+ zypp::ui::Selectable::get((*it)->kind(), (*it)->name());
+ if (s->hasInstalledObj())
+ pks->insert(*it);
+ }
+ return pks;
}
/**
@@ -850,38 +758,54 @@ zypp_get_updates (PkBackend *backend)
patchRepo = candidates->begin ()->resolvable ()->repoInfo ().alias ();
}
- std::set<zypp::PoolItem> *packages;
+ bool hidePackages = false;
+ if (PathInfo("/etc/PackageKit/ZYpp.conf").isExist()) {
+ zypp::parser::IniDict vendorConf(InputStream("/etc/PackageKit/ZYpp.conf"));
+ if (vendorConf.hasSection("Updates")) {
+ for ( zypp::parser::IniDict::entry_const_iterator eit = vendorConf.entriesBegin("Updates");
+ eit != vendorConf.entriesEnd("Updates");
+ ++eit )
+ {
+ if ((*eit).first == "HidePackages" &&
+ zypp::str::strToTrue((*eit).second))
+ hidePackages = true;
+ }
+ }
+ }
- packages = zypp_get_package_updates (patchRepo);
- pi_it_t cb = candidates->begin (), ce = candidates->end (), ci;
- for (ci = cb; ci != ce; ++ci) {
- if (!zypp::isKind<zypp::Patch>(ci->resolvable()))
+ if (!hidePackages)
+ {
+ std::set<zypp::PoolItem> *packages;
+ packages = zypp_get_package_updates (patchRepo);
+ pi_it_t cb = candidates->begin (), ce = candidates->end (), ci;
+ for (ci = cb; ci != ce; ++ci) {
+ if (!zypp::isKind<zypp::Patch>(ci->resolvable()))
continue;
- zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(ci->resolvable());
+ zypp::Patch::constPtr patch = zypp::asKind<zypp::Patch>(ci->resolvable());
+
+ // Remove contained packages from list of packages to add
+ zypp::sat::SolvableSet::const_iterator pki;
+ for (pki = patch->contents().begin(); pki != patch->contents().end(); pki++) {
- // Remove contained packages from list of packages to add
- zypp::sat::SolvableSet::const_iterator pki;
- for (pki = patch->contents().begin(); pki != patch->contents().end(); pki++) {
+ pi_it_t pb = packages->begin (), pe = packages->end (), pi;
+ for (pi = pb; pi != pe; ++pi) {
+ if (pi->satSolvable() == zypp::sat::Solvable::noSolvable)
+ continue;
- pi_it_t pb = packages->begin (), pe = packages->end (), pi;
- for (pi = pb; pi != pe; ++pi) {
- if (pi->satSolvable() == zypp::sat::Solvable::noSolvable)
- continue;
-
- if (pi->satSolvable().identical (*pki)) {
- packages->erase (pi);
- break;
+ if (pi->satSolvable().identical (*pki)) {
+ packages->erase (pi);
+ break;
+ }
}
}
}
- }
- // merge into the list
- candidates->insert (packages->begin (), packages->end ());
- delete (packages);
+ // merge into the list
+ candidates->insert (packages->begin (), packages->end ());
+ delete (packages);
+ }
}
-
return candidates;
}
@@ -1200,7 +1124,7 @@ zypp_backend_finished_error (PkBackend *backend, PkErrorEnum err_code,
va_end (args);
pk_backend_error_code (backend, err_code, "%s", buffer);
-
+
g_free (buffer);
pk_backend_finished (backend);
@@ -1268,7 +1192,7 @@ zypp_ver_and_arch_equal (const zypp::sat::Solvable &pkg,
{
const std::string &ver = pkg.edition ().asString();
if (g_strcmp0 (ver.c_str (), name))
- return FALSE;
+ return FALSE;
if (arch && !strcmp (arch, "source")) {
return zypp::isKind<zypp::SrcPackage>(pkg);
diff --git a/backends/zypp/zypp-utils.h b/backends/zypp/zypp-utils.h
index 815f594..71cd955 100644
--- a/backends/zypp/zypp-utils.h
+++ b/backends/zypp/zypp-utils.h
@@ -229,7 +229,6 @@ gboolean zypp_backend_pool_item_notify (PkBackend *backend,
gboolean zypp_ver_and_arch_equal (const zypp::sat::Solvable &pkg,
const char *name, const char *arch);
-
/**
* helper to refresh a repo's metadata and cache, catching signature
* exceptions in a safe way.
commit f6c639abc0794850c18927913c6f3b254e0c896b
Author: Richard Hughes <richard at hughsie.com>
Date: Fri Feb 18 10:31:34 2011 +0000
trivial: increase the allowed time for cleanup in the self test programs to prevent an intermittent failure
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 9514216..feea3ba 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -1551,6 +1551,7 @@ pk_test_transaction_list_func (void)
gchar *tid_item1;
gchar *tid_item2;
gchar *tid_item3;
+ PkBackend *backend;
/* remove the self check file */
#if PK_BUILD_LOCAL
@@ -1614,7 +1615,6 @@ pk_test_transaction_list_func (void)
ret = pk_transaction_list_create (tlist, tid, ":org.freedesktop.PackageKit", NULL);
g_assert (ret);
- PkBackend *backend;
backend = pk_backend_new ();
/* try to load a valid backend */
ret = pk_backend_set_name (backend, "dummy", NULL);
@@ -1806,7 +1806,7 @@ pk_test_transaction_list_func (void)
g_assert_cmpint (pk_transaction_get_state (transaction), ==, PK_TRANSACTION_STATE_FINISHED);
/* wait for Cleanup */
- _g_test_loop_wait (5000);
+ _g_test_loop_wait (10000);
/* get transactions in queue */
size = pk_transaction_list_get_size (tlist);
diff --git a/src/pk-transaction-list.c b/src/pk-transaction-list.c
index 8db34ce..058a2e2 100644
--- a/src/pk-transaction-list.c
+++ b/src/pk-transaction-list.c
@@ -109,6 +109,8 @@ pk_transaction_list_get_from_tid (PkTransactionList *tlist, const gchar *tid)
/**
* pk_transaction_list_get_transaction:
+ *
+ * Return value: Do not unref.
**/
PkTransaction *
pk_transaction_list_get_transaction (PkTransactionList *tlist, const gchar *tid)
commit a96d18cb8316ad1766a5c3eedc1ae2afce49ceab
Author: Zhang Qiang <qiang.z.zhang at intel.com>
Date: Fri Feb 18 13:04:14 2011 +0800
zypp: remove check online in refresh cache
check online is not neccesary while refreshing cache, as local repo also
can be used while offline.
diff --git a/backends/zypp/zypp-utils.cpp b/backends/zypp/zypp-utils.cpp
index b7574ad..d2280c0 100644
--- a/backends/zypp/zypp-utils.cpp
+++ b/backends/zypp/zypp-utils.cpp
@@ -1125,11 +1125,6 @@ zypp_refresh_cache (PkBackend *backend, gboolean force)
zypp->finishTarget ();
zypp->initializeTarget (pathname);
- if (!pk_backend_is_online (backend)) {
- pk_backend_error_code (backend, PK_ERROR_ENUM_NO_NETWORK, "Cannot refresh cache whilst offline");
- return FALSE;
- }
-
pk_backend_set_status (backend, PK_STATUS_ENUM_REFRESH_CACHE);
pk_backend_set_percentage (backend, 0);
commit 0bd4c77fa29043ac6d513175d5c533625ba6c5e7
Author: Zhang Qiang <qiang.z.zhang at intel.com>
Date: Fri Feb 18 12:55:58 2011 +0800
connman: Change the connman dbus name
connman dbus name is changed as 'net.connman', and this patch sync
connmand dbus name with upstream.
diff --git a/src/pk-network-stack-connman.c b/src/pk-network-stack-connman.c
index 01c04c7..90df93e 100644
--- a/src/pk-network-stack-connman.c
+++ b/src/pk-network-stack-connman.c
@@ -44,7 +44,7 @@ struct PkNetworkStackConnmanPrivate
G_DEFINE_TYPE (PkNetworkStackConnman, pk_network_stack_connman, PK_TYPE_NETWORK_STACK)
#define PK_NETWORK_STACK_CONNMAN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PK_TYPE_NETWORK_STACK_CONNMAN, PkNetworkStackConnmanPrivate))
-#define CONNMAN_DBUS_NAME "org.moblin.connman"
+#define CONNMAN_DBUS_NAME "net.connman"
#define CONNMAN_MANAGER_DBUS_INTERFACE CONNMAN_DBUS_NAME ".Manager"
#define CONNMAN_SERVICE_DBUS_INTERFACE CONNMAN_DBUS_NAME ".Service"
#define CONNMAN_MANAGER_DBUS_PATH "/"
commit f4329839ed8f60a4daa828678663661946cb5b97
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Feb 17 16:43:56 2011 +0000
trivial: make the error checks more strict in the pk_backend_set_name() tests
diff --git a/src/pk-backend.c b/src/pk-backend.c
index 3201239..4421762 100644
--- a/src/pk-backend.c
+++ b/src/pk-backend.c
@@ -517,7 +517,8 @@ pk_backend_set_name (PkBackend *backend, const gchar *backend_name, GError **err
path = pk_backend_build_library_path (backend, backend_name);
handle = g_module_open (path, 0);
if (handle == NULL) {
- g_set_error (error, 1, 0, "opening module %s failed : %s", backend_name, g_module_error ());
+ g_set_error (error, 1, 0, "opening module %s failed : %s",
+ backend_name, g_module_error ());
goto out;
}
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 4aeb7eb..9514216 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -179,6 +179,7 @@ pk_test_backend_func (void)
gboolean ret;
const gchar *filename;
gboolean developer_mode;
+ GError *error = NULL;
/* get an backend */
backend = pk_backend_new ();
@@ -228,16 +229,21 @@ pk_test_backend_func (void)
g_assert (!ret);
/* load an invalid backend */
- ret = pk_backend_set_name (backend, "invalid", NULL);
+ ret = pk_backend_set_name (backend, "invalid", &error);
+ g_assert_error (error, 1, 0);
g_assert (!ret);
+ g_clear_error (&error);
/* try to load a valid backend */
- ret = pk_backend_set_name (backend, "dummy", NULL);
+ ret = pk_backend_set_name (backend, "dummy", &error);
+ g_assert_no_error (error);
g_assert (ret);
/* load an valid backend again */
- ret = pk_backend_set_name (backend, "dummy", NULL);
+ ret = pk_backend_set_name (backend, "dummy", &error);
+ g_assert_error (error, 1, 0);
g_assert (!ret);
+ g_clear_error (&error);
/* lock an valid backend */
ret = pk_backend_lock (backend);
commit 5a7f6f912eaf8dd5cf7d4e468f57c83c23b93f8a
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Feb 17 16:43:31 2011 +0000
trivial: show different warning messages for the different databases
diff --git a/src/pk-transaction-db.c b/src/pk-transaction-db.c
index 989b5d9..5fb09a0 100644
--- a/src/pk-transaction-db.c
+++ b/src/pk-transaction-db.c
@@ -792,7 +792,7 @@ pk_transaction_db_init (PkTransactionDb *tdb)
g_debug ("trying to open database '%s'", PK_TRANSACTION_DB_FILE);
rc = sqlite3_open (PK_TRANSACTION_DB_FILE, &tdb->priv->db);
if (rc != SQLITE_OK) {
- g_error ("Can't open database: %s\n", sqlite3_errmsg (tdb->priv->db));
+ g_error ("Can't open transaction database: %s\n", sqlite3_errmsg (tdb->priv->db));
sqlite3_close (tdb->priv->db);
return;
}
diff --git a/src/pk-transaction-extra.c b/src/pk-transaction-extra.c
index 4d4d11a..cb3ee09 100644
--- a/src/pk-transaction-extra.c
+++ b/src/pk-transaction-extra.c
@@ -1214,7 +1214,7 @@ pk_transaction_extra_init (PkTransactionExtra *extra)
g_debug ("trying to open database '%s'", PK_DESKTOP_DEFAULT_DATABASE);
rc = sqlite3_open (PK_DESKTOP_DEFAULT_DATABASE, &extra->priv->db);
if (rc != 0) {
- g_warning ("Can't open database: %s\n", sqlite3_errmsg (extra->priv->db));
+ g_warning ("Can't open desktop database: %s\n", sqlite3_errmsg (extra->priv->db));
sqlite3_close (extra->priv->db);
extra->priv->db = NULL;
return;
commit 6b54fa7ab7765b2e6e7bf52e67b6e44fb7245436
Merge: 4eb4ab9... 99a53c7...
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Thu Feb 17 17:38:10 2011 +0100
Merge branch 'master' of gitorious.org:packagekit/packagekit
commit 4eb4ab9a483c590989b3edcc8d851a8e8da12d5e
Author: Matthias Klumpp <matthias at nlinux.org>
Date: Thu Feb 17 17:34:50 2011 +0100
trivial: Increase loop timeout in engine self-test
1000ms is a too fast timeout for slower computers,
so we increase it to 1500ms.
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index cb33d50..79a8202 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -720,7 +720,7 @@ pk_test_engine_func (void)
/* force test notify wait updates-changed */
g_test_timer_start ();
pk_notify_wait_updates_changed (notify, 500);
- _g_test_loop_run_with_timeout (1000);
+ _g_test_loop_run_with_timeout (1500);
elapsed = g_test_timer_elapsed ();
g_assert_cmpfloat (elapsed, >, 0.4);
g_assert_cmpfloat (elapsed, <, 0.6);
commit 99a53c71df78b6ba22db4c54f28aa7c9b1c58bb7
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Feb 17 16:33:18 2011 +0000
trivial: remove the get-updates cached results test, we're testing code that no longer exists
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index cb33d50..979a51a 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -1675,42 +1675,6 @@ pk_test_transaction_list_func (void)
g_free (tid);
- tid = pk_test_transaction_list_create_transaction (tlist);
- transaction = pk_transaction_list_get_transaction (tlist, tid);
- g_signal_connect (transaction, "finished",
- G_CALLBACK (pk_test_transaction_list_finished_cb), NULL);
-
- pk_transaction_get_updates (transaction, "none", NULL);
-
- /* wait for cached results*/
- _g_test_loop_run_with_timeout (1000);
-
- /* make sure transaction has correct flags */
- g_assert_cmpint (pk_transaction_get_state (transaction), ==, PK_TRANSACTION_STATE_FINISHED);
-
- /* get transactions (committed, not finished) in progress (none, as cached) */
- array = pk_transaction_list_get_array (tlist);
- size = g_strv_length (array);
- g_assert_cmpint (size, ==, 0);
- g_strfreev (array);
-
- /* get size we have in queue */
- size = pk_transaction_list_get_size (tlist);
- g_assert_cmpint (size, ==, 1);
-
- /* wait for Cleanup */
- _g_test_loop_wait (10000);
-
- /* get transactions (committed, not finished) in progress (none, as cached) */
- array = pk_transaction_list_get_array (tlist);
- size = g_strv_length (array);
- g_assert_cmpint (size, ==, 0);
- g_strfreev (array);
-
- /* get size we have in queue */
- size = pk_transaction_list_get_size (tlist);
- g_assert_cmpint (size, ==, 0);
-
/* create three instances in list */
tid_item1 = pk_test_transaction_list_create_transaction (tlist);
tid_item2 = pk_test_transaction_list_create_transaction (tlist);
commit f78eb22f4c142b35b149ef2ea5cbdd88b6b41ec8
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Feb 17 16:26:06 2011 +0000
trivial: fix make check for 64bit debian systems that only have /lib/libglib-2.0.so.0.2800.0 rather than /lib/libglib-2.0.so
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 461b89f..cb33d50 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -818,12 +818,47 @@ pk_test_inhibit_func (void)
}
static void
+pk_test_lsof_get_files_for_directory (GPtrArray *files, const gchar *dirname)
+{
+ GDir *dir;
+ const gchar *filename;
+ dir = g_dir_open (dirname, 0, NULL);
+ if (dir == NULL)
+ return;
+ filename = g_dir_read_name (dir);
+ while (filename != NULL) {
+ if (g_str_has_prefix (filename, "libglib-2.0.so"))
+ g_ptr_array_add (files,
+ g_build_filename (dirname, filename, NULL));
+ filename = g_dir_read_name (dir);
+ }
+ g_dir_close (dir);
+}
+
+static gchar **
+pk_test_lsof_get_files (void)
+{
+ GPtrArray *files;
+ gchar **retval;
+
+ files = g_ptr_array_new_with_free_func (g_free);
+ pk_test_lsof_get_files_for_directory (files, "/lib");
+ pk_test_lsof_get_files_for_directory (files, "/usr/lib");
+ pk_test_lsof_get_files_for_directory (files, "/usr/lib64");
+
+ /* convert to gchar ** */
+ retval = pk_ptr_array_to_strv (files);
+ g_ptr_array_unref (files);
+ return retval;
+}
+
+static void
pk_test_lsof_func (void)
{
gboolean ret;
PkLsof *lsof;
GPtrArray *pids;
- gchar *files[] = { "/usr/lib/libssl3.so", NULL };
+ gchar **files;
lsof = pk_lsof_new ();
g_assert (lsof != NULL);
@@ -832,11 +867,14 @@ pk_test_lsof_func (void)
ret = pk_lsof_refresh (lsof);
g_assert (ret);
- /* get pids for files */
+ /* get pids for some test files */
+ files = pk_test_lsof_get_files ();
+ g_assert_cmpint (g_strv_length (files), >, 0);
pids = pk_lsof_get_pids_for_filenames (lsof, files);
g_assert_cmpint (pids->len, >, 0);
g_ptr_array_unref (pids);
+ g_strfreev (files);
g_object_unref (lsof);
}
commit a164364b0eedb56217c23085f39b77b3fa1c98e3
Author: Richard Hughes <richard at hughsie.com>
Date: Thu Feb 17 15:36:54 2011 +0000
trivial: require --enable-local for make check support in src/
diff --git a/src/pk-self-test.c b/src/pk-self-test.c
index 970db35..461b89f 100644
--- a/src/pk-self-test.c
+++ b/src/pk-self-test.c
@@ -1824,6 +1824,10 @@ main (int argc, char **argv)
g_type_init ();
g_test_init (&argc, &argv, NULL);
+#ifndef PK_BUILD_LOCAL
+ g_warning ("you need to compile with --enable-local for make check support");
+#endif
+
/* components */
g_test_add_func ("/packagekit/notify", pk_test_proc_func);
g_test_add_func ("/packagekit/proc", pk_test_proc_func);
More information about the PackageKit-commit
mailing list