From bdf00d3dbd19c3def6127f3d372d630930a26abb Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:27:44 -0500 Subject: Make pmfileconflict_t type public This removes the need to write accessor methods for every type we have, and simplifies the API. Any type that doesn't need magic* can be converted in this fashion to make it easier for frontend applications to use, as well as make it less of a pain to introduce new such structs in the future. * "magic" meaning something like pmpkg_t where values can be lazy loaded. Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 36 +++++++++++++++++++----------------- 1 file changed, 19 insertions(+), 17 deletions(-) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index bfc01e5c..4c44a361 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,16 @@ typedef enum _pmpkgreason_t { PM_PKG_REASON_DEPEND = 1 } pmpkgreason_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 */ @@ -83,7 +93,14 @@ 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; + +/** File conflict */ +typedef struct _pmfileconflict_t { + char *target; + pmfileconflicttype_t type; + char *file; + char *ctarget; +} pmfileconflict_t; /* * Logging facilities @@ -944,21 +961,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); - /** @} */ /* -- cgit v1.2.3-2-g168b From 19fcc7401666cd892f7b8a5a49854a1b2eb9988b Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:33:20 -0500 Subject: Make struct pmconflict_t public Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 4c44a361..0fd6f37e 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -92,7 +92,13 @@ 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; + +/** Conflict */ +typedef struct _pmconflict_t { + char *package1; + char *package2; + char *reason; +} pmconflict_t; /** File conflict */ typedef struct _pmfileconflict_t { @@ -928,10 +934,6 @@ 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 -- cgit v1.2.3-2-g168b From 7f6c1a76c66fb718fad2ecce68f99ee13d18ff15 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:42:10 -0500 Subject: Make pmdepend_t and pmdepmissing_t public Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 75 +++++++++++++++++++++++------------------------------- 1 file changed, 32 insertions(+), 43 deletions(-) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 0fd6f37e..08a7a1f3 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -60,6 +60,22 @@ 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_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=2.12" -- cgit v1.2.3-2-g168b From 51359e6d33cf2f3f3acf95ad526c5b22e39d86cf Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:49:34 -0500 Subject: Make pmdelta_t public Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 08a7a1f3..17194f0d 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -103,7 +103,6 @@ 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; @@ -138,6 +137,22 @@ typedef struct _pmfileconflict_t { char *ctarget; } pmfileconflict_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 */ @@ -666,16 +681,6 @@ int alpm_pkg_check_pgp_signature(pmpkg_t *pkg); 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 */ -- cgit v1.2.3-2-g168b From 25b7df4dab61e908a0f86e3aad51f1f5c9ed2ccb Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Thu, 16 Jun 2011 11:55:26 -0500 Subject: Make pmgrp_t public Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 17194f0d..d1faf7fe 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -103,7 +103,6 @@ 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 __pmgrp_t pmgrp_t; typedef struct __pmtrans_t pmtrans_t; /** Dependency */ @@ -137,6 +136,14 @@ typedef struct _pmfileconflict_t { 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 */ @@ -684,8 +691,7 @@ int alpm_db_set_pgp_verify(pmdb_t *db, pgp_verify_t verify); /* * 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); /* -- cgit v1.2.3-2-g168b