summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Conder <jonno.conder@gmail.com>2013-03-17 21:17:31 +1300
committerJonathan Conder <jonno.conder@gmail.com>2013-04-18 00:36:50 +1200
commitb4b3c8fba98e4e1f29e6a1cc3d70ee2dac605a74 (patch)
tree07f484af9da3d8bd891d66f7b6d9900a390d37e3
parent537aeb5fa5595cf1da9ad87f4ea20708f194a0a1 (diff)
alpm: account for minor API changes in alpm 8
-rw-r--r--backends/alpm/Makefile.am4
-rw-r--r--backends/alpm/pk-backend-alpm.c4
-rw-r--r--backends/alpm/pk-backend-config.c2
-rw-r--r--backends/alpm/pk-backend-databases.c14
-rw-r--r--backends/alpm/pk-backend-depends.c2
-rw-r--r--backends/alpm/pk-backend-install.c2
-rw-r--r--backends/alpm/pk-backend-packages.c10
-rw-r--r--backends/alpm/pk-backend-remove.c2
-rw-r--r--backends/alpm/pk-backend-search.c2
-rw-r--r--backends/alpm/pk-backend-sync.c8
-rw-r--r--backends/alpm/pk-backend-transaction.c24
-rw-r--r--backends/alpm/pk-backend-update.c36
-rw-r--r--configure.ac4
13 files changed, 66 insertions, 48 deletions
diff --git a/backends/alpm/Makefile.am b/backends/alpm/Makefile.am
index d8c3dfcbc..8e1479035 100644
--- a/backends/alpm/Makefile.am
+++ b/backends/alpm/Makefile.am
@@ -23,6 +23,7 @@ DEFS = -DPK_BACKEND_CONFIG_FILE=\"$(PK_BACKEND_CONFIG_FILE)\" \
-DPK_BACKEND_DEFAULT_LOGFILE=\"$(PK_BACKEND_DEFAULT_LOGFILE)\" \
-DALPM_CACHE_PATH=\"$(ALPM_CACHE_PATH)\" \
-DALPM_PACKAGE_URL=\"$(ALPM_PACKAGE_URL)\" \
+ -DPK_LOG_PREFIX=\"PACKAGEKIT\" \
-DG_LOG_DOMAIN=\"PackageKit-alpm\"
confdir = $(PK_CONF_DIR)/alpm.d
@@ -47,10 +48,11 @@ libpk_backend_alpm_la_SOURCES = pk-backend-alpm.c \
pk-backend-transaction.c \
pk-backend-update.c
libpk_backend_alpm_la_LIBADD = $(PK_PLUGIN_LIBS) \
- -lalpm
+ $(ALPM_LIBS)
libpk_backend_alpm_la_LDFLAGS = -module \
-avoid-version
libpk_backend_alpm_la_CFLAGS = $(PK_PLUGIN_CFLAGS) \
+ $(ALPM_CFLAGS) \
$(WARNINGFLAGS_C)
EXTRA_DIST = $(conf_DATA) $(libpk_backend_alpm_la_SOURCES:.c=.h)
diff --git a/backends/alpm/pk-backend-alpm.c b/backends/alpm/pk-backend-alpm.c
index 5c6b62973..a4cd1976c 100644
--- a/backends/alpm/pk-backend-alpm.c
+++ b/backends/alpm/pk-backend-alpm.c
@@ -284,9 +284,9 @@ pk_backend_initialize_alpm (PkBackend *self, GError **error)
backend = self;
alpm_option_set_logcb (alpm, pk_backend_logcb);
- localdb = alpm_option_get_localdb (alpm);
+ localdb = alpm_get_localdb (alpm);
if (localdb == NULL) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "[%s]: %s", "local",
alpm_strerror (errno));
}
diff --git a/backends/alpm/pk-backend-config.c b/backends/alpm/pk-backend-config.c
index c8fd13b9e..faf47e62f 100644
--- a/backends/alpm/pk-backend-config.c
+++ b/backends/alpm/pk-backend-config.c
@@ -746,7 +746,7 @@ static alpm_handle_t *
pk_backend_config_initialize_alpm (PkBackendConfig *config, GError **error)
{
alpm_handle_t *handle;
- enum _alpm_errno_t errno;
+ alpm_errno_t errno;
gsize dir = 1;
g_return_val_if_fail (config != NULL, FALSE);
diff --git a/backends/alpm/pk-backend-databases.c b/backends/alpm/pk-backend-databases.c
index a12329753..09462ab4b 100644
--- a/backends/alpm/pk-backend-databases.c
+++ b/backends/alpm/pk-backend-databases.c
@@ -140,8 +140,8 @@ disabled_repos_configure (GHashTable *table, gboolean only_trusted,
g_return_val_if_fail (table != NULL, FALSE);
g_return_val_if_fail (alpm != NULL, FALSE);
- if (alpm_db_unregister_all (alpm) < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ if (alpm_unregister_all_syncdbs (alpm) < 0) {
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error_literal (error, ALPM_ERROR, errno,
alpm_strerror (errno));
return FALSE;
@@ -161,9 +161,9 @@ disabled_repos_configure (GHashTable *table, gboolean only_trusted,
level &= ~ALPM_SIG_USE_DEFAULT;
}
- db = alpm_db_register_sync (alpm, repo->name, level);
+ db = alpm_register_syncdb (alpm, repo->name, level);
if (db == NULL) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "[%s]: %s",
repo->name, alpm_strerror (errno));
return FALSE;
@@ -282,7 +282,7 @@ pk_backend_get_repo_list_thread (PkBackend *self)
g_return_val_if_fail (disabled != NULL, FALSE);
/* emit enabled repos */
- for (i = alpm_option_get_syncdbs (alpm); i != NULL; i = i->next) {
+ for (i = alpm_get_syncdbs (alpm); i != NULL; i = i->next) {
alpm_db_t *db = (alpm_db_t *) i->data;
const gchar *repo = alpm_db_get_name (db);
@@ -368,13 +368,13 @@ pk_backend_repo_disable_thread (PkBackend *self)
g_return_val_if_fail (repo != NULL, FALSE);
- for (i = alpm_option_get_syncdbs (alpm); i != NULL; i = i->next) {
+ for (i = alpm_get_syncdbs (alpm); i != NULL; i = i->next) {
alpm_db_t *db = (alpm_db_t *) i->data;
const gchar *name = alpm_db_get_name (db);
if (g_strcmp0 (repo, name) == 0) {
if (alpm_db_unregister (db) < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (&error, ALPM_ERROR, errno,
"[%s]: %s", repo,
alpm_strerror (errno));
diff --git a/backends/alpm/pk-backend-depends.c b/backends/alpm/pk-backend-depends.c
index 7c7b45aa3..846ac1b1d 100644
--- a/backends/alpm/pk-backend-depends.c
+++ b/backends/alpm/pk-backend-depends.c
@@ -85,7 +85,7 @@ pk_backend_find_provider (PkBackend *self, alpm_list_t *pkgs,
}
/* look for remote dependencies */
- syncdbs = alpm_option_get_syncdbs (alpm);
+ syncdbs = alpm_get_syncdbs (alpm);
provider = alpm_find_dbs_satisfier (alpm, syncdbs, depend);
if (provider != NULL) {
diff --git a/backends/alpm/pk-backend-install.c b/backends/alpm/pk-backend-install.c
index d0cbca22d..393c4ae40 100644
--- a/backends/alpm/pk-backend-install.c
+++ b/backends/alpm/pk-backend-install.c
@@ -66,7 +66,7 @@ pk_backend_transaction_add_targets (PkBackend *self, GError **error)
for (; *paths != NULL; ++paths) {
if (alpm_add_file (*paths) < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "%s: %s",
*paths, alpm_strerror (errno));
return FALSE;
diff --git a/backends/alpm/pk-backend-packages.c b/backends/alpm/pk-backend-packages.c
index c90cd7d78..86b1ef7cd 100644
--- a/backends/alpm/pk-backend-packages.c
+++ b/backends/alpm/pk-backend-packages.c
@@ -42,7 +42,7 @@ alpm_pkg_build_id (alpm_pkg_t *pkg)
}
/* TODO: check correctness */
- if (alpm_pkg_get_origin (pkg) == PKG_FROM_SYNCDB) {
+ if (alpm_pkg_get_origin (pkg) == ALPM_PKG_FROM_SYNCDB) {
repo = alpm_db_get_name (alpm_pkg_get_db (pkg));
} else {
repo = "installed";
@@ -84,7 +84,7 @@ pk_backend_find_pkg (PkBackend *self, const gchar *package_id, GError **error)
if (g_strcmp0 (repo_id, "installed") == 0) {
db = localdb;
} else {
- const alpm_list_t *i = alpm_option_get_syncdbs (alpm);
+ const alpm_list_t *i = alpm_get_syncdbs (alpm);
for (; i != NULL; i = i->next) {
const gchar *repo = alpm_db_get_name (i->data);
@@ -140,7 +140,7 @@ pk_backend_resolve_package (PkBackend *self, const gchar *package,
PK_FILTER_ENUM_NOT_INSTALLED);
skip_remote = pk_bitfield_contain (filters, PK_FILTER_ENUM_INSTALLED);
- if (alpm_pkg_get_origin (pkg) == PKG_FROM_LOCALDB) {
+ if (alpm_pkg_get_origin (pkg) == ALPM_PKG_FROM_LOCALDB) {
if (!skip_local) {
pk_backend_pkg (self, pkg, PK_INFO_ENUM_INSTALLED);
}
@@ -179,7 +179,7 @@ pk_backend_resolve_name (PkBackend *self, const gchar *name, GError **error)
return TRUE;
}
} else if (!skip_remote) {
- const alpm_list_t *i = alpm_option_get_syncdbs (alpm);
+ const alpm_list_t *i = alpm_get_syncdbs (alpm);
for (; i != NULL; i = i->next) {
pkg = alpm_db_get_pkg (i->data, name);
if (pkg != NULL) {
@@ -287,7 +287,7 @@ pk_backend_get_details_thread (PkBackend *self)
desc = alpm_pkg_get_desc (pkg);
url = alpm_pkg_get_url (pkg);
- if (alpm_pkg_get_origin (pkg) == PKG_FROM_LOCALDB) {
+ if (alpm_pkg_get_origin (pkg) == ALPM_PKG_FROM_LOCALDB) {
size = alpm_pkg_get_isize (pkg);
} else {
size = alpm_pkg_download_size (pkg);
diff --git a/backends/alpm/pk-backend-remove.c b/backends/alpm/pk-backend-remove.c
index 19930616f..331684f7f 100644
--- a/backends/alpm/pk-backend-remove.c
+++ b/backends/alpm/pk-backend-remove.c
@@ -48,7 +48,7 @@ pk_backend_transaction_remove_targets (PkBackend *self, GError **error)
alpm_pkg_t *pkg = alpm_db_get_pkg (localdb, name);
if (pkg == NULL || alpm_remove_pkg (alpm, pkg) < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "%s: %s", name,
alpm_strerror (errno));
g_strfreev (package);
diff --git a/backends/alpm/pk-backend-search.c b/backends/alpm/pk-backend-search.c
index c4e80aede..4cfeeb259 100644
--- a/backends/alpm/pk-backend-search.c
+++ b/backends/alpm/pk-backend-search.c
@@ -374,7 +374,7 @@ pk_backend_search_thread (PkBackend *self)
goto out;
}
- for (i = alpm_option_get_syncdbs (alpm); i != NULL; i = i->next) {
+ for (i = alpm_get_syncdbs (alpm); i != NULL; i = i->next) {
if (pk_backend_cancelled (self)) {
break;
}
diff --git a/backends/alpm/pk-backend-sync.c b/backends/alpm/pk-backend-sync.c
index d2f363b8b..80d5ae090 100644
--- a/backends/alpm/pk-backend-sync.c
+++ b/backends/alpm/pk-backend-sync.c
@@ -48,7 +48,7 @@ pk_backend_transaction_sync_targets (PkBackend *self, GError **error)
gchar *repo = package[PK_PACKAGE_ID_DATA];
gchar *name = package[PK_PACKAGE_ID_NAME];
- const alpm_list_t *i = alpm_option_get_syncdbs (alpm);
+ const alpm_list_t *i = alpm_get_syncdbs (alpm);
alpm_pkg_t *pkg;
for (; i != NULL; i = i->next) {
@@ -58,7 +58,7 @@ pk_backend_transaction_sync_targets (PkBackend *self, GError **error)
}
if (i == NULL) {
- enum _alpm_errno_t errno = ALPM_ERR_DB_NOT_FOUND;
+ alpm_errno_t errno = ALPM_ERR_DB_NOT_FOUND;
g_set_error (error, ALPM_ERROR, errno, "%s/%s: %s",
repo, name, alpm_strerror (errno));
g_strfreev (package);
@@ -67,7 +67,7 @@ pk_backend_transaction_sync_targets (PkBackend *self, GError **error)
pkg = alpm_db_get_pkg (i->data, name);
if (pkg == NULL || alpm_add_pkg (alpm, pkg) < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "%s/%s: %s",
repo, name, alpm_strerror (errno));
g_strfreev (package);
@@ -274,7 +274,7 @@ pk_backend_update_packages_thread (PkBackend *self)
for (i = asdeps; i != NULL; i = i->next) {
const gchar *name = (const gchar *) i->data;
alpm_pkg_t *pkg = alpm_db_get_pkg (localdb, name);
- alpm_db_set_pkgreason (alpm, pkg, ALPM_PKG_REASON_DEPEND);
+ alpm_pkg_set_reason (pkg, ALPM_PKG_REASON_DEPEND);
}
out:
diff --git a/backends/alpm/pk-backend-transaction.c b/backends/alpm/pk-backend-transaction.c
index 76402f063..a210a1461 100644
--- a/backends/alpm/pk-backend-transaction.c
+++ b/backends/alpm/pk-backend-transaction.c
@@ -63,7 +63,7 @@ alpm_pkg_has_basename (alpm_pkg_t *pkg, const gchar *basename)
return TRUE;
}
- if (alpm_option_get_usedelta (alpm) == 0) {
+ if (alpm_option_get_deltaratio (alpm) == 0.0) {
return FALSE;
}
@@ -427,7 +427,8 @@ pk_backend_transaction_add_done (PkBackend *self, alpm_pkg_t *pkg)
name = alpm_pkg_get_name (pkg);
version = alpm_pkg_get_version (pkg);
- alpm_logaction (alpm, "installed %s (%s)\n", name, version);
+ alpm_logaction (alpm, PK_LOG_PREFIX, "installed %s (%s)\n", name,
+ version);
pk_backend_pkg (self, pkg, PK_INFO_ENUM_FINISHED);
optdepends = alpm_pkg_get_optdepends (pkg);
@@ -467,7 +468,8 @@ pk_backend_transaction_remove_done (PkBackend *self, alpm_pkg_t *pkg)
name = alpm_pkg_get_name (pkg);
version = alpm_pkg_get_version (pkg);
- alpm_logaction (alpm, "removed %s (%s)\n", name, version);
+ alpm_logaction (alpm, PK_LOG_PREFIX, "removed %s (%s)\n", name,
+ version);
pk_backend_pkg (self, pkg, PK_INFO_ENUM_FINISHED);
pk_backend_output_end (self);
}
@@ -515,7 +517,8 @@ pk_backend_transaction_upgrade_done (PkBackend *self, alpm_pkg_t *pkg,
pre = alpm_pkg_get_version (old);
post = alpm_pkg_get_version (pkg);
- alpm_logaction (alpm, "upgraded %s (%s -> %s)\n", name, pre, post);
+ alpm_logaction (alpm, PK_LOG_PREFIX, "upgraded %s (%s -> %s)\n", name,
+ pre, post);
pk_backend_pkg (self, pkg, PK_INFO_ENUM_FINISHED);
optdepends = alpm_list_diff (alpm_pkg_get_optdepends (pkg),
@@ -623,7 +626,7 @@ pk_backend_transaction_initialize (PkBackend *self, alpm_transflag_t flags,
g_return_val_if_fail (cancellable != NULL, FALSE);
if (alpm_trans_init (alpm, flags) < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error_literal (error, ALPM_ERROR, errno,
alpm_strerror (errno));
return FALSE;
@@ -692,6 +695,7 @@ alpm_depend_free (alpm_depend_t *depend)
{
free (depend->name);
free (depend->version);
+ free (depend->desc);
free (depend);
}
@@ -837,12 +841,12 @@ pk_backend_transaction_simulate (PkBackend *self, GError **error)
}
if (prefix != NULL) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "%s: %s", prefix,
alpm_strerror (errno));
g_free (prefix);
} else {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error_literal (error, ALPM_ERROR, errno,
alpm_strerror (errno));
}
@@ -959,12 +963,12 @@ pk_backend_transaction_commit (PkBackend *self, GError **error)
}
if (prefix != NULL) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "%s: %s", prefix,
alpm_strerror (errno));
g_free (prefix);
} else {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error_literal (error, ALPM_ERROR, errno,
alpm_strerror (errno));
}
@@ -993,7 +997,7 @@ pk_backend_transaction_end (PkBackend *self, GError **error)
}
if (alpm_trans_release (alpm) < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error_literal (error, ALPM_ERROR, errno,
alpm_strerror (errno));
return FALSE;
diff --git a/backends/alpm/pk-backend-update.c b/backends/alpm/pk-backend-update.c
index 37ade1e02..da850676e 100644
--- a/backends/alpm/pk-backend-update.c
+++ b/backends/alpm/pk-backend-update.c
@@ -130,6 +130,20 @@ alpm_pkg_same_pkgver (alpm_pkg_t *a, alpm_pkg_t *b)
}
}
+static gchar *
+alpm_time_to_iso8601 (alpm_time_t time)
+{
+ GDateTime *date = g_date_time_new_from_unix_utc (time);
+
+ if (date != NULL) {
+ gchar *result = g_date_time_format (date, "%FT%TZ");
+ g_date_time_unref (date);
+ return result;
+ } else {
+ return NULL;
+ }
+}
+
static gboolean
pk_backend_get_update_detail_thread (PkBackend *self)
{
@@ -154,7 +168,7 @@ pk_backend_get_update_detail_thread (PkBackend *self)
PkRestartEnum restart;
PkUpdateStateEnum state;
- GTimeVal built = { 0 }, installed = { 0 };
+ alpm_time_t built, installed;
gchar *issued, *updated;
if (pk_backend_cancelled (self)) {
@@ -195,17 +209,17 @@ pk_backend_get_update_detail_thread (PkBackend *self)
state = PK_UPDATE_STATE_ENUM_STABLE;
}
- built.tv_sec = alpm_pkg_get_builddate (pkg);
- if (built.tv_sec > 0) {
- issued = g_time_val_to_iso8601 (&built);
+ built = alpm_pkg_get_builddate (pkg);
+ if (built > 0) {
+ issued = alpm_time_to_iso8601 (built);
} else {
issued = NULL;
}
if (upgrades != NULL) {
- installed.tv_sec = alpm_pkg_get_installdate (old);
- if (installed.tv_sec > 0) {
- updated = g_time_val_to_iso8601 (&installed);
+ installed = alpm_pkg_get_installdate (old);
+ if (installed > 0) {
+ updated = alpm_time_to_iso8601 (installed);
} else {
updated = NULL;
}
@@ -251,13 +265,13 @@ pk_backend_update_databases (PkBackend *self, gint force, GError **error) {
return FALSE;
}
- alpm_logaction (alpm, "synchronizing package lists\n");
+ alpm_logaction (alpm, PK_LOG_PREFIX, "synchronizing package lists\n");
dlcb = alpm_option_get_dlcb (alpm);
totaldlcb = alpm_option_get_totaldlcb (alpm);
/* set total size to minus the number of databases */
- i = alpm_option_get_syncdbs (alpm);
+ i = alpm_get_syncdbs (alpm);
totaldlcb (-alpm_list_count (i));
for (; i != NULL; i = i->next) {
@@ -275,7 +289,7 @@ pk_backend_update_databases (PkBackend *self, gint force, GError **error) {
/* fake the download when already up to date */
dlcb ("", 1, 1);
} else if (result < 0) {
- enum _alpm_errno_t errno = alpm_errno (alpm);
+ alpm_errno_t errno = alpm_errno (alpm);
g_set_error (error, ALPM_ERROR, errno, "[%s]: %s",
alpm_db_get_name (i->data),
alpm_strerror (errno));
@@ -398,7 +412,7 @@ pk_backend_get_updates_thread (PkBackend *self)
}
/* find outdated and replacement packages */
- syncdbs = alpm_option_get_syncdbs (alpm);
+ syncdbs = alpm_get_syncdbs (alpm);
for (i = alpm_db_get_pkgcache (localdb); i != NULL; i = i->next) {
alpm_pkg_t *upgrade = alpm_pkg_find_update (i->data, syncdbs);
diff --git a/configure.ac b/configure.ac
index 51bfb62b1..7e0ed39bd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -681,9 +681,7 @@ if test x$enable_opkg = xyes; then
fi
if test x$enable_alpm = xyes; then
- AC_CHECK_HEADER([alpm.h],
- [],
- [AC_MSG_ERROR([No ALPM headers found])])
+ PKG_CHECK_MODULES(ALPM, libalpm >= 4.1.0)
fi
if test x$enable_poldek = xyes; then