Rename pmdb_t to alpm_db_t
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
64c1cf7921
commit
939d5a9511
29 changed files with 164 additions and 164 deletions
|
@ -457,7 +457,7 @@ static int commit_single_pkg(alpm_handle_t *handle, pmpkg_t *newpkg,
|
||||||
char scriptlet[PATH_MAX];
|
char scriptlet[PATH_MAX];
|
||||||
int is_upgrade = 0;
|
int is_upgrade = 0;
|
||||||
pmpkg_t *oldpkg = NULL;
|
pmpkg_t *oldpkg = NULL;
|
||||||
pmdb_t *db = handle->db_local;
|
alpm_db_t *db = handle->db_local;
|
||||||
pmtrans_t *trans = handle->trans;
|
pmtrans_t *trans = handle->trans;
|
||||||
|
|
||||||
snprintf(scriptlet, PATH_MAX, "%s%s-%s/install",
|
snprintf(scriptlet, PATH_MAX, "%s%s-%s/install",
|
||||||
|
|
|
@ -102,7 +102,7 @@ cleanup:
|
||||||
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
int SYMEXPORT alpm_release(alpm_handle_t *myhandle)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
pmdb_t *db;
|
alpm_db_t *db;
|
||||||
|
|
||||||
CHECK_HANDLE(myhandle, return -1);
|
CHECK_HANDLE(myhandle, return -1);
|
||||||
|
|
||||||
|
|
|
@ -101,7 +101,7 @@ typedef enum _pgp_verify_t {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct __alpm_handle_t alpm_handle_t;
|
typedef struct __alpm_handle_t alpm_handle_t;
|
||||||
typedef struct __pmdb_t pmdb_t;
|
typedef struct __alpm_db_t alpm_db_t;
|
||||||
typedef struct __pmpkg_t pmpkg_t;
|
typedef struct __pmpkg_t pmpkg_t;
|
||||||
typedef struct __pmtrans_t pmtrans_t;
|
typedef struct __pmtrans_t pmtrans_t;
|
||||||
|
|
||||||
|
@ -344,13 +344,13 @@ int alpm_option_set_default_sigverify(alpm_handle_t *handle, pgp_verify_t level)
|
||||||
* libalpm functions.
|
* libalpm functions.
|
||||||
* @return a reference to the local database
|
* @return a reference to the local database
|
||||||
*/
|
*/
|
||||||
pmdb_t *alpm_option_get_localdb(alpm_handle_t *handle);
|
alpm_db_t *alpm_option_get_localdb(alpm_handle_t *handle);
|
||||||
|
|
||||||
/** Get the list of sync databases.
|
/** 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.
|
* sync database.
|
||||||
* @param handle the context handle
|
* @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(alpm_handle_t *handle);
|
alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle);
|
||||||
|
|
||||||
|
@ -359,16 +359,16 @@ alpm_list_t *alpm_option_get_syncdbs(alpm_handle_t *handle);
|
||||||
* @param treename the name of the sync repository
|
* @param treename the name of the sync repository
|
||||||
* @param check_sig what level of signature checking to perform on the
|
* @param check_sig what level of signature checking to perform on the
|
||||||
* database; note that this must be a '.sig' file type verification
|
* 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(alpm_handle_t *handle, const char *treename,
|
alpm_db_t *alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
||||||
pgp_verify_t check_sig);
|
pgp_verify_t check_sig);
|
||||||
|
|
||||||
/** Unregister a package database.
|
/** Unregister a package database.
|
||||||
* @param db pointer to the package database to unregister
|
* @param db pointer to the package database to unregister
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* @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.
|
/** Unregister all package databases.
|
||||||
* @param handle the context handle
|
* @param handle the context handle
|
||||||
|
@ -380,51 +380,51 @@ int alpm_db_unregister_all(alpm_handle_t *handle);
|
||||||
* @param db pointer to the package database
|
* @param db pointer to the package database
|
||||||
* @return the name of the package database, NULL on error
|
* @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.
|
/** @name Accessors to the list of servers for a database.
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
alpm_list_t *alpm_db_get_servers(const pmdb_t *db);
|
alpm_list_t *alpm_db_get_servers(const alpm_db_t *db);
|
||||||
int alpm_db_set_servers(pmdb_t *db, alpm_list_t *servers);
|
int alpm_db_set_servers(alpm_db_t *db, alpm_list_t *servers);
|
||||||
int alpm_db_add_server(pmdb_t *db, const char *url);
|
int alpm_db_add_server(alpm_db_t *db, const char *url);
|
||||||
int alpm_db_remove_server(pmdb_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.
|
/** Get a package entry from a package database.
|
||||||
* @param db pointer to the package database to get the package from
|
* @param db pointer to the package database to get the package from
|
||||||
* @param name of the package
|
* @param name of the package
|
||||||
* @return the package entry on success, NULL on error
|
* @return the package entry on success, NULL on error
|
||||||
*/
|
*/
|
||||||
pmpkg_t *alpm_db_get_pkg(pmdb_t *db, const char *name);
|
pmpkg_t *alpm_db_get_pkg(alpm_db_t *db, const char *name);
|
||||||
|
|
||||||
/** Get the package cache of a package database.
|
/** Get the package cache of a package database.
|
||||||
* @param db pointer to the package database to get the package from
|
* @param db pointer to the package database to get the package from
|
||||||
* @return the list of packages on success, NULL on error
|
* @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.
|
/** Get a group entry from a package database.
|
||||||
* @param db pointer to the package database to get the group from
|
* @param db pointer to the package database to get the group from
|
||||||
* @param name of the group
|
* @param name of the group
|
||||||
* @return the groups entry on success, NULL on error
|
* @return the groups entry on success, NULL on error
|
||||||
*/
|
*/
|
||||||
pmgrp_t *alpm_db_readgrp(pmdb_t *db, const char *name);
|
pmgrp_t *alpm_db_readgrp(alpm_db_t *db, const char *name);
|
||||||
|
|
||||||
/** Get the group cache of a package database.
|
/** Get the group cache of a package database.
|
||||||
* @param db pointer to the package database to get the group from
|
* @param db pointer to the package database to get the group from
|
||||||
* @return the list of groups on success, NULL on error
|
* @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_grpcache(alpm_db_t *db);
|
||||||
|
|
||||||
/** Searches a database with regular expressions.
|
/** Searches a database with regular expressions.
|
||||||
* @param db pointer to the package database to search in
|
* @param db pointer to the package database to search in
|
||||||
* @param needles a list of regular expressions to search for
|
* @param needles a list of regular expressions to search for
|
||||||
* @return the list of packages matching all regular expressions on success, NULL on error
|
* @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.
|
/** Set install reason for a package in db.
|
||||||
* @param db pointer to the package database
|
* @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
|
* @param reason the new install reason
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
||||||
*/
|
*/
|
||||||
int alpm_db_set_pkgreason(pmdb_t *db, const char *name, alpm_pkgreason_t reason);
|
int alpm_db_set_pkgreason(alpm_db_t *db, const char *name, alpm_pkgreason_t reason);
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
|
@ -635,12 +635,12 @@ alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg);
|
||||||
alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg);
|
alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg);
|
||||||
|
|
||||||
/** Returns the database containing 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.
|
* originating from, or NULL if the package was loaded from a file.
|
||||||
* @param pkg a pointer to package
|
* @param pkg a pointer to package
|
||||||
* @return a pointer to the DB containing pkg, or NULL.
|
* @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(pmpkg_t *pkg);
|
||||||
|
|
||||||
/* End of pmpkg_t accessors */
|
/* End of pmpkg_t accessors */
|
||||||
/* @} */
|
/* @} */
|
||||||
|
@ -694,7 +694,7 @@ alpm_list_t *alpm_pkg_unused_deltas(pmpkg_t *pkg);
|
||||||
|
|
||||||
int alpm_pkg_check_pgp_signature(pmpkg_t *pkg);
|
int alpm_pkg_check_pgp_signature(pmpkg_t *pkg);
|
||||||
|
|
||||||
int alpm_db_check_pgp_signature(pmdb_t *db);
|
int alpm_db_check_pgp_signature(alpm_db_t *db);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Groups
|
* Groups
|
||||||
|
|
|
@ -273,7 +273,7 @@ static struct pkg_operations local_pkg_ops = {
|
||||||
.changelog_close = _cache_changelog_close,
|
.changelog_close = _cache_changelog_close,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int checkdbdir(pmdb_t *db)
|
static int checkdbdir(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
struct stat buf;
|
struct stat buf;
|
||||||
const char *path = _alpm_db_path(db);
|
const char *path = _alpm_db_path(db);
|
||||||
|
@ -314,7 +314,7 @@ static int is_dir(const char *path, struct dirent *entry)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int local_db_validate(pmdb_t *db)
|
static int local_db_validate(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
struct dirent *ent = NULL;
|
struct dirent *ent = NULL;
|
||||||
const char *dbpath;
|
const char *dbpath;
|
||||||
|
@ -370,7 +370,7 @@ done:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int local_db_populate(pmdb_t *db)
|
static int local_db_populate(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
size_t est_count;
|
size_t est_count;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -484,7 +484,7 @@ static int local_db_populate(pmdb_t *db)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Note: the return value must be freed by the caller */
|
/* 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, pmpkg_t *info)
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *pkgpath;
|
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, pmpkg_t *info, pmdbinfrq_t inforeq)
|
||||||
{
|
{
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
@ -718,7 +718,7 @@ error:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info)
|
int _alpm_local_db_prepare(alpm_db_t *db, pmpkg_t *info)
|
||||||
{
|
{
|
||||||
mode_t oldmask;
|
mode_t oldmask;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
|
@ -742,7 +742,7 @@ int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info)
|
||||||
return retval;
|
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, pmpkg_t *info, pmdbinfrq_t inforeq)
|
||||||
{
|
{
|
||||||
FILE *fp = NULL;
|
FILE *fp = NULL;
|
||||||
char path[PATH_MAX];
|
char path[PATH_MAX];
|
||||||
|
@ -910,7 +910,7 @@ cleanup:
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_local_db_remove(pmdb_t *db, pmpkg_t *info)
|
int _alpm_local_db_remove(alpm_db_t *db, pmpkg_t *info)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
char *pkgpath = NULL;
|
char *pkgpath = NULL;
|
||||||
|
@ -930,9 +930,9 @@ struct db_operations local_db_ops = {
|
||||||
.unregister = _alpm_db_unregister,
|
.unregister = _alpm_db_unregister,
|
||||||
};
|
};
|
||||||
|
|
||||||
pmdb_t *_alpm_db_register_local(alpm_handle_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");
|
_alpm_log(handle, PM_LOG_DEBUG, "registering local database\n");
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ static char *get_sync_dir(alpm_handle_t *handle)
|
||||||
return syncpath;
|
return syncpath;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sync_db_validate(pmdb_t *db)
|
static int sync_db_validate(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
pgp_verify_t check_sig;
|
pgp_verify_t check_sig;
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ valid:
|
||||||
* @code
|
* @code
|
||||||
* alpm_list_t *syncs = alpm_option_get_syncdbs();
|
* alpm_list_t *syncs = alpm_option_get_syncdbs();
|
||||||
* for(i = syncs; i; i = alpm_list_next(i)) {
|
* 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);
|
* result = alpm_db_update(0, db);
|
||||||
*
|
*
|
||||||
* if(result < 0) {
|
* if(result < 0) {
|
||||||
|
@ -142,7 +142,7 @@ valid:
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly), 1 if up to
|
* @return 0 on success, -1 on error (pm_errno is set accordingly), 1 if up to
|
||||||
* to date
|
* 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;
|
char *syncpath;
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
@ -244,10 +244,10 @@ cleanup:
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Forward decl so I don't reorganize the whole file right now */
|
/* Forward decl so I don't reorganize the whole file right now */
|
||||||
static int sync_db_read(pmdb_t *db, struct archive *archive,
|
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||||
struct archive_entry *entry, pmpkg_t **likely_pkg);
|
struct archive_entry *entry, pmpkg_t **likely_pkg);
|
||||||
|
|
||||||
static pmpkg_t *load_pkg_for_entry(pmdb_t *db, const char *entryname,
|
static pmpkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
|
||||||
const char **entry_filename, pmpkg_t *likely_pkg)
|
const char **entry_filename, pmpkg_t *likely_pkg)
|
||||||
{
|
{
|
||||||
char *pkgname = NULL, *pkgver = NULL;
|
char *pkgname = NULL, *pkgver = NULL;
|
||||||
|
@ -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);
|
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;
|
const char *dbpath;
|
||||||
size_t est_count;
|
size_t est_count;
|
||||||
|
@ -451,7 +451,7 @@ static int sync_db_populate(pmdb_t *db)
|
||||||
f = alpm_list_add(f, linedup); \
|
f = alpm_list_add(f, linedup); \
|
||||||
} while(1) /* note the while(1) and not (0) */
|
} while(1) /* note the while(1) and not (0) */
|
||||||
|
|
||||||
static int sync_db_read(pmdb_t *db, struct archive *archive,
|
static int sync_db_read(alpm_db_t *db, struct archive *archive,
|
||||||
struct archive_entry *entry, pmpkg_t **likely_pkg)
|
struct archive_entry *entry, pmpkg_t **likely_pkg)
|
||||||
{
|
{
|
||||||
const char *entryname, *filename;
|
const char *entryname, *filename;
|
||||||
|
@ -584,10 +584,10 @@ struct db_operations sync_db_ops = {
|
||||||
.unregister = _alpm_db_unregister,
|
.unregister = _alpm_db_unregister,
|
||||||
};
|
};
|
||||||
|
|
||||||
pmdb_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
||||||
pgp_verify_t level)
|
pgp_verify_t level)
|
||||||
{
|
{
|
||||||
pmdb_t *db;
|
alpm_db_t *db;
|
||||||
|
|
||||||
_alpm_log(handle, PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
_alpm_log(handle, PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages)
|
||||||
* In case of conflict the package1 field of pmdepconflict_t contains
|
* In case of conflict the package1 field of pmdepconflict_t contains
|
||||||
* the target package, package2 field contains the local package
|
* 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;
|
alpm_list_t *baddeps = NULL;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict);
|
pmconflict_t *_alpm_conflict_dup(const pmconflict_t *conflict);
|
||||||
void _alpm_conflict_free(pmconflict_t *conflict);
|
void _alpm_conflict_free(pmconflict_t *conflict);
|
||||||
alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages);
|
alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages);
|
||||||
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 *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
||||||
alpm_list_t *upgrade, alpm_list_t *remove);
|
alpm_list_t *upgrade, alpm_list_t *remove);
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/** Register a sync database of packages. */
|
/** Register a sync database of packages. */
|
||||||
pmdb_t SYMEXPORT *alpm_db_register_sync(alpm_handle_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)
|
pgp_verify_t check_sig)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
|
@ -59,7 +59,7 @@ pmdb_t SYMEXPORT *alpm_db_register_sync(alpm_handle_t *handle, const char *treen
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Helper function for alpm_db_unregister{_all} */
|
/* 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) {
|
if(db == NULL) {
|
||||||
return;
|
return;
|
||||||
|
@ -73,7 +73,7 @@ void _alpm_db_unregister(pmdb_t *db)
|
||||||
int SYMEXPORT alpm_db_unregister_all(alpm_handle_t *handle)
|
int SYMEXPORT alpm_db_unregister_all(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
pmdb_t *db;
|
alpm_db_t *db;
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
@ -91,7 +91,7 @@ int SYMEXPORT alpm_db_unregister_all(alpm_handle_t *handle)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Unregister a package database. */
|
/** Unregister a package database. */
|
||||||
int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
int found = 0;
|
int found = 0;
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
|
@ -128,14 +128,14 @@ int SYMEXPORT alpm_db_unregister(pmdb_t *db)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the serverlist of a database. */
|
/** 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);
|
ASSERT(db != NULL, return NULL);
|
||||||
return db->servers;
|
return db->servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set the serverlist of a database. */
|
/** 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);
|
ASSERT(db != NULL, return -1);
|
||||||
if(db->servers) FREELIST(db->servers);
|
if(db->servers) FREELIST(db->servers);
|
||||||
|
@ -161,7 +161,7 @@ static char *sanitize_url(const char *url)
|
||||||
* @param url url of the server
|
* @param url url of the server
|
||||||
* @return 0 on success, -1 on error (pm_errno is set accordingly)
|
* @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;
|
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,
|
* @return 0 on success, 1 on server not present,
|
||||||
* -1 on error (pm_errno is set accordingly)
|
* -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;
|
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. */
|
/** 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);
|
ASSERT(db != NULL, return NULL);
|
||||||
return db->treename;
|
return db->treename;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get a package entry from a package database. */
|
/** Get a package entry from a package database. */
|
||||||
pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
|
pmpkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
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. */
|
/** 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);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
|
@ -239,7 +239,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get a group entry from a package database. */
|
/** Get a group entry from a package database. */
|
||||||
pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
pmgrp_t SYMEXPORT *alpm_db_readgrp(alpm_db_t *db, const char *name)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
|
@ -250,7 +250,7 @@ pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Get the group cache of a package database. */
|
/** 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_grpcache(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return NULL);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
|
@ -259,7 +259,7 @@ alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Searches a database. */
|
/** 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);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
|
@ -268,7 +268,7 @@ alpm_list_t SYMEXPORT *alpm_db_search(pmdb_t *db, const alpm_list_t* needles)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Set install reason for a package in db. */
|
/** Set install reason for a package in db. */
|
||||||
int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, alpm_pkgreason_t reason)
|
int SYMEXPORT alpm_db_set_pkgreason(alpm_db_t *db, const char *name, alpm_pkgreason_t reason)
|
||||||
{
|
{
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
|
@ -297,11 +297,11 @@ int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, alpm_pkgreason
|
||||||
|
|
||||||
/** @} */
|
/** @} */
|
||||||
|
|
||||||
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);
|
STRDUP(db->treename, treename, return NULL);
|
||||||
db->is_local = is_local;
|
db->is_local = is_local;
|
||||||
db->pgp_verify = PM_PGP_VERIFY_UNKNOWN;
|
db->pgp_verify = PM_PGP_VERIFY_UNKNOWN;
|
||||||
|
@ -309,7 +309,7 @@ pmdb_t *_alpm_db_new(const char *treename, int is_local)
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_db_free(pmdb_t *db)
|
void _alpm_db_free(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
/* cleanup pkgcache */
|
/* cleanup pkgcache */
|
||||||
_alpm_db_free_pkgcache(db);
|
_alpm_db_free_pkgcache(db);
|
||||||
|
@ -322,7 +322,7 @@ void _alpm_db_free(pmdb_t *db)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *_alpm_db_path(pmdb_t *db)
|
const char *_alpm_db_path(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
if(!db) {
|
if(!db) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -353,7 +353,7 @@ const char *_alpm_db_path(pmdb_t *db)
|
||||||
return db->_path;
|
return db->_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *_alpm_db_sig_path(pmdb_t *db)
|
char *_alpm_db_sig_path(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
char *sigpath;
|
char *sigpath;
|
||||||
size_t len;
|
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)
|
int _alpm_db_cmp(const void *d1, const void *d2)
|
||||||
{
|
{
|
||||||
pmdb_t *db1 = (pmdb_t *)d1;
|
alpm_db_t *db1 = (alpm_db_t *)d1;
|
||||||
pmdb_t *db2 = (pmdb_t *)d2;
|
alpm_db_t *db2 = (alpm_db_t *)d2;
|
||||||
return strcmp(db1->treename, db2->treename);
|
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;
|
const alpm_list_t *i, *j, *k;
|
||||||
alpm_list_t *ret = NULL;
|
alpm_list_t *ret = NULL;
|
||||||
|
@ -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.
|
/* Returns a new package cache from db.
|
||||||
* It frees the cache if it already exists.
|
* 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);
|
_alpm_db_free_pkgcache(db);
|
||||||
|
|
||||||
|
@ -467,7 +467,7 @@ static int load_pkgcache(pmdb_t *db)
|
||||||
return 0;
|
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)) {
|
if(db == NULL || !(db->status & DB_STATUS_PKGCACHE)) {
|
||||||
return;
|
return;
|
||||||
|
@ -484,7 +484,7 @@ void _alpm_db_free_pkgcache(pmdb_t *db)
|
||||||
_alpm_db_free_grpcache(db);
|
_alpm_db_free_grpcache(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db)
|
pmpkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -501,7 +501,7 @@ pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db)
|
||||||
return db->pkgcache;
|
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);
|
pmpkghash_t *hash = _alpm_db_get_pkgcache_hash(db);
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "duplicate" pkg then add it to pkgcache */
|
/* "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, pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
pmpkg_t *newpkg;
|
pmpkg_t *newpkg;
|
||||||
|
|
||||||
|
@ -535,7 +535,7 @@ int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
|
int _alpm_db_remove_pkgfromcache(alpm_db_t *db, pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
pmpkg_t *data = NULL;
|
pmpkg_t *data = NULL;
|
||||||
|
|
||||||
|
@ -561,7 +561,7 @@ int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target)
|
pmpkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target)
|
||||||
{
|
{
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return NULL;
|
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.
|
/* 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;
|
alpm_list_t *lp;
|
||||||
|
|
||||||
|
@ -627,7 +627,7 @@ static int load_grpcache(pmdb_t *db)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_db_free_grpcache(pmdb_t *db)
|
void _alpm_db_free_grpcache(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
alpm_list_t *lg;
|
alpm_list_t *lg;
|
||||||
|
|
||||||
|
@ -646,7 +646,7 @@ void _alpm_db_free_grpcache(pmdb_t *db)
|
||||||
db->status &= ~DB_STATUS_GRPCACHE;
|
db->status &= ~DB_STATUS_GRPCACHE;
|
||||||
}
|
}
|
||||||
|
|
||||||
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
|
alpm_list_t *_alpm_db_get_grpcache(alpm_db_t *db)
|
||||||
{
|
{
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -663,7 +663,7 @@ alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db)
|
||||||
return db->grpcache;
|
return db->grpcache;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target)
|
pmgrp_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
|
|
|
@ -51,12 +51,12 @@ enum _pmdbstatus_t {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct db_operations {
|
struct db_operations {
|
||||||
int (*populate) (pmdb_t *);
|
int (*populate) (alpm_db_t *);
|
||||||
void (*unregister) (pmdb_t *);
|
void (*unregister) (alpm_db_t *);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Database */
|
/* Database */
|
||||||
struct __pmdb_t {
|
struct __alpm_db_t {
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
char *treename;
|
char *treename;
|
||||||
/* do not access directly, use _alpm_db_path(db) for lazy access */
|
/* do not access directly, use _alpm_db_path(db) for lazy access */
|
||||||
|
@ -75,36 +75,36 @@ struct __pmdb_t {
|
||||||
|
|
||||||
|
|
||||||
/* db.c, database general calls */
|
/* db.c, database general calls */
|
||||||
pmdb_t *_alpm_db_new(const char *treename, int is_local);
|
alpm_db_t *_alpm_db_new(const char *treename, int is_local);
|
||||||
void _alpm_db_free(pmdb_t *db);
|
void _alpm_db_free(alpm_db_t *db);
|
||||||
const char *_alpm_db_path(pmdb_t *db);
|
const char *_alpm_db_path(alpm_db_t *db);
|
||||||
char *_alpm_db_sig_path(pmdb_t *db);
|
char *_alpm_db_sig_path(alpm_db_t *db);
|
||||||
int _alpm_db_cmp(const void *d1, const void *d2);
|
int _alpm_db_cmp(const void *d1, const void *d2);
|
||||||
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);
|
||||||
pmdb_t *_alpm_db_register_local(alpm_handle_t *handle);
|
alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle);
|
||||||
pmdb_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
|
||||||
pgp_verify_t level);
|
pgp_verify_t level);
|
||||||
void _alpm_db_unregister(pmdb_t *db);
|
void _alpm_db_unregister(alpm_db_t *db);
|
||||||
|
|
||||||
/* be_*.c, backend specific calls */
|
/* be_*.c, backend specific calls */
|
||||||
int _alpm_local_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
int _alpm_local_db_read(alpm_db_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
||||||
int _alpm_local_db_prepare(pmdb_t *db, pmpkg_t *info);
|
int _alpm_local_db_prepare(alpm_db_t *db, pmpkg_t *info);
|
||||||
int _alpm_local_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
int _alpm_local_db_write(alpm_db_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
|
||||||
int _alpm_local_db_remove(pmdb_t *db, pmpkg_t *info);
|
int _alpm_local_db_remove(alpm_db_t *db, pmpkg_t *info);
|
||||||
|
|
||||||
/* cache bullshit */
|
/* cache bullshit */
|
||||||
/* packages */
|
/* packages */
|
||||||
void _alpm_db_free_pkgcache(pmdb_t *db);
|
void _alpm_db_free_pkgcache(alpm_db_t *db);
|
||||||
int _alpm_db_add_pkgincache(pmdb_t *db, pmpkg_t *pkg);
|
int _alpm_db_add_pkgincache(alpm_db_t *db, pmpkg_t *pkg);
|
||||||
int _alpm_db_remove_pkgfromcache(pmdb_t *db, pmpkg_t *pkg);
|
int _alpm_db_remove_pkgfromcache(alpm_db_t *db, pmpkg_t *pkg);
|
||||||
pmpkghash_t *_alpm_db_get_pkgcache_hash(pmdb_t *db);
|
pmpkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db);
|
||||||
alpm_list_t *_alpm_db_get_pkgcache(pmdb_t *db);
|
alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db);
|
||||||
int _alpm_db_ensure_pkgcache(pmdb_t *db, pmdbinfrq_t infolevel);
|
int _alpm_db_ensure_pkgcache(alpm_db_t *db, pmdbinfrq_t infolevel);
|
||||||
pmpkg_t *_alpm_db_get_pkgfromcache(pmdb_t *db, const char *target);
|
pmpkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target);
|
||||||
/* groups */
|
/* groups */
|
||||||
void _alpm_db_free_grpcache(pmdb_t *db);
|
void _alpm_db_free_grpcache(alpm_db_t *db);
|
||||||
alpm_list_t *_alpm_db_get_grpcache(pmdb_t *db);
|
alpm_list_t *_alpm_db_get_grpcache(alpm_db_t *db);
|
||||||
pmgrp_t *_alpm_db_get_grpfromcache(pmdb_t *db, const char *target);
|
pmgrp_t *_alpm_db_get_grpfromcache(alpm_db_t *db, const char *target);
|
||||||
|
|
||||||
#endif /* _ALPM_DB_H */
|
#endif /* _ALPM_DB_H */
|
||||||
|
|
||||||
|
|
|
@ -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
|
* 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
|
* target list, or if if the package was explictly installed and
|
||||||
* include_explicit == 0 */
|
* 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, pmpkg_t *pkg, alpm_list_t *targets,
|
||||||
int include_explicit)
|
int include_explicit)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
@ -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 *targs pointer to a list of packages
|
||||||
* @param include_explicit if 0, explicitly installed packages are not included
|
* @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;
|
alpm_list_t *i, *j;
|
||||||
|
|
||||||
|
@ -649,7 +649,7 @@ static pmpkg_t *resolvedep(alpm_handle_t *handle, pmdepend_t *dep,
|
||||||
* providers. The first satisfier found is returned.
|
* providers. The first satisfier found is returned.
|
||||||
* The dependency can include versions with depmod operators.
|
* The dependency can include versions with depmod operators.
|
||||||
* @param handle the context handle
|
* @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
|
* @param depstring package or provision name, versioned or not
|
||||||
* @return a pmpkg_t* satisfying depstring
|
* @return a pmpkg_t* satisfying depstring
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -31,7 +31,7 @@ void _alpm_dep_free(pmdepend_t *dep);
|
||||||
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
pmdepend_t *_alpm_dep_dup(const pmdepend_t *dep);
|
||||||
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
void _alpm_depmiss_free(pmdepmissing_t *miss);
|
||||||
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
|
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
|
||||||
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);
|
||||||
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
|
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, pmpkg_t *pkg,
|
||||||
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
|
alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
|
||||||
alpm_list_t **data);
|
alpm_list_t **data);
|
||||||
|
|
|
@ -248,7 +248,7 @@ int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
|
||||||
return handle->checkspace;
|
return handle->checkspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdb_t SYMEXPORT *alpm_option_get_localdb(alpm_handle_t *handle)
|
alpm_db_t SYMEXPORT *alpm_option_get_localdb(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
return handle->db_local;
|
return handle->db_local;
|
||||||
|
|
|
@ -32,8 +32,8 @@
|
||||||
|
|
||||||
struct __alpm_handle_t {
|
struct __alpm_handle_t {
|
||||||
/* internal usage */
|
/* internal usage */
|
||||||
pmdb_t *db_local; /* local db pointer */
|
alpm_db_t *db_local; /* local db pointer */
|
||||||
alpm_list_t *dbs_sync; /* List of (pmdb_t *) */
|
alpm_list_t *dbs_sync; /* List of (alpm_db_t *) */
|
||||||
FILE *logstream; /* log file stream pointer */
|
FILE *logstream; /* log file stream pointer */
|
||||||
FILE *lckstream; /* lock file stream pointer if one exists */
|
FILE *lckstream; /* lock file stream pointer if one exists */
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
|
|
|
@ -323,7 +323,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_get_backup(pmpkg_t *pkg)
|
||||||
return pkg->ops->get_backup(pkg);
|
return pkg->ops->get_backup(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
pmdb_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
|
alpm_db_t SYMEXPORT *alpm_pkg_get_db(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(pkg != NULL, return NULL);
|
ASSERT(pkg != NULL, return NULL);
|
||||||
|
@ -372,7 +372,7 @@ int SYMEXPORT alpm_pkg_has_scriptlet(pmpkg_t *pkg)
|
||||||
return pkg->ops->has_scriptlet(pkg);
|
return pkg->ops->has_scriptlet(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void find_requiredby(pmpkg_t *pkg, pmdb_t *db, alpm_list_t **reqs)
|
static void find_requiredby(pmpkg_t *pkg, alpm_db_t *db, alpm_list_t **reqs)
|
||||||
{
|
{
|
||||||
const alpm_list_t *i;
|
const alpm_list_t *i;
|
||||||
pkg->handle->pm_errno = 0;
|
pkg->handle->pm_errno = 0;
|
||||||
|
@ -396,7 +396,7 @@ alpm_list_t SYMEXPORT *alpm_pkg_compute_requiredby(pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
const alpm_list_t *i;
|
const alpm_list_t *i;
|
||||||
alpm_list_t *reqs = NULL;
|
alpm_list_t *reqs = NULL;
|
||||||
pmdb_t *db;
|
alpm_db_t *db;
|
||||||
|
|
||||||
ASSERT(pkg != NULL, return NULL);
|
ASSERT(pkg != NULL, return NULL);
|
||||||
pkg->handle->pm_errno = 0;
|
pkg->handle->pm_errno = 0;
|
||||||
|
|
|
@ -116,7 +116,7 @@ struct __pmpkg_t {
|
||||||
/* origin == PKG_FROM_FILE, use pkg->origin_data.file
|
/* origin == PKG_FROM_FILE, use pkg->origin_data.file
|
||||||
* origin == PKG_FROM_*DB, use pkg->origin_data.db */
|
* origin == PKG_FROM_*DB, use pkg->origin_data.db */
|
||||||
union {
|
union {
|
||||||
pmdb_t *db;
|
alpm_db_t *db;
|
||||||
char *file;
|
char *file;
|
||||||
} origin_data;
|
} origin_data;
|
||||||
alpm_handle_t *handle;
|
alpm_handle_t *handle;
|
||||||
|
|
|
@ -138,7 +138,7 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
{
|
{
|
||||||
alpm_list_t *lp;
|
alpm_list_t *lp;
|
||||||
pmtrans_t *trans = handle->trans;
|
pmtrans_t *trans = handle->trans;
|
||||||
pmdb_t *db = handle->db_local;
|
alpm_db_t *db = handle->db_local;
|
||||||
|
|
||||||
if((trans->flags & PM_TRANS_FLAG_RECURSE) && !(trans->flags & PM_TRANS_FLAG_CASCADE)) {
|
if((trans->flags & PM_TRANS_FLAG_RECURSE) && !(trans->flags & PM_TRANS_FLAG_CASCADE)) {
|
||||||
_alpm_log(handle, PM_LOG_DEBUG, "finding removable dependencies\n");
|
_alpm_log(handle, PM_LOG_DEBUG, "finding removable dependencies\n");
|
||||||
|
|
|
@ -367,7 +367,7 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
|
||||||
*
|
*
|
||||||
* @return signature verification level
|
* @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) {
|
if(db->pgp_verify != PM_PGP_VERIFY_UNKNOWN) {
|
||||||
return db->pgp_verify;
|
return db->pgp_verify;
|
||||||
|
@ -395,7 +395,7 @@ int SYMEXPORT alpm_pkg_check_pgp_signature(pmpkg_t *pkg)
|
||||||
* @param db the database to check
|
* @param db the database to check
|
||||||
* @return a int value : 0 (valid), 1 (invalid), -1 (an error occurred)
|
* @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);
|
ASSERT(db != NULL, return -1);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
|
int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
|
||||||
const char *base64_sig);
|
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 */
|
#endif /* _ALPM_SIGNING_H */
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *k;
|
alpm_list_t *i, *j, *k;
|
||||||
pmtrans_t *trans;
|
pmtrans_t *trans;
|
||||||
pmdb_t *db_local;
|
alpm_db_t *db_local;
|
||||||
alpm_list_t *dbs_sync;
|
alpm_list_t *dbs_sync;
|
||||||
|
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
@ -109,7 +109,7 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
|
||||||
/* Search for literal then replacers in each sync database.
|
/* Search for literal then replacers in each sync database.
|
||||||
* If found, don't check other databases */
|
* If found, don't check other databases */
|
||||||
for(j = dbs_sync; j; j = j->next) {
|
for(j = dbs_sync; j; j = j->next) {
|
||||||
pmdb_t *sdb = j->data;
|
alpm_db_t *sdb = j->data;
|
||||||
/* Check sdb */
|
/* Check sdb */
|
||||||
pmpkg_t *spkg = _alpm_db_get_pkgfromcache(sdb, lpkg->name);
|
pmpkg_t *spkg = _alpm_db_get_pkgfromcache(sdb, lpkg->name);
|
||||||
if(spkg) {
|
if(spkg) {
|
||||||
|
@ -209,7 +209,7 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
|
||||||
/** Find group members across a list of databases.
|
/** Find group members across a list of databases.
|
||||||
* If a member exists in several databases, only the first database is used.
|
* If a member exists in several databases, only the first database is used.
|
||||||
* IgnorePkg is also handled.
|
* 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
|
* @pram name the name of the group
|
||||||
* @return the list of pmpkg_t * (caller is responsible for alpm_list_free)
|
* @return the list of pmpkg_t * (caller is responsible for alpm_list_free)
|
||||||
*/
|
*/
|
||||||
|
@ -219,7 +219,7 @@ alpm_list_t SYMEXPORT *alpm_find_grp_pkgs(alpm_list_t *dbs,
|
||||||
alpm_list_t *i, *j, *pkgs = NULL, *ignorelist = NULL;
|
alpm_list_t *i, *j, *pkgs = NULL, *ignorelist = NULL;
|
||||||
|
|
||||||
for(i = dbs; i; i = i->next) {
|
for(i = dbs; i; i = i->next) {
|
||||||
pmdb_t *db = i->data;
|
alpm_db_t *db = i->data;
|
||||||
pmgrp_t *grp = alpm_db_readgrp(db, name);
|
pmgrp_t *grp = alpm_db_readgrp(db, name);
|
||||||
|
|
||||||
if(!grp)
|
if(!grp)
|
||||||
|
@ -751,7 +751,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
||||||
|
|
||||||
/* group sync records by repository and download */
|
/* group sync records by repository and download */
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
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) {
|
for(j = handle->trans->add; j; j = j->next) {
|
||||||
pmpkg_t *spkg = j->data;
|
pmpkg_t *spkg = j->data;
|
||||||
|
@ -873,7 +873,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
|
|
||||||
filename = alpm_pkg_get_filename(spkg);
|
filename = alpm_pkg_get_filename(spkg);
|
||||||
filepath = _alpm_filecache_find(handle, filename);
|
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);
|
check_sig = _alpm_db_get_sigverify_level(sdb);
|
||||||
|
|
||||||
/* load the package file and replace pkgcache entry with it in the target list */
|
/* load the package file and replace pkgcache entry with it in the target list */
|
||||||
|
|
|
@ -60,7 +60,7 @@ int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, pmtransflag_t flags,
|
||||||
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1));
|
||||||
|
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
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)) {
|
if(!(db->status & DB_STATUS_VALID)) {
|
||||||
RET_ERR(handle, PM_ERR_DB_INVALID, -1);
|
RET_ERR(handle, PM_ERR_DB_INVALID, -1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -378,7 +378,7 @@ static int _parse_options(const char *key, char *value,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int _add_mirror(pmdb_t *db, char *value)
|
static int _add_mirror(alpm_db_t *db, char *value)
|
||||||
{
|
{
|
||||||
const char *dbname = alpm_db_get_name(db);
|
const char *dbname = alpm_db_get_name(db);
|
||||||
/* let's attempt a replacement for the current repo */
|
/* let's attempt a replacement for the current repo */
|
||||||
|
@ -535,7 +535,7 @@ static int finish_section(struct section_t *section, int parse_options)
|
||||||
{
|
{
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
pmdb_t *db;
|
alpm_db_t *db;
|
||||||
|
|
||||||
pm_printf(PM_LOG_DEBUG, "config: finish section '%s'\n", section->name);
|
pm_printf(PM_LOG_DEBUG, "config: finish section '%s'\n", section->name);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
int pacman_database(alpm_list_t *targets)
|
int pacman_database(alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
pmdb_t *db_local;
|
alpm_db_t *db_local;
|
||||||
int retval = 0;
|
int retval = 0;
|
||||||
alpm_pkgreason_t reason;
|
alpm_pkgreason_t reason;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@ int pacman_deptest(alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
alpm_list_t *deps = NULL;
|
alpm_list_t *deps = NULL;
|
||||||
pmdb_t *localdb = alpm_option_get_localdb(config->handle);
|
alpm_db_t *localdb = alpm_option_get_localdb(config->handle);
|
||||||
|
|
||||||
for(i = targets; i; i = alpm_list_next(i)) {
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
char *target = alpm_list_getdata(i);
|
char *target = alpm_list_getdata(i);
|
||||||
|
|
|
@ -113,7 +113,7 @@ static int query_fileowner(alpm_list_t *targets)
|
||||||
char *append;
|
char *append;
|
||||||
size_t max_length;
|
size_t max_length;
|
||||||
alpm_list_t *t;
|
alpm_list_t *t;
|
||||||
pmdb_t *db_local;
|
alpm_db_t *db_local;
|
||||||
|
|
||||||
/* This code is here for safety only */
|
/* This code is here for safety only */
|
||||||
if(targets == NULL) {
|
if(targets == NULL) {
|
||||||
|
@ -240,7 +240,7 @@ static int query_search(alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *searchlist;
|
alpm_list_t *i, *searchlist;
|
||||||
int freelist;
|
int freelist;
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
|
|
||||||
/* if we have a targets list, search for packages matching it */
|
/* if we have a targets list, search for packages matching it */
|
||||||
if(targets) {
|
if(targets) {
|
||||||
|
@ -299,7 +299,7 @@ static int query_group(alpm_list_t *targets)
|
||||||
alpm_list_t *i, *j;
|
alpm_list_t *i, *j;
|
||||||
char *grpname = NULL;
|
char *grpname = NULL;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
|
|
||||||
if(targets == NULL) {
|
if(targets == NULL) {
|
||||||
for(j = alpm_db_get_grpcache(db_local); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_grpcache(db_local); j; j = alpm_list_next(j)) {
|
||||||
|
@ -343,7 +343,7 @@ static int is_foreign(pmpkg_t *pkg)
|
||||||
|
|
||||||
int match = 0;
|
int match = 0;
|
||||||
for(j = sync_dbs; j; j = alpm_list_next(j)) {
|
for(j = sync_dbs; j; j = alpm_list_next(j)) {
|
||||||
pmdb_t *db = alpm_list_getdata(j);
|
alpm_db_t *db = alpm_list_getdata(j);
|
||||||
pmpkg_t *findpkg = alpm_db_get_pkg(db, pkgname);
|
pmpkg_t *findpkg = alpm_db_get_pkg(db, pkgname);
|
||||||
if(findpkg) {
|
if(findpkg) {
|
||||||
match = 1;
|
match = 1;
|
||||||
|
@ -483,7 +483,7 @@ int pacman_query(alpm_list_t *targets)
|
||||||
int match = 0;
|
int match = 0;
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
pmpkg_t *pkg = NULL;
|
pmpkg_t *pkg = NULL;
|
||||||
pmdb_t *db_local;
|
alpm_db_t *db_local;
|
||||||
|
|
||||||
/* First: operations that do not require targets */
|
/* First: operations that do not require targets */
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
static int remove_target(const char *target)
|
static int remove_target(const char *target)
|
||||||
{
|
{
|
||||||
pmpkg_t *info;
|
pmpkg_t *info;
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
alpm_list_t *p;
|
alpm_list_t *p;
|
||||||
|
|
||||||
if((info = alpm_db_get_pkg(db_local, target)) != NULL) {
|
if((info = alpm_db_get_pkg(db_local, target)) != NULL) {
|
||||||
|
|
|
@ -95,7 +95,7 @@ static int sync_cleandb(const char *dbpath, int keep_used)
|
||||||
len = strlen(dname);
|
len = strlen(dname);
|
||||||
char *dbname = strndup(dname, len - 3);
|
char *dbname = strndup(dname, len - 3);
|
||||||
for(i = syncdbs; i && !found; i = alpm_list_next(i)) {
|
for(i = syncdbs; i && !found; i = alpm_list_next(i)) {
|
||||||
pmdb_t *db = alpm_list_getdata(i);
|
alpm_db_t *db = alpm_list_getdata(i);
|
||||||
found = !strcmp(dbname, alpm_db_get_name(db));
|
found = !strcmp(dbname, alpm_db_get_name(db));
|
||||||
}
|
}
|
||||||
free(dbname);
|
free(dbname);
|
||||||
|
@ -146,7 +146,7 @@ static int sync_cleancache(int level)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
alpm_list_t *sync_dbs = alpm_option_get_syncdbs(config->handle);
|
alpm_list_t *sync_dbs = alpm_option_get_syncdbs(config->handle);
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
alpm_list_t *cachedirs = alpm_option_get_cachedirs(config->handle);
|
alpm_list_t *cachedirs = alpm_option_get_cachedirs(config->handle);
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ static int sync_cleancache(int level)
|
||||||
alpm_list_t *j;
|
alpm_list_t *j;
|
||||||
/* check if this package is in a sync DB */
|
/* check if this package is in a sync DB */
|
||||||
for(j = sync_dbs; j && delete; j = alpm_list_next(j)) {
|
for(j = sync_dbs; j && delete; j = alpm_list_next(j)) {
|
||||||
pmdb_t *db = alpm_list_getdata(j);
|
alpm_db_t *db = alpm_list_getdata(j);
|
||||||
pkg = alpm_db_get_pkg(db, local_name);
|
pkg = alpm_db_get_pkg(db, local_name);
|
||||||
if(pkg != NULL && alpm_pkg_vercmp(local_version,
|
if(pkg != NULL && alpm_pkg_vercmp(local_version,
|
||||||
alpm_pkg_get_version(pkg)) == 0) {
|
alpm_pkg_get_version(pkg)) == 0) {
|
||||||
|
@ -284,7 +284,7 @@ static int sync_synctree(int level, alpm_list_t *syncs)
|
||||||
int success = 0, ret;
|
int success = 0, ret;
|
||||||
|
|
||||||
for(i = syncs; i; i = alpm_list_next(i)) {
|
for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
pmdb_t *db = alpm_list_getdata(i);
|
alpm_db_t *db = alpm_list_getdata(i);
|
||||||
|
|
||||||
ret = alpm_db_update((level < 2 ? 0 : 1), db);
|
ret = alpm_db_update((level < 2 ? 0 : 1), db);
|
||||||
if(ret < 0) {
|
if(ret < 0) {
|
||||||
|
@ -308,7 +308,7 @@ static int sync_synctree(int level, alpm_list_t *syncs)
|
||||||
return (success > 0);
|
return (success > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void print_installed(pmdb_t *db_local, pmpkg_t *pkg)
|
static void print_installed(alpm_db_t *db_local, pmpkg_t *pkg)
|
||||||
{
|
{
|
||||||
const char *pkgname = alpm_pkg_get_name(pkg);
|
const char *pkgname = alpm_pkg_get_name(pkg);
|
||||||
const char *pkgver = alpm_pkg_get_version(pkg);
|
const char *pkgver = alpm_pkg_get_version(pkg);
|
||||||
|
@ -329,10 +329,10 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
alpm_list_t *i, *j, *ret;
|
alpm_list_t *i, *j, *ret;
|
||||||
int freelist;
|
int freelist;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
|
|
||||||
for(i = syncs; i; i = alpm_list_next(i)) {
|
for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
pmdb_t *db = alpm_list_getdata(i);
|
alpm_db_t *db = alpm_list_getdata(i);
|
||||||
/* if we have a targets list, search for packages matching it */
|
/* if we have a targets list, search for packages matching it */
|
||||||
if(targets) {
|
if(targets) {
|
||||||
ret = alpm_db_search(db, targets);
|
ret = alpm_db_search(db, targets);
|
||||||
|
@ -397,7 +397,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
for(i = targets; i; i = alpm_list_next(i)) {
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
const char *grpname = alpm_list_getdata(i);
|
const char *grpname = alpm_list_getdata(i);
|
||||||
for(j = syncs; j; j = alpm_list_next(j)) {
|
for(j = syncs; j; j = alpm_list_next(j)) {
|
||||||
pmdb_t *db = alpm_list_getdata(j);
|
alpm_db_t *db = alpm_list_getdata(j);
|
||||||
pmgrp_t *grp = alpm_db_readgrp(db, grpname);
|
pmgrp_t *grp = alpm_db_readgrp(db, grpname);
|
||||||
|
|
||||||
if(grp) {
|
if(grp) {
|
||||||
|
@ -415,7 +415,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(i = syncs; i; i = alpm_list_next(i)) {
|
for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
pmdb_t *db = alpm_list_getdata(i);
|
alpm_db_t *db = alpm_list_getdata(i);
|
||||||
|
|
||||||
for(j = alpm_db_get_grpcache(db); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_grpcache(db); j; j = alpm_list_next(j)) {
|
||||||
pmgrp_t *grp = alpm_list_getdata(j);
|
pmgrp_t *grp = alpm_list_getdata(j);
|
||||||
|
@ -451,7 +451,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
strncpy(target, i->data, 512);
|
strncpy(target, i->data, 512);
|
||||||
pkgstr = strchr(target, '/');
|
pkgstr = strchr(target, '/');
|
||||||
if(pkgstr) {
|
if(pkgstr) {
|
||||||
pmdb_t *db = NULL;
|
alpm_db_t *db = NULL;
|
||||||
repo = target;
|
repo = target;
|
||||||
*pkgstr = '\0';
|
*pkgstr = '\0';
|
||||||
++pkgstr;
|
++pkgstr;
|
||||||
|
@ -489,7 +489,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
pkgstr = target;
|
pkgstr = target;
|
||||||
|
|
||||||
for(j = syncs; j; j = alpm_list_next(j)) {
|
for(j = syncs; j; j = alpm_list_next(j)) {
|
||||||
pmdb_t *db = alpm_list_getdata(j);
|
alpm_db_t *db = alpm_list_getdata(j);
|
||||||
|
|
||||||
for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) {
|
for(k = alpm_db_get_pkgcache(db); k; k = alpm_list_next(k)) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(k);
|
pmpkg_t *pkg = alpm_list_getdata(k);
|
||||||
|
@ -510,7 +510,7 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for(i = syncs; i; i = alpm_list_next(i)) {
|
for(i = syncs; i; i = alpm_list_next(i)) {
|
||||||
pmdb_t *db = alpm_list_getdata(i);
|
alpm_db_t *db = alpm_list_getdata(i);
|
||||||
|
|
||||||
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(j);
|
pmpkg_t *pkg = alpm_list_getdata(j);
|
||||||
|
@ -525,15 +525,15 @@ static int sync_info(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
|
static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
{
|
{
|
||||||
alpm_list_t *i, *j, *ls = NULL;
|
alpm_list_t *i, *j, *ls = NULL;
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
|
|
||||||
if(targets) {
|
if(targets) {
|
||||||
for(i = targets; i; i = alpm_list_next(i)) {
|
for(i = targets; i; i = alpm_list_next(i)) {
|
||||||
const char *repo = alpm_list_getdata(i);
|
const char *repo = alpm_list_getdata(i);
|
||||||
pmdb_t *db = NULL;
|
alpm_db_t *db = NULL;
|
||||||
|
|
||||||
for(j = syncs; j; j = alpm_list_next(j)) {
|
for(j = syncs; j; j = alpm_list_next(j)) {
|
||||||
pmdb_t *d = alpm_list_getdata(j);
|
alpm_db_t *d = alpm_list_getdata(j);
|
||||||
|
|
||||||
if(strcmp(repo, alpm_db_get_name(d)) == 0) {
|
if(strcmp(repo, alpm_db_get_name(d)) == 0) {
|
||||||
db = d;
|
db = d;
|
||||||
|
@ -555,7 +555,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
}
|
}
|
||||||
|
|
||||||
for(i = ls; i; i = alpm_list_next(i)) {
|
for(i = ls; i; i = alpm_list_next(i)) {
|
||||||
pmdb_t *db = alpm_list_getdata(i);
|
alpm_db_t *db = alpm_list_getdata(i);
|
||||||
|
|
||||||
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
for(j = alpm_db_get_pkgcache(db); j; j = alpm_list_next(j)) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(j);
|
pmpkg_t *pkg = alpm_list_getdata(j);
|
||||||
|
@ -580,7 +580,7 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
|
||||||
|
|
||||||
static alpm_list_t *syncfirst(void) {
|
static alpm_list_t *syncfirst(void) {
|
||||||
alpm_list_t *i, *res = NULL;
|
alpm_list_t *i, *res = NULL;
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
alpm_list_t *syncdbs = alpm_option_get_syncdbs(config->handle);
|
alpm_list_t *syncdbs = alpm_option_get_syncdbs(config->handle);
|
||||||
|
|
||||||
for(i = config->syncfirst; i; i = alpm_list_next(i)) {
|
for(i = config->syncfirst; i; i = alpm_list_next(i)) {
|
||||||
|
@ -598,11 +598,11 @@ static alpm_list_t *syncfirst(void) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static pmdb_t *get_db(const char *dbname)
|
static alpm_db_t *get_db(const char *dbname)
|
||||||
{
|
{
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
for(i = alpm_option_get_syncdbs(config->handle); i; i = i->next) {
|
for(i = alpm_option_get_syncdbs(config->handle); i; i = i->next) {
|
||||||
pmdb_t *db = i->data;
|
alpm_db_t *db = i->data;
|
||||||
if(strcmp(alpm_db_get_name(db), dbname) == 0) {
|
if(strcmp(alpm_db_get_name(db), dbname) == 0) {
|
||||||
return db;
|
return db;
|
||||||
}
|
}
|
||||||
|
@ -705,7 +705,7 @@ static int process_target(char *target)
|
||||||
alpm_list_t *dblist = NULL;
|
alpm_list_t *dblist = NULL;
|
||||||
|
|
||||||
if(targname) {
|
if(targname) {
|
||||||
pmdb_t *db = NULL;
|
alpm_db_t *db = NULL;
|
||||||
|
|
||||||
*targname = '\0';
|
*targname = '\0';
|
||||||
targname++;
|
targname++;
|
||||||
|
|
|
@ -666,7 +666,7 @@ static alpm_list_t *create_verbose_row(pmpkg_t *pkg, int install)
|
||||||
double size;
|
double size;
|
||||||
const char *label;
|
const char *label;
|
||||||
alpm_list_t *ret = NULL;
|
alpm_list_t *ret = NULL;
|
||||||
pmdb_t *ldb = alpm_option_get_localdb(config->handle);
|
alpm_db_t *ldb = alpm_option_get_localdb(config->handle);
|
||||||
|
|
||||||
/* a row consists of the package name, */
|
/* a row consists of the package name, */
|
||||||
pm_asprintf(&str, "%s", alpm_pkg_get_name(pkg));
|
pm_asprintf(&str, "%s", alpm_pkg_get_name(pkg));
|
||||||
|
@ -700,7 +700,7 @@ void display_targets(const alpm_list_t *pkgs, int install)
|
||||||
const alpm_list_t *i;
|
const alpm_list_t *i;
|
||||||
off_t isize = 0, rsize = 0, dlsize = 0;
|
off_t isize = 0, rsize = 0, dlsize = 0;
|
||||||
alpm_list_t *j, *lp, *header = NULL, *targets = NULL;
|
alpm_list_t *j, *lp, *header = NULL, *targets = NULL;
|
||||||
pmdb_t *db_local = alpm_option_get_localdb(config->handle);
|
alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
|
||||||
|
|
||||||
if(!pkgs) {
|
if(!pkgs) {
|
||||||
return;
|
return;
|
||||||
|
@ -882,7 +882,7 @@ void print_packages(const alpm_list_t *packages)
|
||||||
/* %r : repo */
|
/* %r : repo */
|
||||||
if(strstr(temp,"%r")) {
|
if(strstr(temp,"%r")) {
|
||||||
const char *repo = "local";
|
const char *repo = "local";
|
||||||
pmdb_t *db = alpm_pkg_get_db(pkg);
|
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
||||||
if(db) {
|
if(db) {
|
||||||
repo = alpm_db_get_name(db);
|
repo = alpm_db_get_name(db);
|
||||||
}
|
}
|
||||||
|
@ -950,7 +950,7 @@ void select_display(const alpm_list_t *pkglist)
|
||||||
|
|
||||||
for (i = pkglist; i; i = i->next) {
|
for (i = pkglist; i; i = i->next) {
|
||||||
pmpkg_t *pkg = alpm_list_getdata(i);
|
pmpkg_t *pkg = alpm_list_getdata(i);
|
||||||
pmdb_t *db = alpm_pkg_get_db(pkg);
|
alpm_db_t *db = alpm_pkg_get_db(pkg);
|
||||||
|
|
||||||
if(!dbname)
|
if(!dbname)
|
||||||
dbname = alpm_db_get_name(db);
|
dbname = alpm_db_get_name(db);
|
||||||
|
|
|
@ -69,7 +69,7 @@ static void checkpkgs(alpm_list_t *pkglist)
|
||||||
|
|
||||||
static void checkdbs(const char *dbpath, alpm_list_t *dbnames) {
|
static void checkdbs(const char *dbpath, alpm_list_t *dbnames) {
|
||||||
char syncdbpath[PATH_MAX];
|
char syncdbpath[PATH_MAX];
|
||||||
pmdb_t *db = NULL;
|
alpm_db_t *db = NULL;
|
||||||
alpm_list_t *i;
|
alpm_list_t *i;
|
||||||
|
|
||||||
for(i = dbnames; i; i = alpm_list_next(i)) {
|
for(i = dbnames; i; i = alpm_list_next(i)) {
|
||||||
|
|
|
@ -129,7 +129,7 @@ static int checkconflicts(alpm_list_t *pkglist)
|
||||||
|
|
||||||
static int check_localdb(void) {
|
static int check_localdb(void) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
pmdb_t *db = NULL;
|
alpm_db_t *db = NULL;
|
||||||
alpm_list_t *pkglist;
|
alpm_list_t *pkglist;
|
||||||
|
|
||||||
ret = check_localdb_files();
|
ret = check_localdb_files();
|
||||||
|
@ -146,7 +146,7 @@ static int check_localdb(void) {
|
||||||
|
|
||||||
static int check_syncdbs(alpm_list_t *dbnames) {
|
static int check_syncdbs(alpm_list_t *dbnames) {
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
pmdb_t *db = NULL;
|
alpm_db_t *db = NULL;
|
||||||
alpm_list_t *i, *pkglist, *syncpkglist = NULL;
|
alpm_list_t *i, *pkglist, *syncpkglist = NULL;
|
||||||
|
|
||||||
for(i = dbnames; i; i = alpm_list_next(i)) {
|
for(i = dbnames; i; i = alpm_list_next(i)) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue