summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-03-03 08:13:59 +0000
committerAaron Griffin <aaron@archlinux.org>2007-03-03 08:13:59 +0000
commit7f5dada8851c3b40ba44ed92e46315cefa9006b2 (patch)
tree402349c1d0cb2e82a4606872954b4d46e4df10ed /lib/libalpm/db.c
parenta0dbade77420f6e83be1406ae67a99e337ce57ec (diff)
downloadpacman-7f5dada8851c3b40ba44ed92e46315cefa9006b2.tar.xz
Big commit this time:
* Moved entirely to alpm_pkg_get_* accessors, to read data on demand * Mostly removed the INFRQ_ parameters from outside the be_files backend (making the backend more extensible in the long run) * packages created from _alpm_db_scan now have the db and origin set (making accessors actually work for these packages) * removed _alpm_db_ensure_pkgcache * totally revamped the _alpm_checkconflicts function, making it cleaner and easier to read (and thus fix in the long run) - maintainable code ftw NOTE: feel free to rename the functions... I couldn't think of anything better * removed an extra loop in sync.c:find_replacements - no sense in looping over an entire DB while strcmp'ing the name, when we have get_pkgfromcache Other: * package struct "license" -> "licenses" * Created _alpm_sync_find (duplicate code in some places, find_pkginsync * Minor const correctness changes along the way * fixed a couple extra '/' pathing issues (non-issues really) * removed a duplicate pkg_cmp function
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index a44e079d..ab828614 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -71,7 +71,7 @@ pmdb_t *_alpm_db_new(const char *root, const char *dbpath, const char *treename)
FREE(db);
RET_ERR(PM_ERR_MEMORY, NULL);
}
- sprintf(db->path, "%s%s%s", root, dbpath, treename);
+ sprintf(db->path, "%s%s%s/", root, dbpath, treename);
STRNCPY(db->treename, treename, PATH_MAX);
@@ -115,23 +115,23 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, alpm_list_t *needles)
RET_ERR(PM_ERR_INVALID_REGEX, NULL);
}
- for(j = _alpm_db_get_pkgcache(db, INFRQ_DESC|INFRQ_DEPENDS); j; j = j->next) {
+ for(j = _alpm_db_get_pkgcache(db); j; j = j->next) {
pmpkg_t *pkg = j->data;
- char *matched = NULL;
+ const char *matched = NULL;
/* check name */
- if (regexec(&reg, pkg->name, 0, 0, 0) == 0) {
- matched = pkg->name;
+ if (regexec(&reg, alpm_pkg_get_name(pkg), 0, 0, 0) == 0) {
+ matched = alpm_pkg_get_name(pkg);
}
/* check desc */
- else if (regexec(&reg, pkg->desc, 0, 0, 0) == 0) {
- matched = pkg->desc;
+ else if (regexec(&reg, alpm_pkg_get_desc(pkg), 0, 0, 0) == 0) {
+ matched = alpm_pkg_get_desc(pkg);
}
/* check provides */
/* TODO: should we be doing this, and should we print something
* differently when we do match it since it isn't currently printed? */
else {
- for(k = pkg->provides; k; k = k->next) {
+ for(k = alpm_pkg_get_provides(pkg); k; k = k->next) {
if (regexec(&reg, k->data, 0, 0, 0) == 0) {
matched = k->data;
break;