summaryrefslogtreecommitdiff
path: root/lib/libalpm/package.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/package.c')
-rw-r--r--lib/libalpm/package.c36
1 files changed, 35 insertions, 1 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index 014dedce..038c899d 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -62,8 +62,10 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg)
int retval;
ASSERT(pkg != NULL, return -1);
+ pkg->handle->pm_errno = 0;
/* We only inspect packages from sync repositories */
- ASSERT(pkg->origin == PKG_FROM_SYNCDB, return -1);
+ ASSERT(pkg->origin == PKG_FROM_SYNCDB,
+ RET_ERR(pkg->handle, PM_ERR_WRONG_ARGS, -1));
fpath = _alpm_filecache_find(pkg->handle, alpm_pkg_get_filename(pkg));
@@ -162,116 +164,139 @@ struct pkg_operations default_pkg_ops = {
* package, which depend on where the package was loaded from. */
const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_filename(pkg);
}
const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->name;
}
const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->version;
}
const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_desc(pkg);
}
const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_url(pkg);
}
time_t SYMEXPORT alpm_pkg_get_builddate(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_builddate(pkg);
}
time_t SYMEXPORT alpm_pkg_get_installdate(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_installdate(pkg);
}
const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_packager(pkg);
}
const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_md5sum(pkg);
}
const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_arch(pkg);
}
off_t SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_size(pkg);
}
off_t SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_isize(pkg);
}
pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_reason(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_licenses(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_groups(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_depends(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_optdepends(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_conflicts(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_provides(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_replaces(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_deltas(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_files(pkg);
}
alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->get_backup(pkg);
}
@@ -280,6 +305,7 @@ pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
/* Sanity checks */
ASSERT(pkg != NULL, return NULL);
ASSERT(pkg->origin != PKG_FROM_FILE, return NULL);
+ pkg->handle->pm_errno = 0;
return pkg->origin_data.db;
}
@@ -287,6 +313,7 @@ pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
/** Open a package changelog for reading. */
void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->changelog_open(pkg);
}
@@ -294,6 +321,7 @@ void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg)
size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size,
const pmpkg_t *pkg, const void *fp)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->changelog_read(ptr, size, pkg, fp);
}
@@ -307,17 +335,21 @@ int SYMEXPORT alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp)
/** Close a package changelog for reading. */
int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->changelog_close(pkg, fp);
}
int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
{
+ pkg->handle->pm_errno = 0;
return pkg->ops->has_scriptlet(pkg);
}
static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
{
const alpm_list_t *i;
+ pkg->handle->pm_errno = 0;
+
for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
pmpkg_t *cachepkg = i->data;
alpm_list_t *i;
@@ -339,6 +371,8 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
alpm_list_t *reqs = NULL;
pmdb_t *db;
+ pkg->handle->pm_errno = 0;
+
if(pkg->origin == PKG_FROM_FILE) {
/* The sane option; search locally for things that require this. */
find_requiredby(pkg, pkg->handle->db_local, &reqs);