summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/be_local.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-07-03 21:44:57 +0200
committerDan McGee <dan@archlinux.org>2011-07-03 21:44:57 +0200
commit1ce7f39ad73c5c96870c6036014afad3d49a8edf (patch)
tree616b3259a2a6c4bcad5a5433a02985352c60699d /lib/libalpm/be_local.c
parentc839415e3fb4bcde11de3cb7595cec93501bed13 (diff)
parentafc96f2ab3d05f14a73e81f871164f01423b5572 (diff)
downloadpacman-1ce7f39ad73c5c96870c6036014afad3d49a8edf.tar.gz
pacman-1ce7f39ad73c5c96870c6036014afad3d49a8edf.tar.xz
Merge remote-tracking branch 'allan/ALPM'
Conflicts: lib/libalpm/be_local.c lib/libalpm/be_package.c lib/libalpm/conflict.c lib/libalpm/diskspace.c lib/libalpm/dload.c lib/libalpm/remove.c
Diffstat (limited to 'lib/libalpm/be_local.c')
-rw-r--r--lib/libalpm/be_local.c60
1 files changed, 30 insertions, 30 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index f1056d40..70f242d2 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -280,15 +280,15 @@ static int checkdbdir(alpm_db_t *db)
const char *path = _alpm_db_path(db);
if(stat(path, &buf) != 0) {
- _alpm_log(db->handle, PM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
path);
if(_alpm_makepath(path) != 0) {
- RET_ERR(db->handle, PM_ERR_SYSTEM, -1);
+ RET_ERR(db->handle, ALPM_ERR_SYSTEM, -1);
}
} else if(!S_ISDIR(buf.st_mode)) {
- _alpm_log(db->handle, PM_LOG_WARNING, _("removing invalid database: %s\n"), path);
+ _alpm_log(db->handle, ALPM_LOG_WARNING, _("removing invalid database: %s\n"), path);
if(unlink(path) != 0 || _alpm_makepath(path) != 0) {
- RET_ERR(db->handle, PM_ERR_SYSTEM, -1);
+ RET_ERR(db->handle, ALPM_ERR_SYSTEM, -1);
}
}
return 0;
@@ -328,7 +328,7 @@ static int local_db_validate(alpm_db_t *db)
dbpath = _alpm_db_path(db);
if(dbpath == NULL) {
- RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
+ RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
}
dbdir = opendir(dbpath);
if(dbdir == NULL) {
@@ -337,7 +337,7 @@ static int local_db_validate(alpm_db_t *db)
db->status |= DB_STATUS_VALID;
return 0;
} else {
- RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
+ RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
}
}
@@ -355,7 +355,7 @@ static int local_db_validate(alpm_db_t *db)
snprintf(path, PATH_MAX, "%s%s/depends", dbpath, name);
if(access(path, F_OK) == 0) {
/* we found a depends file- bail */
- db->handle->pm_errno = PM_ERR_DB_VERSION;
+ db->handle->pm_errno = ALPM_ERR_DB_VERSION;
goto done;
}
}
@@ -392,10 +392,10 @@ static int local_db_populate(alpm_db_t *db)
/* no database existing yet is not an error */
return 0;
}
- RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
+ RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
}
if(fstat(dirfd(dbdir), &buf) != 0) {
- RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
+ RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
}
if(buf.st_nlink >= 2) {
est_count = buf.st_nlink;
@@ -419,7 +419,7 @@ static int local_db_populate(alpm_db_t *db)
db->pkgcache = _alpm_pkghash_create(est_count * 2);
if(db->pkgcache == NULL){
closedir(dbdir);
- RET_ERR(db->handle, PM_ERR_MEMORY, -1);
+ RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
}
while((ent = readdir(dbdir)) != NULL) {
@@ -437,12 +437,12 @@ static int local_db_populate(alpm_db_t *db)
pkg = _alpm_pkg_new();
if(pkg == NULL) {
closedir(dbdir);
- RET_ERR(db->handle, PM_ERR_MEMORY, -1);
+ RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
}
/* split the db entry name */
if(_alpm_splitname(name, &(pkg->name), &(pkg->version),
&(pkg->name_hash)) != 0) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("invalid name for database entry '%s'\n"),
name);
_alpm_pkg_free(pkg);
continue;
@@ -450,7 +450,7 @@ static int local_db_populate(alpm_db_t *db)
/* duplicated database entries are not allowed */
if(_alpm_pkghash_find(db->pkgcache, pkg->name)) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("duplicated database entry '%s'\n"), pkg->name);
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("duplicated database entry '%s'\n"), pkg->name);
_alpm_pkg_free(pkg);
continue;
}
@@ -462,13 +462,13 @@ static int local_db_populate(alpm_db_t *db)
/* explicitly read with only 'BASE' data, accessors will handle the rest */
if(local_db_read(pkg, INFRQ_BASE) == -1) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("corrupted database entry '%s'\n"), name);
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("corrupted database entry '%s'\n"), name);
_alpm_pkg_free(pkg);
continue;
}
/* add to the collection */
- _alpm_log(db->handle, PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
+ _alpm_log(db->handle, ALPM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
pkg->name, db->treename);
db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
count++;
@@ -478,7 +478,7 @@ static int local_db_populate(alpm_db_t *db)
if(count > 0) {
db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
}
- _alpm_log(db->handle, PM_LOG_DEBUG, "added %d packages to package cache for db '%s'\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG, "added %d packages to package cache for db '%s'\n",
count, db->treename);
return count;
@@ -493,7 +493,7 @@ static char *get_pkgpath(alpm_db_t *db, alpm_pkg_t *info)
dbpath = _alpm_db_path(db);
len = strlen(dbpath) + strlen(info->name) + strlen(info->version) + 3;
- MALLOC(pkgpath, len, RET_ERR(db->handle, PM_ERR_MEMORY, NULL));
+ MALLOC(pkgpath, len, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
sprintf(pkgpath, "%s%s-%s/", dbpath, info->name, info->version);
return pkgpath;
}
@@ -533,7 +533,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
/* already loaded all of this info, do nothing */
return 0;
}
- _alpm_log(db->handle, PM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
+ _alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x\n",
info->name, inforeq);
/* clear out 'line', to be certain - and to make valgrind happy */
@@ -543,7 +543,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
if(access(pkgpath, F_OK)) {
/* directory doesn't exist or can't be opened */
- _alpm_log(db->handle, PM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'\n",
info->name, info->version, db->treename);
goto error;
}
@@ -552,7 +552,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
if(inforeq & INFRQ_DESC && !(info->infolevel & INFRQ_DESC)) {
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(!feof(fp)) {
@@ -560,13 +560,13 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
if(strcmp(line, "%NAME%") == 0) {
READ_NEXT();
if(strcmp(line, info->name) != 0) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: name "
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: name "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%VERSION%") == 0) {
READ_NEXT();
if(strcmp(line, info->version) != 0) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("%s database is inconsistent: version "
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: version "
"mismatch on package %s\n"), db->treename, info->name);
}
} else if(strcmp(line, "%DESC%") == 0) {
@@ -625,7 +625,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
if(inforeq & INFRQ_FILES && !(info->infolevel & INFRQ_FILES)) {
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "r")) == NULL) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), path, strerror(errno));
goto error;
}
while(fgets(line, sizeof(line), fp)) {
@@ -689,7 +689,7 @@ int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info)
pkgpath = get_pkgpath(db, info);
if((retval = mkdir(pkgpath, 0755)) != 0) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("could not create directory %s: %s\n"),
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not create directory %s: %s\n"),
pkgpath, strerror(errno));
}
@@ -723,11 +723,11 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
/* DESC */
if(inforeq & INFRQ_DESC) {
- _alpm_log(db->handle, PM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s DESC information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sdesc", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s\n"),
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
path, strerror(errno));
retval = -1;
goto cleanup;
@@ -825,11 +825,11 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
/* FILES */
if(inforeq & INFRQ_FILES) {
- _alpm_log(db->handle, PM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
+ _alpm_log(db->handle, ALPM_LOG_DEBUG, "writing %s-%s FILES information back to db\n",
info->name, info->version);
snprintf(path, PATH_MAX, "%sfiles", pkgpath);
if((fp = fopen(path, "w")) == NULL) {
- _alpm_log(db->handle, PM_LOG_ERROR, _("could not open file %s: %s\n"),
+ _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"),
path, strerror(errno));
retval = -1;
goto cleanup;
@@ -893,11 +893,11 @@ alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle)
{
alpm_db_t *db;
- _alpm_log(handle, PM_LOG_DEBUG, "registering local database\n");
+ _alpm_log(handle, ALPM_LOG_DEBUG, "registering local database\n");
db = _alpm_db_new("local", 1);
if(db == NULL) {
- handle->pm_errno = PM_ERR_DB_CREATE;
+ handle->pm_errno = ALPM_ERR_DB_CREATE;
return NULL;
}
db->ops = &local_db_ops;