diff options
author | Dan McGee <dan@archlinux.org> | 2011-06-30 17:37:08 +0200 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-06-30 17:37:08 +0200 |
commit | ad577b3cb46dcaf1b143c55324a6eecf9f0ad7f1 (patch) | |
tree | d79aa34734791bb069eab172b8ea3e0ee12bedc6 /lib/libalpm | |
parent | 0f4aaeee42135d06dd18eb585eab3bae0e5fbf34 (diff) | |
parent | fed3e09c94d204b4655656c703a178e6fa2144b3 (diff) | |
download | pacman-ad577b3cb46dcaf1b143c55324a6eecf9f0ad7f1.tar.gz pacman-ad577b3cb46dcaf1b143c55324a6eecf9f0ad7f1.tar.xz |
Merge remote-tracking branch 'allan/breakshit'
Diffstat (limited to 'lib/libalpm')
44 files changed, 916 insertions, 916 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index fd8799b1..b8b1ca18 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -50,11 +50,11 @@ #include "handle.h" /** Add a package to the transaction. */ -int SYMEXPORT alpm_add_pkg(pmhandle_t *handle, pmpkg_t *pkg) +int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg) { const char *pkgname, *pkgver; - pmtrans_t *trans; - pmpkg_t *local; + alpm_trans_t *trans; + alpm_pkg_t *local; /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -106,7 +106,7 @@ int SYMEXPORT alpm_add_pkg(pmhandle_t *handle, pmpkg_t *pkg) return 0; } -static int perform_extraction(pmhandle_t *handle, struct archive *archive, +static int perform_extraction(alpm_handle_t *handle, struct archive *archive, struct archive_entry *entry, const char *filename, const char *origname) { int ret; @@ -131,8 +131,8 @@ static int perform_extraction(pmhandle_t *handle, struct archive *archive, return 0; } -static int extract_single_file(pmhandle_t *handle, struct archive *archive, - struct archive_entry *entry, pmpkg_t *newpkg, pmpkg_t *oldpkg) +static int extract_single_file(alpm_handle_t *handle, struct archive *archive, + struct archive_entry *entry, alpm_pkg_t *newpkg, alpm_pkg_t *oldpkg) { const char *entryname; mode_t entrymode; @@ -252,7 +252,7 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive, if(alpm_list_find_str(handle->noupgrade, entryname)) { notouch = 1; } else { - pmbackup_t *backup; + alpm_backup_t *backup; /* go to the backup array and see if our conflict is there */ /* check newpkg first, so that adding backup files is retroactive */ backup = _alpm_needbackup(entryname, alpm_pkg_get_backup(newpkg)); @@ -303,7 +303,7 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive, /* update the md5 hash in newpkg's backup (it will be the new orginal) */ alpm_list_t *i; for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) { - pmbackup_t *backup = i->data; + alpm_backup_t *backup = i->data; char *newhash; if(!backup->name || strcmp(backup->name, entryname_orig) != 0) { continue; @@ -435,7 +435,7 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive, /* calculate an hash if this is in newpkg's backup */ alpm_list_t *i; for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) { - pmbackup_t *backup = i->data; + alpm_backup_t *backup = i->data; char *newhash; if(!backup->name || strcmp(backup->name, entryname_orig) != 0) { continue; @@ -450,22 +450,22 @@ static int extract_single_file(pmhandle_t *handle, struct archive *archive, return errors; } -static int commit_single_pkg(pmhandle_t *handle, pmpkg_t *newpkg, +static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, size_t pkg_current, size_t pkg_count) { int i, ret = 0, errors = 0; char scriptlet[PATH_MAX]; int is_upgrade = 0; - pmpkg_t *oldpkg = NULL; - pmdb_t *db = handle->db_local; - pmtrans_t *trans = handle->trans; + alpm_pkg_t *oldpkg = NULL; + alpm_db_t *db = handle->db_local; + alpm_trans_t *trans = handle->trans; snprintf(scriptlet, PATH_MAX, "%s%s-%s/install", _alpm_db_path(db), alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); /* see if this is an upgrade. if so, remove the old package first */ - pmpkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name); + alpm_pkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name); if(local) { is_upgrade = 1; @@ -684,12 +684,12 @@ cleanup: return ret; } -int _alpm_upgrade_packages(pmhandle_t *handle) +int _alpm_upgrade_packages(alpm_handle_t *handle) { size_t pkg_count, pkg_current; int skip_ldconfig = 0, ret = 0; alpm_list_t *targ; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; if(trans->add == NULL) { return 0; @@ -700,7 +700,7 @@ int _alpm_upgrade_packages(pmhandle_t *handle) /* loop through our package list adding/upgrading one at a time */ for(targ = trans->add; targ; targ = targ->next) { - pmpkg_t *newpkg = targ->data; + alpm_pkg_t *newpkg = targ->data; if(handle->trans->state == STATE_INTERRUPTED) { return ret; diff --git a/lib/libalpm/add.h b/lib/libalpm/add.h index 1baab8d4..77a3d22a 100644 --- a/lib/libalpm/add.h +++ b/lib/libalpm/add.h @@ -24,7 +24,7 @@ #include "alpm_list.h" #include "trans.h" -int _alpm_upgrade_packages(pmhandle_t *handle); +int _alpm_upgrade_packages(alpm_handle_t *handle); #endif /* _ALPM_ADD_H */ diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index d35512bd..7780c1fd 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -46,13 +46,13 @@ * @param err an optional variable to hold any error return codes * @return a context handle on success, NULL on error, err will be set if provided */ -pmhandle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath, - enum _pmerrno_t *err) +alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath, + enum _alpm_errno_t *err) { - enum _pmerrno_t myerr; + enum _alpm_errno_t myerr; const char *lf = "db.lck"; size_t lockfilelen; - pmhandle_t *myhandle = _alpm_handle_new(); + alpm_handle_t *myhandle = _alpm_handle_new(); if(myhandle == NULL) { myerr = PM_ERR_MEMORY; @@ -99,10 +99,10 @@ cleanup: * @param handle the context handle * @return 0 on success, -1 on error */ -int SYMEXPORT alpm_release(pmhandle_t *myhandle) +int SYMEXPORT alpm_release(alpm_handle_t *myhandle) { int ret = 0; - pmdb_t *db; + alpm_db_t *db; CHECK_HANDLE(myhandle, return -1); diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index ac352131..33707dd3 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -53,15 +53,15 @@ extern "C" { * Install reasons. * Why the package was installed. */ -typedef enum _pmpkgreason_t { +typedef enum _alpm_pkgreason_t { /** Explicitly requested by the user. */ PM_PKG_REASON_EXPLICIT = 0, /** Installed as a dependency for another package. */ PM_PKG_REASON_DEPEND = 1 -} pmpkgreason_t; +} alpm_pkgreason_t; /** Types of version constraints in dependency specs. */ -typedef enum _pmdepmod_t { +typedef enum _alpm_depmod_t { /** No version constraint */ PM_DEP_MOD_ANY = 1, /** Test version equality (package=x.y.z) */ @@ -74,17 +74,17 @@ typedef enum _pmdepmod_t { PM_DEP_MOD_GT, /** Test for less than some version (package<x.y.z) */ PM_DEP_MOD_LT -} pmdepmod_t; +} alpm_depmod_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 { +typedef enum _alpm_fileconflicttype_t { PM_FILECONFLICT_TARGET = 1, PM_FILECONFLICT_FILESYSTEM -} pmfileconflicttype_t; +} alpm_fileconflicttype_t; /** * GPG signature verification options @@ -100,52 +100,52 @@ typedef enum _pgp_verify_t { * Structures */ -typedef struct __pmhandle_t pmhandle_t; -typedef struct __pmdb_t pmdb_t; -typedef struct __pmpkg_t pmpkg_t; -typedef struct __pmtrans_t pmtrans_t; +typedef struct __alpm_handle_t alpm_handle_t; +typedef struct __alpm_db_t alpm_db_t; +typedef struct __alpm_pkg_t alpm_pkg_t; +typedef struct __alpm_trans_t alpm_trans_t; /** Dependency */ -typedef struct _pmdepend_t { +typedef struct _alpm_depend_t { char *name; char *version; unsigned long name_hash; - pmdepmod_t mod; -} pmdepend_t; + alpm_depmod_t mod; +} alpm_depend_t; /** Missing dependency */ -typedef struct _pmdepmissing_t { +typedef struct _alpm_depmissing_t { char *target; - pmdepend_t *depend; + alpm_depend_t *depend; /* this is used in case of remove dependency error only */ char *causingpkg; -} pmdepmissing_t; +} alpm_depmissing_t; /** Conflict */ -typedef struct _pmconflict_t { +typedef struct _alpm_conflict_t { char *package1; char *package2; char *reason; -} pmconflict_t; +} alpm_conflict_t; /** File conflict */ -typedef struct _pmfileconflict_t { +typedef struct _alpm_fileconflict_t { char *target; - pmfileconflicttype_t type; + alpm_fileconflicttype_t type; char *file; char *ctarget; -} pmfileconflict_t; +} alpm_fileconflict_t; /** Package group */ -typedef struct _pmgrp_t { +typedef struct _alpm_group_t { /** group name */ char *name; - /** list of pmpkg_t packages */ + /** list of alpm_pkg_t packages */ alpm_list_t *packages; -} pmgrp_t; +} alpm_group_t; /** Package upgrade delta */ -typedef struct _pmdelta_t { +typedef struct _alpm_delta_t { /** filename of the delta patch */ char *delta; /** md5sum of the delta file */ @@ -158,13 +158,13 @@ typedef struct _pmdelta_t { off_t delta_size; /** download filesize of the delta file */ off_t download_size; -} pmdelta_t; +} alpm_delta_t; /** Local package or package file backup entry */ -typedef struct _pmbackup_t { +typedef struct _alpm_backup_t { char *name; char *hash; -} pmbackup_t; +} alpm_backup_t; /* * Logging facilities @@ -173,15 +173,15 @@ typedef struct _pmbackup_t { /** * Logging Levels */ -typedef enum _pmloglevel_t { +typedef enum _alpm_loglevel_t { PM_LOG_ERROR = 1, PM_LOG_WARNING = (1 << 1), PM_LOG_DEBUG = (1 << 2), PM_LOG_FUNCTION = (1 << 3) -} pmloglevel_t; +} alpm_loglevel_t; -typedef void (*alpm_cb_log)(pmloglevel_t, const char *, va_list); -int alpm_logaction(pmhandle_t *handle, const char *fmt, ...); +typedef void (*alpm_cb_log)(alpm_loglevel_t, const char *, va_list); +int alpm_logaction(alpm_handle_t *handle, const char *fmt, ...); /* * Downloading @@ -212,7 +212,7 @@ typedef int (*alpm_cb_fetch)(const char *url, const char *localpath, * @param url URL of the package to download * @return the downloaded filepath on success, NULL on error */ -char *alpm_fetch_pkgurl(pmhandle_t *handle, const char *url); +char *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url); /** @addtogroup alpm_api_options Options * Libalpm option getters and setters @@ -220,67 +220,67 @@ char *alpm_fetch_pkgurl(pmhandle_t *handle, const char *url); */ /** Returns the callback used for logging. */ -alpm_cb_log alpm_option_get_logcb(pmhandle_t *handle); +alpm_cb_log alpm_option_get_logcb(alpm_handle_t *handle); /** Sets the callback used for logging. */ -int alpm_option_set_logcb(pmhandle_t *handle, alpm_cb_log cb); +int alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb); /** Returns the callback used to report download progress. */ -alpm_cb_download alpm_option_get_dlcb(pmhandle_t *handle); +alpm_cb_download alpm_option_get_dlcb(alpm_handle_t *handle); /** Sets the callback used to report download progress. */ -int alpm_option_set_dlcb(pmhandle_t *handle, alpm_cb_download cb); +int alpm_option_set_dlcb(alpm_handle_t *handle, alpm_cb_download cb); /** Returns the downloading callback. */ -alpm_cb_fetch alpm_option_get_fetchcb(pmhandle_t *handle); +alpm_cb_fetch alpm_option_get_fetchcb(alpm_handle_t *handle); /** Sets the downloading callback. */ -int alpm_option_set_fetchcb(pmhandle_t *handle, alpm_cb_fetch cb); +int alpm_option_set_fetchcb(alpm_handle_t *handle, alpm_cb_fetch cb); /** Returns the callback used to report total download size. */ -alpm_cb_totaldl alpm_option_get_totaldlcb(pmhandle_t *handle); +alpm_cb_totaldl alpm_option_get_totaldlcb(alpm_handle_t *handle); /** Sets the callback used to report total download size. */ -int alpm_option_set_totaldlcb(pmhandle_t *handle, alpm_cb_totaldl cb); +int alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb); /** Returns the root of the destination filesystem. Read-only. */ -const char *alpm_option_get_root(pmhandle_t *handle); +const char *alpm_option_get_root(alpm_handle_t *handle); /** Returns the path to the database directory. Read-only. */ -const char *alpm_option_get_dbpath(pmhandle_t *handle); +const char *alpm_option_get_dbpath(alpm_handle_t *handle); /** Get the name of the database lock file. Read-only. */ -const char *alpm_option_get_lockfile(pmhandle_t *handle); +const char *alpm_option_get_lockfile(alpm_handle_t *handle); /** @name Accessors to the list of package cache directories. * @{ */ -alpm_list_t *alpm_option_get_cachedirs(pmhandle_t *handle); -int alpm_option_set_cachedirs(pmhandle_t *handle, alpm_list_t *cachedirs); -int alpm_option_add_cachedir(pmhandle_t *handle, const char *cachedir); -int alpm_option_remove_cachedir(pmhandle_t *handle, const char *cachedir); +alpm_list_t *alpm_option_get_cachedirs(alpm_handle_t *handle); +int alpm_option_set_cachedirs(alpm_handle_t *handle, alpm_list_t *cachedirs); +int alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir); +int alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cachedir); /** @} */ /** Returns the logfile name. */ -const char *alpm_option_get_logfile(pmhandle_t *handle); +const char *alpm_option_get_logfile(alpm_handle_t *handle); /** Sets the logfile name. */ -int alpm_option_set_logfile(pmhandle_t *handle, const char *logfile); +int alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile); /** Returns the path to libalpm's GnuPG home directory. */ -const char *alpm_option_get_gpgdir(pmhandle_t *handle); +const char *alpm_option_get_gpgdir(alpm_handle_t *handle); /** Sets the path to libalpm's GnuPG home directory. */ -int alpm_option_set_gpgdir(pmhandle_t *handle, const char *gpgdir); +int alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir); /** Returns whether to use syslog (0 is FALSE, TRUE otherwise). */ -int alpm_option_get_usesyslog(pmhandle_t *handle); +int alpm_option_get_usesyslog(alpm_handle_t *handle); /** Sets whether to use syslog (0 is FALSE, TRUE otherwise). */ -int alpm_option_set_usesyslog(pmhandle_t *handle, int usesyslog); +int alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog); /** @name Accessors to the list of no-upgrade files. * These functions modify the list of files which should * not be updated by package installation. * @{ */ -alpm_list_t *alpm_option_get_noupgrades(pmhandle_t *handle); -int alpm_option_add_noupgrade(pmhandle_t *handle, const char *pkg); -int alpm_option_set_noupgrades(pmhandle_t *handle, alpm_list_t *noupgrade); -int alpm_option_remove_noupgrade(pmhandle_t *handle, const char *pkg); +alpm_list_t *alpm_option_get_noupgrades(alpm_handle_t *handle); +int alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg); +int alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade); +int alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *pkg); /** @} */ /** @name Accessors to the list of no-extract files. @@ -289,10 +289,10 @@ int alpm_option_remove_noupgrade(pmhandle_t *handle, const char *pkg); * not be upgraded by a sysupgrade operation. * @{ */ -alpm_list_t *alpm_option_get_noextracts(pmhandle_t *handle); -int alpm_option_add_noextract(pmhandle_t *handle, const char *pkg); -int alpm_option_set_noextracts(pmhandle_t *handle, alpm_list_t *noextract); -int alpm_option_remove_noextract(pmhandle_t *handle, const char *pkg); +alpm_list_t *alpm_option_get_noextracts(alpm_handle_t *handle); +int alpm_option_add_noextract(alpm_handle_t *handle, const char *pkg); +int alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract); +int alpm_option_remove_noextract(alpm_handle_t *handle, const char *pkg); /** @} */ /** @name Accessors to the list of ignored packages. @@ -300,10 +300,10 @@ int alpm_option_remove_noextract(pmhandle_t *handle, const char *pkg); * should be ignored by a sysupgrade. * @{ */ -alpm_list_t *alpm_option_get_ignorepkgs(pmhandle_t *handle); -int alpm_option_add_ignorepkg(pmhandle_t *handle, const char *pkg); -int alpm_option_set_ignorepkgs(pmhandle_t *handle, alpm_list_t *ignorepkgs); -int alpm_option_remove_ignorepkg(pmhandle_t *handle, const char *pkg); +alpm_list_t *alpm_option_get_ignorepkgs(alpm_handle_t *handle); +int alpm_option_add_ignorepkg(alpm_handle_t *handle, const char *pkg); +int alpm_option_set_ignorepkgs(alpm_handle_t *handle, alpm_list_t *ignorepkgs); +int alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg); /** @} */ /** @name Accessors to the list of ignored groups. @@ -311,25 +311,25 @@ int alpm_option_remove_ignorepkg(pmhandle_t *handle, const char *pkg); * should be ignored by a sysupgrade. * @{ */ -alpm_list_t *alpm_option_get_ignoregrps(pmhandle_t *handle); -int alpm_option_add_ignoregrp(pmhandle_t *handle, const char *grp); -int alpm_option_set_ignoregrps(pmhandle_t *handle, alpm_list_t *ignoregrps); -int alpm_option_remove_ignoregrp(pmhandle_t *handle, const char *grp); +alpm_list_t *alpm_option_get_ignoregroups(alpm_handle_t *handle); +int alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp); +int alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps); +int alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp); /** @} */ /** Returns the targeted architecture. */ -const char *alpm_option_get_arch(pmhandle_t *handle); +const char *alpm_option_get_arch(alpm_handle_t *handle); /** Sets the targeted architecture. */ -int alpm_option_set_arch(pmhandle_t *handle, const char *arch); +int alpm_option_set_arch(alpm_handle_t *handle, const char *arch); -int alpm_option_get_usedelta(pmhandle_t *handle); -int alpm_option_set_usedelta(pmhandle_t *handle, int usedelta); +int alpm_option_get_usedelta(alpm_handle_t *handle); +int alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta); -int alpm_option_get_checkspace(pmhandle_t *handle); -int alpm_option_set_checkspace(pmhandle_t *handle, int checkspace); +int alpm_option_get_checkspace(alpm_handle_t *handle); +int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace); -pgp_verify_t alpm_option_get_default_sigverify(pmhandle_t *handle); -int alpm_option_set_default_sigverify(pmhandle_t *handle, pgp_verify_t level); +pgp_verify_t alpm_option_get_default_sigverify(alpm_handle_t *handle); +int alpm_option_set_default_sigverify(alpm_handle_t *handle, pgp_verify_t level); /** @} */ @@ -344,87 +344,87 @@ int alpm_option_set_default_sigverify(pmhandle_t *handle, pgp_verify_t level); * libalpm functions. * @return a reference to the local database */ -pmdb_t *alpm_option_get_localdb(pmhandle_t *handle); +alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle); /** Get the list of sync databases. - * Returns a list of pmdb_t structures, one for each registered + * Returns a list of alpm_db_t structures, one for each registered * sync database. * @param handle the context handle - * @return a reference to an internal list of pmdb_t structures + * @return a reference to an internal list of alpm_db_t structures */ -alpm_list_t *alpm_option_get_syncdbs(pmhandle_t *handle); +alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle); /** Register a sync database of packages. * @param handle the context handle * @param treename the name of the sync repository * @param check_sig what level of signature checking to perform on the * database; note that this must be a '.sig' file type verification - * @return a pmdb_t* on success (the value), NULL on error + * @return a alpm_db_t* on success (the value), NULL on error */ -pmdb_t *alpm_db_register_sync(pmhandle_t *handle, const char *treename, +alpm_db_t *alpm_db_register_sync(alpm_handle_t *handle, const char *treename, pgp_verify_t check_sig); /** Unregister a package database. * @param db pointer to the package database to unregister * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_db_unregister(pmdb_t *db); +int alpm_db_unregister(alpm_db_t *db); /** Unregister all package databases. * @param handle the context handle * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_db_unregister_all(pmhandle_t *handle); +int alpm_db_unregister_all(alpm_handle_t *handle); /** Get the name of a package database. * @param db pointer to the package database * @return the name of the package database, NULL on error */ -const char *alpm_db_get_name(const pmdb_t *db); +const char *alpm_db_get_name(const alpm_db_t *db); /** @name Accessors to the list of servers for a database. * @{ */ -alpm_list_t *alpm_db_get_servers(const pmdb_t *db); -int alpm_db_set_servers(pmdb_t *db, alpm_list_t *servers); -int alpm_db_add_server(pmdb_t *db, const char *url); -int alpm_db_remove_server(pmdb_t *db, const char *url); +alpm_list_t *alpm_db_get_servers(const alpm_db_t *db); +int alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers); +int alpm_db_add_server(alpm_db_t *db, const char *url); +int alpm_db_remove_server(alpm_db_t *db, const char *url); /** @} */ -int alpm_db_update(int level, pmdb_t *db); +int alpm_db_update(int level, alpm_db_t *db); /** Get a package entry from a package database. * @param db pointer to the package database to get the package from * @param name of the package * @return the package entry on success, NULL on error */ -pmpkg_t *alpm_db_get_pkg(pmdb_t *db, const char *name); +alpm_pkg_t *alpm_db_get_pkg(alpm_db_t *db, const char *name); /** Get the package cache of a package database. * @param db pointer to the package database to get the package from * @return the list of packages on success, NULL on error */ -alpm_list_t *alpm_db_get_pkgcache(pmdb_t *db); +alpm_list_t *alpm_db_get_pkgcache(alpm_db_t *db); /** Get a group entry from a package database. * @param db pointer to the package database to get the group from * @param name of the group * @return the groups entry on success, NULL on error */ -pmgrp_t *alpm_db_readgrp(pmdb_t *db, const char *name); +alpm_group_t *alpm_db_readgroup(alpm_db_t *db, const char *name); /** Get the group cache of a package database. * @param db pointer to the package database to get the group from * @return the list of groups on success, NULL on error */ -alpm_list_t *alpm_db_get_grpcache(pmdb_t *db); +alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db); /** Searches a database with regular expressions. * @param db pointer to the package database to search in * @param needles a list of regular expressions to search for * @return the list of packages matching all regular expressions on success, NULL on error */ -alpm_list_t *alpm_db_search(pmdb_t *db, const alpm_list_t* needles); +alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles); /** Set install reason for a package in db. * @param db pointer to the package database @@ -432,7 +432,7 @@ alpm_list_t *alpm_db_search(pmdb_t *db, const alpm_list_t* needles); * @param reason the new install reason * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason); +int alpm_db_set_pkgreason(alpm_db_t *db, const char *name, alpm_pkgreason_t reason); /** @} */ @@ -455,20 +455,20 @@ int alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason); * @param pkg address of the package pointer * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_pkg_load(pmhandle_t *handle, const char *filename, int full, - pgp_verify_t check_sig, pmpkg_t **pkg); +int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full, + pgp_verify_t check_sig, alpm_pkg_t **pkg); /** Free a package. * @param pkg package pointer to free * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_pkg_free(pmpkg_t *pkg); +int alpm_pkg_free(alpm_pkg_t *pkg); /** Check the integrity (with md5) of a package from the sync cache. * @param pkg package pointer * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_pkg_checkmd5sum(pmpkg_t *pkg); +int alpm_pkg_checkmd5sum(alpm_pkg_t *pkg); /** Compare two version strings and determine which one is 'newer'. */ int alpm_pkg_vercmp(const char *a, const char *b); @@ -479,7 +479,7 @@ int alpm_pkg_vercmp(const char *a, const char *b); * @param pkg a package * @return the list of packages requiring pkg */ -alpm_list_t *alpm_pkg_compute_requiredby(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_compute_requiredby(alpm_pkg_t *pkg); /** @name Package Property Accessors * Any pointer returned by these functions points to internal structures @@ -492,13 +492,13 @@ alpm_list_t *alpm_pkg_compute_requiredby(pmpkg_t *pkg); * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_filename(pmpkg_t *pkg); +const char *alpm_pkg_get_filename(alpm_pkg_t *pkg); /** Returns the package name. * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_name(pmpkg_t *pkg); +const char *alpm_pkg_get_name(alpm_pkg_t *pkg); /** Returns the package version as a string. * This includes all available epoch, version, and pkgrel components. Use @@ -506,116 +506,116 @@ const char *alpm_pkg_get_name(pmpkg_t *pkg); * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_version(pmpkg_t *pkg); +const char *alpm_pkg_get_version(alpm_pkg_t *pkg); /** Returns the package description. * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_desc(pmpkg_t *pkg); +const char *alpm_pkg_get_desc(alpm_pkg_t *pkg); /** Returns the package URL. * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_url(pmpkg_t *pkg); +const char *alpm_pkg_get_url(alpm_pkg_t *pkg); /** Returns the build timestamp of the package. * @param pkg a pointer to package * @return the timestamp of the build time */ -time_t alpm_pkg_get_builddate(pmpkg_t *pkg); +time_t alpm_pkg_get_builddate(alpm_pkg_t *pkg); /** Returns the install timestamp of the package. * @param pkg a pointer to package * @return the timestamp of the install time */ -time_t alpm_pkg_get_installdate(pmpkg_t *pkg); +time_t alpm_pkg_get_installdate(alpm_pkg_t *pkg); /** Returns the packager's name. * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_packager(pmpkg_t *pkg); +const char *alpm_pkg_get_packager(alpm_pkg_t *pkg); /** Returns the package's MD5 checksum as a string. * The returned string is a sequence of lowercase hexadecimal digits. * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_md5sum(pmpkg_t *pkg); +const char *alpm_pkg_get_md5sum(alpm_pkg_t *pkg); /** Returns the architecture for which the package was built. * @param pkg a pointer to package * @return a reference to an internal string */ -const char *alpm_pkg_get_arch(pmpkg_t *pkg); +const char *alpm_pkg_get_arch(alpm_pkg_t *pkg); /** Returns the size of the package. * @param pkg a pointer to package * @return the size of the package in bytes. */ -off_t alpm_pkg_get_size(pmpkg_t *pkg); +off_t alpm_pkg_get_size(alpm_pkg_t *pkg); /** Returns the installed size of the package. * @param pkg a pointer to package * @return the total size of files installed by the package. */ -off_t alpm_pkg_get_isize(pmpkg_t *pkg); +off_t alpm_pkg_get_isize(alpm_pkg_t *pkg); /** Returns the package installation reason. * @param pkg a pointer to package * @return an enum member giving the install reason. */ -pmpkgreason_t alpm_pkg_get_reason(pmpkg_t *pkg); +alpm_pkgreason_t alpm_pkg_get_reason(alpm_pkg_t *pkg); /** Returns the list of package licenses. * @param pkg a pointer to package * @return a pointer to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_licenses(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_licenses(alpm_pkg_t *pkg); /** Returns the list of package groups. * @param pkg a pointer to package * @return a pointer to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_groups(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_groups(alpm_pkg_t *pkg); -/** Returns the list of package dependencies as pmdepend_t. +/** Returns the list of package dependencies as alpm_depend_t. * @param pkg a pointer to package - * @return a reference to an internal list of pmdepend_t structures. + * @return a reference to an internal list of alpm_depend_t structures. */ -alpm_list_t *alpm_pkg_get_depends(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg); /** Returns the list of package optional dependencies. * @param pkg a pointer to package * @return a reference to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_optdepends(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg); /** Returns the list of package names conflicting with pkg. * @param pkg a pointer to package * @return a reference to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_conflicts(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_conflicts(alpm_pkg_t *pkg); /** Returns the list of package names provided by pkg. * @param pkg a pointer to package * @return a reference to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_provides(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_provides(alpm_pkg_t *pkg); /** Returns the list of available deltas for pkg. * @param pkg a pointer to package * @return a reference to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_deltas(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_deltas(alpm_pkg_t *pkg); /** Returns the list of packages to be replaced by pkg. * @param pkg a pointer to package * @return a reference to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_replaces(alpm_pkg_t *pkg); /** Returns the list of files installed by pkg. * The filenames are relative to the install root, @@ -623,7 +623,7 @@ alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg); * @param pkg a pointer to package * @return a reference to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_files(alpm_pkg_t *pkg); /** Returns the list of files backed up when installing pkg. * The elements of the returned list have the form @@ -632,17 +632,17 @@ alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg); * @param pkg a pointer to package * @return a reference to an internal list of strings. */ -alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_get_backup(alpm_pkg_t *pkg); /** Returns the database containing pkg. - * Returns a pointer to the pmdb_t structure the package is + * Returns a pointer to the alpm_db_t structure the package is * originating from, or NULL if the package was loaded from a file. * @param pkg a pointer to package * @return a pointer to the DB containing pkg, or NULL. */ -pmdb_t *alpm_pkg_get_db(pmpkg_t *pkg); +alpm_db_t *alpm_pkg_get_db(alpm_pkg_t *pkg); -/* End of pmpkg_t accessors */ +/* End of alpm_pkg_t accessors */ /* @} */ /** Open a package changelog for reading. @@ -651,7 +651,7 @@ pmdb_t *alpm_pkg_get_db(pmpkg_t *pkg); * @param pkg the package to read the changelog of (either file or db) * @return a 'file stream' to the package changelog */ -void *alpm_pkg_changelog_open(pmpkg_t *pkg); +void *alpm_pkg_changelog_open(alpm_pkg_t *pkg); /** Read data from an open changelog 'file stream'. * Similar to fread in functionality, this function takes a buffer and @@ -664,16 +664,16 @@ void *alpm_pkg_changelog_open(pmpkg_t *pkg); * error occurred. */ size_t alpm_pkg_changelog_read(void *ptr, size_t size, - const pmpkg_t *pkg, const void *fp); + const alpm_pkg_t *pkg, const void *fp); -/*int alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp);*/ +/*int alpm_pkg_changelog_feof(const alpm_pkg_t *pkg, void *fp);*/ -int alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp); +int alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp); /** Returns whether the package has an install scriptlet. * @return 0 if FALSE, TRUE otherwise */ -int alpm_pkg_has_scriptlet(pmpkg_t *pkg); +int alpm_pkg_has_scriptlet(alpm_pkg_t *pkg); /** Returns the size of download. * Returns the size of the files that will be downloaded to install a @@ -681,9 +681,9 @@ int alpm_pkg_has_scriptlet(pmpkg_t *pkg); * @param newpkg the new package to upgrade to * @return the size of the download */ -off_t alpm_pkg_download_size(pmpkg_t *newpkg); +off_t alpm_pkg_download_size(alpm_pkg_t *newpkg); -alpm_list_t *alpm_pkg_unused_deltas(pmpkg_t *pkg); +alpm_list_t *alpm_pkg_unused_deltas(alpm_pkg_t *pkg); /* End of alpm_pkg */ /** @} */ @@ -692,21 +692,21 @@ alpm_list_t *alpm_pkg_unused_deltas(pmpkg_t *pkg); * Signatures */ -int alpm_pkg_check_pgp_signature(pmpkg_t *pkg); +int alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg); -int alpm_db_check_pgp_signature(pmdb_t *db); +int alpm_db_check_pgp_signature(alpm_db_t *db); /* * Groups */ -alpm_list_t *alpm_find_grp_pkgs(alpm_list_t *dbs, const char *name); +alpm_list_t *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name); /* * Sync */ -pmpkg_t *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync); +alpm_pkg_t *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_sync); /** @addtogroup alpm_api_trans Transaction Functions * Functions to manipulate libalpm transactions @@ -714,7 +714,7 @@ pmpkg_t *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync); */ /** Transaction flags */ -typedef enum _pmtransflag_t { +typedef enum _alpm_transflag_t { /** Ignore dependency checks. */ PM_TRANS_FLAG_NODEPS = 1, /** Ignore file conflicts and overwrite files. */ @@ -749,12 +749,12 @@ typedef enum _pmtransflag_t { PM_TRANS_FLAG_RECURSEALL = (1 << 16), /** Do not lock the database during the operation. */ PM_TRANS_FLAG_NOLOCK = (1 << 17) -} pmtransflag_t; +} alpm_transflag_t; /** Transaction events. * NULL parameters are passed to in all events unless specified otherwise. */ -typedef enum _pmtransevt_t { +typedef enum _alpm_transevt_t { /** Dependencies will be computed for a package. */ PM_TRANS_EVT_CHECKDEPS_START = 1, /** Dependencies were computed for a package. */ @@ -829,10 +829,10 @@ typedef enum _pmtransevt_t { PM_TRANS_EVT_DISKSPACE_START, /** Disk space usage was computed for a package */ PM_TRANS_EVT_DISKSPACE_DONE, -} pmtransevt_t; +} alpm_transevt_t; /** Transaction Conversations (ie, questions) */ -typedef enum _pmtransconv_t { +typedef enum _alpm_transconv_t { PM_TRANS_CONV_INSTALL_IGNOREPKG = 1, PM_TRANS_CONV_REPLACE_PKG = (1 << 1), PM_TRANS_CONV_CONFLICT_PKG = (1 << 2), @@ -840,45 +840,45 @@ typedef enum _pmtransconv_t { PM_TRANS_CONV_LOCAL_NEWER = (1 << 4), PM_TRANS_CONV_REMOVE_PKGS = (1 << 5), PM_TRANS_CONV_SELECT_PROVIDER = (1 << 6), -} pmtransconv_t; +} alpm_transconv_t; /** Transaction Progress */ -typedef enum _pmtransprog_t { +typedef enum _alpm_transprog_t { PM_TRANS_PROGRESS_ADD_START, PM_TRANS_PROGRESS_UPGRADE_START, PM_TRANS_PROGRESS_REMOVE_START, PM_TRANS_PROGRESS_CONFLICTS_START, PM_TRANS_PROGRESS_DISKSPACE_START, PM_TRANS_PROGRESS_INTEGRITY_START, -} pmtransprog_t; +} alpm_transprog_t; /** Transaction Event callback */ -typedef void (*alpm_trans_cb_event)(pmtransevt_t, void *, void *); +typedef void (*alpm_trans_cb_event)(alpm_transevt_t, void *, void *); /** Transaction Conversation callback */ -typedef void (*alpm_trans_cb_conv)(pmtransconv_t, void *, void *, +typedef void (*alpm_trans_cb_conv)(alpm_transconv_t, void *, void *, void *, int *); /** Transaction Progress callback */ -typedef void (*alpm_trans_cb_progress)(pmtransprog_t, const char *, int, size_t, size_t); +typedef void (*alpm_trans_cb_progress)(alpm_transprog_t, const char *, int, size_t, size_t); /** Returns the bitfield of flags for the current transaction. * @param handle the context handle * @return the bitfield of transaction flags */ -pmtransflag_t alpm_trans_get_flags(pmhandle_t *handle); +alpm_transflag_t alpm_trans_get_flags(alpm_handle_t *handle); /** Returns a list of packages added by the transaction. * @param handle the context handle - * @return a list of pmpkg_t structures + * @return a list of alpm_pkg_t structures */ -alpm_list_t * alpm_trans_get_add(pmhandle_t *handle); +alpm_list_t * alpm_trans_get_add(alpm_handle_t *handle); /** Returns the list of packages removed by the transaction. * @param handle the context handle - * @return a list of pmpkg_t structures + * @return a list of alpm_pkg_t structures */ -alpm_list_t * alpm_trans_get_remove(pmhandle_t *handle); +alpm_list_t * alpm_trans_get_remove(alpm_handle_t *handle); /** Initialize the transaction. * @param handle the context handle @@ -888,17 +888,17 @@ alpm_list_t * alpm_trans_get_remove(pmhandle_t *handle); * @param progress progress callback function pointer * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_trans_init(pmhandle_t *handle, pmtransflag_t flags, +int alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags, alpm_trans_cb_event cb_event, alpm_trans_cb_conv conv, alpm_trans_cb_progress cb_progress); /** Prepare a transaction. * @param handle the context handle * @param data the address of an alpm_list where a list - * of pmdepmissing_t objects is dumped (conflicting packages) + * of alpm_depmissing_t objects is dumped (conflicting packages) * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_trans_prepare(pmhandle_t *handle, alpm_list_t **data); +int alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data); /** Commit a transaction. * @param handle the context handle @@ -906,19 +906,19 @@ int alpm_trans_prepare(pmhandle_t *handle, alpm_list_t **data); * of an error can be dumped (ie. list of conflicting files) * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_trans_commit(pmhandle_t *handle, alpm_list_t **data); +int alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data); /** Interrupt a transaction. * @param handle the context handle * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_trans_interrupt(pmhandle_t *handle); +int alpm_trans_interrupt(alpm_handle_t *handle); /** Release a transaction. * @param handle the context handle * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_trans_release(pmhandle_t *handle); +int alpm_trans_release(alpm_handle_t *handle); /** @} */ /** @name Common Transactions */ @@ -929,7 +929,7 @@ int alpm_trans_release(pmhandle_t *handle); * @param enable_downgrade allow downgrading of packages if the remote version is lower * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade); +int alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade); /** Add a package to the transaction. * If the package was loaded by alpm_pkg_load(), it will be freed upon @@ -938,14 +938,14 @@ int alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade); * @param pkg the package to add * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_add_pkg(pmhandle_t *handle, pmpkg_t *pkg); +int alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg); /** Add a package removal action to the transaction. * @param handle the context handle * @param pkg the package to uninstall * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg); +int alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg); /** @} */ @@ -955,19 +955,19 @@ int alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg); * @{ */ -alpm_list_t *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist, +alpm_list_t *alpm_checkdeps(alpm_handle_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_pkg_t *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring); +alpm_pkg_t *alpm_find_dbs_satisfier(alpm_handle_t *handle, alpm_list_t *dbs, const char *depstring); -alpm_list_t *alpm_checkconflicts(pmhandle_t *handle, alpm_list_t *pkglist); +alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist); /** Returns a newly allocated string representing the dependency information. * @param dep a dependency info structure * @return a formatted string, e.g. "glibc>=2.12" */ -char *alpm_dep_compute_string(const pmdepend_t *dep); +char *alpm_dep_compute_string(const alpm_depend_t *dep); /** @} */ @@ -983,7 +983,7 @@ char *alpm_compute_md5sum(const char *name); /** @addtogroup alpm_api_errors Error Codes * @{ */ -enum _pmerrno_t { +enum _alpm_errno_t { PM_ERR_MEMORY = 1, PM_ERR_SYSTEM, PM_ERR_BADPERMS, @@ -1048,17 +1048,17 @@ enum _pmerrno_t { }; /** Returns the current error code from the handle. */ -enum _pmerrno_t alpm_errno(pmhandle_t *handle); +enum _alpm_errno_t alpm_errno(alpm_handle_t *handle); /** Returns the string corresponding to an error number. */ -const char *alpm_strerror(enum _pmerrno_t err); +const char *alpm_strerror(enum _alpm_errno_t err); /* End of alpm_api_errors */ /** @} */ -pmhandle_t *alpm_initialize(const char *root, const char *dbpath, - enum _pmerrno_t *err); -int alpm_release(pmhandle_t *handle); +alpm_handle_t *alpm_initialize(const char *root, const char *dbpath, + enum _alpm_errno_t *err); +int alpm_release(alpm_handle_t *handle); const char *alpm_version(void); /* End of alpm_api */ diff --git a/lib/libalpm/backup.c b/lib/libalpm/backup.c index dc0c5674..0334042c 100644 --- a/lib/libalpm/backup.c +++ b/lib/libalpm/backup.c @@ -33,7 +33,7 @@ #include "util.h" /* split a backup string "file\thash" into the relevant components */ -int _alpm_split_backup(const char *string, pmbackup_t **backup) +int _alpm_split_backup(const char *string, alpm_backup_t **backup) { char *str, *ptr; @@ -55,10 +55,10 @@ int _alpm_split_backup(const char *string, pmbackup_t **backup) return 0; } -/* Look for a filename in a pmpkg_t.backup list. If we find it, +/* Look for a filename in a alpm_pkg_t.backup list. If we find it, * then we return the full backup entry. */ -pmbackup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list) +alpm_backup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list) { const alpm_list_t *lp; @@ -68,7 +68,7 @@ pmbackup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list) /* run through the backup list and parse out the hash for our file */ for(lp = backup_list; lp; lp = lp->next) { - pmbackup_t *backup = lp->data; + alpm_backup_t *backup = lp->data; if(strcmp(file, backup->name) == 0) { return backup; @@ -78,17 +78,17 @@ pmbackup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list) return NULL; } -void _alpm_backup_free(pmbackup_t *backup) +void _alpm_backup_free(alpm_backup_t *backup) { free(backup->name); free(backup->hash); free(backup); } -pmbackup_t *_alpm_backup_dup(const pmbackup_t *backup) +alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup) { - pmbackup_t *newbackup; - CALLOC(newbackup, 1, sizeof(pmbackup_t), return NULL); + alpm_backup_t *newbackup; + CALLOC(newbackup, 1, sizeof(alpm_backup_t), return NULL); STRDUP(newbackup->name, backup->name, return NULL); STRDUP(newbackup->hash, backup->hash, return NULL); diff --git a/lib/libalpm/backup.h b/lib/libalpm/backup.h index be8de97a..39c01a6d 100644 --- a/lib/libalpm/backup.h +++ b/lib/libalpm/backup.h @@ -23,10 +23,10 @@ #include "alpm_list.h" #include "alpm.h" -int _alpm_split_backup(const char *string, pmbackup_t **backup); -pmbackup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list); -void _alpm_backup_free(pmbackup_t *backup); -pmbackup_t *_alpm_backup_dup(const pmbackup_t *backup); +int _alpm_split_backup(const char *string, alpm_backup_t **backup); +alpm_backup_t *_alpm_needbackup(const char *file, const alpm_list_t *backup_list); +void _alpm_backup_free(alpm_backup_t *backup); +alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup); #endif /* _ALPM_BACKUP_H */ diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 50066883..2ee71cc0 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -55,85 +55,85 @@ * initialized. */ -static const char *_cache_get_filename(pmpkg_t *pkg) +static const char *_cache_get_filename(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->filename; } -static const char *_cache_get_desc(pmpkg_t *pkg) +static const char *_cache_get_desc(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->desc; } -static const char *_cache_get_url(pmpkg_t *pkg) +static const char *_cache_get_url(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->url; } -static time_t _cache_get_builddate(pmpkg_t *pkg) +static time_t _cache_get_builddate(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, 0); return pkg->builddate; } -static time_t _cache_get_installdate(pmpkg_t *pkg) +static time_t _cache_get_installdate(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, 0); return pkg->installdate; } -static const char *_cache_get_packager(pmpkg_t *pkg) +static const char *_cache_get_packager(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->packager; } -static const char *_cache_get_md5sum(pmpkg_t *pkg) +static const char *_cache_get_md5sum(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->md5sum; } -static const char *_cache_get_arch(pmpkg_t *pkg) +static const char *_cache_get_arch(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->arch; } -static off_t _cache_get_size(pmpkg_t *pkg) +static off_t _cache_get_size(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->size; } -static off_t _cache_get_isize(pmpkg_t *pkg) +static off_t _cache_get_isize(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->isize; } -static pmpkgreason_t _cache_get_reason(pmpkg_t *pkg) +static alpm_pkgreason_t _cache_get_reason(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, -1); return pkg->reason; } -static alpm_list_t *_cache_get_licenses(pmpkg_t *pkg) +static alpm_list_t *_cache_get_licenses(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->licenses; } -static alpm_list_t *_cache_get_groups(pmpkg_t *pkg) +static alpm_list_t *_cache_get_groups(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->groups; } -static int _cache_has_scriptlet(pmpkg_t *pkg) +static int _cache_has_scriptlet(alpm_pkg_t *pkg) { if(!(pkg->infolevel & INFRQ_SCRIPTLET)) { _alpm_local_db_read(pkg->origin_data.db, pkg, INFRQ_SCRIPTLET); @@ -141,43 +141,43 @@ static int _cache_has_scriptlet(pmpkg_t *pkg) return pkg->scriptlet; } -static alpm_list_t *_cache_get_depends(pmpkg_t *pkg) +static alpm_list_t *_cache_get_depends(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->depends; } -static alpm_list_t *_cache_get_optdepends(pmpkg_t *pkg) +static alpm_list_t *_cache_get_optdepends(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->optdepends; } -static alpm_list_t *_cache_get_conflicts(pmpkg_t *pkg) +static alpm_list_t *_cache_get_conflicts(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->conflicts; } -static alpm_list_t *_cache_get_provides(pmpkg_t *pkg) +static alpm_list_t *_cache_get_provides(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->provides; } -static alpm_list_t *_cache_get_replaces(pmpkg_t *pkg) +static alpm_list_t *_cache_get_replaces(alpm_pkg_t *pkg) { LAZY_LOAD(INFRQ_DESC, NULL); return pkg->replaces; } /* local packages can not have deltas */ -static alpm_list_t *_cache_get_deltas(pmpkg_t UNUSED *pkg) +static alpm_list_t *_cache_get_deltas(alpm_pkg_t UNUSED *pkg) { return NULL; } -static alpm_list_t *_cache_get_files(pmpkg_t *pkg) +static alpm_list_t *_cache_get_files(alpm_pkg_t *pkg) { if(pkg->origin == PKG_FROM_LOCALDB && !(pkg->infolevel & INFRQ_FILES)) { @@ -186,7 +186,7 @@ static alpm_list_t *_cache_get_files(pmpkg_t *pkg) return pkg->files; } -static alpm_list_t *_cache_get_backup(pmpkg_t *pkg) +static alpm_list_t *_cache_get_backup(alpm_pkg_t *pkg) { if(pkg->origin == PKG_FROM_LOCALDB && !(pkg->infolevel & INFRQ_FILES)) { @@ -201,7 +201,7 @@ static alpm_list_t *_cache_get_backup(pmpkg_t *pkg) * @param pkg the package (from db) to read the changelog * @return a 'file stream' to the package changelog */ -static void *_cache_changelog_open(pmpkg_t *pkg) +static void *_cache_changelog_open(alpm_pkg_t *pkg) { char clfile[PATH_MAX]; snprintf(clfile, PATH_MAX, "%s/%s/%s-%s/changelog", @@ -222,7 +222,7 @@ static void *_cache_changelog_open(pmpkg_t *pkg) * @return the number of characters read, or 0 if there is no more data */ static size_t _cache_changelog_read(void *ptr, size_t size, - const pmpkg_t UNUSED *pkg, const void *fp) + const alpm_pkg_t UNUSED *pkg, const void *fp) { return fread(ptr, 1, size, (FILE *)fp); } @@ -234,7 +234,7 @@ static size_t _cache_changelog_read(void *ptr, size_t size, * @param fp a 'file stream' to the package changelog * @return whether closing the package changelog stream was successful */ -static int _cache_changelog_close(const pmpkg_t UNUSED *pkg, void *fp) +static int _cache_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp) { return fclose((FILE *)fp); } @@ -273,7 +273,7 @@ static struct pkg_operations local_pkg_ops = { .changelog_close = _cache_changelog_close, }; -static int checkdbdir(pmdb_t *db) +static int checkdbdir(alpm_db_t *db) { struct stat buf; const char *path = _alpm_db_path(db); @@ -314,7 +314,7 @@ static int is_dir(const char *path, struct dirent *entry) return 0; } -static int local_db_validate(pmdb_t *db) +static int local_db_validate(alpm_db_t *db) { struct dirent *ent = NULL; const char *dbpath; @@ -370,7 +370,7 @@ done: return ret; } -static int local_db_populate(pmdb_t *db) +static int local_db_populate(alpm_db_t *db) { size_t est_count; int count = 0; @@ -424,7 +424,7 @@ static int local_db_populate(pmdb_t *db) while((ent = readdir(dbdir)) != NULL) { const char *name = ent->d_name; - pmpkg_t *pkg; + alpm_pkg_t *pkg; if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) { continue; @@ -484,7 +484,7 @@ static int local_db_populate(pmdb_t *db) } /* Note: the return value must be freed by the caller */ -static char *get_pkgpath(pmdb_t *db, pmpkg_t *info) +static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info) { size_t len; char *pkgpath; @@ -498,7 +498,7 @@ static char *get_pkgpath(pmdb_t *db, pmpkg_t *info) } -int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) +int _alpm_local_db_read(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq) { FILE *fp = NULL; char path[PATH_MAX]; @@ -618,7 +618,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) if(fgets(line, sizeof(line), fp) == NULL) { goto error; } - info->reason = (pmpkgreason_t)atol(_alpm_strtrim(line)); + info->reason = (alpm_pkgreason_t)atol(_alpm_strtrim(line)); } else if(strcmp(line, "%SIZE%") == 0) { /* NOTE: the CSIZE and SIZE fields both share the "size" field * in the pkginfo_t struct. This can be done b/c CSIZE @@ -639,7 +639,7 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) } } else if(strcmp(line, "%DEPENDS%") == 0) { while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) { - pmdepend_t *dep = _alpm_splitdep(line); + alpm_depend_t *dep = _alpm_splitdep(line); info->depends = alpm_list_add(info->depends, dep); } } else if(strcmp(line, "%OPTDEPENDS%") == 0) { @@ -683,8 +683,8 @@ int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) } } else if(strcmp(line, "%BACKUP%") == 0) { while(fgets(line, sizeof(line), fp) && strlen(_alpm_strtrim(line))) { - pmbackup_t *backup; - CALLOC(backup, 1, sizeof(pmbackup_t), goto error); + alpm_backup_t *backup; + CALLOC(backup, 1, sizeof(alpm_backup_t), goto error); if(_alpm_split_backup(line, &backup)) { goto error; } @@ -718,7 +718,7 @@ error: return -1; } -int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info) +int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info) { mode_t oldmask; int retval = 0; @@ -742,7 +742,7 @@ int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info) return retval; } -int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) +int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq) { FILE *fp = NULL; char path[PATH_MAX]; @@ -887,7 +887,7 @@ int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq) if(info->backup) { fprintf(fp, "%%BACKUP%%\n"); for(lp = info->backup; lp; lp = lp->next) { - pmbackup_t *backup = lp->data; + alpm_backup_t *backup = lp->data; fprintf(fp, "%s\t%s\n", backup->name, backup->hash); } fprintf(fp, "\n"); @@ -910,7 +910,7 @@ cleanup: return retval; } -int _alpm_local_db_remove(pmdb_t *db, pmpkg_t *info) +int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info) { int ret = 0; char *pkgpath = NULL; @@ -930,9 +930,9 @@ struct db_operations local_db_ops = { .unregister = _alpm_db_unregister, }; -pmdb_t *_alpm_db_register_local(pmhandle_t *handle) +alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle) { - pmdb_t *db; + alpm_db_t *db; _alpm_log(handle, PM_LOG_DEBUG, "registering local database\n"); diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 748f27a0..a4c6c559 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -43,7 +43,7 @@ * @param pkg the package (file) to read the changelog * @return a 'file stream' to the package changelog */ -static void *_package_changelog_open(pmpkg_t *pkg) +static void *_package_changelog_open(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); @@ -87,7 +87,7 @@ static void *_package_changelog_open(pmpkg_t *pkg) * @return the number of characters read, or 0 if there is no more data */ static size_t _package_changelog_read(void *ptr, size_t size, - const pmpkg_t UNUSED *pkg, const void *fp) + const alpm_pkg_t UNUSED *pkg, const void *fp) { ssize_t sret = archive_read_data((struct archive *)fp, ptr, size); /* Report error (negative values) */ @@ -105,7 +105,7 @@ static size_t _package_changelog_read(void *ptr, size_t size, * @param fp a 'file stream' to the package changelog * @return whether closing the package changelog stream was successful */ -static int _package_changelog_close(const pmpkg_t UNUSED *pkg, void *fp) +static int _package_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp) { return archive_read_finish((struct archive *)fp); } @@ -130,13 +130,13 @@ static struct pkg_operations *get_file_pkg_ops(void) } /** - * Parses the package description file for a package into a pmpkg_t struct. + * Parses the package description file for a package into a alpm_pkg_t struct. * @param archive the archive to read from, pointed at the .PKGINFO entry - * @param newpkg an empty pmpkg_t struct to fill with package info + * @param newpkg an empty alpm_pkg_t struct to fill with package info * * @return 0 on success, -1 on error */ -static int parse_descfile(pmhandle_t *handle, struct archive *a, pmpkg_t *newpkg) +static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *newpkg) { char *ptr = NULL; char *key = NULL; @@ -189,7 +189,7 @@ static int parse_descfile(pmhandle_t *handle, struct archive *a, pmpkg_t *newpkg /* size in the raw package is uncompressed (installed) size */ newpkg->isize = atol(ptr); } else if(strcmp(key, "depend") == 0) { - pmdepend_t *dep = _alpm_splitdep(ptr); + alpm_depend_t *dep = _alpm_splitdep(ptr); newpkg->depends = alpm_list_add(newpkg->depends, dep); } else if(strcmp(key, "optdepend") == 0) { newpkg->optdepends = alpm_list_add(newpkg->optdepends, strdup(ptr)); @@ -200,8 +200,8 @@ static int parse_descfile(pmhandle_t *handle, struct archive *a, pmpkg_t *newpkg } else if(strcmp(key, "provides") == 0) { newpkg->provides = alpm_list_add(newpkg->provides, strdup(ptr)); } else if(strcmp(key, "backup") == 0) { - pmbackup_t *backup; - CALLOC(backup, 1, sizeof(pmbackup_t), return -1); + alpm_backup_t *backup; + CALLOC(backup, 1, sizeof(alpm_backup_t), return -1); STRDUP(backup->name, ptr, return -1); newpkg->backup = alpm_list_add(newpkg->backup, backup); } else if(strcmp(key, "force") == 0) { @@ -224,14 +224,14 @@ static int parse_descfile(pmhandle_t *handle, struct archive *a, pmpkg_t *newpkg } /** - * Load a package and create the corresponding pmpkg_t struct. + * Load a package and create the corresponding alpm_pkg_t struct. * @param handle the context handle * @param pkgfile path to the package file * @param full whether to stop the load after metadata is read or continue * through the full archive - * @return An information filled pmpkg_t struct + * @return An information filled alpm_pkg_t struct */ -pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile, +alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, int full, const char *md5sum, const char *base64_sig, pgp_verify_t check_sig) { @@ -239,7 +239,7 @@ pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile, int config = 0; struct archive *archive; struct archive_entry *entry; - pmpkg_t *newpkg = NULL; + alpm_pkg_t *newpkg = NULL; struct stat st; size_t files_count = 0; @@ -387,8 +387,8 @@ error: return NULL; } -int SYMEXPORT alpm_pkg_load(pmhandle_t *handle, const char *filename, int full, - pgp_verify_t check_sig, pmpkg_t **pkg) +int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full, + pgp_verify_t check_sig, alpm_pkg_t **pkg) { CHECK_HANDLE(handle, return -1); ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 2bf37dab..9d3646c8 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -39,7 +39,7 @@ #include "deps.h" #include "dload.h" -static char *get_sync_dir(pmhandle_t *handle) +static char *get_sync_dir(alpm_handle_t *handle) { const char *dbpath = alpm_option_get_dbpath(handle); size_t len = strlen(dbpath) + 6; @@ -67,7 +67,7 @@ static char *get_sync_dir(pmhandle_t *handle) return syncpath; } -static int sync_db_validate(pmdb_t *db) +static int sync_db_validate(alpm_db_t *db) { pgp_verify_t check_sig; @@ -120,7 +120,7 @@ valid: * @code * alpm_list_t *syncs = alpm_option_get_syncdbs(); * for(i = syncs; i; i = alpm_list_next(i)) { - * pmdb_t *db = alpm_list_getdata(i); + * alpm_db_t *db = alpm_list_getdata(i); * result = alpm_db_update(0, db); * * if(result < 0) { @@ -142,13 +142,13 @@ valid: * @return 0 on success, -1 on error (pm_errno is set accordingly), 1 if up to * to date */ -int SYMEXPORT alpm_db_update(int force, pmdb_t *db) +int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) { char *syncpath; alpm_list_t *i; int ret = -1; mode_t oldmask; - pmhandle_t *handle; + alpm_handle_t *handle; pgp_verify_t check_sig; /* Sanity checks */ @@ -244,15 +244,15 @@ cleanup: } /* Forward decl so I don't reorganize the whole file right now */ -static int sync_db_read(pmdb_t *db, struct archive *archive, - struct archive_entry *entry, pmpkg_t **likely_pkg); +static int sync_db_read(alpm_db_t *db, struct archive *archive, + struct archive_entry *entry, alpm_pkg_t **likely_pkg); -static pmpkg_t *load_pkg_for_entry(pmdb_t *db, const char *entryname, - const char **entry_filename, pmpkg_t *likely_pkg) +static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname, + const char **entry_filename, alpm_pkg_t *likely_pkg) { char *pkgname = NULL, *pkgver = NULL; unsigned long pkgname_hash; - pmpkg_t *pkg; + alpm_pkg_t *pkg; /* get package and db file names */ if(entry_filename) { @@ -360,7 +360,7 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive) return (size_t)((st->st_size / per_package) + 1); } -static int sync_db_populate(pmdb_t *db) +static int sync_db_populate(alpm_db_t *db) { const char *dbpath; size_t est_count; @@ -368,7 +368,7 @@ static int sync_db_populate(pmdb_t *db) struct stat buf; struct archive *archive; struct archive_entry *entry; - pmpkg_t *pkg = NULL; + alpm_pkg_t *pkg = NULL; if((archive = archive_read_new()) == NULL) { RET_ERR(db->handle, PM_ERR_LIBARCHIVE, -1); @@ -451,11 +451,11 @@ static int sync_db_populate(pmdb_t *db) f = alpm_list_add(f, linedup); \ } while(1) /* note the while(1) and not (0) */ -static int sync_db_read(pmdb_t *db, struct archive *archive, - struct archive_entry *entry, pmpkg_t **likely_pkg) +static int sync_db_read(alpm_db_t *db, struct archive *archive, + struct archive_entry *entry, alpm_pkg_t **likely_pkg) { const char *entryname, *filename; - pmpkg_t *pkg; + alpm_pkg_t *pkg; struct archive_read_buffer buf; entryname = archive_entry_pathname(entry); @@ -584,10 +584,10 @@ struct db_operations sync_db_ops = { .unregister = _alpm_db_unregister, }; -pmdb_t *_alpm_db_register_sync(pmhandle_t *handle, const char *treename, +alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename, pgp_verify_t level) { - pmdb_t *db; + alpm_db_t *db; _alpm_log(handle, PM_LOG_DEBUG, "registering sync database '%s'\n", treename); diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index 94d82dd9..e54c7147 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -40,12 +40,12 @@ #include "log.h" #include "deps.h" -static pmconflict_t *conflict_new(const char *package1, const char *package2, +static alpm_conflict_t *conflict_new(const char *package1, const char *package2, const char *reason) { - pmconflict_t *conflict; + alpm_conflict_t *conflict; - MALLOC(conflict, sizeof(pmconflict_t), return NULL); + MALLOC(conflict, sizeof(alpm_conflict_t), return NULL); STRDUP(conflict->package1, package1, return NULL); STRDUP(conflict->package2, package2, return NULL); @@ -54,7 +54,7 @@ static pmconflict_t *conflict_new(const char *package1, const char *package2, return conflict; } -void _alpm_conflict_free(pmconflict_t *conflict) +void _alpm_conflict_free(alpm_conflict_t *conflict) { FREE(conflict->package2); FREE(conflict->package1); @@ -62,10 +62,10 @@ void _alpm_conflict_free(pmconflict_t *conflict) FREE(conflict); } -pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict) +alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict) { - pmconflict_t *newconflict; - CALLOC(newconflict, 1, sizeof(pmconflict_t), ); + alpm_conflict_t *newconflict; + CALLOC(newconflict, 1, sizeof(alpm_conflict_t), ); STRDUP(newconflict->package1, conflict->package1, return NULL); STRDUP(newconflict->package2, conflict->package2, return NULL); @@ -74,14 +74,14 @@ pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict) return newconflict; } -static int conflict_isin(pmconflict_t *needle, alpm_list_t *haystack) +static int conflict_isin(alpm_conflict_t *needle, alpm_list_t *haystack) { alpm_list_t *i; const char *npkg1 = needle->package1; const char *npkg2 = needle->package2; for(i = haystack; i; i = i->next) { - pmconflict_t *conflict = i->data; + alpm_conflict_t *conflict = i->data; const char *cpkg1 = conflict->package1; const char *cpkg2 = conflict->package2; if((strcmp(cpkg1, npkg1) == 0 && strcmp(cpkg2, npkg2) == 0) @@ -100,10 +100,10 @@ static int conflict_isin(pmconflict_t *needle, alpm_list_t *haystack) * @param pkg2 package causing conflict * @param reason reason for this conflict */ -static int add_conflict(pmhandle_t *handle, alpm_list_t **baddeps, +static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps, const char *pkg1, const char *pkg2, const char *reason) { - pmconflict_t *conflict = conflict_new(pkg1, pkg2, reason); + alpm_conflict_t *conflict = conflict_new(pkg1, pkg2, reason); if(!conflict) { return -1; } @@ -129,7 +129,7 @@ static int add_conflict(pmhandle_t *handle, alpm_list_t **baddeps, * @param baddeps list to store conflicts * @param order if >= 0 the conflict order is preserved, if < 0 it's reversed */ -static void check_conflict(pmhandle_t *handle, +static void check_conflict(alpm_handle_t *handle, alpm_list_t *list1, alpm_list_t *list2, alpm_list_t **baddeps, int order) { alpm_list_t *i; @@ -138,17 +138,17 @@ static void check_conflict(pmhandle_t *handle, return; } for(i = list1; i; i = i->next) { - pmpkg_t *pkg1 = i->data; + alpm_pkg_t *pkg1 = i->data; const char *pkg1name = alpm_pkg_get_name(pkg1); alpm_list_t *j; for(j = alpm_pkg_get_conflicts(pkg1); j; j = j->next) { const char *conflict = j->data; alpm_list_t *k; - pmdepend_t *parsed_conflict = _alpm_splitdep(conflict); + alpm_depend_t *parsed_conflict = _alpm_splitdep(conflict); for(k = list2; k; k = k->next) { - pmpkg_t *pkg2 = k->data; + alpm_pkg_t *pkg2 = k->data; const char *pkg2name = alpm_pkg_get_name(pkg2); if(strcmp(pkg1name, pkg2name) == 0) { @@ -170,7 +170,7 @@ static void check_conflict(pmhandle_t *handle, } /* Check for inter-conflicts */ -alpm_list_t *_alpm_innerconflicts(pmhandle_t *handle, alpm_list_t *packages) +alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages) { alpm_list_t *baddeps = NULL; @@ -184,7 +184,7 @@ alpm_list_t *_alpm_innerconflicts(pmhandle_t *handle, alpm_list_t *packages) * In case of conflict the package1 field of pmdepconflict_t contains * the target package, package2 field contains the local package */ -alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages) +alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages) { alpm_list_t *baddeps = NULL; @@ -209,9 +209,9 @@ alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages) * * @param handle the context handle * @param pkglist the list of packages to check - * @return an alpm_list_t of pmconflict_t + * @return an alpm_list_t of alpm_conflict_t */ -alpm_list_t SYMEXPORT *alpm_checkconflicts(pmhandle_t *handle, +alpm_list_t SYMEXPORT *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist) { CHECK_HANDLE(handle, return NULL); @@ -275,17 +275,17 @@ static alpm_list_t *filelist_operation(alpm_list_t *filesA, alpm_list_t *filesB, return ret; } -/* Adds pmfileconflict_t to a conflicts list. Pass the conflicts list, type +/* Adds alpm_fileconflict_t to a conflicts list. Pass the conflicts list, type * (either PM_FILECONFLICT_TARGET or PM_FILECONFLICT_FILESYSTEM), a file * string, and either two package names or one package name and NULL. This is * a wrapper for former functionality that was done inline. */ -static alpm_list_t *add_fileconflict(pmhandle_t *handle, - alpm_list_t *conflicts, pmfileconflicttype_t type, const char *filestr, +static alpm_list_t *add_fileconflict(alpm_handle_t *handle, + alpm_list_t *conflicts, alpm_fileconflicttype_t type, const char *filestr, const char *name1, const char *name2) { - pmfileconflict_t *conflict; - MALLOC(conflict, sizeof(pmfileconflict_t), goto error); + alpm_fileconflict_t *conflict; + MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error); conflict->type = type; STRDUP(conflict->target, name1, goto error); @@ -306,7 +306,7 @@ error: RET_ERR(handle, PM_ERR_MEMORY, conflicts); } -void _alpm_fileconflict_free(pmfileconflict_t *conflict) +void _alpm_fileconflict_free(alpm_fileconflict_t *conflict) { FREE(conflict->ctarget); FREE(conflict->file); @@ -315,7 +315,7 @@ void _alpm_fileconflict_free(pmfileconflict_t *conflict) } static int dir_belongsto_pkg(const char *root, const char *dirpath, - pmpkg_t *pkg) + alpm_pkg_t *pkg) { struct dirent *ent = NULL; struct stat sbuf; @@ -362,13 +362,13 @@ static int dir_belongsto_pkg(const char *root, const char *dirpath, /* Find file conflicts that may occur during the transaction with two checks: * 1: check every target against every target * 2: check every target against the filesystem */ -alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, +alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, alpm_list_t *upgrade, alpm_list_t *remove) { alpm_list_t *i, *j, *conflicts = NULL; size_t numtargs = alpm_list_count(upgrade); size_t current; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; if(!upgrade) { return NULL; @@ -380,7 +380,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, * different cases. */ for(current = 0, i = upgrade; i; i = i->next, current++) { alpm_list_t *k, *tmpfiles; - pmpkg_t *p1, *p2, *dbpkg; + alpm_pkg_t *p1, *p2, *dbpkg; char path[PATH_MAX]; p1 = i->data; @@ -474,7 +474,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, /* Check remove list (will we remove the conflicting local file?) */ for(k = remove; k && !resolved_conflict; k = k->next) { - pmpkg_t *rempkg = k->data; + alpm_pkg_t *rempkg = k->data; if(alpm_list_find_str(alpm_pkg_get_files(rempkg), relative_path)) { _alpm_log(handle, PM_LOG_DEBUG, "local file will be removed, not a conflict: %s\n", @@ -489,7 +489,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, if(!p2 || strcmp(p1->name, p2->name) == 0) { continue; } - pmpkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name); + alpm_pkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name); /* localp2->files will be removed (target conflicts are handled by CHECK 1) */ if(localp2 && alpm_list_find_str(alpm_pkg_get_files(localp2), filestr)) { diff --git a/lib/libalpm/conflict.h b/lib/libalpm/conflict.h index 546a2820..6c13cb28 100644 --- a/lib/libalpm/conflict.h +++ b/lib/libalpm/conflict.h @@ -24,14 +24,14 @@ #include "db.h" #include "package.h" -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); -alpm_list_t *_alpm_outerconflicts(pmdb_t *db, alpm_list_t *packages); -alpm_list_t *_alpm_db_find_fileconflicts(pmhandle_t *handle, +alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict); +void _alpm_conflict_free(alpm_conflict_t *conflict); +alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages); +alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages); +alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, alpm_list_t *upgrade, alpm_list_t *remove); -void _alpm_fileconflict_free(pmfileconflict_t *conflict); +void _alpm_fileconflict_free(alpm_fileconflict_t *conflict); #endif /* _ALPM_CONFLICT_H */ diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index 9f37f80b..f6f810c0 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -45,7 +45,7 @@ */ /** Register a sync database of packages. */ -pmdb_t SYMEXPORT *alpm_db_register_sync(pmhandle_t *handle, const char *treename, +alpm_db_t SYMEXPORT *alpm_db_register_sync(alpm_handle_t *handle, const char *treename, pgp_verify_t check_sig) { /* Sanity checks */ @@ -59,7 +59,7 @@ pmdb_t SYMEXPORT *alpm_db_register_sync(pmhandle_t *handle, const char *treename } /* Helper function for alpm_db_unregister{_all} */ -void _alpm_db_unregister(pmdb_t *db) +void _alpm_db_unregister(alpm_db_t *db) { if(db == NULL) { return; @@ -70,10 +70,10 @@ void _alpm_db_unregister(pmdb_t *db) } /** Unregister all package databases. */ -int SYMEXPORT alpm_db_unregister_all(pmhandle_t *handle) +int SYMEXPORT alpm_db_unregister_all(alpm_handle_t *handle) { alpm_list_t *i; - pmdb_t *db; + alpm_db_t *db; /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -91,10 +91,10 @@ int SYMEXPORT alpm_db_unregister_all(pmhandle_t *handle) } /** Unregister a package database. */ -int SYMEXPORT alpm_db_unregister(pmdb_t *db) +int SYMEXPORT alpm_db_unregister(alpm_db_t *db) { int found = 0; - pmhandle_t *handle; + alpm_handle_t *handle; /* Sanity checks */ ASSERT(db != NULL, return -1); @@ -128,14 +128,14 @@ int SYMEXPORT alpm_db_unregister(pmdb_t *db) } /** Get the serverlist of a database. */ -alpm_list_t SYMEXPORT *alpm_db_get_servers(const pmdb_t *db) +alpm_list_t SYMEXPORT *alpm_db_get_servers(const alpm_db_t *db) { ASSERT(db != NULL, return NULL); return db->servers; } /** Set the serverlist of a database. */ -int SYMEXPORT alpm_db_set_servers(pmdb_t *db, alpm_list_t *servers) +int SYMEXPORT alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers) { ASSERT(db != NULL, return -1); if(db->servers) FREELIST(db->servers); @@ -161,7 +161,7 @@ static char *sanitize_url(const char *url) * @param url url of the server * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int SYMEXPORT alpm_db_add_server(pmdb_t *db, const char *url) +int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url) { char *newurl; @@ -187,7 +187,7 @@ int SYMEXPORT alpm_db_add_server(pmdb_t *db, const char *url) * @return 0 on success, 1 on server not present, * -1 on error (pm_errno is set accordingly) */ -int SYMEXPORT alpm_db_remove_server(pmdb_t *db, const char *url) +int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url) { char *newurl, *vdata = NULL; @@ -213,14 +213,14 @@ int SYMEXPORT alpm_db_remove_server(pmdb_t *db, const char *url) } /** Get the name of a package database. */ -const char SYMEXPORT *alpm_db_get_name(const pmdb_t *db) +const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db) { ASSERT(db != NULL, return NULL); return db->treename; } /** Get a package entry from a package database. */ -pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name) +alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name) { ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; @@ -231,7 +231,7 @@ pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name) } /** Get the package cache of a package database. */ -alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db) +alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db) { ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; @@ -239,27 +239,27 @@ alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db) } /** Get a group entry from a package database. */ -pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name) +alpm_group_t SYMEXPORT *alpm_db_readgroup(alpm_db_t *db, const char *name) { ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; ASSERT(name != NULL && strlen(name) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, NULL)); - return _alpm_db_get_grpfromcache(db, name); + return _alpm_db_get_groupfromcache(db, name); } /** Get the group cache of a package database. */ -alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db) +alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db) { ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; - return _alpm_db_get_grpcache(db); + return _alpm_db_get_groupcache(db); } /** Searches a database. */ -alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles) +alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t* needles) { ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; @@ -268,14 +268,14 @@ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles) } /** Set install reason for a package in db. */ -int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t reason) +int SYMEXPORT alpm_db_set_pkgreason(alpm_db_t *db, const char *name, alpm_pkgreason_t reason) { ASSERT(db != NULL, return -1); db->handle->pm_errno = 0; /* TODO assert db == db_local ? shouldn't need a db param at all here... */ ASSERT(name != NULL, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1)); - pmpkg_t *pkg = _alpm_db_get_pkgfromcache(db, name); + alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(db, name); if(pkg == NULL) { RET_ERR(db->handle, PM_ERR_PKG_NOT_FOUND, -1); } @@ -297,11 +297,11 @@ int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t /** @} */ -pmdb_t *_alpm_db_new(const char *treename, int is_local) +alpm_db_t *_alpm_db_new(const char *treename, int is_local) { - pmdb_t *db; + alpm_db_t *db; - CALLOC(db, 1, sizeof(pmdb_t), return NULL); + CALLOC(db, 1, sizeof(alpm_db_t), return NULL); STRDUP(db->treename, treename, return NULL); db->is_local = is_local; db->pgp_verify = PM_PGP_VERIFY_UNKNOWN; @@ -309,7 +309,7 @@ pmdb_t *_alpm_db_new(const char *treename, int is_local) return db; } -void _alpm_db_free(pmdb_t *db) +void _alpm_db_free(alpm_db_t *db) { /* cleanup pkgcache */ _alpm_db_free_pkgcache(db); @@ -322,7 +322,7 @@ void _alpm_db_free(pmdb_t *db) return; } -const char *_alpm_db_path(pmdb_t *db) +const char *_alpm_db_path(alpm_db_t *db) { if(!db) { return NULL; @@ -353,7 +353,7 @@ const char *_alpm_db_path(pmdb_t *db) return db->_path; } -char *_alpm_db_sig_path(pmdb_t *db) +char *_alpm_db_sig_path(alpm_db_t *db) { char *sigpath; size_t len; @@ -369,12 +369,12 @@ char *_alpm_db_sig_path(pmdb_t *db) int _alpm_db_cmp(const void *d1, const void *d2) { - pmdb_t *db1 = (pmdb_t *)d1; - pmdb_t *db2 = (pmdb_t *)d2; + alpm_db_t *db1 = (alpm_db_t *)d1; + alpm_db_t *db2 = (alpm_db_t *)d2; return strcmp(db1->treename, db2->treename); } -alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) +alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles) { const alpm_list_t *i, *j, *k; alpm_list_t *ret = NULL; @@ -397,7 +397,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) } for(j = list; j; j = j->next) { - pmpkg_t *pkg = j->data; + alpm_pkg_t *pkg = j->data; const char *matched = NULL; const char *name = alpm_pkg_get_name(pkg); const char *desc = alpm_pkg_get_desc(pkg); @@ -451,7 +451,7 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles) /* Returns a new package cache from db. * It frees the cache if it already exists. */ -static int load_pkgcache(pmdb_t *db) +static int load_pkgcache(alpm_db_t *db) { _alpm_db_free_pkgcache(db); @@ -467,7 +467,7 @@ static int load_pkgcache(pmdb_t *db) return 0; } -void _alpm_db_free_pkgcache(pmdb_t *db) +void _alpm_db_free_pkgcache(alpm_db_t *db) { if(db == NULL || !(db->status & DB_STATUS_PKGCACHE)) { return; @@ -481,10 +481,10 @@ void _alpm_db_free_pkgcache(pmdb_t *db) _alpm_pkghash_free(db->pkgcache); db->status &= ~DB_STATUS_PKGCACHE; - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); } -pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db) +alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db) { if(db == NULL) { return NULL; @@ -501,9 +501,9 @@ pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db) return db->pkgcache; } -alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db) +alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db) { - pmpkghash_t *hash = _alpm_db_get_pkgcache_hash(db); + alpm_pkghash_t *hash = _alpm_db_get_pkgcache_hash(db); if(hash == NULL) { return NULL; @@ -513,9 +513,9 @@ alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db) } /* "duplicate" pkg then add it to pkgcache */ -int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg) +int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg) { - pmpkg_t *newpkg; + alpm_pkg_t *newpkg; if(db == NULL || pkg == NULL || !(db->status & DB_STATUS_PKGCACHE)) { return -1; @@ -530,14 +530,14 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg) alpm_pkg_get_name(newpkg), db->treename); db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg); - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); return 0; } -int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg) +int _alpm_db_remove_pkgfromcache(alpm_db_t *db, alpm_pkg_t *pkg) { - pmpkg_t *data = NULL; + alpm_pkg_t *data = NULL; if(db == NULL || pkg == NULL || !(db->status & DB_STATUS_PKGCACHE)) { return -1; @@ -556,18 +556,18 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg) _alpm_pkg_free(data); - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); return 0; } -pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target) +alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target) { if(db == NULL) { return NULL; } - pmpkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db); + alpm_pkghash_t *pkgcache = _alpm_db_get_pkgcache_hash(db); if(!pkgcache) { return NULL; } @@ -577,7 +577,7 @@ pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target) /* Returns a new group cache from db. */ -static int load_grpcache(pmdb_t *db) +static int load_grpcache(alpm_db_t *db) { alpm_list_t *lp; @@ -590,12 +590,12 @@ static int load_grpcache(pmdb_t *db) for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) { const alpm_list_t *i; - pmpkg_t *pkg = lp->data; + alpm_pkg_t *pkg = lp->data; for(i = alpm_pkg_get_groups(pkg); i; i = i->next) { const char *grpname = i->data; alpm_list_t *j; - pmgrp_t *grp = NULL; + alpm_group_t *grp = NULL; int found = 0; /* first look through the group cache for a group with this name */ @@ -613,9 +613,9 @@ static int load_grpcache(pmdb_t *db) continue; } /* we didn't find the group, so create a new one with this name */ - grp = _alpm_grp_new(grpname); + grp = _alpm_group_new(grpname); if(!grp) { - _alpm_db_free_grpcache(db); + _alpm_db_free_groupcache(db); return -1; } grp->packages = alpm_list_add(grp->packages, pkg); @@ -627,7 +627,7 @@ static int load_grpcache(pmdb_t *db) return 0; } -void _alpm_db_free_grpcache(pmdb_t *db) +void _alpm_db_free_groupcache(alpm_db_t *db) { alpm_list_t *lg; @@ -639,14 +639,14 @@ void _alpm_db_free_grpcache(pmdb_t *db) "freeing group cache for repository '%s'\n", db->treename); for(lg = db->grpcache; lg; lg = lg->next) { - _alpm_grp_free(lg->data); + _alpm_group_free(lg->data); lg->data = NULL; } FREELIST(db->grpcache); db->status &= ~DB_STATUS_GRPCACHE; } -alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db) +alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db) { if(db == NULL) { return NULL; @@ -663,7 +663,7 @@ alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db) return db->grpcache; } -pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target) +alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target) { alpm_list_t *i; @@ -671,8 +671,8 @@ pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target) return NULL; } - for(i = _alpm_db_get_grpcache(db); i; i = i->next) { - pmgrp_t *info = i->data; + for(i = _alpm_db_get_groupcache(db); i; i = i->next) { + alpm_group_t *info = i->data; if(strcmp(info->name, target) == 0) { return info; diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h index 03187342..7055abd8 100644 --- a/lib/libalpm/db.h +++ b/lib/libalpm/db.h @@ -33,7 +33,7 @@ #include "signing.h" /* Database entries */ -typedef enum _pmdbinfrq_t { +typedef enum _alpm_dbinfrq_t { INFRQ_BASE = 1, INFRQ_DESC = (1 << 1), INFRQ_FILES = (1 << 2), @@ -41,31 +41,31 @@ typedef enum _pmdbinfrq_t { INFRQ_DSIZE = (1 << 4), /* ALL should be info stored in the package or database */ INFRQ_ALL = 0x1F -} pmdbinfrq_t; +} alpm_dbinfrq_t; /** Database status. Bitflags. */ -enum _pmdbstatus_t { +enum _alpm_dbstatus_t { DB_STATUS_VALID = (1 << 0), DB_STATUS_PKGCACHE = (1 << 1), DB_STATUS_GRPCACHE = (1 << 2) }; struct db_operations { - int (*populate) (pmdb_t *); - void (*unregister) (pmdb_t *); + int (*populate) (alpm_db_t *); + void (*unregister) (alpm_db_t *); }; /* Database */ -struct __pmdb_t { - pmhandle_t *handle; +struct __alpm_db_t { + alpm_handle_t *handle; char *treename; /* do not access directly, use _alpm_db_path(db) for lazy access */ char *_path; /* also indicates whether we are RO or RW */ int is_local; /* flags determining validity, loaded caches, etc. */ - enum _pmdbstatus_t status; - pmpkghash_t *pkgcache; + enum _alpm_dbstatus_t status; + alpm_pkghash_t *pkgcache; alpm_list_t *grpcache; alpm_list_t *servers; pgp_verify_t pgp_verify; @@ -75,36 +75,36 @@ struct __pmdb_t { /* db.c, database general calls */ -pmdb_t *_alpm_db_new(const char *treename, int is_local); -void _alpm_db_free(pmdb_t *db); -const char *_alpm_db_path(pmdb_t *db); -char *_alpm_db_sig_path(pmdb_t *db); +alpm_db_t *_alpm_db_new(const char *treename, int is_local); +void _alpm_db_free(alpm_db_t *db); +const char *_alpm_db_path(alpm_db_t *db); +char *_alpm_db_sig_path(alpm_db_t *db); int _alpm_db_cmp(const void *d1, const void *d2); -alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles); -pmdb_t *_alpm_db_register_local(pmhandle_t *handle); -pmdb_t *_alpm_db_register_sync(pmhandle_t *handle, const char *treename, +alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles); +alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle); +alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename, pgp_verify_t level); -void _alpm_db_unregister(pmdb_t *db); +void _alpm_db_unregister(alpm_db_t *db); /* be_*.c, backend specific calls */ -int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq); -int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info); -int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq); -int _alpm_local_db_remove(pmdb_t *db, pmpkg_t *info); +int _alpm_local_db_read(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq); +int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info); +int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq); +int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info); /* cache bullshit */ /* packages */ -void _alpm_db_free_pkgcache(pmdb_t *db); -int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg); -int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg); -pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db); -alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db); -int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel); -pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target); +void _alpm_db_free_pkgcache(alpm_db_t *db); +int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg); +int _alpm_db_remove_pkgfromcache(alpm_db_t *db, alpm_pkg_t *pkg); +alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db); +alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db); +int _alpm_db_ensure_pkgcache(alpm_db_t *db, alpm_dbinfrq_t infolevel); +alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target); /* groups */ -void _alpm_db_free_grpcache(pmdb_t *db); -alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db); -pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target); +void _alpm_db_free_groupcache(alpm_db_t *db); +alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db); +alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target); #endif /* _ALPM_DB_H */ diff --git a/lib/libalpm/delta.c b/lib/libalpm/delta.c index fc7a0f75..d2c2fe80 100644 --- a/lib/libalpm/delta.c +++ b/lib/libalpm/delta.c @@ -40,12 +40,12 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse) alpm_list_t *vertices = NULL; /* create the vertices */ for(i = deltas; i; i = i->next) { - pmgraph_t *v = _alpm_graph_new(); + alpm_graph_t *v = _alpm_graph_new(); if(!v) { alpm_list_free(vertices); return NULL; } - pmdelta_t *vdelta = i->data; + alpm_delta_t *vdelta = i->data; vdelta->download_size = vdelta->delta_size; v->weight = LONG_MAX; v->data = vdelta; @@ -54,12 +54,12 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse) /* compute the edges */ for(i = vertices; i; i = i->next) { - pmgraph_t *v_i = i->data; - pmdelta_t *d_i = v_i->data; + alpm_graph_t *v_i = i->data; + alpm_delta_t *d_i = v_i->data; /* loop a second time so we make all possible comparisons */ for(j = vertices; j; j = j->next) { - pmgraph_t *v_j = j->data; - pmdelta_t *d_j = v_j->data; + alpm_graph_t *v_j = j->data; + alpm_delta_t *d_j = v_j->data; /* We want to create a delta tree like the following: * 1_to_2 * | @@ -78,14 +78,14 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse) return vertices; } -static void graph_init_size(pmhandle_t *handle, alpm_list_t *vertices) +static void graph_init_size(alpm_handle_t *handle, alpm_list_t *vertices) { alpm_list_t *i; for(i = vertices; i; i = i->next) { char *fpath, *md5sum; - pmgraph_t *v = i->data; - pmdelta_t *vdelta = v->data; + alpm_graph_t *v = i->data; + alpm_delta_t *vdelta = v->data; /* determine whether the delta file already exists */ fpath = _alpm_filecache_find(handle, vdelta->delta); @@ -109,12 +109,12 @@ static void graph_init_size(pmhandle_t *handle, alpm_list_t *vertices) static void dijkstra(alpm_list_t *vertices) { alpm_list_t *i; - pmgraph_t *v; + alpm_graph_t *v; while(1) { v = NULL; /* find the smallest vertice not visited yet */ for(i = vertices; i; i = i->next) { - pmgraph_t *v_i = i->data; + alpm_graph_t *v_i = i->data; if(v_i->state == -1) { continue; @@ -132,8 +132,8 @@ static void dijkstra(alpm_list_t *vertices) v->childptr = v->children; while(v->childptr) { - pmgraph_t *v_c = v->childptr->data; - pmdelta_t *d_c = v_c->data; + alpm_graph_t *v_c = v->childptr->data; + alpm_delta_t *d_c = v_c->data; if(v_c->weight > v->weight + d_c->download_size) { v_c->weight = v->weight + d_c->download_size; v_c->parent = v; @@ -148,13 +148,13 @@ static void dijkstra(alpm_list_t *vertices) static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t **path) { alpm_list_t *i; - pmgraph_t *v = NULL; + alpm_graph_t *v = NULL; off_t bestsize = 0; alpm_list_t *rpath = NULL; for(i = vertices; i; i = i->next) { - pmgraph_t *v_i = i->data; - pmdelta_t *d_i = v_i->data; + alpm_graph_t *v_i = i->data; + alpm_delta_t *d_i = v_i->data; if(strcmp(d_i->to, to) == 0) { if(v == NULL || v_i->weight < v->weight) { @@ -165,7 +165,7 @@ static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t ** } while(v != NULL) { - pmdelta_t *vdelta = v->data; + alpm_delta_t *vdelta = v->data; rpath = alpm_list_add(rpath, vdelta); v = v->parent; } @@ -179,14 +179,14 @@ static off_t shortest_path(alpm_list_t *vertices, const char *to, alpm_list_t ** * The shortest path is defined as the path with the smallest combined * size, not the length of the path. * @param handle the context handle - * @param deltas the list of pmdelta_t * objects that a file has + * @param deltas the list of alpm_delta_t * objects that a file has * @param to the file to start the search at - * @param path the pointer to a list location where pmdelta_t * objects that + * @param path the pointer to a list location where alpm_delta_t * objects that * have the smallest size are placed. NULL is set if there is no path * possible with the files available. * @return the size of the path stored, or LONG_MAX if path is unfindable */ -off_t _alpm_shortest_delta_path(pmhandle_t *handle, alpm_list_t *deltas, +off_t _alpm_shortest_delta_path(alpm_handle_t *handle, alpm_list_t *deltas, const char *to, alpm_list_t **path) { alpm_list_t *bestpath = NULL; @@ -222,8 +222,8 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota vertices = graph_init(deltas, 1); for(i = vertices; i; i = i->next) { - pmgraph_t *v = i->data; - pmdelta_t *vdelta = v->data; + alpm_graph_t *v = i->data; + alpm_delta_t *vdelta = v->data; if(strcmp(vdelta->to, to) == 0) { v->weight = vdelta->download_size; @@ -231,8 +231,8 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota } dijkstra(vertices); for(i = vertices; i; i = i->next) { - pmgraph_t *v = i->data; - pmdelta_t *vdelta = v->data; + alpm_graph_t *v = i->data; + alpm_delta_t *vdelta = v->data; if(v->weight > quota) { unused = alpm_list_add(unused, vdelta->delta); } @@ -247,7 +247,7 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota * @{ */ -alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(alpm_pkg_t *pkg) { off_t pkgsize = alpm_pkg_get_size(pkg); alpm_list_t *unused = find_unused( @@ -259,17 +259,17 @@ alpm_list_t SYMEXPORT *alpm_pkg_unused_deltas(pmpkg_t *pkg) /** @} */ -/** Parses the string representation of a pmdelta_t object. +/** Parses the string representation of a alpm_delta_t object. * This function assumes that the string is in the correct format. * This format is as follows: * $deltafile $deltamd5 $deltasize $oldfile $newfile * @param line the string to parse - * @return A pointer to the new pmdelta_t object + * @return A pointer to the new alpm_delta_t object */ /* TODO this does not really belong here, but in a parsing lib */ -pmdelta_t *_alpm_delta_parse(char *line) +alpm_delta_t *_alpm_delta_parse(char *line) { - pmdelta_t *delta; + alpm_delta_t *delta; char *tmp = line, *tmp2; regex_t reg; @@ -284,7 +284,7 @@ pmdelta_t *_alpm_delta_parse(char *line) } regfree(®); - CALLOC(delta, 1, sizeof(pmdelta_t), return NULL); + CALLOC(delta, 1, sizeof(alpm_delta_t), return NULL); tmp2 = tmp; tmp = strchr(tmp, ' '); @@ -312,7 +312,7 @@ pmdelta_t *_alpm_delta_parse(char *line) return delta; } -void _alpm_delta_free(pmdelta_t *delta) +void _alpm_delta_free(alpm_delta_t *delta) { FREE(delta->delta); FREE(delta->delta_md5); @@ -321,10 +321,10 @@ void _alpm_delta_free(pmdelta_t *delta) FREE(delta); } -pmdelta_t *_alpm_delta_dup(const pmdelta_t *delta) +alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta) { - pmdelta_t *newdelta; - CALLOC(newdelta, 1, sizeof(pmdelta_t), return NULL); + alpm_delta_t *newdelta; + CALLOC(newdelta, 1, sizeof(alpm_delta_t), return NULL); STRDUP(newdelta->delta, delta->delta, return NULL); STRDUP(newdelta->delta_md5, delta->delta_md5, return NULL); STRDUP(newdelta->from, delta->from, return NULL); diff --git a/lib/libalpm/delta.h b/lib/libalpm/delta.h index 6ac54139..05df4207 100644 --- a/lib/libalpm/delta.h +++ b/lib/libalpm/delta.h @@ -26,10 +26,10 @@ #include "alpm.h" -pmdelta_t *_alpm_delta_parse(char *line); -void _alpm_delta_free(pmdelta_t *delta); -pmdelta_t *_alpm_delta_dup(const pmdelta_t *delta); -off_t _alpm_shortest_delta_path(pmhandle_t *handle, alpm_list_t *deltas, +alpm_delta_t *_alpm_delta_parse(char *line); +void _alpm_delta_free(alpm_delta_t *delta); +alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta); +off_t _alpm_shortest_delta_path(alpm_handle_t *handle, alpm_list_t *deltas, const char *to, alpm_list_t **path); /* max percent of package size to download deltas */ diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index 085e6ca9..6ca79c34 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -37,19 +37,19 @@ #include "handle.h" #include "trans.h" -void _alpm_dep_free(pmdepend_t *dep) +void _alpm_dep_free(alpm_depend_t *dep) { FREE(dep->name); FREE(dep->version); FREE(dep); } -static pmdepmissing_t *depmiss_new(const char *target, pmdepend_t *dep, +static alpm_depmissing_t *depmiss_new(const char *target, alpm_depend_t *dep, const char *causingpkg) { - pmdepmissing_t *miss; + alpm_depmissing_t *miss; - MALLOC(miss, sizeof(pmdepmissing_t), return NULL); + MALLOC(miss, sizeof(alpm_depmissing_t), return NULL); STRDUP(miss->target, target, return NULL); miss->depend = _alpm_dep_dup(dep); @@ -58,7 +58,7 @@ static pmdepmissing_t *depmiss_new(const char *target, pmdepend_t *dep, return miss; } -void _alpm_depmiss_free(pmdepmissing_t *miss) +void _alpm_depmiss_free(alpm_depmissing_t *miss) { _alpm_dep_free(miss->depend); FREE(miss->target); @@ -67,7 +67,7 @@ void _alpm_depmiss_free(pmdepmissing_t *miss) } /* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */ -static int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2) +static int _alpm_dep_edge(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2) { alpm_list_t *i; for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) { @@ -78,7 +78,7 @@ static int _alpm_dep_edge(pmpkg_t *pkg1, pmpkg_t *pkg2) return 0; } -/* Convert a list of pmpkg_t * to a graph structure, +/* Convert a list of alpm_pkg_t * to a graph structure, * with a edge for each dependency. * Returns a list of vertices (one vertex = one package) * (used by alpm_sortbydeps) @@ -89,19 +89,19 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets) alpm_list_t *vertices = NULL; /* We create the vertices */ for(i = targets; i; i = i->next) { - pmgraph_t *vertex = _alpm_graph_new(); + alpm_graph_t *vertex = _alpm_graph_new(); vertex->data = (void *)i->data; vertices = alpm_list_add(vertices, vertex); } /* We compute the edges */ for(i = vertices; i; i = i->next) { - pmgraph_t *vertex_i = i->data; - pmpkg_t *p_i = vertex_i->data; + alpm_graph_t *vertex_i = i->data; + alpm_pkg_t *p_i = vertex_i->data; /* TODO this should be somehow combined with alpm_checkdeps */ for(j = vertices; j; j = j->next) { - pmgraph_t *vertex_j = j->data; - pmpkg_t *p_j = vertex_j->data; + alpm_graph_t *vertex_j = j->data; + alpm_pkg_t *p_j = vertex_j->data; if(_alpm_dep_edge(p_i, p_j)) { vertex_i->children = alpm_list_add(vertex_i->children, vertex_j); @@ -126,13 +126,13 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets) * This function returns the new alpm_list_t* target list. * */ -alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle, +alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse) { alpm_list_t *newtargs = NULL; alpm_list_t *vertices = NULL; alpm_list_t *vptr; - pmgraph_t *vertex; + alpm_graph_t *vertex; if(targets == NULL) { return NULL; @@ -149,7 +149,7 @@ alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle, vertex->state = -1; int found = 0; while(vertex->childptr && !found) { - pmgraph_t *nextchild = vertex->childptr->data; + alpm_graph_t *nextchild = vertex->childptr->data; vertex->childptr = vertex->childptr->next; if(nextchild->state == 0) { found = 1; @@ -157,8 +157,8 @@ alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle, vertex = nextchild; } else if(nextchild->state == -1) { - pmpkg_t *vertexpkg = vertex->data; - pmpkg_t *childpkg = nextchild->data; + alpm_pkg_t *vertexpkg = vertex->data; + alpm_pkg_t *childpkg = nextchild->data; const char *message; _alpm_log(handle, PM_LOG_WARNING, _("dependency cycle detected:\n")); @@ -202,16 +202,16 @@ alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle, return newtargs; } -static int no_dep_version(pmhandle_t *handle) +static int no_dep_version(alpm_handle_t *handle) { int flags = alpm_trans_get_flags(handle); return flags != -1 && (flags & PM_TRANS_FLAG_NODEPVERSION); } -static pmdepend_t *filtered_depend(pmdepend_t *dep, int nodepversion) +static alpm_depend_t *filtered_depend(alpm_depend_t *dep, int nodepversion) { if(nodepversion) { - pmdepend_t *newdep = _alpm_dep_dup(dep); + alpm_depend_t *newdep = _alpm_dep_dup(dep); ASSERT(newdep, return dep); newdep->mod = PM_DEP_MOD_ANY; dep = newdep; @@ -219,19 +219,19 @@ static pmdepend_t *filtered_depend(pmdepend_t *dep, int nodepversion) return dep; } -static void release_filtered_depend(pmdepend_t *dep, int nodepversion) +static void release_filtered_depend(alpm_depend_t *dep, int nodepversion) { if(nodepversion) { free(dep); } } -static pmpkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) +static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep) { alpm_list_t *i; for(i = pkgs; i; i = alpm_list_next(i)) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(_alpm_depcmp(pkg, dep)) { return pkg; } @@ -241,17 +241,17 @@ static pmpkg_t *find_dep_satisfier(alpm_list_t *pkgs, pmdepend_t *dep) /** Find a package satisfying a specified dependency. * The dependency can include versions with depmod operators. - * @param pkgs an alpm_list_t* of pmpkg_t where the satisfier will be searched + * @param pkgs an alpm_list_t* of alpm_pkg_t where the satisfier will be searched * @param depstring package or provision name, versioned or not - * @return a pmpkg_t* satisfying depstring + * @return a alpm_pkg_t* satisfying depstring */ -pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring) +alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring) { - pmdepend_t *dep = _alpm_splitdep(depstring); + alpm_depend_t *dep = _alpm_splitdep(depstring); if(!dep) { return NULL; } - pmpkg_t *pkg = find_dep_satisfier(pkgs, dep); + alpm_pkg_t *pkg = find_dep_satisfier(pkgs, dep); _alpm_dep_free(dep); return pkg; } @@ -263,9 +263,9 @@ pmpkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring) * @param remove an alpm_list_t* of packages to be removed * @param upgrade an alpm_list_t* of packages to be upgraded (remove-then-upgrade) * @param reversedeps handles the backward dependencies - * @return an alpm_list_t* of pmdepmissing_t pointers. + * @return an alpm_list_t* of alpm_depmissing_t pointers. */ -alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist, +alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle, alpm_list_t *pkglist, alpm_list_t *remove, alpm_list_t *upgrade, int reversedeps) { alpm_list_t *i, *j; @@ -277,7 +277,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist, targets = alpm_list_join(alpm_list_copy(remove), alpm_list_copy(upgrade)); for(i = pkglist; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(_alpm_pkg_find(targets, pkg->name)) { modified = alpm_list_add(modified, pkg); } else { @@ -290,19 +290,19 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist, /* look for unsatisfied dependencies of the upgrade list */ for(i = upgrade; i; i = i->next) { - pmpkg_t *tp = i->data; + alpm_pkg_t *tp = i->data; _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: package %s-%s\n", alpm_pkg_get_name(tp), alpm_pkg_get_version(tp)); for(j = alpm_pkg_get_depends(tp); j; j = j->next) { - pmdepend_t *depend = j->data; + alpm_depend_t *depend = j->data; depend = filtered_depend(depend, nodepversion); /* 1. we check the upgrade list */ /* 2. we check database for untouched satisfying packages */ if(!find_dep_satisfier(upgrade, depend) && !find_dep_satisfier(dblist, depend)) { /* Unsatisfied dependency in the upgrade list */ - pmdepmissing_t *miss; + alpm_depmissing_t *miss; char *missdepstring = alpm_dep_compute_string(depend); _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: missing dependency '%s' for package '%s'\n", missdepstring, alpm_pkg_get_name(tp)); @@ -318,18 +318,18 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist, /* reversedeps handles the backwards dependencies, ie, * the packages listed in the requiredby field. */ for(i = dblist; i; i = i->next) { - pmpkg_t *lp = i->data; + alpm_pkg_t *lp = i->data; for(j = alpm_pkg_get_depends(lp); j; j = j->next) { - pmdepend_t *depend = j->data; + alpm_depend_t *depend = j->data; depend = filtered_depend(depend, nodepversion); - pmpkg_t *causingpkg = find_dep_satisfier(modified, depend); + alpm_pkg_t *causingpkg = find_dep_satisfier(modified, depend); /* we won't break this depend, if it is already broken, we ignore it */ /* 1. check upgrade list for satisfiers */ /* 2. check dblist for satisfiers */ if(causingpkg && !find_dep_satisfier(upgrade, depend) && !find_dep_satisfier(dblist, depend)) { - pmdepmissing_t *miss; + alpm_depmissing_t *miss; char *missdepstring = alpm_dep_compute_string(depend); _alpm_log(handle, PM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n", missdepstring, alpm_pkg_get_name(lp)); @@ -348,7 +348,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(pmhandle_t *handle, alpm_list_t *pkglist, return baddeps; } -static int dep_vercmp(const char *version1, pmdepmod_t mod, +static int dep_vercmp(const char *version1, alpm_depmod_t mod, const char *version2) { int equal = 0; @@ -369,7 +369,7 @@ static int dep_vercmp(const char *version1, pmdepmod_t mod, return equal; } -int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) +int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep) { alpm_list_t *i; int satisfy = 0; @@ -411,16 +411,16 @@ int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep) return satisfy; } -pmdepend_t *_alpm_splitdep(const char *depstring) +alpm_depend_t *_alpm_splitdep(const char *depstring) { - pmdepend_t *depend; + alpm_depend_t *depend; const char *ptr, *version = NULL; if(depstring == NULL) { return NULL; } - CALLOC(depend, 1, sizeof(pmdepend_t), return NULL); + CALLOC(depend, 1, sizeof(alpm_depend_t), return NULL); /* Find a version comparator if one exists. If it does, set the type and * increment the ptr accordingly so we can copy the right strings. */ @@ -455,10 +455,10 @@ pmdepend_t *_alpm_splitdep(const char *depstring) return depend; } -pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep) +alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep) { - pmdepend_t *newdep; - CALLOC(newdep, 1, sizeof(pmdepend_t), return NULL); + alpm_depend_t *newdep; + CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL); STRDUP(newdep->name, dep->name, return NULL); newdep->name_hash = dep->name_hash; @@ -472,7 +472,7 @@ pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep) * targets and a db is safe to remove. We do NOT remove it if it is in the * target list, or if if the package was explictly installed and * include_explicit == 0 */ -static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets, +static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg, alpm_list_t *targets, int include_explicit) { alpm_list_t *i; @@ -498,7 +498,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets, /* see if other packages need it */ for(i = _alpm_db_get_pkgcache(db); i; i = i->next) { - pmpkg_t *lpkg = i->data; + alpm_pkg_t *lpkg = i->data; if(_alpm_dep_edge(lpkg, pkg) && !_alpm_pkg_find(targets, lpkg->name)) { return 0; } @@ -518,7 +518,7 @@ static int can_remove_package(pmdb_t *db, pmpkg_t *pkg, alpm_list_t *targets, * @param *targs pointer to a list of packages * @param include_explicit if 0, explicitly installed packages are not included */ -void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit) +void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit) { alpm_list_t *i, *j; @@ -527,9 +527,9 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit) } for(i = targs; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; for(j = _alpm_db_get_pkgcache(db); j; j = j->next) { - pmpkg_t *deppkg = j->data; + alpm_pkg_t *deppkg = j->data; if(_alpm_dep_edge(pkg, deppkg) && can_remove_package(db, deppkg, targs, include_explicit)) { _alpm_log(db->handle, PM_LOG_DEBUG, "adding '%s' to the targets\n", @@ -554,7 +554,7 @@ void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit) * an error code without prompting * @return the resolved package **/ -static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep, +static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep, alpm_list_t *dbs, alpm_list_t *excluding, int prompt) { alpm_list_t *i, *j; @@ -565,7 +565,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep, /* 1. literals */ for(i = dbs; i; i = i->next) { - pmpkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name); + alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name); if(pkg && _alpm_depcmp(pkg, dep) && !_alpm_pkg_find(excluding, pkg->name)) { if(_alpm_pkg_should_ignore(handle, pkg)) { int install = 0; @@ -586,7 +586,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep, /* 2. satisfiers (skip literals here) */ for(i = dbs; i; i = i->next) { for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) { - pmpkg_t *pkg = j->data; + alpm_pkg_t *pkg = j->data; if(_alpm_depcmp(pkg, dep) && strcmp(pkg->name, dep->name) != 0 && !_alpm_pkg_find(excluding, pkg->name)) { if(_alpm_pkg_should_ignore(handle, pkg)) { @@ -612,7 +612,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep, /* first check if one provider is already installed locally */ for(i = providers; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(_alpm_pkghash_find(_alpm_db_get_pkgcache_hash(handle->db_local), pkg->name)) { alpm_list_free(providers); return pkg; @@ -628,7 +628,7 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep, providers, dep, NULL, &index); } if(index >= 0 && index < count) { - pmpkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index)); + alpm_pkg_t *pkg = alpm_list_getdata(alpm_list_nth(providers, index)); alpm_list_free(providers); return pkg; } @@ -649,15 +649,15 @@ static pmpkg_t *resolvedep(pmhandle_t *handle, pmdepend_t *dep, * providers. The first satisfier found is returned. * The dependency can include versions with depmod operators. * @param handle the context handle - * @param dbs an alpm_list_t* of pmdb_t where the satisfier will be searched + * @param dbs an alpm_list_t* of alpm_db_t where the satisfier will be searched * @param depstring package or provision name, versioned or not - * @return a pmpkg_t* satisfying depstring + * @return a alpm_pkg_t* satisfying depstring */ -pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(pmhandle_t *handle, +alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle, alpm_list_t *dbs, const char *depstring) { - pmdepend_t *dep; - pmpkg_t *pkg; + alpm_depend_t *dep; + alpm_pkg_t *pkg; CHECK_HANDLE(handle, return NULL); ASSERT(dbs, RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL)); @@ -689,7 +689,7 @@ pmpkg_t SYMEXPORT *alpm_find_dbs_satisfier(pmhandle_t *handle, * unresolvable dependency, in which case the [*packages] list will be * unmodified by this function */ -int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg, +int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove, alpm_list_t **data) { @@ -712,14 +712,14 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg, _alpm_log(handle, PM_LOG_DEBUG, "started resolving dependencies\n"); for(i = alpm_list_last(*packages); i; i = i->next) { - pmpkg_t *tpkg = i->data; + alpm_pkg_t *tpkg = i->data; targ = alpm_list_add(NULL, tpkg); deps = alpm_checkdeps(handle, localpkgs, remove, targ, 0); alpm_list_free(targ); for(j = deps; j; j = j->next) { - pmdepmissing_t *miss = j->data; - pmdepend_t *missdep = miss->depend; + alpm_depmissing_t *miss = j->data; + alpm_depend_t *missdep = miss->depend; /* check if one of the packages in the [*packages] list already satisfies * this dependency */ if(find_dep_satisfier(*packages, missdep)) { @@ -728,7 +728,7 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg, } /* check if one of the packages in the [preferred] list already satisfies * this dependency */ - pmpkg_t *spkg = find_dep_satisfier(preferred, missdep); + alpm_pkg_t *spkg = find_dep_satisfier(preferred, missdep); if(!spkg) { /* find a satisfier package in the given repositories */ spkg = resolvedep(handle, missdep, handle->dbs_sync, *packages, 0); @@ -764,12 +764,12 @@ int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg, return ret; } -/** Reverse of splitdep; make a dep string from a pmdepend_t struct. +/** Reverse of splitdep; make a dep string from a alpm_depend_t struct. * The string must be freed! * @param dep the depend to turn into a string * @return a string-formatted dependency with operator if necessary */ -char SYMEXPORT *alpm_dep_compute_string(const pmdepend_t *dep) +char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep) { const char *name, *opr, *ver; char *str; diff --git a/lib/libalpm/deps.h b/lib/libalpm/deps.h index ecc3b92c..6ef4cbbe 100644 --- a/lib/libalpm/deps.h +++ b/lib/libalpm/deps.h @@ -27,16 +27,16 @@ #include "package.h" #include "alpm.h" -void _alpm_dep_free(pmdepend_t *dep); -pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep); -void _alpm_depmiss_free(pmdepmissing_t *miss); -alpm_list_t *_alpm_sortbydeps(pmhandle_t *handle, alpm_list_t *targets, int reverse); -void _alpm_recursedeps(pmdb_t *db, alpm_list_t *targs, int include_explicit); -int _alpm_resolvedeps(pmhandle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg, +void _alpm_dep_free(alpm_depend_t *dep); +alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep); +void _alpm_depmiss_free(alpm_depmissing_t *miss); +alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse); +void _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit); +int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg, alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove, alpm_list_t **data); -pmdepend_t *_alpm_splitdep(const char *depstring); -int _alpm_depcmp(pmpkg_t *pkg, pmdepend_t *dep); +alpm_depend_t *_alpm_splitdep(const char *depstring); +int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep); #endif /* _ALPM_DEPS_H */ diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index 51aa47f2..7ca72c3c 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -59,7 +59,7 @@ static int mount_point_cmp(const void *p1, const void *p2) return -strcmp(mp1->mount_dir, mp2->mount_dir); } -static alpm_list_t *mount_point_list(pmhandle_t *handle) +static alpm_list_t *mount_point_list(alpm_handle_t *handle) { alpm_list_t *mount_points = NULL, *ptr; alpm_mountpoint_t *mp; @@ -148,8 +148,8 @@ static alpm_mountpoint_t *match_mount_point(const alpm_list_t *mount_points, return NULL; } -static int calculate_removed_size(pmhandle_t *handle, - const alpm_list_t *mount_points, pmpkg_t *pkg) +static int calculate_removed_size(alpm_handle_t *handle, + const alpm_list_t *mount_points, alpm_pkg_t *pkg) { alpm_list_t *file; @@ -185,8 +185,8 @@ static int calculate_removed_size(pmhandle_t *handle, return 0; } -static int calculate_installed_size(pmhandle_t *handle, - const alpm_list_t *mount_points, pmpkg_t *pkg) +static int calculate_installed_size(alpm_handle_t *handle, + const alpm_list_t *mount_points, alpm_pkg_t *pkg) { int ret=0; struct archive *archive; @@ -257,14 +257,14 @@ cleanup: return ret; } -int _alpm_check_diskspace(pmhandle_t *handle) +int _alpm_check_diskspace(alpm_handle_t *handle) { alpm_list_t *mount_points, *i; alpm_mountpoint_t *root_mp; size_t replaces = 0, current = 0, numtargs; int error = 0; alpm_list_t *targ; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; numtargs = alpm_list_count(trans->add); mount_points = mount_point_list(handle); @@ -283,7 +283,7 @@ int _alpm_check_diskspace(pmhandle_t *handle) if(replaces) { numtargs += replaces; for(targ = trans->remove; targ; targ = targ->next, current++) { - pmpkg_t *local_pkg; + alpm_pkg_t *local_pkg; int percent = (current * 100) / numtargs; PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent, numtargs, current); @@ -294,7 +294,7 @@ int _alpm_check_diskspace(pmhandle_t *handle) } for(targ = trans->add; targ; targ = targ->next, current++) { - pmpkg_t *pkg, *local_pkg; + alpm_pkg_t *pkg, *local_pkg; int percent = (current * 100) / numtargs; PROGRESS(trans, PM_TRANS_PROGRESS_DISKSPACE_START, "", percent, numtargs, current); diff --git a/lib/libalpm/diskspace.h b/lib/libalpm/diskspace.h index 28aca7e9..79e16772 100644 --- a/lib/libalpm/diskspace.h +++ b/lib/libalpm/diskspace.h @@ -46,7 +46,7 @@ typedef struct __alpm_mountpoint_t { FSSTATSTYPE fsp; } alpm_mountpoint_t; -int _alpm_check_diskspace(pmhandle_t *handle); +int _alpm_check_diskspace(alpm_handle_t *handle); #endif /* _ALPM_DISKSPACE_H */ diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index c7903ff0..73f75144 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -149,7 +149,7 @@ static int utimes_long(const char *path, long seconds) } -static int curl_download_internal(pmhandle_t *handle, +static int curl_download_internal(alpm_handle_t *handle, const char *url, const char *localpath, int force, int allow_resume, int errors_ok) { @@ -321,7 +321,7 @@ cleanup: * @param errors_ok do not log errors (but still return them) * @return 0 on success, -1 on error (pm_errno is set accordingly if errors_ok == 0) */ -int _alpm_download(pmhandle_t *handle, const char *url, const char *localpath, +int _alpm_download(alpm_handle_t *handle, const char *url, const char *localpath, int force, int allow_resume, int errors_ok) { if(handle->fetchcb == NULL) { @@ -341,7 +341,7 @@ int _alpm_download(pmhandle_t *handle, const char *url, const char *localpath, } /** Fetch a remote pkg. */ -char SYMEXPORT *alpm_fetch_pkgurl(pmhandle_t *handle, const char *url) +char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url) { char *filepath; const char *filename, *cachedir; diff --git a/lib/libalpm/dload.h b/lib/libalpm/dload.h index e409c32b..0cdd9001 100644 --- a/lib/libalpm/dload.h +++ b/lib/libalpm/dload.h @@ -27,12 +27,12 @@ /* internal structure for communicating with curl progress callback */ struct fileinfo { - pmhandle_t *handle; + alpm_handle_t *handle; const char *filename; double initial_size; }; -int _alpm_download(pmhandle_t *handle, const char *url, const char *localpath, +int _alpm_download(alpm_handle_t *handle, const char *url, const char *localpath, int force, int allow_resume, int errors_ok); #endif /* _ALPM_DLOAD_H */ diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c index 1e4e705b..225d8859 100644 --- a/lib/libalpm/error.c +++ b/lib/libalpm/error.c @@ -29,12 +29,12 @@ #include "alpm.h" #include "handle.h" -enum _pmerrno_t SYMEXPORT alpm_errno(pmhandle_t *handle) +enum _alpm_errno_t SYMEXPORT alpm_errno(alpm_handle_t *handle) { return handle->pm_errno; } -const char SYMEXPORT *alpm_strerror(enum _pmerrno_t err) +const char SYMEXPORT *alpm_strerror(enum _alpm_errno_t err) { switch(err) { /* System */ diff --git a/lib/libalpm/graph.c b/lib/libalpm/graph.c index fc2c9e16..3a7f24b8 100644 --- a/lib/libalpm/graph.c +++ b/lib/libalpm/graph.c @@ -23,17 +23,17 @@ #include "util.h" #include "log.h" -pmgraph_t *_alpm_graph_new(void) +alpm_graph_t *_alpm_graph_new(void) { - pmgraph_t *graph = NULL; + alpm_graph_t *graph = NULL; - CALLOC(graph, 1, sizeof(pmgraph_t), return NULL); + CALLOC(graph, 1, sizeof(alpm_graph_t), return NULL); return graph; } void _alpm_graph_free(void *data) { - pmgraph_t *graph = data; + alpm_graph_t *graph = data; alpm_list_free(graph->children); free(graph); } diff --git a/lib/libalpm/graph.h b/lib/libalpm/graph.h index f76c6004..d4d134b5 100644 --- a/lib/libalpm/graph.h +++ b/lib/libalpm/graph.h @@ -25,16 +25,16 @@ #include "alpm_list.h" -typedef struct __pmgraph_t { +typedef struct __alpm_graph_t { char state; /* 0: untouched, -1: entered, other: leaving time */ off_t weight; /* weight of the node */ void *data; - struct __pmgraph_t *parent; /* where did we come from? */ + struct __alpm_graph_t *parent; /* where did we come from? */ alpm_list_t *children; alpm_list_t *childptr; /* points to a child in children list */ -} pmgraph_t; +} alpm_graph_t; -pmgraph_t *_alpm_graph_new(void); +alpm_graph_t *_alpm_graph_new(void); void _alpm_graph_free(void *data); #endif /* _ALPM_GRAPH_H */ diff --git a/lib/libalpm/group.c b/lib/libalpm/group.c index 07acfa89..47458df2 100644 --- a/lib/libalpm/group.c +++ b/lib/libalpm/group.c @@ -30,17 +30,17 @@ #include "log.h" #include "alpm.h" -pmgrp_t *_alpm_grp_new(const char *name) +alpm_group_t *_alpm_group_new(const char *name) { - pmgrp_t* grp; + alpm_group_t* grp; - CALLOC(grp, 1, sizeof(pmgrp_t), return NULL); + CALLOC(grp, 1, sizeof(alpm_group_t), return NULL); STRDUP(grp->name, name, free(grp); return NULL); return grp; } -void _alpm_grp_free(pmgrp_t *grp) +void _alpm_group_free(alpm_group_t *grp) { if(grp == NULL) { return; diff --git a/lib/libalpm/group.h b/lib/libalpm/group.h index f2a67ca9..078c9af7 100644 --- a/lib/libalpm/group.h +++ b/lib/libalpm/group.h @@ -22,8 +22,8 @@ #include "alpm.h" -pmgrp_t *_alpm_grp_new(const char *name); -void _alpm_grp_free(pmgrp_t *grp); +alpm_group_t *_alpm_group_new(const char *name); +void _alpm_group_free(alpm_group_t *grp); #endif /* _ALPM_GROUP_H */ diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index acd35409..8486851f 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -39,18 +39,18 @@ #include "trans.h" #include "alpm.h" -pmhandle_t *_alpm_handle_new() +alpm_handle_t *_alpm_handle_new() { - pmhandle_t *handle; + alpm_handle_t *handle; - CALLOC(handle, 1, sizeof(pmhandle_t), return NULL); + CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL); handle->sigverify = PM_PGP_VERIFY_OPTIONAL; return handle; } -void _alpm_handle_free(pmhandle_t *handle) +void _alpm_handle_free(alpm_handle_t *handle) { if(handle == NULL) { return; @@ -84,12 +84,12 @@ void _alpm_handle_free(pmhandle_t *handle) FREELIST(handle->noupgrade); FREELIST(handle->noextract); FREELIST(handle->ignorepkg); - FREELIST(handle->ignoregrp); + FREELIST(handle->ignoregroup); FREE(handle); } /** Lock the database */ -int _alpm_handle_lock(pmhandle_t *handle) +int _alpm_handle_lock(alpm_handle_t *handle) { int fd; char *dir, *ptr; @@ -124,7 +124,7 @@ int _alpm_handle_lock(pmhandle_t *handle) } /** Remove a lock file */ -int _alpm_handle_unlock(pmhandle_t *handle) +int _alpm_handle_unlock(alpm_handle_t *handle) { ASSERT(handle->lockfile != NULL, return -1); ASSERT(handle->lckstream != NULL, return 0); @@ -140,148 +140,148 @@ int _alpm_handle_unlock(pmhandle_t *handle) } -alpm_cb_log SYMEXPORT alpm_option_get_logcb(pmhandle_t *handle) +alpm_cb_log SYMEXPORT alpm_option_get_logcb(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->logcb; } -alpm_cb_download SYMEXPORT alpm_option_get_dlcb(pmhandle_t *handle) +alpm_cb_download SYMEXPORT alpm_option_get_dlcb(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->dlcb; } -alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb(pmhandle_t *handle) +alpm_cb_fetch SYMEXPORT alpm_option_get_fetchcb(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->fetchcb; } -alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb(pmhandle_t *handle) +alpm_cb_totaldl SYMEXPORT alpm_option_get_totaldlcb(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->totaldlcb; } -const char SYMEXPORT *alpm_option_get_root(pmhandle_t *handle) +const char SYMEXPORT *alpm_option_get_root(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->root; } -const char SYMEXPORT *alpm_option_get_dbpath(pmhandle_t *handle) +const char SYMEXPORT *alpm_option_get_dbpath(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->dbpath; } -alpm_list_t SYMEXPORT *alpm_option_get_cachedirs(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_option_get_cachedirs(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->cachedirs; } -const char SYMEXPORT *alpm_option_get_logfile(pmhandle_t *handle) +const char SYMEXPORT *alpm_option_get_logfile(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->logfile; } -const char SYMEXPORT *alpm_option_get_lockfile(pmhandle_t *handle) +const char SYMEXPORT *alpm_option_get_lockfile(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->lockfile; } -const char SYMEXPORT *alpm_option_get_gpgdir(pmhandle_t *handle) +const char SYMEXPORT *alpm_option_get_gpgdir(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->gpgdir; } -int SYMEXPORT alpm_option_get_usesyslog(pmhandle_t *handle) +int SYMEXPORT alpm_option_get_usesyslog(alpm_handle_t *handle) { CHECK_HANDLE(handle, return -1); return handle->usesyslog; } -alpm_list_t SYMEXPORT *alpm_option_get_noupgrades(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_option_get_noupgrades(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->noupgrade; } -alpm_list_t SYMEXPORT *alpm_option_get_noextracts(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_option_get_noextracts(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->noextract; } -alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_option_get_ignorepkgs(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->ignorepkg; } -alpm_list_t SYMEXPORT *alpm_option_get_ignoregrps(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_option_get_ignoregroups(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); - return handle->ignoregrp; + return handle->ignoregroup; } -const char SYMEXPORT *alpm_option_get_arch(pmhandle_t *handle) +const char SYMEXPORT *alpm_option_get_arch(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->arch; } -int SYMEXPORT alpm_option_get_usedelta(pmhandle_t *handle) +int SYMEXPORT alpm_option_get_usedelta(alpm_handle_t *handle) { CHECK_HANDLE(handle, return -1); return handle->usedelta; } -int SYMEXPORT alpm_option_get_checkspace(pmhandle_t *handle) +int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle) { CHECK_HANDLE(handle, return -1); return handle->checkspace; } -pmdb_t SYMEXPORT *alpm_option_get_localdb(pmhandle_t *handle) +alpm_db_t SYMEXPORT *alpm_option_get_localdb(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->db_local; } -alpm_list_t SYMEXPORT *alpm_option_get_syncdbs(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_option_get_syncdbs(alpm_handle_t *handle) { CHECK_HANDLE(handle, return NULL); return handle->dbs_sync; } -int SYMEXPORT alpm_option_set_logcb(pmhandle_t *handle, alpm_cb_log cb) +int SYMEXPORT alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb) { CHECK_HANDLE(handle, return -1); handle->logcb = cb; return 0; } -int SYMEXPORT alpm_option_set_dlcb(pmhandle_t *handle, alpm_cb_download cb) +int SYMEXPORT alpm_option_set_dlcb(alpm_handle_t *handle, alpm_cb_download cb) { CHECK_HANDLE(handle, return -1); handle->dlcb = cb; return 0; } -int SYMEXPORT alpm_option_set_fetchcb(pmhandle_t *handle, alpm_cb_fetch cb) +int SYMEXPORT alpm_option_set_fetchcb(alpm_handle_t *handle, alpm_cb_fetch cb) { CHECK_HANDLE(handle, return -1); handle->fetchcb = cb; return 0; } -int SYMEXPORT alpm_option_set_totaldlcb(pmhandle_t *handle, alpm_cb_totaldl cb) +int SYMEXPORT alpm_option_set_totaldlcb(alpm_handle_t *handle, alpm_cb_totaldl cb) { CHECK_HANDLE(handle, return -1); handle->totaldlcb = cb; @@ -303,7 +303,7 @@ static char *canonicalize_path(const char *path) { return new_path; } -enum _pmerrno_t _alpm_set_directory_option(const char *value, +enum _alpm_errno_t _alpm_set_directory_option(const char *value, char **storage, int must_exist) { struct stat st; @@ -337,7 +337,7 @@ enum _pmerrno_t _alpm_set_directory_option(const char *value, return 0; } -int SYMEXPORT alpm_option_add_cachedir(pmhandle_t *handle, const char *cachedir) +int SYMEXPORT alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir) { char *newcachedir; @@ -355,7 +355,7 @@ int SYMEXPORT alpm_option_add_cachedir(pmhandle_t *handle, const char *cachedir) return 0; } -int SYMEXPORT alpm_option_set_cachedirs(pmhandle_t *handle, alpm_list_t *cachedirs) +int SYMEXPORT alpm_option_set_cachedirs(alpm_handle_t *handle, alpm_list_t *cachedirs) { alpm_list_t *i; CHECK_HANDLE(handle, return -1); @@ -371,7 +371,7 @@ int SYMEXPORT alpm_option_set_cachedirs(pmhandle_t *handle, alpm_list_t *cachedi return 0; } -int SYMEXPORT alpm_option_remove_cachedir(pmhandle_t *handle, const char *cachedir) +int SYMEXPORT alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cachedir) { char *vdata = NULL; char *newcachedir; @@ -391,7 +391,7 @@ int SYMEXPORT alpm_option_remove_cachedir(pmhandle_t *handle, const char *cached return 0; } -int SYMEXPORT alpm_option_set_logfile(pmhandle_t *handle, const char *logfile) +int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile) { char *oldlogfile = handle->logfile; @@ -416,7 +416,7 @@ int SYMEXPORT alpm_option_set_logfile(pmhandle_t *handle, const char *logfile) return 0; } -int SYMEXPORT alpm_option_set_gpgdir(pmhandle_t *handle, const char *gpgdir) +int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir) { CHECK_HANDLE(handle, return -1); if(!gpgdir) { @@ -433,21 +433,21 @@ int SYMEXPORT alpm_option_set_gpgdir(pmhandle_t *handle, const char *gpgdir) return 0; } -int SYMEXPORT alpm_option_set_usesyslog(pmhandle_t *handle, int usesyslog) +int SYMEXPORT alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog) { CHECK_HANDLE(handle, return -1); handle->usesyslog = usesyslog; return 0; } -int SYMEXPORT alpm_option_add_noupgrade(pmhandle_t *handle, const char *pkg) +int SYMEXPORT alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg) { CHECK_HANDLE(handle, return -1); handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg)); return 0; } -int SYMEXPORT alpm_option_set_noupgrades(pmhandle_t *handle, alpm_list_t *noupgrade) +int SYMEXPORT alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade) { CHECK_HANDLE(handle, return -1); if(handle->noupgrade) FREELIST(handle->noupgrade); @@ -455,7 +455,7 @@ int SYMEXPORT alpm_option_set_noupgrades(pmhandle_t *handle, alpm_list_t *noupgr return 0; } -int SYMEXPORT alpm_option_remove_noupgrade(pmhandle_t *handle, const char *pkg) +int SYMEXPORT alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *pkg) { char *vdata = NULL; CHECK_HANDLE(handle, return -1); @@ -467,14 +467,14 @@ int SYMEXPORT alpm_option_remove_noupgrade(pmhandle_t *handle, const char *pkg) return 0; } -int SYMEXPORT alpm_option_add_noextract(pmhandle_t *handle, const char *pkg) +int SYMEXPORT alpm_option_add_noextract(alpm_handle_t *handle, const char *pkg) { CHECK_HANDLE(handle, return -1); handle->noextract = alpm_list_add(handle->noextract, strdup(pkg)); return 0; } -int SYMEXPORT alpm_option_set_noextracts(pmhandle_t *handle, alpm_list_t *noextract) +int SYMEXPORT alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract) { CHECK_HANDLE(handle, return -1); if(handle->noextract) FREELIST(handle->noextract); @@ -482,7 +482,7 @@ int SYMEXPORT alpm_option_set_noextracts(pmhandle_t *handle, alpm_list_t *noextr return 0; } -int SYMEXPORT alpm_option_remove_noextract(pmhandle_t *handle, const char *pkg) +int SYMEXPORT alpm_option_remove_noextract(alpm_handle_t *handle, const char *pkg) { char *vdata = NULL; CHECK_HANDLE(handle, return -1); @@ -494,14 +494,14 @@ int SYMEXPORT alpm_option_remove_noextract(pmhandle_t *handle, const char *pkg) return 0; } -int SYMEXPORT alpm_option_add_ignorepkg(pmhandle_t *handle, const char *pkg) +int SYMEXPORT alpm_option_add_ignorepkg(alpm_handle_t *handle, const char *pkg) { CHECK_HANDLE(handle, return -1); handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg)); return 0; } -int SYMEXPORT alpm_option_set_ignorepkgs(pmhandle_t *handle, alpm_list_t *ignorepkgs) +int SYMEXPORT alpm_option_set_ignorepkgs(alpm_handle_t *handle, alpm_list_t *ignorepkgs) { CHECK_HANDLE(handle, return -1); if(handle->ignorepkg) FREELIST(handle->ignorepkg); @@ -509,7 +509,7 @@ int SYMEXPORT alpm_option_set_ignorepkgs(pmhandle_t *handle, alpm_list_t *ignore return 0; } -int SYMEXPORT alpm_option_remove_ignorepkg(pmhandle_t *handle, const char *pkg) +int SYMEXPORT alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg) { char *vdata = NULL; CHECK_HANDLE(handle, return -1); @@ -521,26 +521,26 @@ int SYMEXPORT alpm_option_remove_ignorepkg(pmhandle_t *handle, const char *pkg) return 0; } -int SYMEXPORT alpm_option_add_ignoregrp(pmhandle_t *handle, const char *grp) +int SYMEXPORT alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp) { CHECK_HANDLE(handle, return -1); - handle->ignoregrp = alpm_list_add(handle->ignoregrp, strdup(grp)); + handle->ignoregroup = alpm_list_add(handle->ignoregroup, strdup(grp)); return 0; } -int SYMEXPORT alpm_option_set_ignoregrps(pmhandle_t *handle, alpm_list_t *ignoregrps) +int SYMEXPORT alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps) { CHECK_HANDLE(handle, return -1); - if(handle->ignoregrp) FREELIST(handle->ignoregrp); - handle->ignoregrp = alpm_list_strdup(ignoregrps); + if(handle->ignoregroup) FREELIST(handle->ignoregroup); + handle->ignoregroup = alpm_list_strdup(ignoregrps); return 0; } -int SYMEXPORT alpm_option_remove_ignoregrp(pmhandle_t *handle, const char *grp) +int SYMEXPORT alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp) { char *vdata = NULL; CHECK_HANDLE(handle, return -1); - handle->ignoregrp = alpm_list_remove_str(handle->ignoregrp, grp, &vdata); + handle->ignoregroup = alpm_list_remove_str(handle->ignoregroup, grp, &vdata); if(vdata != NULL) { FREE(vdata); return 1; @@ -548,7 +548,7 @@ int SYMEXPORT alpm_option_remove_ignoregrp(pmhandle_t *handle, const char *grp) return 0; } -int SYMEXPORT alpm_option_set_arch(pmhandle_t *handle, const char *arch) +int SYMEXPORT alpm_option_set_arch(alpm_handle_t *handle, const char *arch) { CHECK_HANDLE(handle, return -1); if(handle->arch) FREE(handle->arch); @@ -560,21 +560,21 @@ int SYMEXPORT alpm_option_set_arch(pmhandle_t *handle, const char *arch) return 0; } -int SYMEXPORT alpm_option_set_usedelta(pmhandle_t *handle, int usedelta) +int SYMEXPORT alpm_option_set_usedelta(alpm_handle_t *handle, int usedelta) { CHECK_HANDLE(handle, return -1); handle->usedelta = usedelta; return 0; } -int SYMEXPORT alpm_option_set_checkspace(pmhandle_t *handle, int checkspace) +int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace) { CHECK_HANDLE(handle, return -1); handle->checkspace = checkspace; return 0; } -int SYMEXPORT alpm_option_set_default_sigverify(pmhandle_t *handle, pgp_verify_t level) +int SYMEXPORT alpm_option_set_default_sigverify(alpm_handle_t *handle, pgp_verify_t level) { CHECK_HANDLE(handle, return -1); ASSERT(level != PM_PGP_VERIFY_UNKNOWN, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); @@ -582,7 +582,7 @@ int SYMEXPORT alpm_option_set_default_sigverify(pmhandle_t *handle, pgp_verify_t return 0; } -pgp_verify_t SYMEXPORT alpm_option_get_default_sigverify(pmhandle_t *handle) +pgp_verify_t SYMEXPORT alpm_option_get_default_sigverify(alpm_handle_t *handle) { CHECK_HANDLE(handle, return PM_PGP_VERIFY_UNKNOWN); return handle->sigverify; diff --git a/lib/libalpm/handle.h b/lib/libalpm/handle.h index 4ffd00c4..ae8c7c8d 100644 --- a/lib/libalpm/handle.h +++ b/lib/libalpm/handle.h @@ -30,13 +30,13 @@ #include <curl/curl.h> #endif -struct __pmhandle_t { +struct __alpm_handle_t { /* internal usage */ - pmdb_t *db_local; /* local db pointer */ - alpm_list_t *dbs_sync; /* List of (pmdb_t *) */ + alpm_db_t *db_local; /* local db pointer */ + alpm_list_t *dbs_sync; /* List of (alpm_db_t *) */ FILE *logstream; /* log file stream pointer */ FILE *lckstream; /* lock file stream pointer if one exists */ - pmtrans_t *trans; + alpm_trans_t *trans; #ifdef HAVE_LIBCURL /* libcurl handle */ @@ -62,7 +62,7 @@ struct __pmhandle_t { alpm_list_t *noupgrade; /* List of packages NOT to be upgraded */ alpm_list_t *noextract; /* List of files NOT to extract */ alpm_list_t *ignorepkg; /* List of packages to ignore */ - alpm_list_t *ignoregrp; /* List of groups to ignore */ + alpm_list_t *ignoregroup; /* List of groups to ignore */ /* options */ int usesyslog; /* Use syslog instead of logfile? */ /* TODO move to frontend */ @@ -72,16 +72,16 @@ struct __pmhandle_t { pgp_verify_t sigverify; /* Default signature verification level */ /* error code */ - enum _pmerrno_t pm_errno; + enum _alpm_errno_t pm_errno; }; -pmhandle_t *_alpm_handle_new(void); -void _alpm_handle_free(pmhandle_t *handle); +alpm_handle_t *_alpm_handle_new(void); +void _alpm_handle_free(alpm_handle_t *handle); -int _alpm_handle_lock(pmhandle_t *handle); -int _alpm_handle_unlock(pmhandle_t *handle); +int _alpm_handle_lock(alpm_handle_t *handle); +int _alpm_handle_unlock(alpm_handle_t *handle); -enum _pmerrno_t _alpm_set_directory_option(const char *value, +enum _alpm_errno_t _alpm_set_directory_option(const char *value, char **storage, int must_exist); #endif /* _ALPM_HANDLE_H */ diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index 8bb88117..eeeaef3c 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -40,7 +40,7 @@ * @param fmt output format * @return 0 on success, -1 on error (pm_errno is set accordingly) */ -int SYMEXPORT alpm_logaction(pmhandle_t *handle, const char *fmt, ...) +int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *fmt, ...) { int ret; va_list args; @@ -83,7 +83,7 @@ int SYMEXPORT alpm_logaction(pmhandle_t *handle, const char *fmt, ...) /** @} */ -void _alpm_log(pmhandle_t *handle, pmloglevel_t flag, const char *fmt, ...) +void _alpm_log(alpm_handle_t *handle, alpm_loglevel_t flag, const char *fmt, ...) { va_list args; diff --git a/lib/libalpm/log.h b/lib/libalpm/log.h index 105430c4..a43290d8 100644 --- a/lib/libalpm/log.h +++ b/lib/libalpm/log.h @@ -22,7 +22,7 @@ #include "alpm.h" -void _alpm_log(pmhandle_t *handle, pmloglevel_t flag, +void _alpm_log(alpm_handle_t *handle, alpm_loglevel_t flag, const char *fmt, ...) __attribute__((format(printf,3,4))); #endif /* _ALPM_LOG_H */ diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 75ac94c7..31f07325 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -43,7 +43,7 @@ */ /** Free a package. */ -int SYMEXPORT alpm_pkg_free(pmpkg_t *pkg) +int SYMEXPORT alpm_pkg_free(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); @@ -56,7 +56,7 @@ int SYMEXPORT alpm_pkg_free(pmpkg_t *pkg) } /** Check the integrity (with md5) of a package from the sync cache. */ -int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg) +int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg) { char *fpath; int retval; @@ -85,42 +85,42 @@ int SYMEXPORT alpm_pkg_checkmd5sum(pmpkg_t *pkg) * backend logic that needs lazy access, such as the local database through * a lazy-load cache. However, the defaults will work just fine for fully- * populated package structures. */ -static const char *_pkg_get_filename(pmpkg_t *pkg) { return pkg->filename; } -static const char *_pkg_get_desc(pmpkg_t *pkg) { return pkg->desc; } -static const char *_pkg_get_url(pmpkg_t *pkg) { return pkg->url; } -static time_t _pkg_get_builddate(pmpkg_t *pkg) { return pkg->builddate; } -static time_t _pkg_get_installdate(pmpkg_t *pkg) { return pkg->installdate; } -static const char *_pkg_get_packager(pmpkg_t *pkg) { return pkg->packager; } -static const char *_pkg_get_md5sum(pmpkg_t *pkg) { return pkg->md5sum; } -static const char *_pkg_get_arch(pmpkg_t *pkg) { return pkg->arch; } -static off_t _pkg_get_size(pmpkg_t *pkg) { return pkg->size; } -static off_t _pkg_get_isize(pmpkg_t *pkg) { return pkg->isize; } -static pmpkgreason_t _pkg_get_reason(pmpkg_t *pkg) { return pkg->reason; } -static int _pkg_has_scriptlet(pmpkg_t *pkg) { return pkg->scriptlet; } - -static alpm_list_t *_pkg_get_licenses(pmpkg_t *pkg) { return pkg->licenses; } -static alpm_list_t *_pkg_get_groups(pmpkg_t *pkg) { return pkg->groups; } -static alpm_list_t *_pkg_get_depends(pmpkg_t *pkg) { return pkg->depends; } -static alpm_list_t *_pkg_get_optdepends(pmpkg_t *pkg) { return pkg->optdepends; } -static alpm_list_t *_pkg_get_conflicts(pmpkg_t *pkg) { return pkg->conflicts; } -static alpm_list_t *_pkg_get_provides(pmpkg_t *pkg) { return pkg->provides; } -static alpm_list_t *_pkg_get_replaces(pmpkg_t *pkg) { return pkg->replaces; } -static alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; } -static alpm_list_t *_pkg_get_files(pmpkg_t *pkg) { return pkg->files; } -static alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; } - -static void *_pkg_changelog_open(pmpkg_t UNUSED *pkg) +static const char *_pkg_get_filename(alpm_pkg_t *pkg) { return pkg->filename; } +static const char *_pkg_get_desc(alpm_pkg_t *pkg) { return pkg->desc; } +static const char *_pkg_get_url(alpm_pkg_t *pkg) { return pkg->url; } +static time_t _pkg_get_builddate(alpm_pkg_t *pkg) { return pkg->builddate; } +static time_t _pkg_get_installdate(alpm_pkg_t *pkg) { return pkg->installdate; } +static const char *_pkg_get_packager(alpm_pkg_t *pkg) { return pkg->packager; } +static const char *_pkg_get_md5sum(alpm_pkg_t *pkg) { return pkg->md5sum; } +static const char *_pkg_get_arch(alpm_pkg_t *pkg) { return pkg->arch; } +static off_t _pkg_get_size(alpm_pkg_t *pkg) { return pkg->size; } +static off_t _pkg_get_isize(alpm_pkg_t *pkg) { return pkg->isize; } +static alpm_pkgreason_t _pkg_get_reason(alpm_pkg_t *pkg) { return pkg->reason; } +static int _pkg_has_scriptlet(alpm_pkg_t *pkg) { return pkg->scriptlet; } + +static alpm_list_t *_pkg_get_licenses(alpm_pkg_t *pkg) { return pkg->licenses; } +static alpm_list_t *_pkg_get_groups(alpm_pkg_t *pkg) { return pkg->groups; } +static alpm_list_t *_pkg_get_depends(alpm_pkg_t *pkg) { return pkg->depends; } +static alpm_list_t *_pkg_get_optdepends(alpm_pkg_t *pkg) { return pkg->optdepends; } +static alpm_list_t *_pkg_get_conflicts(alpm_pkg_t *pkg) { return pkg->conflicts; } +static alpm_list_t *_pkg_get_provides(alpm_pkg_t *pkg) { return pkg->provides; } +static alpm_list_t *_pkg_get_replaces(alpm_pkg_t *pkg) { return pkg->replaces; } +static alpm_list_t *_pkg_get_deltas(alpm_pkg_t *pkg) { return pkg->deltas; } +static alpm_list_t *_pkg_get_files(alpm_pkg_t *pkg) { return pkg->files; } +static alpm_list_t *_pkg_get_backup(alpm_pkg_t *pkg) { return pkg->backup; } + +static void *_pkg_changelog_open(alpm_pkg_t UNUSED *pkg) { return NULL; } static size_t _pkg_changelog_read(void UNUSED *ptr, size_t UNUSED size, - const pmpkg_t UNUSED *pkg, const UNUSED void *fp) + const alpm_pkg_t UNUSED *pkg, const UNUSED void *fp) { return 0; } -static int _pkg_changelog_close(const pmpkg_t UNUSED *pkg, +static int _pkg_changelog_close(const alpm_pkg_t UNUSED *pkg, void UNUSED *fp) { return EOF; @@ -162,168 +162,168 @@ struct pkg_operations default_pkg_ops = { /* Public functions for getting package information. These functions * delegate the hard work to the function callbacks attached to each * package, which depend on where the package was loaded from. */ -const char SYMEXPORT *alpm_pkg_get_filename(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_filename(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_filename(pkg); } -const char SYMEXPORT *alpm_pkg_get_name(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_name(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->name; } -const char SYMEXPORT *alpm_pkg_get_version(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_version(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->version; } -const char SYMEXPORT *alpm_pkg_get_desc(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_desc(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_desc(pkg); } -const char SYMEXPORT *alpm_pkg_get_url(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_url(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_url(pkg); } -time_t SYMEXPORT alpm_pkg_get_builddate(pmpkg_t *pkg) +time_t SYMEXPORT alpm_pkg_get_builddate(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = 0; return pkg->ops->get_builddate(pkg); } -time_t SYMEXPORT alpm_pkg_get_installdate(pmpkg_t *pkg) +time_t SYMEXPORT alpm_pkg_get_installdate(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = 0; return pkg->ops->get_installdate(pkg); } -const char SYMEXPORT *alpm_pkg_get_packager(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_packager(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_packager(pkg); } -const char SYMEXPORT *alpm_pkg_get_md5sum(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_md5sum(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_md5sum(pkg); } -const char SYMEXPORT *alpm_pkg_get_arch(pmpkg_t *pkg) +const char SYMEXPORT *alpm_pkg_get_arch(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_arch(pkg); } -off_t SYMEXPORT alpm_pkg_get_size(pmpkg_t *pkg) +off_t SYMEXPORT alpm_pkg_get_size(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = 0; return pkg->ops->get_size(pkg); } -off_t SYMEXPORT alpm_pkg_get_isize(pmpkg_t *pkg) +off_t SYMEXPORT alpm_pkg_get_isize(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = 0; return pkg->ops->get_isize(pkg); } -pmpkgreason_t SYMEXPORT alpm_pkg_get_reason(pmpkg_t *pkg) +alpm_pkgreason_t SYMEXPORT alpm_pkg_get_reason(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = 0; return pkg->ops->get_reason(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_licenses(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_licenses(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_groups(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_groups(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_groups(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_depends(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_depends(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_depends(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_optdepends(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_optdepends(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_conflicts(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_conflicts(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_provides(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_provides(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_provides(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_replaces(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_replaces(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_deltas(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_deltas(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_files(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_files(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_files(pkg); } -alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_get_backup(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; return pkg->ops->get_backup(pkg); } -pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg) +alpm_db_t SYMEXPORT *alpm_pkg_get_db(alpm_pkg_t *pkg) { /* Sanity checks */ ASSERT(pkg != NULL, return NULL); @@ -334,7 +334,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) +void SYMEXPORT *alpm_pkg_changelog_open(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; @@ -343,7 +343,7 @@ void SYMEXPORT *alpm_pkg_changelog_open(pmpkg_t *pkg) /** Read data from an open changelog 'file stream'. */ size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size, - const pmpkg_t *pkg, const void *fp) + const alpm_pkg_t *pkg, const void *fp) { ASSERT(pkg != NULL, return 0); pkg->handle->pm_errno = 0; @@ -351,34 +351,34 @@ size_t SYMEXPORT alpm_pkg_changelog_read(void *ptr, size_t size, } /* -int SYMEXPORT alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp) +int SYMEXPORT alpm_pkg_changelog_feof(const alpm_pkg_t *pkg, void *fp) { return pkg->ops->changelog_feof(pkg, fp); } */ /** Close a package changelog for reading. */ -int SYMEXPORT alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp) +int SYMEXPORT alpm_pkg_changelog_close(const alpm_pkg_t *pkg, void *fp) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = 0; return pkg->ops->changelog_close(pkg, fp); } -int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg) +int SYMEXPORT alpm_pkg_has_scriptlet(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); 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) +static void find_requiredby(alpm_pkg_t *pkg, alpm_db_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_pkg_t *cachepkg = i->data; alpm_list_t *j; for(j = alpm_pkg_get_depends(cachepkg); j; j = j->next) { if(_alpm_depcmp(pkg, j->data)) { @@ -392,11 +392,11 @@ static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs) } /** Compute the packages requiring a given package. */ -alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg) +alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(alpm_pkg_t *pkg) { const alpm_list_t *i; alpm_list_t *reqs = NULL; - pmdb_t *db; + alpm_db_t *db; ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; @@ -423,21 +423,21 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg) /** @} */ -pmpkg_t *_alpm_pkg_new(void) +alpm_pkg_t *_alpm_pkg_new(void) { - pmpkg_t* pkg; + alpm_pkg_t* pkg; - CALLOC(pkg, 1, sizeof(pmpkg_t), return NULL); + CALLOC(pkg, 1, sizeof(alpm_pkg_t), return NULL); return pkg; } -pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg) +alpm_pkg_t *_alpm_pkg_dup(alpm_pkg_t *pkg) { - pmpkg_t *newpkg; + alpm_pkg_t *newpkg; alpm_list_t *i; - CALLOC(newpkg, 1, sizeof(pmpkg_t), goto cleanup); + CALLOC(newpkg, 1, sizeof(alpm_pkg_t), goto cleanup); newpkg->name_hash = pkg->name_hash; STRDUP(newpkg->filename, pkg->filename, goto cleanup); @@ -490,7 +490,7 @@ cleanup: return NULL; } -void _alpm_pkg_free(pmpkg_t *pkg) +void _alpm_pkg_free(alpm_pkg_t *pkg) { if(pkg == NULL) { return; @@ -532,7 +532,7 @@ void _alpm_pkg_free(pmpkg_t *pkg) * Case 2: If pkg is a pkgcache entry (PKG_FROM_CACHE), it won't be freed, * only the transaction specific fields of pkg will be freed. */ -void _alpm_pkg_free_trans(pmpkg_t *pkg) +void _alpm_pkg_free_trans(alpm_pkg_t *pkg) { if(pkg == NULL) { return; @@ -548,7 +548,7 @@ void _alpm_pkg_free_trans(pmpkg_t *pkg) } /* Is spkg an upgrade for localpkg? */ -int _alpm_pkg_compare_versions(pmpkg_t *spkg, pmpkg_t *localpkg) +int _alpm_pkg_compare_versions(alpm_pkg_t *spkg, alpm_pkg_t *localpkg) { return alpm_pkg_vercmp(alpm_pkg_get_version(spkg), alpm_pkg_get_version(localpkg)); @@ -558,15 +558,15 @@ int _alpm_pkg_compare_versions(pmpkg_t *spkg, pmpkg_t *localpkg) */ int _alpm_pkg_cmp(const void *p1, const void *p2) { - pmpkg_t *pkg1 = (pmpkg_t *)p1; - pmpkg_t *pkg2 = (pmpkg_t *)p2; + alpm_pkg_t *pkg1 = (alpm_pkg_t *)p1; + alpm_pkg_t *pkg2 = (alpm_pkg_t *)p2; return strcoll(pkg1->name, pkg2->name); } /* Test for existence of a package in a alpm_list_t* - * of pmpkg_t* + * of alpm_pkg_t* */ -pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle) +alpm_pkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle) { alpm_list_t *lp; unsigned long needle_hash; @@ -578,7 +578,7 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle) needle_hash = _alpm_hash_sdbm(needle); for(lp = haystack; lp; lp = lp->next) { - pmpkg_t *info = lp->data; + alpm_pkg_t *info = lp->data; if(info) { /* a zero hash will cause a fall-through just in case */ @@ -598,14 +598,14 @@ pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle) /** Test if a package should be ignored. * * Checks if the package is ignored via IgnorePkg, or if the package is - * in a group ignored via IgnoreGrp. + * in a group ignored via IgnoreGroup. * * @param handle the context handle * @param pkg the package to test * * @return 1 if the package should be ignored, 0 otherwise */ -int _alpm_pkg_should_ignore(pmhandle_t *handle, pmpkg_t *pkg) +int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg) { alpm_list_t *groups = NULL; @@ -615,7 +615,7 @@ int _alpm_pkg_should_ignore(pmhandle_t *handle, pmpkg_t *pkg) } /* next see if the package is in a group that is ignored */ - for(groups = handle->ignoregrp; groups; groups = alpm_list_next(groups)) { + for(groups = handle->ignoregroup; groups; groups = alpm_list_next(groups)) { char *grp = (char *)alpm_list_getdata(groups); if(alpm_list_find_str(alpm_pkg_get_groups(pkg), grp)) { return 1; diff --git a/lib/libalpm/package.h b/lib/libalpm/package.h index d18020d4..388a53c8 100644 --- a/lib/libalpm/package.h +++ b/lib/libalpm/package.h @@ -34,11 +34,11 @@ #include "db.h" #include "signing.h" -typedef enum _pmpkgfrom_t { +typedef enum _alpm_pkgfrom_t { PKG_FROM_FILE = 1, PKG_FROM_LOCALDB, PKG_FROM_SYNCDB -} pmpkgfrom_t; +} alpm_pkgfrom_t; /** Package operations struct. This struct contains function pointers to * all methods used to access data in a package to allow for things such @@ -48,33 +48,33 @@ typedef enum _pmpkgfrom_t { * defined default_pkg_ops struct to work just fine for their needs. */ struct pkg_operations { - const char *(*get_filename) (pmpkg_t *); - const char *(*get_desc) (pmpkg_t *); - const char *(*get_url) (pmpkg_t *); - time_t (*get_builddate) (pmpkg_t *); - time_t (*get_installdate) (pmpkg_t *); - const char *(*get_packager) (pmpkg_t *); - const char *(*get_md5sum) (pmpkg_t *); - const char *(*get_arch) (pmpkg_t *); - off_t (*get_size) (pmpkg_t *); - off_t (*get_isize) (pmpkg_t *); - pmpkgreason_t (*get_reason) (pmpkg_t *); - int (*has_scriptlet) (pmpkg_t *); - - alpm_list_t *(*get_licenses) (pmpkg_t *); - alpm_list_t *(*get_groups) (pmpkg_t *); - alpm_list_t *(*get_depends) (pmpkg_t *); - alpm_list_t *(*get_optdepends) (pmpkg_t *); - alpm_list_t *(*get_conflicts) (pmpkg_t *); - alpm_list_t *(*get_provides) (pmpkg_t *); - alpm_list_t *(*get_replaces) (pmpkg_t *); - alpm_list_t *(*get_deltas) (pmpkg_t *); - alpm_list_t *(*get_files) (pmpkg_t *); - alpm_list_t *(*get_backup) (pmpkg_t *); - - void *(*changelog_open) (pmpkg_t *); - size_t (*changelog_read) (void *, size_t, const pmpkg_t *, const void *); - int (*changelog_close) (const pmpkg_t *, void *); + const char *(*get_filename) (alpm_pkg_t *); + const char *(*get_desc) (alpm_pkg_t *); + const char *(*get_url) (alpm_pkg_t *); + time_t (*get_builddate) (alpm_pkg_t *); + time_t (*get_installdate) (alpm_pkg_t *); + const char *(*get_packager) (alpm_pkg_t *); + const char *(*get_md5sum) (alpm_pkg_t *); + const char *(*get_arch) (alpm_pkg_t *); + off_t (*get_size) (alpm_pkg_t *); + off_t (*get_isize) (alpm_pkg_t *); + alpm_pkgreason_t (*get_reason) (alpm_pkg_t *); + int (*has_scriptlet) (alpm_pkg_t *); + + alpm_list_t *(*get_licenses) (alpm_pkg_t *); + alpm_list_t *(*get_groups) (alpm_pkg_t *); + alpm_list_t *(*get_depends) (alpm_pkg_t *); + alpm_list_t *(*get_optdepends) (alpm_pkg_t *); + alpm_list_t *(*get_conflicts) (alpm_pkg_t *); + alpm_list_t *(*get_provides) (alpm_pkg_t *); + alpm_list_t *(*get_replaces) (alpm_pkg_t *); + alpm_list_t *(*get_deltas) (alpm_pkg_t *); + alpm_list_t *(*get_files) (alpm_pkg_t *); + alpm_list_t *(*get_backup) (alpm_pkg_t *); + + void *(*changelog_open) (alpm_pkg_t *); + size_t (*changelog_read) (void *, size_t, const alpm_pkg_t *, const void *); + int (*changelog_close) (const alpm_pkg_t *, void *); /* still to add: * checkmd5sum() ? @@ -89,7 +89,7 @@ struct pkg_operations { */ extern struct pkg_operations default_pkg_ops; -struct __pmpkg_t { +struct __alpm_pkg_t { unsigned long name_hash; char *filename; char *name; @@ -110,16 +110,16 @@ struct __pmpkg_t { int scriptlet; - pmpkgreason_t reason; - pmdbinfrq_t infolevel; - pmpkgfrom_t origin; + alpm_pkgreason_t reason; + alpm_dbinfrq_t infolevel; + alpm_pkgfrom_t origin; /* origin == PKG_FROM_FILE, use pkg->origin_data.file * origin == PKG_FROM_*DB, use pkg->origin_data.db */ union { - pmdb_t *db; + alpm_db_t *db; char *file; } origin_data; - pmhandle_t *handle; + alpm_handle_t *handle; alpm_list_t *licenses; alpm_list_t *replaces; @@ -137,20 +137,20 @@ struct __pmpkg_t { struct pkg_operations *ops; }; -pmpkg_t* _alpm_pkg_new(void); -pmpkg_t *_alpm_pkg_dup(pmpkg_t *pkg); -void _alpm_pkg_free(pmpkg_t *pkg); -void _alpm_pkg_free_trans(pmpkg_t *pkg); +alpm_pkg_t* _alpm_pkg_new(void); +alpm_pkg_t *_alpm_pkg_dup(alpm_pkg_t *pkg); +void _alpm_pkg_free(alpm_pkg_t *pkg); +void _alpm_pkg_free_trans(alpm_pkg_t *pkg); -pmpkg_t *_alpm_pkg_load_internal(pmhandle_t *handle, const char *pkgfile, +alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, int full, const char *md5sum, const char *base64_sig, pgp_verify_t check_sig); int _alpm_pkg_cmp(const void *p1, const void *p2); -int _alpm_pkg_compare_versions(pmpkg_t *local_pkg, pmpkg_t *pkg); -pmpkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle); -int _alpm_pkg_should_ignore(pmhandle_t *handle, pmpkg_t *pkg); +int _alpm_pkg_compare_versions(alpm_pkg_t *local_pkg, alpm_pkg_t *pkg); +alpm_pkg_t *_alpm_pkg_find(alpm_list_t *haystack, const char *needle); +int _alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg); #endif /* _ALPM_PACKAGE_H */ diff --git a/lib/libalpm/pkghash.c b/lib/libalpm/pkghash.c index 9e98fcd8..f6207ada 100644 --- a/lib/libalpm/pkghash.c +++ b/lib/libalpm/pkghash.c @@ -51,12 +51,12 @@ static const size_t prime_list[] = }; /* Allocate a hash table with at least "size" buckets */ -pmpkghash_t *_alpm_pkghash_create(size_t size) +alpm_pkghash_t *_alpm_pkghash_create(size_t size) { - pmpkghash_t *hash = NULL; + alpm_pkghash_t *hash = NULL; size_t i, loopsize; - CALLOC(hash, 1, sizeof(pmpkghash_t), return NULL); + CALLOC(hash, 1, sizeof(alpm_pkghash_t), return NULL); loopsize = sizeof(prime_list) / sizeof(*prime_list); for(i = 0; i < loopsize; i++) { @@ -78,7 +78,7 @@ pmpkghash_t *_alpm_pkghash_create(size_t size) return hash; } -static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash) +static size_t get_hash_position(unsigned long name_hash, alpm_pkghash_t *hash) { size_t position; @@ -93,9 +93,9 @@ static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash) } /* Expand the hash table size to the next increment and rebin the entries */ -static pmpkghash_t *rehash(pmpkghash_t *oldhash) +static alpm_pkghash_t *rehash(alpm_pkghash_t *oldhash) { - pmpkghash_t *newhash; + alpm_pkghash_t *newhash; size_t newsize, position, i; /* Hash tables will need resized in two cases: @@ -128,7 +128,7 @@ static pmpkghash_t *rehash(pmpkghash_t *oldhash) for(i = 0; i < oldhash->buckets; i++) { if(oldhash->hash_table[i] != NULL) { - pmpkg_t *package = oldhash->hash_table[i]->data; + alpm_pkg_t *package = oldhash->hash_table[i]->data; position = get_hash_position(package->name_hash, newhash); @@ -144,7 +144,7 @@ static pmpkghash_t *rehash(pmpkghash_t *oldhash) return newhash; } -static pmpkghash_t *pkghash_add_pkg(pmpkghash_t *hash, pmpkg_t *pkg, int sorted) +static alpm_pkghash_t *pkghash_add_pkg(alpm_pkghash_t *hash, alpm_pkg_t *pkg, int sorted) { alpm_list_t *ptr; size_t position; @@ -179,17 +179,17 @@ static pmpkghash_t *pkghash_add_pkg(pmpkghash_t *hash, pmpkg_t *pkg, int sorted) return hash; } -pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, pmpkg_t *pkg) +alpm_pkghash_t *_alpm_pkghash_add(alpm_pkghash_t *hash, alpm_pkg_t *pkg) { return pkghash_add_pkg(hash, pkg, 0); } -pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, pmpkg_t *pkg) +alpm_pkghash_t *_alpm_pkghash_add_sorted(alpm_pkghash_t *hash, alpm_pkg_t *pkg) { return pkghash_add_pkg(hash, pkg, 1); } -static size_t move_one_entry(pmpkghash_t *hash, size_t start, size_t end) +static size_t move_one_entry(alpm_pkghash_t *hash, size_t start, size_t end) { /* Iterate backwards from 'end' to 'start', seeing if any of the items * would hash to 'start'. If we find one, we move it there and break. If @@ -200,7 +200,7 @@ static size_t move_one_entry(pmpkghash_t *hash, size_t start, size_t end) * 'start' we can stop this madness. */ while(end != start) { alpm_list_t *i = hash->hash_table[end]; - pmpkg_t *info = i->data; + alpm_pkg_t *info = i->data; size_t new_position = get_hash_position(info->name_hash, hash); if(new_position == start) { @@ -226,8 +226,8 @@ static size_t move_one_entry(pmpkghash_t *hash, size_t start, size_t end) * * @return the resultant hash */ -pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg, - pmpkg_t **data) +alpm_pkghash_t *_alpm_pkghash_remove(alpm_pkghash_t *hash, alpm_pkg_t *pkg, + alpm_pkg_t **data) { alpm_list_t *i; size_t position; @@ -242,7 +242,7 @@ pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg, position = pkg->name_hash % hash->buckets; while((i = hash->hash_table[position]) != NULL) { - pmpkg_t *info = i->data; + alpm_pkg_t *info = i->data; if(info->name_hash == pkg->name_hash && strcmp(info->name, pkg->name) == 0) { @@ -283,7 +283,7 @@ pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg, return hash; } -void _alpm_pkghash_free(pmpkghash_t *hash) +void _alpm_pkghash_free(alpm_pkghash_t *hash) { size_t i; if(hash != NULL) { @@ -295,7 +295,7 @@ void _alpm_pkghash_free(pmpkghash_t *hash) free(hash); } -pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name) +alpm_pkg_t *_alpm_pkghash_find(alpm_pkghash_t *hash, const char *name) { alpm_list_t *lp; unsigned long name_hash; @@ -310,7 +310,7 @@ pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name) position = name_hash % hash->buckets; while((lp = hash->hash_table[position]) != NULL) { - pmpkg_t *info = lp->data; + alpm_pkg_t *info = lp->data; if(info->name_hash == name_hash && strcmp(info->name, name) == 0) { return info; diff --git a/lib/libalpm/pkghash.h b/lib/libalpm/pkghash.h index 617e60bd..edd500e9 100644 --- a/lib/libalpm/pkghash.h +++ b/lib/libalpm/pkghash.h @@ -27,12 +27,12 @@ /** - * @brief A hash table for holding pmpkg_t objects. + * @brief A hash table for holding alpm_pkg_t objects. * * A combination of a hash table and a list, allowing for fast look-up * by package name but also iteration over the packages. */ -struct __pmpkghash_t { +struct __alpm_pkghash_t { /** data held by the hash table */ alpm_list_t **hash_table; /** number of buckets in hash table */ @@ -43,17 +43,17 @@ struct __pmpkghash_t { alpm_list_t *list; }; -typedef struct __pmpkghash_t pmpkghash_t; +typedef struct __alpm_pkghash_t alpm_pkghash_t; -pmpkghash_t *_alpm_pkghash_create(size_t size); +alpm_pkghash_t *_alpm_pkghash_create(size_t size); -pmpkghash_t *_alpm_pkghash_add(pmpkghash_t *hash, pmpkg_t *pkg); -pmpkghash_t *_alpm_pkghash_add_sorted(pmpkghash_t *hash, pmpkg_t *pkg); -pmpkghash_t *_alpm_pkghash_remove(pmpkghash_t *hash, pmpkg_t *pkg, pmpkg_t **data); +alpm_pkghash_t *_alpm_pkghash_add(alpm_pkghash_t *hash, alpm_pkg_t *pkg); +alpm_pkghash_t *_alpm_pkghash_add_sorted(alpm_pkghash_t *hash, alpm_pkg_t *pkg); +alpm_pkghash_t *_alpm_pkghash_remove(alpm_pkghash_t *hash, alpm_pkg_t *pkg, alpm_pkg_t **data); -void _alpm_pkghash_free(pmpkghash_t *hash); +void _alpm_pkghash_free(alpm_pkghash_t *hash); -pmpkg_t *_alpm_pkghash_find(pmpkghash_t *hash, const char *name); +alpm_pkg_t *_alpm_pkghash_find(alpm_pkghash_t *hash, const char *name); #define MAX_HASH_LOAD 0.7 diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index 134c6662..86571a4f 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -44,10 +44,10 @@ #include "deps.h" #include "handle.h" -int SYMEXPORT alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg) +int SYMEXPORT alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg) { const char *pkgname; - pmtrans_t *trans; + alpm_trans_t *trans; /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -70,15 +70,15 @@ int SYMEXPORT alpm_remove_pkg(pmhandle_t *handle, pmpkg_t *pkg) return 0; } -static void remove_prepare_cascade(pmhandle_t *handle, alpm_list_t *lp) +static void remove_prepare_cascade(alpm_handle_t *handle, alpm_list_t *lp) { - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; while(lp) { alpm_list_t *i; for(i = lp; i; i = i->next) { - pmdepmissing_t *miss = (pmdepmissing_t *)i->data; - pmpkg_t *info = _alpm_db_get_pkgfromcache(handle->db_local, miss->target); + alpm_depmissing_t *miss = (alpm_depmissing_t *)i->data; + alpm_pkg_t *info = _alpm_db_get_pkgfromcache(handle->db_local, miss->target); if(info) { if(!_alpm_pkg_find(trans->remove, alpm_pkg_get_name(info))) { _alpm_log(handle, PM_LOG_DEBUG, "pulling %s in target list\n", @@ -97,17 +97,17 @@ static void remove_prepare_cascade(pmhandle_t *handle, alpm_list_t *lp) } } -static void remove_prepare_keep_needed(pmhandle_t *handle, alpm_list_t *lp) +static void remove_prepare_keep_needed(alpm_handle_t *handle, alpm_list_t *lp) { - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; /* Remove needed packages (which break dependencies) from target list */ while(lp != NULL) { alpm_list_t *i; for(i = lp; i; i = i->next) { - pmdepmissing_t *miss = (pmdepmissing_t *)i->data; + alpm_depmissing_t *miss = (alpm_depmissing_t *)i->data; void *vpkg; - pmpkg_t *pkg = _alpm_pkg_find(trans->remove, miss->causingpkg); + alpm_pkg_t *pkg = _alpm_pkg_find(trans->remove, miss->causingpkg); if(pkg == NULL) { continue; } @@ -129,16 +129,16 @@ static void remove_prepare_keep_needed(pmhandle_t *handle, alpm_list_t *lp) /** Transaction preparation for remove actions. * This functions takes a pointer to a alpm_list_t which will be - * filled with a list of pmdepmissing_t* objects representing + * filled with a list of alpm_depmissing_t* objects representing * the packages blocking the transaction. * @param handle the context handle * @param data a pointer to an alpm_list_t* to fill */ -int _alpm_remove_prepare(pmhandle_t *handle, alpm_list_t **data) +int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data) { alpm_list_t *lp; - pmtrans_t *trans = handle->trans; - pmdb_t *db = handle->db_local; + alpm_trans_t *trans = handle->trans; + alpm_db_t *db = handle->db_local; if((trans->flags & PM_TRANS_FLAG_RECURSE) && !(trans->flags & PM_TRANS_FLAG_CASCADE)) { _alpm_log(handle, PM_LOG_DEBUG, "finding removable dependencies\n"); @@ -191,7 +191,7 @@ int _alpm_remove_prepare(pmhandle_t *handle, alpm_list_t **data) return 0; } -static int can_remove_file(pmhandle_t *handle, const char *path, +static int can_remove_file(alpm_handle_t *handle, const char *path, alpm_list_t *skip_remove) { char file[PATH_MAX]; @@ -219,7 +219,7 @@ static int can_remove_file(pmhandle_t *handle, const char *path, /* Helper function for iterating through a package's file and deleting them * Used by _alpm_remove_commit. */ -static void unlink_file(pmhandle_t *handle, pmpkg_t *info, const char *filename, +static void unlink_file(alpm_handle_t *handle, alpm_pkg_t *info, const char *filename, alpm_list_t *skip_remove, int nosave) { struct stat buf; @@ -254,7 +254,7 @@ static void unlink_file(pmhandle_t *handle, pmpkg_t *info, const char *filename, } } else { /* if the file needs backup and has been modified, back it up to .pacsave */ - pmbackup_t *backup = _alpm_needbackup(filename, alpm_pkg_get_backup(info)); + alpm_backup_t *backup = _alpm_needbackup(filename, alpm_pkg_get_backup(info)); if(backup) { if(nosave) { _alpm_log(handle, PM_LOG_DEBUG, "transaction is set to NOSAVE, not backing up '%s'\n", file); @@ -282,8 +282,8 @@ static void unlink_file(pmhandle_t *handle, pmpkg_t *info, const char *filename, } } -int _alpm_upgraderemove_package(pmhandle_t *handle, - pmpkg_t *oldpkg, pmpkg_t *newpkg) +int _alpm_upgraderemove_package(alpm_handle_t *handle, + alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg) { alpm_list_t *skip_remove, *b; alpm_list_t *newfiles, *lp; @@ -307,7 +307,7 @@ int _alpm_upgraderemove_package(pmhandle_t *handle, /* old package backup list */ alpm_list_t *filelist = alpm_pkg_get_files(newpkg); for(b = alpm_pkg_get_backup(newpkg); b; b = b->next) { - const pmbackup_t *backup = b->data; + const alpm_backup_t *backup = b->data; /* safety check (fix the upgrade026 pactest) */ if(!alpm_list_find_str(filelist, backup->name)) { continue; @@ -353,19 +353,19 @@ db: return 0; } -int _alpm_remove_packages(pmhandle_t *handle) +int _alpm_remove_packages(alpm_handle_t *handle) { - pmpkg_t *info; + alpm_pkg_t *info; alpm_list_t *targ, *lp; size_t pkg_count; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; pkg_count = alpm_list_count(trans->remove); for(targ = trans->remove; targ; targ = targ->next) { int position = 0; char scriptlet[PATH_MAX]; - info = (pmpkg_t *)targ->data; + info = (alpm_pkg_t *)targ->data; const char *pkgname = NULL; size_t targcount = alpm_list_count(targ); diff --git a/lib/libalpm/remove.h b/lib/libalpm/remove.h index 5cab526a..48dc2e9c 100644 --- a/lib/libalpm/remove.h +++ b/lib/libalpm/remove.h @@ -24,11 +24,11 @@ #include "alpm_list.h" #include "trans.h" -int _alpm_remove_prepare(pmhandle_t *handle, alpm_list_t **data); -int _alpm_remove_packages(pmhandle_t *handle); +int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data); +int _alpm_remove_packages(alpm_handle_t *handle); -int _alpm_upgraderemove_package(pmhandle_t *handle, - pmpkg_t *oldpkg, pmpkg_t *newpkg); +int _alpm_upgraderemove_package(alpm_handle_t *handle, + alpm_pkg_t *oldpkg, alpm_pkg_t *newpkg); #endif /* _ALPM_REMOVE_H */ diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 9826e425..35b352be 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -104,7 +104,7 @@ static alpm_list_t *list_sigsum(gpgme_sigsum_t sigsum) return summary; } -static int init_gpgme(pmhandle_t *handle) +static int init_gpgme(alpm_handle_t *handle) { static int init = 0; const char *version, *sigdir; @@ -205,7 +205,7 @@ error: * @param base64_sig optional PGP signature data in base64 encoding * @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred) */ -int _alpm_gpgme_checksig(pmhandle_t *handle, const char *path, +int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, const char *base64_sig) { int ret = 0; @@ -354,7 +354,7 @@ error: return ret; } #else -int _alpm_gpgme_checksig(pmhandle_t *handle, const char *path, +int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, const char *base64_sig) { return -1; @@ -367,7 +367,7 @@ int _alpm_gpgme_checksig(pmhandle_t *handle, const char *path, * * @return signature verification level */ -pgp_verify_t _alpm_db_get_sigverify_level(pmdb_t *db) +pgp_verify_t _alpm_db_get_sigverify_level(alpm_db_t *db) { if(db->pgp_verify != PM_PGP_VERIFY_UNKNOWN) { return db->pgp_verify; @@ -381,7 +381,7 @@ pgp_verify_t _alpm_db_get_sigverify_level(pmdb_t *db) * @param pkg the package to check * @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred) */ -int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg) +int SYMEXPORT alpm_pkg_check_pgp_signature(alpm_pkg_t *pkg) { ASSERT(pkg != NULL, return -1); pkg->handle->pm_errno = 0; @@ -395,7 +395,7 @@ int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg) * @param db the database to check * @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred) */ -int SYMEXPORT alpm_db_check_pgp_signature(pmdb_t *db) +int SYMEXPORT alpm_db_check_pgp_signature(alpm_db_t *db) { ASSERT(db != NULL, return -1); db->handle->pm_errno = 0; diff --git a/lib/libalpm/signing.h b/lib/libalpm/signing.h index fdf81fcf..eb4cb18a 100644 --- a/lib/libalpm/signing.h +++ b/lib/libalpm/signing.h @@ -21,9 +21,9 @@ #include "alpm.h" -int _alpm_gpgme_checksig(pmhandle_t *handle, const char *path, +int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, const char *base64_sig); -pgp_verify_t _alpm_db_get_sigverify_level(pmdb_t *db); +pgp_verify_t _alpm_db_get_sigverify_level(alpm_db_t *db); #endif /* _ALPM_SIGNING_H */ diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 15f135ba..dcce18d3 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -53,10 +53,10 @@ /** Check for new version of pkg in sync repos * (only the first occurrence is considered in sync) */ -pmpkg_t SYMEXPORT *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync) +alpm_pkg_t SYMEXPORT *alpm_sync_newversion(alpm_pkg_t *pkg, alpm_list_t *dbs_sync) { alpm_list_t *i; - pmpkg_t *spkg = NULL; + alpm_pkg_t *spkg = NULL; ASSERT(pkg != NULL, return NULL); pkg->handle->pm_errno = 0; @@ -83,11 +83,11 @@ pmpkg_t SYMEXPORT *alpm_sync_newversion(pmpkg_t *pkg, alpm_list_t *dbs_sync) } /** Search for packages to upgrade and add them to the transaction. */ -int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade) +int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) { alpm_list_t *i, *j, *k; - pmtrans_t *trans; - pmdb_t *db_local; + alpm_trans_t *trans; + alpm_db_t *db_local; alpm_list_t *dbs_sync; CHECK_HANDLE(handle, return -1); @@ -99,7 +99,7 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade) _alpm_log(handle, PM_LOG_DEBUG, "checking for package upgrades\n"); for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) { - pmpkg_t *lpkg = i->data; + alpm_pkg_t *lpkg = i->data; if(_alpm_pkg_find(trans->add, lpkg->name)) { _alpm_log(handle, PM_LOG_DEBUG, "%s is already in the target list -- skipping\n", lpkg->name); @@ -109,9 +109,9 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade) /* Search for literal then replacers in each sync database. * If found, don't check other databases */ for(j = dbs_sync; j; j = j->next) { - pmdb_t *sdb = j->data; + alpm_db_t *sdb = j->data; /* Check sdb */ - pmpkg_t *spkg = _alpm_db_get_pkgfromcache(sdb, lpkg->name); + alpm_pkg_t *spkg = _alpm_db_get_pkgfromcache(sdb, lpkg->name); if(spkg) { /* 1. literal was found in sdb */ int cmp = _alpm_pkg_compare_versions(spkg, lpkg); @@ -170,7 +170,7 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade) /* If spkg is already in the target list, we append lpkg to spkg's * removes list */ - pmpkg_t *tpkg = _alpm_pkg_find(trans->add, spkg->name); + alpm_pkg_t *tpkg = _alpm_pkg_find(trans->add, spkg->name); if(tpkg) { /* sanity check, multiple repos can contain spkg->name */ if(tpkg->origin_data.db != sdb) { @@ -209,24 +209,24 @@ int SYMEXPORT alpm_sync_sysupgrade(pmhandle_t *handle, int enable_downgrade) /** Find group members across a list of databases. * If a member exists in several databases, only the first database is used. * IgnorePkg is also handled. - * @param dbs the list of pmdb_t * + * @param dbs the list of alpm_db_t * * @pram name the name of the group - * @return the list of pmpkg_t * (caller is responsible for alpm_list_free) + * @return the list of alpm_pkg_t * (caller is responsible for alpm_list_free) */ -alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs, +alpm_list_t SYMEXPORT *alpm_find_group_pkgs(alpm_list_t *dbs, const char *name) { alpm_list_t *i, *j, *pkgs = NULL, *ignorelist = NULL; for(i = dbs; i; i = i->next) { - pmdb_t *db = i->data; - pmgrp_t *grp = alpm_db_readgrp(db, name); + alpm_db_t *db = i->data; + alpm_group_t *grp = alpm_db_readgroup(db, name); if(!grp) continue; for(j = grp->packages; j; j = j->next) { - pmpkg_t *pkg = j->data; + alpm_pkg_t *pkg = j->data; if(_alpm_pkg_find(ignorelist, alpm_pkg_get_name(pkg))) { continue; @@ -252,12 +252,12 @@ alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs, * package. * @param newpkg the new package to upgrade to */ -static int compute_download_size(pmpkg_t *newpkg) +static int compute_download_size(alpm_pkg_t *newpkg) { const char *fname; char *fpath; off_t size = 0; - pmhandle_t *handle = newpkg->handle; + alpm_handle_t *handle = newpkg->handle; if(newpkg->origin != PKG_FROM_SYNCDB) { newpkg->infolevel |= INFRQ_DSIZE; @@ -302,14 +302,14 @@ static int compute_download_size(pmpkg_t *newpkg) return 0; } -int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) +int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) { alpm_list_t *i, *j; alpm_list_t *deps = NULL; alpm_list_t *unresolvable = NULL; alpm_list_t *remove = NULL; int ret = 0; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; if(data) { *data = NULL; @@ -325,7 +325,7 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) /* build remove list for resolvedeps */ for(i = trans->add; i; i = i->next) { - pmpkg_t *spkg = i->data; + alpm_pkg_t *spkg = i->data; for(j = spkg->removes; j; j = j->next) { remove = alpm_list_add(remove, j->data); } @@ -339,7 +339,7 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) /* Resolve packages in the transaction one at a time, in addition building up a list of packages which could not be resolved. */ for(i = trans->add; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(_alpm_resolvedeps(handle, localpkgs, pkg, trans->add, &resolved, remove, data) == -1) { unresolvable = alpm_list_add(unresolvable, pkg); @@ -376,7 +376,7 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) /* Set DEPEND reason for pulled packages */ for(i = resolved; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; if(!_alpm_pkg_find(trans->add, pkg->name)) { pkg->reason = PM_PKG_REASON_DEPEND; } @@ -405,8 +405,8 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) deps = _alpm_innerconflicts(handle, trans->add); for(i = deps; i; i = i->next) { - pmconflict_t *conflict = i->data; - pmpkg_t *rsync, *sync, *sync1, *sync2; + alpm_conflict_t *conflict = i->data; + alpm_pkg_t *rsync, *sync, *sync1, *sync2; /* have we already removed one of the conflicting targets? */ sync1 = _alpm_pkg_find(trans->add, conflict->package1); @@ -419,8 +419,8 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) conflict->package1, conflict->package2); /* if sync1 provides sync2, we remove sync2 from the targets, and vice versa */ - pmdepend_t *dep1 = _alpm_splitdep(conflict->package1); - pmdepend_t *dep2 = _alpm_splitdep(conflict->package2); + alpm_depend_t *dep1 = _alpm_splitdep(conflict->package1); + alpm_depend_t *dep2 = _alpm_splitdep(conflict->package2); if(_alpm_depcmp(sync1, dep2)) { rsync = sync2; sync = sync1; @@ -432,7 +432,7 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) handle->pm_errno = PM_ERR_CONFLICTING_DEPS; ret = -1; if(data) { - pmconflict_t *newconflict = _alpm_conflict_dup(conflict); + alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); if(newconflict) { *data = alpm_list_add(*data, newconflict); } @@ -464,13 +464,13 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) deps = _alpm_outerconflicts(handle->db_local, trans->add); for(i = deps; i; i = i->next) { - pmconflict_t *conflict = i->data; + alpm_conflict_t *conflict = i->data; /* if conflict->package2 (the local package) is not elected for removal, we ask the user */ int found = 0; for(j = trans->add; j && !found; j = j->next) { - pmpkg_t *spkg = j->data; + alpm_pkg_t *spkg = j->data; if(_alpm_pkg_find(spkg->removes, conflict->package2)) { found = 1; } @@ -482,8 +482,8 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) _alpm_log(handle, PM_LOG_DEBUG, "package '%s' conflicts with '%s'\n", conflict->package1, conflict->package2); - pmpkg_t *sync = _alpm_pkg_find(trans->add, conflict->package1); - pmpkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, conflict->package2); + alpm_pkg_t *sync = _alpm_pkg_find(trans->add, conflict->package1); + alpm_pkg_t *local = _alpm_db_get_pkgfromcache(handle->db_local, conflict->package2); int doremove = 0; QUESTION(trans, PM_TRANS_CONV_CONFLICT_PKG, conflict->package1, conflict->package2, conflict->reason, &doremove); @@ -496,7 +496,7 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) handle->pm_errno = PM_ERR_CONFLICTING_DEPS; ret = -1; if(data) { - pmconflict_t *newconflict = _alpm_conflict_dup(conflict); + alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); if(newconflict) { *data = alpm_list_add(*data, newconflict); } @@ -513,9 +513,9 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) /* Build trans->remove list */ for(i = trans->add; i; i = i->next) { - pmpkg_t *spkg = i->data; + alpm_pkg_t *spkg = i->data; for(j = spkg->removes; j; j = j->next) { - pmpkg_t *rpkg = j->data; + alpm_pkg_t *rpkg = j->data; if(!_alpm_pkg_find(trans->remove, rpkg->name)) { _alpm_log(handle, PM_LOG_DEBUG, "adding '%s' to remove list\n", rpkg->name); trans->remove = alpm_list_add(trans->remove, _alpm_pkg_dup(rpkg)); @@ -541,7 +541,7 @@ int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data) } for(i = trans->add; i; i = i->next) { /* update download size field */ - pmpkg_t *spkg = i->data; + alpm_pkg_t *spkg = i->data; if(compute_download_size(spkg) != 0) { ret = -1; goto cleanup; @@ -560,7 +560,7 @@ cleanup: * @param newpkg the new package to upgrade to * @return the size of the download */ -off_t SYMEXPORT alpm_pkg_download_size(pmpkg_t *newpkg) +off_t SYMEXPORT alpm_pkg_download_size(alpm_pkg_t *newpkg) { if(!(newpkg->infolevel & INFRQ_DSIZE)) { compute_download_size(newpkg); @@ -583,15 +583,15 @@ static int endswith(const char *filename, const char *extension) * * @return 0 if all delta files were able to be applied, 1 otherwise. */ -static int apply_deltas(pmhandle_t *handle) +static int apply_deltas(alpm_handle_t *handle) { alpm_list_t *i; int ret = 0; const char *cachedir = _alpm_filecache_setup(handle); - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; for(i = trans->add; i; i = i->next) { - pmpkg_t *spkg = i->data; + alpm_pkg_t *spkg = i->data; alpm_list_t *delta_path = spkg->delta_path; alpm_list_t *dlts = NULL; @@ -600,7 +600,7 @@ static int apply_deltas(pmhandle_t *handle) } for(dlts = delta_path; dlts; dlts = dlts->next) { - pmdelta_t *d = dlts->data; + alpm_delta_t *d = dlts->data; char *delta, *from, *to; char command[PATH_MAX]; size_t len = 0; @@ -673,7 +673,7 @@ static int apply_deltas(pmhandle_t *handle) * * @return 0 if the md5sum matched, 1 if not, -1 in case of errors */ -static int test_md5sum(pmtrans_t *trans, const char *filepath, +static int test_md5sum(alpm_trans_t *trans, const char *filepath, const char *md5sum) { int ret = _alpm_test_md5sum(filepath, md5sum); @@ -689,12 +689,12 @@ static int test_md5sum(pmtrans_t *trans, const char *filepath, return ret; } -static int validate_deltas(pmhandle_t *handle, alpm_list_t *deltas, +static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas, alpm_list_t **data) { int errors = 0, ret = 0; alpm_list_t *i; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; if(!deltas) { return 0; @@ -704,7 +704,7 @@ static int validate_deltas(pmhandle_t *handle, alpm_list_t *deltas, EVENT(trans, PM_TRANS_EVT_DELTA_INTEGRITY_START, NULL, NULL); for(i = deltas; i; i = i->next) { - pmdelta_t *d = alpm_list_getdata(i); + alpm_delta_t *d = alpm_list_getdata(i); char *filepath = _alpm_filecache_find(handle, d->delta); if(test_md5sum(trans, filepath, d->delta_md5) != 0) { @@ -726,7 +726,7 @@ static int validate_deltas(pmhandle_t *handle, alpm_list_t *deltas, return ret; } -static int download_files(pmhandle_t *handle, alpm_list_t **deltas) +static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) { const char *cachedir; alpm_list_t *i, *j; @@ -743,7 +743,7 @@ static int download_files(pmhandle_t *handle, alpm_list_t **deltas) off_t total_size = (off_t)0; /* sum up the download size for each package and store total */ for(i = handle->trans->add; i; i = i->next) { - pmpkg_t *spkg = i->data; + alpm_pkg_t *spkg = i->data; total_size += spkg->download_size; } handle->totaldlcb(total_size); @@ -751,10 +751,10 @@ static int download_files(pmhandle_t *handle, alpm_list_t **deltas) /* group sync records by repository and download */ for(i = handle->dbs_sync; i; i = i->next) { - pmdb_t *current = i->data; + alpm_db_t *current = i->data; for(j = handle->trans->add; j; j = j->next) { - pmpkg_t *spkg = j->data; + alpm_pkg_t *spkg = j->data; if(spkg->origin != PKG_FROM_FILE && current == spkg->origin_data.db) { const char *fname = NULL; @@ -766,7 +766,7 @@ static int download_files(pmhandle_t *handle, alpm_list_t **deltas) /* using deltas */ alpm_list_t *dlts; for(dlts = delta_path; dlts; dlts = dlts->next) { - pmdelta_t *delta = dlts->data; + alpm_delta_t *delta = dlts->data; if(delta->download_size != 0) { files = alpm_list_add(files, strdup(delta->delta)); } @@ -821,7 +821,7 @@ static int download_files(pmhandle_t *handle, alpm_list_t **deltas) } for(j = handle->trans->add; j; j = j->next) { - pmpkg_t *pkg = j->data; + alpm_pkg_t *pkg = j->data; pkg->infolevel &= ~INFRQ_DSIZE; pkg->download_size = 0; } @@ -833,13 +833,13 @@ static int download_files(pmhandle_t *handle, alpm_list_t **deltas) return 0; } -int _alpm_sync_commit(pmhandle_t *handle, alpm_list_t **data) +int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) { alpm_list_t *i; alpm_list_t *deltas = NULL; size_t numtargs, current = 0, replaces = 0; int errors; - pmtrans_t *trans = handle->trans; + alpm_trans_t *trans = handle->trans; if(download_files(handle, &deltas)) { alpm_list_free(deltas); @@ -859,7 +859,7 @@ int _alpm_sync_commit(pmhandle_t *handle, alpm_list_t **data) errors = 0; for(i = trans->add; i; i = i->next, current++) { - pmpkg_t *spkg = i->data; + alpm_pkg_t *spkg = i->data; int percent = (current * 100) / numtargs; const char *filename; char *filepath; @@ -873,7 +873,7 @@ int _alpm_sync_commit(pmhandle_t *handle, alpm_list_t **data) filename = alpm_pkg_get_filename(spkg); filepath = _alpm_filecache_find(handle, filename); - pmdb_t *sdb = alpm_pkg_get_db(spkg); + alpm_db_t *sdb = alpm_pkg_get_db(spkg); check_sig = _alpm_db_get_sigverify_level(sdb); /* load the package file and replace pkgcache entry with it in the target list */ @@ -881,7 +881,7 @@ int _alpm_sync_commit(pmhandle_t *handle, alpm_list_t **data) _alpm_log(handle, PM_LOG_DEBUG, "replacing pkgcache entry with package file for target %s\n", spkg->name); - pmpkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, 1, spkg->md5sum, + alpm_pkg_t *pkgfile =_alpm_pkg_load_internal(handle, filepath, 1, spkg->md5sum, spkg->base64_sig, check_sig); if(!pkgfile) { errors++; diff --git a/lib/libalpm/sync.h b/lib/libalpm/sync.h index 3049dd21..472d1dfc 100644 --- a/lib/libalpm/sync.h +++ b/lib/libalpm/sync.h @@ -24,8 +24,8 @@ #include "alpm.h" -int _alpm_sync_prepare(pmhandle_t *handle, alpm_list_t **data); -int _alpm_sync_commit(pmhandle_t *handle, alpm_list_t **data); +int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data); +int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data); #endif /* _ALPM_SYNC_H */ diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 507ea027..29a74bf9 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -48,11 +48,11 @@ */ /** Initialize the transaction. */ -int SYMEXPORT alpm_trans_init(pmhandle_t *handle, pmtransflag_t flags, +int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress) { - pmtrans_t *trans; + alpm_trans_t *trans; alpm_list_t *i; /* Sanity checks */ @@ -60,7 +60,7 @@ int SYMEXPORT alpm_trans_init(pmhandle_t *handle, pmtransflag_t flags, ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1)); for(i = handle->dbs_sync; i; i = i->next) { - const pmdb_t *db = i->data; + const alpm_db_t *db = i->data; if(!(db->status & DB_STATUS_VALID)) { RET_ERR(handle, PM_ERR_DB_INVALID, -1); } @@ -73,7 +73,7 @@ int SYMEXPORT alpm_trans_init(pmhandle_t *handle, pmtransflag_t flags, } } - CALLOC(trans, 1, sizeof(pmtrans_t), RET_ERR(handle, PM_ERR_MEMORY, -1)); + CALLOC(trans, 1, sizeof(alpm_trans_t), RET_ERR(handle, PM_ERR_MEMORY, -1)); trans->flags = flags; trans->cb_event = event; trans->cb_conv = conv; @@ -85,7 +85,7 @@ int SYMEXPORT alpm_trans_init(pmhandle_t *handle, pmtransflag_t flags, return 0; } -static alpm_list_t *check_arch(pmhandle_t *handle, alpm_list_t *pkgs) +static alpm_list_t *check_arch(alpm_handle_t *handle, alpm_list_t *pkgs) { alpm_list_t *i; alpm_list_t *invalid = NULL; @@ -95,7 +95,7 @@ static alpm_list_t *check_arch(pmhandle_t *handle, alpm_list_t *pkgs) return NULL; } for(i = pkgs; i; i = i->next) { - pmpkg_t *pkg = i->data; + alpm_pkg_t *pkg = i->data; const char *pkgarch = alpm_pkg_get_arch(pkg); if(pkgarch && strcmp(pkgarch, arch) && strcmp(pkgarch, "any")) { char *string; @@ -111,9 +111,9 @@ static alpm_list_t *check_arch(pmhandle_t *handle, alpm_list_t *pkgs) } /** Prepare a transaction. */ -int SYMEXPORT alpm_trans_prepare(pmhandle_t *handle, alpm_list_t **data) +int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data) { - pmtrans_t *trans; + alpm_trans_t *trans; /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -155,9 +155,9 @@ int SYMEXPORT alpm_trans_prepare(pmhandle_t *handle, alpm_list_t **data) } /** Commit a transaction. */ -int SYMEXPORT alpm_trans_commit(pmhandle_t *handle, alpm_list_t **data) +int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data) { - pmtrans_t *trans; + alpm_trans_t *trans; /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -194,9 +194,9 @@ int SYMEXPORT alpm_trans_commit(pmhandle_t *handle, alpm_list_t **data) } /** Interrupt a transaction. */ -int SYMEXPORT alpm_trans_interrupt(pmhandle_t *handle) +int SYMEXPORT alpm_trans_interrupt(alpm_handle_t *handle) { - pmtrans_t *trans; + alpm_trans_t *trans; /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -212,9 +212,9 @@ int SYMEXPORT alpm_trans_interrupt(pmhandle_t *handle) } /** Release a transaction. */ -int SYMEXPORT alpm_trans_release(pmhandle_t *handle) +int SYMEXPORT alpm_trans_release(alpm_handle_t *handle) { - pmtrans_t *trans; + alpm_trans_t *trans; /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -243,7 +243,7 @@ int SYMEXPORT alpm_trans_release(pmhandle_t *handle) /** @} */ -void _alpm_trans_free(pmtrans_t *trans) +void _alpm_trans_free(alpm_trans_t *trans) { if(trans == NULL) { return; @@ -285,7 +285,7 @@ static int grep(const char *fn, const char *needle) return 0; } -int _alpm_runscriptlet(pmhandle_t *handle, const char *installfn, +int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn, const char *script, const char *ver, const char *oldver) { char scriptfn[PATH_MAX]; @@ -359,7 +359,7 @@ cleanup: return retval; } -pmtransflag_t SYMEXPORT alpm_trans_get_flags(pmhandle_t *handle) +alpm_transflag_t SYMEXPORT alpm_trans_get_flags(alpm_handle_t *handle) { /* Sanity checks */ CHECK_HANDLE(handle, return -1); @@ -368,7 +368,7 @@ pmtransflag_t SYMEXPORT alpm_trans_get_flags(pmhandle_t *handle) return handle->trans->flags; } -alpm_list_t SYMEXPORT *alpm_trans_get_add(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_trans_get_add(alpm_handle_t *handle) { /* Sanity checks */ CHECK_HANDLE(handle, return NULL); @@ -377,7 +377,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_add(pmhandle_t *handle) return handle->trans->add; } -alpm_list_t SYMEXPORT *alpm_trans_get_remove(pmhandle_t *handle) +alpm_list_t SYMEXPORT *alpm_trans_get_remove(alpm_handle_t *handle) { /* Sanity checks */ CHECK_HANDLE(handle, return NULL); diff --git a/lib/libalpm/trans.h b/lib/libalpm/trans.h index e8587156..9a60e71b 100644 --- a/lib/libalpm/trans.h +++ b/lib/libalpm/trans.h @@ -25,7 +25,7 @@ #include "alpm.h" -typedef enum _pmtransstate_t { +typedef enum _alpm_transstate_t { STATE_IDLE = 0, STATE_INITIALIZED, STATE_PREPARED, @@ -33,14 +33,14 @@ typedef enum _pmtransstate_t { STATE_COMMITING, STATE_COMMITED, STATE_INTERRUPTED -} pmtransstate_t; +} alpm_transstate_t; /* Transaction */ -struct __pmtrans_t { - pmtransflag_t flags; - pmtransstate_t state; - alpm_list_t *add; /* list of (pmpkg_t *) */ - alpm_list_t *remove; /* list of (pmpkg_t *) */ +struct __alpm_trans_t { + alpm_transflag_t flags; + alpm_transstate_t state; + alpm_list_t *add; /* list of (alpm_pkg_t *) */ + alpm_list_t *remove; /* list of (alpm_pkg_t *) */ alpm_list_t *skip_remove; /* list of (char *) */ alpm_trans_cb_event cb_event; alpm_trans_cb_conv cb_conv; @@ -66,11 +66,11 @@ do { \ } \ } while(0) -void _alpm_trans_free(pmtrans_t *trans); -int _alpm_trans_init(pmtrans_t *trans, pmtransflag_t flags, +void _alpm_trans_free(alpm_trans_t *trans); +int _alpm_trans_init(alpm_trans_t *trans, alpm_transflag_t flags, alpm_trans_cb_event event, alpm_trans_cb_conv conv, alpm_trans_cb_progress progress); -int _alpm_runscriptlet(pmhandle_t *handle, const char *installfn, +int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn, const char *script, const char *ver, const char *oldver); #endif /* _ALPM_TRANS_H */ diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 028ed8aa..8bcb5463 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -218,7 +218,7 @@ char *_alpm_strtrim(char *str) * @param filename a file within the archive to unpack * @return 0 on success, 1 on failure */ -int _alpm_unpack_single(pmhandle_t *handle, const char *archive, +int _alpm_unpack_single(alpm_handle_t *handle, const char *archive, const char *prefix, const char *filename) { alpm_list_t *list = NULL; @@ -243,7 +243,7 @@ int _alpm_unpack_single(pmhandle_t *handle, const char *archive, * * @return 0 on success, 1 on failure */ -int _alpm_unpack(pmhandle_t *handle, const char *archive, const char *prefix, +int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, alpm_list_t *list, int breakfirst) { int ret = 0; @@ -388,7 +388,7 @@ int _alpm_rmrf(const char *path) return 0; } -int _alpm_logaction(pmhandle_t *handle, const char *fmt, va_list args) +int _alpm_logaction(alpm_handle_t *handle, const char *fmt, va_list args) { int ret = 0; @@ -419,7 +419,7 @@ int _alpm_logaction(pmhandle_t *handle, const char *fmt, va_list args) return ret; } -int _alpm_run_chroot(pmhandle_t *handle, const char *path, char *const argv[]) +int _alpm_run_chroot(alpm_handle_t *handle, const char *path, char *const argv[]) { char cwd[PATH_MAX]; pid_t pid; @@ -536,7 +536,7 @@ cleanup: return retval; } -int _alpm_ldconfig(pmhandle_t *handle) +int _alpm_ldconfig(alpm_handle_t *handle) { char line[PATH_MAX]; @@ -566,7 +566,7 @@ int _alpm_str_cmp(const void *s1, const void *s2) * @param filename name of file to find * @return malloced path of file, NULL if not found */ -char *_alpm_filecache_find(pmhandle_t *handle, const char *filename) +char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename) { char path[PATH_MAX]; char *retpath; @@ -592,7 +592,7 @@ char *_alpm_filecache_find(pmhandle_t *handle, const char *filename) * @param handle the context handle * @return pointer to a writable cache directory. */ -const char *_alpm_filecache_setup(pmhandle_t *handle) +const char *_alpm_filecache_setup(alpm_handle_t *handle) { struct stat buf; alpm_list_t *i, *tmp; diff --git a/lib/libalpm/util.h b/lib/libalpm/util.h index c68b07ba..614c2fbb 100644 --- a/lib/libalpm/util.h +++ b/lib/libalpm/util.h @@ -28,8 +28,8 @@ #include "alpm_list.h" #include "alpm.h" -#include "package.h" /* pmpkg_t */ -#include "handle.h" /* pmhandle_t */ +#include "package.h" /* alpm_pkg_t */ +#include "handle.h" /* alpm_handle_t */ #include <stdio.h> #include <string.h> @@ -95,17 +95,17 @@ int _alpm_makepath(const char *path); int _alpm_makepath_mode(const char *path, mode_t mode); int _alpm_copyfile(const char *src, const char *dest); char *_alpm_strtrim(char *str); -int _alpm_unpack_single(pmhandle_t *handle, const char *archive, +int _alpm_unpack_single(alpm_handle_t *handle, const char *archive, const char *prefix, const char *filename); -int _alpm_unpack(pmhandle_t *handle, const char *archive, const char *prefix, +int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, alpm_list_t *list, int breakfirst); int _alpm_rmrf(const char *path); -int _alpm_logaction(pmhandle_t *handle, const char *fmt, va_list args); -int _alpm_run_chroot(pmhandle_t *handle, const char *path, char *const argv[]); -int _alpm_ldconfig(pmhandle_t *handle); +int _alpm_logaction(alpm_handle_t *handle, const char *fmt, va_list args); +int _alpm_run_chroot(alpm_handle_t *handle, const char *path, char *const argv[]); +int _alpm_ldconfig(alpm_handle_t *handle); int _alpm_str_cmp(const void *s1, const void *s2); -char *_alpm_filecache_find(pmhandle_t *handle, const char *filename); -const char *_alpm_filecache_setup(pmhandle_t *handle); +char *_alpm_filecache_find(alpm_handle_t *handle, const char *filename); +const char *_alpm_filecache_setup(alpm_handle_t *handle); int _alpm_lstat(const char *path, struct stat *buf); int _alpm_test_md5sum(const char *filepath, const char *md5sum); int _alpm_archive_fgets(struct archive *a, struct archive_read_buffer *b); |