Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-02-01 23:45:52 -0600
committerDan McGee <dan@archlinux.org>2012-02-06 05:49:52 -0600
commitb488f229d2ec4f2e4b9e746d68422460ca664715 (patch)
tree31604f41d7c3780d3b76ac4bb87c10e676a16c54 /src
parentf12effc6ff4605ea81b3b765ff1655107aad29d8 (diff)
ALPM API adjustments for sanity and consistency
This makes several small adjustments to our exposed method names, and in one case, parameters. The justification here is to make methods less odd in their naming convention. If a method takes an alpm_db_t argument, the method should be named 'alpm_db_*', but perhaps more importantly, if it doesn't take a database as the first parameter, it should not. Summary of changes: alpm_db_register_sync -> alpm_register_syncdb alpm_db_unregister_all -> alpm_unregister_all_syncdbs alpm_option_get_localdb -> aplpm_get_localdb alpm_option_get_syncdbs -> aplpm_get_syncdbs alpm_db_readgroup -> alpm_db_get_group alpm_db_set_pkgreason -> alpm_pkg_set_reason All methods keep the same argument list except for alpm_pkg_set_reason; there we drop the 'handle' argument as it can be retrieved from the passed in package object. Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src')
-rw-r--r--src/pacman/conf.c2
-rw-r--r--src/pacman/database.c4
-rw-r--r--src/pacman/deptest.c2
-rw-r--r--src/pacman/query.c14
-rw-r--r--src/pacman/remove.c4
-rw-r--r--src/pacman/sync.c22
-rw-r--r--src/pacman/util.c4
-rw-r--r--src/util/cleanupdelta.c2
-rw-r--r--src/util/pactree.c6
-rw-r--r--src/util/testdb.c4
10 files changed, 32 insertions, 32 deletions
diff --git a/src/pacman/conf.c b/src/pacman/conf.c
index e1bff189..bfa8cad6 100644
--- a/src/pacman/conf.c
+++ b/src/pacman/conf.c
@@ -664,7 +664,7 @@ static int finish_section(struct section_t *section, int parse_options)
}
/* if we are not looking at options sections only, register a db */
- db = alpm_db_register_sync(config->handle, section->name, section->siglevel);
+ db = alpm_register_syncdb(config->handle, section->name, section->siglevel);
if(db == NULL) {
pm_printf(ALPM_LOG_ERROR, _("could not register '%s' database (%s)\n"),
section->name, alpm_strerror(alpm_errno(config->handle)));
diff --git a/src/pacman/database.c b/src/pacman/database.c
index b9736618..f8795c04 100644
--- a/src/pacman/database.c
+++ b/src/pacman/database.c
@@ -61,11 +61,11 @@ int pacman_database(alpm_list_t *targets)
return 1;
}
- db_local = alpm_option_get_localdb(config->handle);
+ db_local = alpm_get_localdb(config->handle);
for(i = targets; i; i = alpm_list_next(i)) {
char *pkgname = i->data;
alpm_pkg_t *pkg = alpm_db_get_pkg(db_local, pkgname);
- if(!pkg || alpm_db_set_pkgreason(config->handle, pkg, reason)) {
+ if(!pkg || alpm_pkg_set_reason(pkg, reason)) {
pm_printf(ALPM_LOG_ERROR, _("could not set install reason for package %s (%s)\n"),
pkgname, alpm_strerror(alpm_errno(config->handle)));
retval = 1;
diff --git a/src/pacman/deptest.c b/src/pacman/deptest.c
index 63e7985d..ecca36ef 100644
--- a/src/pacman/deptest.c
+++ b/src/pacman/deptest.c
@@ -31,7 +31,7 @@ int pacman_deptest(alpm_list_t *targets)
{
alpm_list_t *i;
alpm_list_t *deps = NULL;
- alpm_db_t *localdb = alpm_option_get_localdb(config->handle);
+ alpm_db_t *localdb = alpm_get_localdb(config->handle);
for(i = targets; i; i = alpm_list_next(i)) {
char *target = i->data;
diff --git a/src/pacman/query.c b/src/pacman/query.c
index 66813e35..0a6891aa 100644
--- a/src/pacman/query.c
+++ b/src/pacman/query.c
@@ -132,7 +132,7 @@ static int query_fileowner(alpm_list_t *targets)
}
strcpy(path, root);
- db_local = alpm_option_get_localdb(config->handle);
+ db_local = alpm_get_localdb(config->handle);
for(t = targets; t; t = alpm_list_next(t)) {
char *filename, *dname, *rpath;
@@ -245,7 +245,7 @@ static int query_search(alpm_list_t *targets)
{
alpm_list_t *i, *searchlist;
int freelist;
- alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
/* if we have a targets list, search for packages matching it */
if(targets) {
@@ -304,7 +304,7 @@ static int query_group(alpm_list_t *targets)
alpm_list_t *i, *j;
const char *grpname = NULL;
int ret = 0;
- alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
if(targets == NULL) {
for(j = alpm_db_get_groupcache(db_local); j; j = alpm_list_next(j)) {
@@ -320,7 +320,7 @@ static int query_group(alpm_list_t *targets)
for(i = targets; i; i = alpm_list_next(i)) {
alpm_group_t *grp;
grpname = i->data;
- grp = alpm_db_readgroup(db_local, grpname);
+ grp = alpm_db_get_group(db_local, grpname);
if(grp) {
const alpm_list_t *p;
for(p = grp->packages; p; p = alpm_list_next(p)) {
@@ -344,7 +344,7 @@ static int is_foreign(alpm_pkg_t *pkg)
{
const char *pkgname = alpm_pkg_get_name(pkg);
alpm_list_t *j;
- alpm_list_t *sync_dbs = alpm_option_get_syncdbs(config->handle);
+ alpm_list_t *sync_dbs = alpm_get_syncdbs(config->handle);
int match = 0;
for(j = sync_dbs; j; j = alpm_list_next(j)) {
@@ -393,7 +393,7 @@ static int filter(alpm_pkg_t *pkg)
}
/* check if this pkg is outdated */
if(config->op_q_upgrade && (alpm_sync_newversion(pkg,
- alpm_option_get_syncdbs(config->handle)) == NULL)) {
+ alpm_get_syncdbs(config->handle)) == NULL)) {
return 0;
}
return 1;
@@ -512,7 +512,7 @@ int pacman_query(alpm_list_t *targets)
}
}
- db_local = alpm_option_get_localdb(config->handle);
+ db_local = alpm_get_localdb(config->handle);
/* operations on all packages in the local DB
* valid: no-op (plain -Q), list, info, check
diff --git a/src/pacman/remove.c b/src/pacman/remove.c
index 3de57695..d6378236 100644
--- a/src/pacman/remove.c
+++ b/src/pacman/remove.c
@@ -38,7 +38,7 @@ static int fnmatch_cmp(const void *pattern, const void *string)
static int remove_target(const char *target)
{
alpm_pkg_t *pkg;
- alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
alpm_list_t *p;
if((pkg = alpm_db_get_pkg(db_local, target)) != NULL) {
@@ -52,7 +52,7 @@ static int remove_target(const char *target)
}
/* fallback to group */
- alpm_group_t *grp = alpm_db_readgroup(db_local, target);
+ alpm_group_t *grp = alpm_db_get_group(db_local, target);
if(grp == NULL) {
pm_printf(ALPM_LOG_ERROR, "'%s': target not found\n", target);
return -1;
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index e22f94f7..700bb780 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -49,7 +49,7 @@ static int sync_cleandb(const char *dbpath, int keep_used)
return 1;
}
- syncdbs = alpm_option_get_syncdbs(config->handle);
+ syncdbs = alpm_get_syncdbs(config->handle);
rewinddir(dir);
/* step through the directory one file at a time */
@@ -147,8 +147,8 @@ static int sync_cleandb_all(void)
static int sync_cleancache(int level)
{
alpm_list_t *i;
- alpm_list_t *sync_dbs = alpm_option_get_syncdbs(config->handle);
- alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
+ alpm_list_t *sync_dbs = alpm_get_syncdbs(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
alpm_list_t *cachedirs = alpm_option_get_cachedirs(config->handle);
int ret = 0;
@@ -320,7 +320,7 @@ static int sync_search(alpm_list_t *syncs, alpm_list_t *targets)
alpm_list_t *i, *j, *ret;
int freelist;
int found = 0;
- alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
for(i = syncs; i; i = alpm_list_next(i)) {
alpm_db_t *db = i->data;
@@ -389,7 +389,7 @@ static int sync_group(int level, alpm_list_t *syncs, alpm_list_t *targets)
const char *grpname = i->data;
for(j = syncs; j; j = alpm_list_next(j)) {
alpm_db_t *db = j->data;
- alpm_group_t *grp = alpm_db_readgroup(db, grpname);
+ alpm_group_t *grp = alpm_db_get_group(db, grpname);
if(grp) {
/* get names of packages in group */
@@ -496,7 +496,7 @@ static int sync_info(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_db_t *db_local = alpm_option_get_localdb(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
if(targets) {
for(i = targets; i; i = alpm_list_next(i)) {
@@ -551,8 +551,8 @@ static int sync_list(alpm_list_t *syncs, alpm_list_t *targets)
static alpm_list_t *syncfirst(void) {
alpm_list_t *i, *res = NULL;
- alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
- alpm_list_t *syncdbs = alpm_option_get_syncdbs(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
+ alpm_list_t *syncdbs = alpm_get_syncdbs(config->handle);
for(i = config->syncfirst; i; i = alpm_list_next(i)) {
const char *pkgname = i->data;
@@ -572,7 +572,7 @@ static alpm_list_t *syncfirst(void) {
static alpm_db_t *get_db(const char *dbname)
{
alpm_list_t *i;
- for(i = alpm_option_get_syncdbs(config->handle); i; i = i->next) {
+ for(i = alpm_get_syncdbs(config->handle); i; i = i->next) {
alpm_db_t *db = i->data;
if(strcmp(alpm_db_get_name(db), dbname) == 0) {
return db;
@@ -709,7 +709,7 @@ static int process_target(const char *target, int error)
alpm_list_free(dblist);
} else {
targname = targstring;
- dblist = alpm_option_get_syncdbs(config->handle);
+ dblist = alpm_get_syncdbs(config->handle);
ret = process_targname(dblist, targname, error);
}
@@ -911,7 +911,7 @@ int pacman_sync(alpm_list_t *targets)
return 1;
}
- sync_dbs = alpm_option_get_syncdbs(config->handle);
+ sync_dbs = alpm_get_syncdbs(config->handle);
if(config->op_s_sync) {
/* grab a fresh package list */
diff --git a/src/pacman/util.c b/src/pacman/util.c
index 27efdb0a..49beb83d 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -104,7 +104,7 @@ int check_syncdbs(size_t need_repos, int check_valid)
{
int ret = 0;
alpm_list_t *i;
- alpm_list_t *sync_dbs = alpm_option_get_syncdbs(config->handle);
+ alpm_list_t *sync_dbs = alpm_get_syncdbs(config->handle);
if(need_repos && sync_dbs == NULL) {
pm_printf(ALPM_LOG_ERROR, _("no usable package repositories configured.\n"));
@@ -977,7 +977,7 @@ static int pkg_cmp(const void *p1, const void *p2)
void display_targets(void)
{
alpm_list_t *i, *targets = NULL;
- alpm_db_t *db_local = alpm_option_get_localdb(config->handle);
+ alpm_db_t *db_local = alpm_get_localdb(config->handle);
for(i = alpm_trans_get_add(config->handle); i; i = alpm_list_next(i)) {
alpm_pkg_t *pkg = i->data;
diff --git a/src/util/cleanupdelta.c b/src/util/cleanupdelta.c
index ea34fe7f..2f7720b5 100644
--- a/src/util/cleanupdelta.c
+++ b/src/util/cleanupdelta.c
@@ -71,7 +71,7 @@ static void checkdbs(alpm_list_t *dbnames) {
for(i = dbnames; i; i = alpm_list_next(i)) {
const char *dbname = i->data;
- db = alpm_db_register_sync(handle, dbname, level);
+ db = alpm_register_syncdb(handle, dbname, level);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database '%s' (%s)\n",
dbname, alpm_strerror(alpm_errno(handle)));
diff --git a/src/util/pactree.c b/src/util/pactree.c
index 0adc2ea8..a7dab9f1 100644
--- a/src/util/pactree.c
+++ b/src/util/pactree.c
@@ -184,7 +184,7 @@ static int register_syncs(void) {
section = strndup(&line[1], linelen - 2);
if(section && strcmp(section, "options") != 0) {
- alpm_db_register_sync(handle, section, level);
+ alpm_register_syncdb(handle, section, level);
}
}
}
@@ -468,9 +468,9 @@ int main(int argc, char *argv[])
ret = 1;
goto finish;
}
- dblist = alpm_option_get_syncdbs(handle);
+ dblist = alpm_get_syncdbs(handle);
} else {
- dblist = alpm_list_add(dblist, alpm_option_get_localdb(handle));
+ dblist = alpm_list_add(dblist, alpm_get_localdb(handle));
freelist = 1;
}
diff --git a/src/util/testdb.c b/src/util/testdb.c
index c12aee04..f3a7b659 100644
--- a/src/util/testdb.c
+++ b/src/util/testdb.c
@@ -207,7 +207,7 @@ static int check_localdb(void)
return ret;
}
- db = alpm_option_get_localdb(handle);
+ db = alpm_get_localdb(handle);
pkglist = alpm_db_get_pkgcache(db);
ret += check_deps(pkglist);
ret += check_conflicts(pkglist);
@@ -224,7 +224,7 @@ static int check_syncdbs(alpm_list_t *dbnames)
for(i = dbnames; i; i = alpm_list_next(i)) {
const char *dbname = i->data;
- db = alpm_db_register_sync(handle, dbname, level);
+ db = alpm_register_syncdb(handle, dbname, level);
if(db == NULL) {
fprintf(stderr, "error: could not register sync database (%s)\n",
alpm_strerror(alpm_errno(handle)));