summaryrefslogtreecommitdiffstats
path: root/lib/libalpm
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-06-20 07:07:10 +0200
committerDan McGee <dan@archlinux.org>2011-06-20 07:07:10 +0200
commit0ee9ced4cbcff27823d4a1d5e0ef8a49dfc9dd8e (patch)
tree0596e17d100cb1de355cfd89556ff118d95598a2 /lib/libalpm
parenteb2d607899117757971186845930242c4541bfb4 (diff)
parent25b7df4dab61e908a0f86e3aad51f1f5c9ed2ccb (diff)
downloadpacman-0ee9ced4cbcff27823d4a1d5e0ef8a49dfc9dd8e.tar.gz
pacman-0ee9ced4cbcff27823d4a1d5e0ef8a49dfc9dd8e.tar.xz
Merge branch 'public-structs'
Diffstat (limited to 'lib/libalpm')
-rw-r--r--lib/libalpm/alpm.h162
-rw-r--r--lib/libalpm/conflict.c42
-rw-r--r--lib/libalpm/conflict.h13
-rw-r--r--lib/libalpm/delta.c43
-rw-r--r--lib/libalpm/delta.h15
-rw-r--r--lib/libalpm/deps.c38
-rw-r--r--lib/libalpm/deps.h15
-rw-r--r--lib/libalpm/group.c12
-rw-r--r--lib/libalpm/group.h7
-rw-r--r--lib/libalpm/sync.c10
10 files changed, 94 insertions, 263 deletions
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index bfc01e5c..d1faf7fe 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -50,7 +50,7 @@ extern "C" {
*/
/**
- * Install reasons
+ * Install reasons.
* Why the package was installed.
*/
typedef enum _pmpkgreason_t {
@@ -60,6 +60,32 @@ typedef enum _pmpkgreason_t {
PM_PKG_REASON_DEPEND = 1
} pmpkgreason_t;
+/** Types of version constraints in dependency specs. */
+typedef enum _pmdepmod_t {
+ /** No version constraint */
+ PM_DEP_MOD_ANY = 1,
+ /** Test version equality (package=x.y.z) */
+ PM_DEP_MOD_EQ,
+ /** Test for at least a version (package>=x.y.z) */
+ PM_DEP_MOD_GE,
+ /** Test for at most a version (package<=x.y.z) */
+ PM_DEP_MOD_LE,
+ /** Test for greater than some version (package>x.y.z) */
+ PM_DEP_MOD_GT,
+ /** Test for less than some version (package<x.y.z) */
+ PM_DEP_MOD_LT
+} pmdepmod_t;
+
+/**
+ * File conflict type.
+ * Whether the conflict results from a file existing on the filesystem, or with
+ * another target in the transaction.
+ */
+typedef enum _pmfileconflicttype_t {
+ PM_FILECONFLICT_TARGET = 1,
+ PM_FILECONFLICT_FILESYSTEM
+} pmfileconflicttype_t;
+
/**
* GPG signature verification options
*/
@@ -77,13 +103,62 @@ typedef enum _pgp_verify_t {
typedef struct __pmhandle_t pmhandle_t;
typedef struct __pmdb_t pmdb_t;
typedef struct __pmpkg_t pmpkg_t;
-typedef struct __pmdelta_t pmdelta_t;
-typedef struct __pmgrp_t pmgrp_t;
typedef struct __pmtrans_t pmtrans_t;
-typedef struct __pmdepend_t pmdepend_t;
-typedef struct __pmdepmissing_t pmdepmissing_t;
-typedef struct __pmconflict_t pmconflict_t;
-typedef struct __pmfileconflict_t pmfileconflict_t;
+
+/** Dependency */
+typedef struct _pmdepend_t {
+ char *name;
+ char *version;
+ unsigned long name_hash;
+ pmdepmod_t mod;
+} pmdepend_t;
+
+/** Missing dependency */
+typedef struct _pmdepmissing_t {
+ char *target;
+ pmdepend_t *depend;
+ /* this is used in case of remove dependency error only */
+ char *causingpkg;
+} pmdepmissing_t;
+
+/** Conflict */
+typedef struct _pmconflict_t {
+ char *package1;
+ char *package2;
+ char *reason;
+} pmconflict_t;
+
+/** File conflict */
+typedef struct _pmfileconflict_t {
+ char *target;
+ pmfileconflicttype_t type;
+ char *file;
+ char *ctarget;
+} pmfileconflict_t;
+
+/** Package group */
+typedef struct _pmgrp_t {
+ /** group name */
+ char *name;
+ /** list of pmpkg_t packages */
+ alpm_list_t *packages;
+} pmgrp_t;
+
+/** Package upgrade delta */
+typedef struct _pmdelta_t {
+ /** filename of the delta patch */
+ char *delta;
+ /** md5sum of the delta file */
+ char *delta_md5;
+ /** filename of the 'before' file */
+ char *from;
+ /** filename of the 'after' file */
+ char *to;
+ /** filesize of the delta file */
+ off_t delta_size;
+ /** download filesize of the delta file */
+ off_t download_size;
+} pmdelta_t;
/*
* Logging facilities
@@ -614,20 +689,9 @@ int alpm_db_check_pgp_signature(pmdb_t *db);
int alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify);
/*
- * Deltas
- */
-
-const char *alpm_delta_get_from(pmdelta_t *delta);
-const char *alpm_delta_get_to(pmdelta_t *delta);
-const char *alpm_delta_get_filename(pmdelta_t *delta);
-const char *alpm_delta_get_md5sum(pmdelta_t *delta);
-off_t alpm_delta_get_size(pmdelta_t *delta);
-
-/*
* Groups
*/
-const char *alpm_grp_get_name(const pmgrp_t *grp);
-alpm_list_t *alpm_grp_get_pkgs(const pmgrp_t *grp);
+
alpm_list_t *alpm_find_grp_pkgs(alpm_list_t *dbs, const char *name);
/*
@@ -883,59 +947,14 @@ int alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg);
* @{
*/
-/** Types of version constraints in dependency specs. */
-typedef enum _pmdepmod_t {
- /** No version constraint */
- PM_DEP_MOD_ANY = 1,
- /** Test version equality (package=x.y.z) */
- PM_DEP_MOD_EQ,
- /** Test for at least a version (package>=x.y.z) */
- PM_DEP_MOD_GE,
- /** Test for at most a version (package<=x.y.z) */
- PM_DEP_MOD_LE,
- /** Test for greater than some version (package>x.y.z) */
- PM_DEP_MOD_GT,
- /** Test for less than some version (package<x.y.z) */
- PM_DEP_MOD_LT
-} pmdepmod_t;
-
alpm_list_t *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist,
alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps);
pmpkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring);
pmpkg_t *alpm_find_dbs_satisfier(pmhandle_t *handle,
alpm_list_t *dbs, const char *depstring);
-const char *alpm_miss_get_target(const pmdepmissing_t *miss);
-pmdepend_t *alpm_miss_get_dep(pmdepmissing_t *miss);
-const char *alpm_miss_get_causingpkg(const pmdepmissing_t *miss);
-
alpm_list_t *alpm_checkconflicts(pmhandle_t *handle, alpm_list_t *pkglist);
-const char *alpm_conflict_get_package1(pmconflict_t *conflict);
-const char *alpm_conflict_get_package2(pmconflict_t *conflict);
-const char *alpm_conflict_get_reason(pmconflict_t *conflict);
-
-/** Returns the type of version constraint.
- * @param dep a dependency info structure
- * @return the type of version constraint (PM_DEP_MOD_ANY if no version
- * is specified).
- */
-pmdepmod_t alpm_dep_get_mod(const pmdepend_t *dep);
-
-/** Returns the package name of a dependency constraint.
- * @param dep a dependency info structure
- * @return a pointer to an internal string.
- */
-const char *alpm_dep_get_name(const pmdepend_t *dep);
-
-/** Returns the version specified by a dependency constraint.
- * The version information is returned as a string in the same format
- * as given by alpm_pkg_get_version().
- * @param dep a dependency info structure
- * @return a pointer to an internal string.
- */
-const char *alpm_dep_get_version(const pmdepend_t *dep);
-
/** Returns a newly allocated string representing the dependency information.
* @param dep a dependency info structure
* @return a formatted string, e.g. "glibc>=2.12"
@@ -944,21 +963,6 @@ char *alpm_dep_compute_string(const pmdepend_t *dep);
/** @} */
-/** @addtogroup alpm_api_fileconflicts File Conflicts Functions
- * Functions to manipulate file conflict information.
- * @{
- */
-
-typedef enum _pmfileconflicttype_t {
- PM_FILECONFLICT_TARGET = 1,
- PM_FILECONFLICT_FILESYSTEM
-} pmfileconflicttype_t;
-
-const char *alpm_fileconflict_get_target(pmfileconflict_t *conflict);
-pmfileconflicttype_t alpm_fileconflict_get_type(pmfileconflict_t *conflict);
-const char *alpm_fileconflict_get_file(pmfileconflict_t *conflict);
-const char *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict);
-
/** @} */
/*
diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c
index a6bbe093..39f42bfe 100644
--- a/lib/libalpm/conflict.c
+++ b/lib/libalpm/conflict.c
@@ -547,46 +547,4 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle,
return conflicts;
}
-const char SYMEXPORT *alpm_conflict_get_package1(pmconflict_t *conflict)
-{
- ASSERT(conflict != NULL, return NULL);
- return conflict->package1;
-}
-
-const char SYMEXPORT *alpm_conflict_get_package2(pmconflict_t *conflict)
-{
- ASSERT(conflict != NULL, return NULL);
- return conflict->package2;
-}
-
-const char SYMEXPORT *alpm_conflict_get_reason(pmconflict_t *conflict)
-{
- ASSERT(conflict != NULL, return NULL);
- return conflict->reason;
-}
-
-const char SYMEXPORT *alpm_fileconflict_get_target(pmfileconflict_t *conflict)
-{
- ASSERT(conflict != NULL, return NULL);
- return conflict->target;
-}
-
-pmfileconflicttype_t SYMEXPORT alpm_fileconflict_get_type(pmfileconflict_t *conflict)
-{
- ASSERT(conflict != NULL, return -1);
- return conflict->type;
-}
-
-const char SYMEXPORT *alpm_fileconflict_get_file(pmfileconflict_t *conflict)
-{
- ASSERT(conflict != NULL, return NULL);
- return conflict->file;
-}
-
-const char SYMEXPORT *alpm_fileconflict_get_ctarget(pmfileconflict_t *conflict)
-{
- ASSERT(conflict != NULL, return NULL);
- return conflict->ctarget;
-}
-
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h
index 7a3784a2..546a2820 100644
--- a/lib/libalpm/conflict.h
+++ b/lib/libalpm/conflict.h
@@ -24,19 +24,6 @@
#include "db.h"
#include "package.h"
-struct __pmconflict_t {
- char *package1;
- char *package2;
- char *reason;
-};
-
-struct __pmfileconflict_t {
- char *target;
- pmfileconflicttype_t type;
- char *file;
- char *ctarget;
-};
-
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict);
void _alpm_conflict_free(pmconflict_t *conflict);
alpm_list_t *_alpm_innerconflicts(pmhandle_t *handle, alpm_list_t *packages);
diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c
index aa76b492..fed84f45 100644
--- a/lib/libalpm/delta.c
+++ b/lib/libalpm/delta.c
@@ -34,43 +34,6 @@
#include "log.h"
#include "graph.h"
-/** \addtogroup alpm_deltas Delta Functions
- * @brief Functions to manipulate libalpm deltas
- * @{
- */
-
-const char SYMEXPORT *alpm_delta_get_from(pmdelta_t *delta)
-{
- ASSERT(delta != NULL, return NULL);
- return delta->from;
-}
-
-const char SYMEXPORT *alpm_delta_get_to(pmdelta_t *delta)
-{
- ASSERT(delta != NULL, return NULL);
- return delta->to;
-}
-
-const char SYMEXPORT *alpm_delta_get_filename(pmdelta_t *delta)
-{
- ASSERT(delta != NULL, return NULL);
- return delta->delta;
-}
-
-const char SYMEXPORT *alpm_delta_get_md5sum(pmdelta_t *delta)
-{
- ASSERT(delta != NULL, return NULL);
- return delta->delta_md5;
-}
-
-off_t SYMEXPORT alpm_delta_get_size(pmdelta_t *delta)
-{
- ASSERT(delta != NULL, return -1);
- return delta->delta_size;
-}
-
-/** @} */
-
static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
{
alpm_list_t *i, *j;
@@ -279,6 +242,11 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
return unused;
}
+/** \addtogroup alpm_deltas Delta Functions
+ * @brief Functions to manipulate libalpm deltas
+ * @{
+ */
+
alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg)
{
off_t pkgsize = alpm_pkg_get_size(pkg);
@@ -289,6 +257,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg)
return unused;
}
+/** @} */
/** Parses the string representation of a pmdelta_t object.
* This function assumes that the string is in the correct format.
diff --git a/lib/libalpm/delta.h b/lib/libalpm/delta.h
index d7725f5a..87869256 100644
--- a/lib/libalpm/delta.h
+++ b/lib/libalpm/delta.h
@@ -26,21 +26,6 @@
#include "alpm.h"
-struct __pmdelta_t {
- /** filename of the delta patch */
- char *delta;
- /** md5sum of the delta file */
- char *delta_md5;
- /** filename of the 'before' file */
- char *from;
- /** filename of the 'after' file */
- char *to;
- /** filesize of the delta file */
- off_t delta_size;
- /** download filesize of the delta file */
- off_t download_size;
-};
-
pmdelta_t *_alpm_delta_parse(char *line);
void _alpm_delta_free(pmdelta_t *delta);
off_t _alpm_shortest_delta_path(pmhandle_t *handle, alpm_list_t *deltas,
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index 10c0009d..085e6ca9 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -719,7 +719,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
for(j = deps; j; j = j->next) {
pmdepmissing_t *miss = j->data;
- pmdepend_t *missdep = alpm_miss_get_dep(miss);
+ pmdepend_t *missdep = miss->depend;
/* check if one of the packages in the [*packages] list already satisfies
* this dependency */
if(find_dep_satisfier(*packages, missdep)) {
@@ -764,42 +764,6 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
return ret;
}
-const char SYMEXPORT *alpm_miss_get_target(const pmdepmissing_t *miss)
-{
- ASSERT(miss != NULL, return NULL);
- return miss->target;
-}
-
-const char SYMEXPORT *alpm_miss_get_causingpkg(const pmdepmissing_t *miss)
-{
- ASSERT(miss != NULL, return NULL);
- return miss->causingpkg;
-}
-
-pmdepend_t SYMEXPORT *alpm_miss_get_dep(pmdepmissing_t *miss)
-{
- ASSERT(miss != NULL, return NULL);
- return miss->depend;
-}
-
-pmdepmod_t SYMEXPORT alpm_dep_get_mod(const pmdepend_t *dep)
-{
- ASSERT(dep != NULL, return -1);
- return dep->mod;
-}
-
-const char SYMEXPORT *alpm_dep_get_name(const pmdepend_t *dep)
-{
- ASSERT(dep != NULL, return NULL);
- return dep->name;
-}
-
-const char SYMEXPORT *alpm_dep_get_version(const pmdepend_t *dep)
-{
- ASSERT(dep != NULL, return NULL);
- return dep->version;
-}
-
/** Reverse of splitdep; make a dep string from a pmdepend_t struct.
* The string must be freed!
* @param dep the depend to turn into a string
diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h
index 97c0918e..ecc3b92c 100644
--- a/lib/libalpm/deps.h
+++ b/lib/libalpm/deps.h
@@ -27,21 +27,6 @@
#include "package.h"
#include "alpm.h"
-/* Dependency */
-struct __pmdepend_t {
- char *name;
- char *version;
- unsigned long name_hash;
- pmdepmod_t mod;
-};
-
-/* Missing dependency */
-struct __pmdepmissing_t {
- char *target;
- pmdepend_t *depend;
- char *causingpkg; /* this is used in case of remove dependency error only */
-};
-
void _alpm_dep_free(pmdepend_t *dep);
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
void _alpm_depmiss_free(pmdepmissing_t *miss);
diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c
index 13a216ee..07acfa89 100644
--- a/lib/libalpm/group.c
+++ b/lib/libalpm/group.c
@@ -52,16 +52,4 @@ void _alpm_grp_free(pmgrp_t *grp)
FREE(grp);
}
-const char SYMEXPORT *alpm_grp_get_name(const pmgrp_t *grp)
-{
- ASSERT(grp != NULL, return NULL);
- return grp->name;
-}
-
-alpm_list_t SYMEXPORT *alpm_grp_get_pkgs(const pmgrp_t *grp)
-{
- ASSERT(grp != NULL, return NULL);
- return grp->packages;
-}
-
/* vim: set ts=2 sw=2 noet: */
diff --git a/lib/libalpm/group.h b/lib/libalpm/group.h
index c92684e3..f2a67ca9 100644
--- a/lib/libalpm/group.h
+++ b/lib/libalpm/group.h
@@ -22,13 +22,6 @@
#include "alpm.h"
-struct __pmgrp_t {
- /** group name */
- char *name;
- /** list of pmpkg_t packages */
- alpm_list_t *packages;
-};
-
pmgrp_t *_alpm_grp_new(const char *name);
void _alpm_grp_free(pmgrp_t *grp);
diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c
index 05735730..15f135ba 100644
--- a/lib/libalpm/sync.c
+++ b/lib/libalpm/sync.c
@@ -225,7 +225,7 @@ alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs,
if(!grp)
continue;
- for(j = alpm_grp_get_pkgs(grp); j; j = j->next) {
+ for(j = grp->packages; j; j = j->next) {
pmpkg_t *pkg = j->data;
if(_alpm_pkg_find(ignorelist, alpm_pkg_get_name(pkg))) {
@@ -705,13 +705,11 @@ static int validate_deltas(pmhandle_t *handle, alpm_list_t *deltas,
for(i = deltas; i; i = i->next) {
pmdelta_t *d = alpm_list_getdata(i);
- const char *filename = alpm_delta_get_filename(d);
- char *filepath = _alpm_filecache_find(handle, filename);
- const char *md5sum = alpm_delta_get_md5sum(d);
+ char *filepath = _alpm_filecache_find(handle, d->delta);
- if(test_md5sum(trans, filepath, md5sum) != 0) {
+ if(test_md5sum(trans, filepath, d->delta_md5) != 0) {
errors++;
- *data = alpm_list_add(*data, strdup(filename));
+ *data = alpm_list_add(*data, strdup(d->delta));
}
FREE(filepath);
}