Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/libalpm/db.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libalpm/db.c')
-rw-r--r--lib/libalpm/db.c45
1 files changed, 2 insertions, 43 deletions
diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c
index 5632ffac..561967ce 100644
--- a/lib/libalpm/db.c
+++ b/lib/libalpm/db.c
@@ -85,9 +85,6 @@ static void _alpm_db_unregister(pmdb_t *db)
return;
}
- _alpm_log(PM_LOG_DEBUG, "closing database '%s'\n", db->treename);
- _alpm_db_close(db);
-
_alpm_log(PM_LOG_DEBUG, "unregistering database '%s'\n", db->treename);
_alpm_db_free(db);
}
@@ -263,7 +260,7 @@ pmpkg_t SYMEXPORT *alpm_db_get_pkg(pmdb_t *db, const char *name)
* @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 SYMEXPORT *alpm_db_getpkgcache(pmdb_t *db)
+alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
@@ -295,7 +292,7 @@ pmgrp_t SYMEXPORT *alpm_db_readgrp(pmdb_t *db, const char *name)
* @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 SYMEXPORT *alpm_db_getgrpcache(pmdb_t *db)
+alpm_list_t SYMEXPORT *alpm_db_get_grpcache(pmdb_t *db)
{
ALPM_LOG_FUNC;
@@ -431,10 +428,8 @@ alpm_list_t *_alpm_db_search(pmdb_t *db, const alpm_list_t *needles)
pmdb_t *_alpm_db_register_local(void)
{
- struct stat buf;
pmdb_t *db;
const char *dbpath;
- char path[PATH_MAX];
ALPM_LOG_FUNC;
@@ -445,40 +440,23 @@ pmdb_t *_alpm_db_register_local(void)
_alpm_log(PM_LOG_DEBUG, "registering local database\n");
- /* make sure the database directory exists */
dbpath = alpm_option_get_dbpath();
if(!dbpath) {
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
RET_ERR(PM_ERR_DB_OPEN, NULL);
}
- snprintf(path, PATH_MAX, "%slocal", dbpath);
- /* TODO this is rediculous, we try to do this even if we can't */
- if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
- _alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
- path);
- if(_alpm_makepath(path) != 0) {
- RET_ERR(PM_ERR_SYSTEM, NULL);
- }
- }
db = _alpm_db_new(dbpath, "local");
if(db == NULL) {
RET_ERR(PM_ERR_DB_CREATE, NULL);
}
- _alpm_log(PM_LOG_DEBUG, "opening database '%s'\n", db->treename);
- if(_alpm_db_open(db) == -1) {
- _alpm_db_free(db);
- RET_ERR(PM_ERR_DB_OPEN, NULL);
- }
-
handle->db_local = db;
return(db);
}
pmdb_t *_alpm_db_register_sync(const char *treename)
{
- struct stat buf;
pmdb_t *db;
const char *dbpath;
char path[PATH_MAX];
@@ -496,25 +474,12 @@ pmdb_t *_alpm_db_register_sync(const char *treename)
_alpm_log(PM_LOG_DEBUG, "registering sync database '%s'\n", treename);
- /* make sure the database directory exists */
dbpath = alpm_option_get_dbpath();
if(!dbpath) {
_alpm_log(PM_LOG_ERROR, _("database path is undefined\n"));
RET_ERR(PM_ERR_DB_OPEN, NULL);
}
/* all sync DBs now reside in the sync/ subdir of the dbpath */
- snprintf(path, PATH_MAX, "%ssync/%s", dbpath, treename);
- /* TODO this is rediculous, we try to do this even if we can't */
- if(stat(path, &buf) != 0 || !S_ISDIR(buf.st_mode)) {
- _alpm_log(PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
- path);
- if(_alpm_makepath(path) != 0) {
- RET_ERR(PM_ERR_SYSTEM, NULL);
- }
- }
-
- /* Ensure the db gets the real path. */
- path[0] = '\0';
snprintf(path, PATH_MAX, "%ssync/", dbpath);
db = _alpm_db_new(path, treename);
@@ -522,12 +487,6 @@ pmdb_t *_alpm_db_register_sync(const char *treename)
RET_ERR(PM_ERR_DB_CREATE, NULL);
}
- _alpm_log(PM_LOG_DEBUG, "opening database '%s'\n", db->treename);
- if(_alpm_db_open(db) == -1) {
- _alpm_db_free(db);
- RET_ERR(PM_ERR_DB_OPEN, NULL);
- }
-
handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
return(db);
}