diff options
author | Allan McRae <allan@archlinux.org> | 2011-07-01 18:01:39 +0200 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2011-07-01 18:01:39 +0200 |
commit | afc96f2ab3d05f14a73e81f871164f01423b5572 (patch) | |
tree | 16ff0c0f2390b51ed43cfaa1a9ec508678793ec6 /lib | |
parent | bd88a8d5511c24db55dd2a5c04161918571dbfbd (diff) | |
download | pacman-afc96f2ab3d05f14a73e81f871164f01423b5572.tar.gz pacman-afc96f2ab3d05f14a73e81f871164f01423b5572.tar.xz |
Prefix _alpm_errno_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/add.c | 26 | ||||
-rw-r--r-- | lib/libalpm/alpm.c | 2 | ||||
-rw-r--r-- | lib/libalpm/alpm.h | 102 | ||||
-rw-r--r-- | lib/libalpm/be_local.c | 22 | ||||
-rw-r--r-- | lib/libalpm/be_package.c | 28 | ||||
-rw-r--r-- | lib/libalpm/be_sync.c | 28 | ||||
-rw-r--r-- | lib/libalpm/conflict.c | 6 | ||||
-rw-r--r-- | lib/libalpm/db.c | 38 | ||||
-rw-r--r-- | lib/libalpm/deps.c | 8 | ||||
-rw-r--r-- | lib/libalpm/diskspace.c | 12 | ||||
-rw-r--r-- | lib/libalpm/dload.c | 12 | ||||
-rw-r--r-- | lib/libalpm/error.c | 102 | ||||
-rw-r--r-- | lib/libalpm/handle.c | 24 | ||||
-rw-r--r-- | lib/libalpm/log.c | 6 | ||||
-rw-r--r-- | lib/libalpm/package.c | 4 | ||||
-rw-r--r-- | lib/libalpm/remove.c | 16 | ||||
-rw-r--r-- | lib/libalpm/signing.c | 22 | ||||
-rw-r--r-- | lib/libalpm/sync.c | 30 | ||||
-rw-r--r-- | lib/libalpm/trans.c | 38 | ||||
-rw-r--r-- | lib/libalpm/util.c | 4 |
20 files changed, 265 insertions, 265 deletions
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index a0e5f1db..9ed4d818 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -58,12 +58,12 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg) /* Sanity checks */ CHECK_HANDLE(handle, return -1); - ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); - ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); + ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); trans = handle->trans; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); ASSERT(trans->state == STATE_INITIALIZED, - RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1)); + RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1)); pkgname = pkg->name; pkgver = pkg->version; @@ -71,7 +71,7 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg) _alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname); if(_alpm_pkg_find(trans->add, pkgname)) { - RET_ERR(handle, PM_ERR_TRANS_DUP_TARGET, -1); + RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1); } local = _alpm_db_get_pkgfromcache(handle->db_local, pkgname); @@ -278,7 +278,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, /* we need access to the original entryname later after calls to * archive_entry_set_pathname(), so we need to dupe it and free() later */ - STRDUP(entryname_orig, entryname, RET_ERR(handle, PM_ERR_MEMORY, -1)); + STRDUP(entryname_orig, entryname, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); if(needbackup) { char checkfile[PATH_MAX]; @@ -305,7 +305,7 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive, if(!backup->name || strcmp(backup->name, entryname_orig) != 0) { continue; } - STRDUP(newhash, hash_pkg, RET_ERR(handle, PM_ERR_MEMORY, -1)); + STRDUP(newhash, hash_pkg, RET_ERR(handle, ALPM_ERR_MEMORY, -1)); FREE(backup->hash); backup->hash = newhash; } @@ -507,7 +507,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, if(oldpkg) { /* set up fake remove transaction */ if(_alpm_upgraderemove_package(handle, oldpkg, newpkg) == -1) { - handle->pm_errno = PM_ERR_TRANS_ABORT; + handle->pm_errno = ALPM_ERR_TRANS_ABORT; ret = -1; goto cleanup; } @@ -518,7 +518,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, if(_alpm_local_db_prepare(db, newpkg)) { alpm_logaction(handle, "error: could not create database entry %s-%s\n", alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); - handle->pm_errno = PM_ERR_DB_WRITE; + handle->pm_errno = ALPM_ERR_DB_WRITE; ret = -1; goto cleanup; } @@ -532,7 +532,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, _alpm_log(handle, ALPM_LOG_DEBUG, "extracting files\n"); if((archive = archive_read_new()) == NULL) { - handle->pm_errno = PM_ERR_LIBARCHIVE; + handle->pm_errno = ALPM_ERR_LIBARCHIVE; ret = -1; goto cleanup; } @@ -543,7 +543,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, _alpm_log(handle, ALPM_LOG_DEBUG, "archive: %s\n", newpkg->origin_data.file); if(archive_read_open_filename(archive, newpkg->origin_data.file, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { - handle->pm_errno = PM_ERR_PKG_OPEN; + handle->pm_errno = ALPM_ERR_PKG_OPEN; ret = -1; goto cleanup; } @@ -638,7 +638,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg, alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); alpm_logaction(handle, "error: could not update database entry %s-%s\n", alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg)); - handle->pm_errno = PM_ERR_DB_WRITE; + handle->pm_errno = ALPM_ERR_DB_WRITE; ret = -1; goto cleanup; } @@ -705,7 +705,7 @@ int _alpm_upgrade_packages(alpm_handle_t *handle) if(commit_single_pkg(handle, newpkg, pkg_current, pkg_count)) { /* something screwed up on the commit, abort the trans */ trans->state = STATE_INTERRUPTED; - handle->pm_errno = PM_ERR_TRANS_ABORT; + handle->pm_errno = ALPM_ERR_TRANS_ABORT; /* running ldconfig at this point could possibly screw system */ skip_ldconfig = 1; ret = -1; diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 7780c1fd..585c6a82 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -55,7 +55,7 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath, alpm_handle_t *myhandle = _alpm_handle_new(); if(myhandle == NULL) { - myerr = PM_ERR_MEMORY; + myerr = ALPM_ERR_MEMORY; goto cleanup; } if((myerr = _alpm_set_directory_option(root, &(myhandle->root), 1))) { diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index b891e453..8d458c3e 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -1000,67 +1000,67 @@ char *alpm_compute_md5sum(const char *name); * @{ */ enum _alpm_errno_t { - PM_ERR_MEMORY = 1, - PM_ERR_SYSTEM, - PM_ERR_BADPERMS, - PM_ERR_NOT_A_FILE, - PM_ERR_NOT_A_DIR, - PM_ERR_WRONG_ARGS, - PM_ERR_DISK_SPACE, + ALPM_ERR_MEMORY = 1, + ALPM_ERR_SYSTEM, + ALPM_ERR_BADPERMS, + ALPM_ERR_NOT_A_FILE, + ALPM_ERR_NOT_A_DIR, + ALPM_ERR_WRONG_ARGS, + ALPM_ERR_DISK_SPACE, /* Interface */ - PM_ERR_HANDLE_NULL, - PM_ERR_HANDLE_NOT_NULL, - PM_ERR_HANDLE_LOCK, + ALPM_ERR_HANDLE_NULL, + ALPM_ERR_HANDLE_NOT_NULL, + ALPM_ERR_HANDLE_LOCK, /* Databases */ - PM_ERR_DB_OPEN, - PM_ERR_DB_CREATE, - PM_ERR_DB_NULL, - PM_ERR_DB_NOT_NULL, - PM_ERR_DB_NOT_FOUND, - PM_ERR_DB_INVALID, - PM_ERR_DB_VERSION, - PM_ERR_DB_WRITE, - PM_ERR_DB_REMOVE, + ALPM_ERR_DB_OPEN, + ALPM_ERR_DB_CREATE, + ALPM_ERR_DB_NULL, + ALPM_ERR_DB_NOT_NULL, + ALPM_ERR_DB_NOT_FOUND, + ALPM_ERR_DB_INVALID, + ALPM_ERR_DB_VERSION, + ALPM_ERR_DB_WRITE, + ALPM_ERR_DB_REMOVE, /* Servers */ - PM_ERR_SERVER_BAD_URL, - PM_ERR_SERVER_NONE, + ALPM_ERR_SERVER_BAD_URL, + ALPM_ERR_SERVER_NONE, /* Transactions */ - PM_ERR_TRANS_NOT_NULL, - PM_ERR_TRANS_NULL, - PM_ERR_TRANS_DUP_TARGET, - PM_ERR_TRANS_NOT_INITIALIZED, - PM_ERR_TRANS_NOT_PREPARED, - PM_ERR_TRANS_ABORT, - PM_ERR_TRANS_TYPE, - PM_ERR_TRANS_NOT_LOCKED, + ALPM_ERR_TRANS_NOT_NULL, + ALPM_ERR_TRANS_NULL, + ALPM_ERR_TRANS_DUP_TARGET, + ALPM_ERR_TRANS_NOT_INITIALIZED, + ALPM_ERR_TRANS_NOT_PREPARED, + ALPM_ERR_TRANS_ABORT, + ALPM_ERR_TRANS_TYPE, + ALPM_ERR_TRANS_NOT_LOCKED, /* Packages */ - PM_ERR_PKG_NOT_FOUND, - PM_ERR_PKG_IGNORED, - PM_ERR_PKG_INVALID, - PM_ERR_PKG_OPEN, - PM_ERR_PKG_CANT_REMOVE, - PM_ERR_PKG_INVALID_NAME, - PM_ERR_PKG_INVALID_ARCH, - PM_ERR_PKG_REPO_NOT_FOUND, + ALPM_ERR_PKG_NOT_FOUND, + ALPM_ERR_PKG_IGNORED, + ALPM_ERR_PKG_INVALID, + ALPM_ERR_PKG_OPEN, + ALPM_ERR_PKG_CANT_REMOVE, + ALPM_ERR_PKG_INVALID_NAME, + ALPM_ERR_PKG_INVALID_ARCH, + ALPM_ERR_PKG_REPO_NOT_FOUND, /* Signatures */ - PM_ERR_SIG_MISSINGDIR, - PM_ERR_SIG_INVALID, - PM_ERR_SIG_UNKNOWN, + ALPM_ERR_SIG_MISSINGDIR, + ALPM_ERR_SIG_INVALID, + ALPM_ERR_SIG_UNKNOWN, /* Deltas */ - PM_ERR_DLT_INVALID, - PM_ERR_DLT_PATCHFAILED, + ALPM_ERR_DLT_INVALID, + ALPM_ERR_DLT_PATCHFAILED, /* Dependencies */ - PM_ERR_UNSATISFIED_DEPS, - PM_ERR_CONFLICTING_DEPS, - PM_ERR_FILE_CONFLICTS, + ALPM_ERR_UNSATISFIED_DEPS, + ALPM_ERR_CONFLICTING_DEPS, + ALPM_ERR_FILE_CONFLICTS, /* Misc */ - PM_ERR_RETRIEVE, - PM_ERR_INVALID_REGEX, + ALPM_ERR_RETRIEVE, + ALPM_ERR_INVALID_REGEX, /* External library errors */ - PM_ERR_LIBARCHIVE, - PM_ERR_LIBCURL, - PM_ERR_EXTERNAL_DOWNLOAD, - PM_ERR_GPGME + ALPM_ERR_LIBARCHIVE, + ALPM_ERR_LIBCURL, + ALPM_ERR_EXTERNAL_DOWNLOAD, + ALPM_ERR_GPGME }; /** Returns the current error code from the handle. */ diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index a98b1bba..304a5a13 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -283,12 +283,12 @@ static int checkdbdir(alpm_db_t *db) _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, 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,7 +437,7 @@ 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), @@ -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; } @@ -928,7 +928,7 @@ alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle) 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; diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c index 57f01233..16132144 100644 --- a/lib/libalpm/be_package.c +++ b/lib/libalpm/be_package.c @@ -52,7 +52,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg) const char *pkgfile = pkg->origin_data.file; if((archive = archive_read_new()) == NULL) { - RET_ERR(pkg->handle, PM_ERR_LIBARCHIVE, NULL); + RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, NULL); } archive_read_support_compression_all(archive); @@ -60,7 +60,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg) if(archive_read_open_filename(archive, pkgfile, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { - RET_ERR(pkg->handle, PM_ERR_PKG_OPEN, NULL); + RET_ERR(pkg->handle, ALPM_ERR_PKG_OPEN, NULL); } while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) { @@ -92,7 +92,7 @@ static size_t _package_changelog_read(void *ptr, size_t size, ssize_t sret = archive_read_data((struct archive *)fp, ptr, size); /* Report error (negative values) */ if(sret < 0) { - RET_ERR(pkg->handle, PM_ERR_LIBARCHIVE, 0); + RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, 0); } else { return (size_t)sret; } @@ -244,20 +244,20 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, size_t files_count = 0; if(pkgfile == NULL || strlen(pkgfile) == 0) { - RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL); + RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL); } /* attempt to stat the package file, ensure it exists */ if(stat(pkgfile, &st) == 0) { newpkg = _alpm_pkg_new(); if(newpkg == NULL) { - RET_ERR(handle, PM_ERR_MEMORY, NULL); + RET_ERR(handle, ALPM_ERR_MEMORY, NULL); } newpkg->filename = strdup(pkgfile); newpkg->size = st.st_size; } else { /* couldn't stat the pkgfile, return an error */ - RET_ERR(handle, PM_ERR_PKG_OPEN, NULL); + RET_ERR(handle, ALPM_ERR_PKG_OPEN, NULL); } /* first steps- validate the package file */ @@ -266,7 +266,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, _alpm_log(handle, ALPM_LOG_DEBUG, "checking md5sum for %s\n", pkgfile); if(_alpm_test_md5sum(pkgfile, md5sum) != 0) { alpm_pkg_free(newpkg); - RET_ERR(handle, PM_ERR_PKG_INVALID, NULL); + RET_ERR(handle, ALPM_ERR_PKG_INVALID, NULL); } } @@ -277,14 +277,14 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) || (check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) { alpm_pkg_free(newpkg); - RET_ERR(handle, PM_ERR_SIG_INVALID, NULL); + RET_ERR(handle, ALPM_ERR_SIG_INVALID, NULL); } } /* next- try to create an archive object to read in the package */ if((archive = archive_read_new()) == NULL) { alpm_pkg_free(newpkg); - RET_ERR(handle, PM_ERR_LIBARCHIVE, NULL); + RET_ERR(handle, ALPM_ERR_LIBARCHIVE, NULL); } archive_read_support_compression_all(archive); @@ -293,7 +293,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, if(archive_read_open_filename(archive, pkgfile, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { alpm_pkg_free(newpkg); - RET_ERR(handle, PM_ERR_PKG_OPEN, NULL); + RET_ERR(handle, ALPM_ERR_PKG_OPEN, NULL); } _alpm_log(handle, ALPM_LOG_DEBUG, "starting package load for %s\n", pkgfile); @@ -335,7 +335,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, if(archive_read_data_skip(archive)) { _alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"), pkgfile, archive_error_string(archive)); - handle->pm_errno = PM_ERR_LIBARCHIVE; + handle->pm_errno = ALPM_ERR_LIBARCHIVE; goto error; } @@ -348,7 +348,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */ _alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"), pkgfile, archive_error_string(archive)); - handle->pm_errno = PM_ERR_LIBARCHIVE; + handle->pm_errno = ALPM_ERR_LIBARCHIVE; goto error; } @@ -379,7 +379,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile, return newpkg; pkg_invalid: - handle->pm_errno = PM_ERR_PKG_INVALID; + handle->pm_errno = ALPM_ERR_PKG_INVALID; error: _alpm_pkg_free(newpkg); archive_read_finish(archive); @@ -391,7 +391,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful pgp_verify_t check_sig, alpm_pkg_t **pkg) { CHECK_HANDLE(handle, return -1); - ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); *pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, check_sig); if(*pkg == NULL) { diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 3f24b3fa..cda1e097 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -46,7 +46,7 @@ static char *get_sync_dir(alpm_handle_t *handle) char *syncpath; struct stat buf; - MALLOC(syncpath, len, RET_ERR(handle, PM_ERR_MEMORY, NULL)); + MALLOC(syncpath, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); sprintf(syncpath, "%s%s", dbpath, "sync/"); if(stat(syncpath, &buf) != 0) { @@ -54,13 +54,13 @@ static char *get_sync_dir(alpm_handle_t *handle) syncpath); if(_alpm_makepath(syncpath) != 0) { free(syncpath); - RET_ERR(handle, PM_ERR_SYSTEM, NULL); + RET_ERR(handle, ALPM_ERR_SYSTEM, NULL); } } else if(!S_ISDIR(buf.st_mode)) { _alpm_log(handle, ALPM_LOG_WARNING, _("removing invalid file: %s\n"), syncpath); if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) { free(syncpath); - RET_ERR(handle, PM_ERR_SYSTEM, NULL); + RET_ERR(handle, ALPM_ERR_SYSTEM, NULL); } } @@ -98,7 +98,7 @@ static int sync_db_validate(alpm_db_t *db) ret = _alpm_gpgme_checksig(db->handle, dbpath, NULL); if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) || (check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) { - RET_ERR(db->handle, PM_ERR_SIG_INVALID, -1); + RET_ERR(db->handle, ALPM_ERR_SIG_INVALID, -1); } } @@ -155,8 +155,8 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) ASSERT(db != NULL, return -1); handle = db->handle; handle->pm_errno = 0; - ASSERT(db != handle->db_local, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); - ASSERT(db->servers != NULL, RET_ERR(handle, PM_ERR_SERVER_NONE, -1)); + ASSERT(db != handle->db_local, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); + ASSERT(db->servers != NULL, RET_ERR(handle, ALPM_ERR_SERVER_NONE, -1)); syncpath = get_sync_dir(handle); if(!syncpath) { @@ -170,7 +170,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) /* attempt to grab a lock */ if(_alpm_handle_lock(handle)) { - RET_ERR(handle, PM_ERR_HANDLE_LOCK, -1); + RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1); } for(i = db->servers; i; i = i->next) { @@ -181,7 +181,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db) /* print server + filename into a buffer (leave space for .sig) */ len = strlen(server) + strlen(db->treename) + 9; - CALLOC(fileurl, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, -1)); + CALLOC(fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(fileurl, len, "%s/%s.db", server, db->treename); ret = _alpm_download(handle, fileurl, syncpath, force, 0, 0); @@ -277,7 +277,7 @@ static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname, if(pkg == NULL) { pkg = _alpm_pkg_new(); if(pkg == NULL) { - RET_ERR(db->handle, PM_ERR_MEMORY, NULL); + RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL); } pkg->name = pkgname; @@ -371,7 +371,7 @@ static int sync_db_populate(alpm_db_t *db) alpm_pkg_t *pkg = NULL; if((archive = archive_read_new()) == NULL) { - RET_ERR(db->handle, PM_ERR_LIBARCHIVE, -1); + RET_ERR(db->handle, ALPM_ERR_LIBARCHIVE, -1); } archive_read_support_compression_all(archive); @@ -390,17 +390,17 @@ static int sync_db_populate(alpm_db_t *db) _alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), dbpath, archive_error_string(archive)); archive_read_finish(archive); - RET_ERR(db->handle, PM_ERR_DB_OPEN, -1); + RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1); } if(stat(dbpath, &buf) != 0) { - RET_ERR(db->handle, PM_ERR_DB_OPEN, -1); + RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1); } est_count = estimate_package_count(&buf, archive); /* initialize hash at 66% full */ db->pkgcache = _alpm_pkghash_create(est_count * 3 / 2); if(db->pkgcache == NULL) { - RET_ERR(db->handle, PM_ERR_MEMORY, -1); + RET_ERR(db->handle, ALPM_ERR_MEMORY, -1); } while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) { @@ -594,7 +594,7 @@ alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename, db = _alpm_db_new(treename, 0); if(db == NULL) { - RET_ERR(handle, PM_ERR_DB_CREATE, NULL); + RET_ERR(handle, ALPM_ERR_DB_CREATE, NULL); } db->ops = &sync_db_ops; db->handle = handle; diff --git a/lib/libalpm/conflict.c b/lib/libalpm/conflict.c index af1bce15..ad689dcf 100644 --- a/lib/libalpm/conflict.c +++ b/lib/libalpm/conflict.c @@ -303,7 +303,7 @@ static alpm_list_t *add_fileconflict(alpm_handle_t *handle, return conflicts; error: - RET_ERR(handle, PM_ERR_MEMORY, conflicts); + RET_ERR(handle, ALPM_ERR_MEMORY, conflicts); } void _alpm_fileconflict_free(alpm_fileconflict_t *conflict) @@ -409,7 +409,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, conflicts = add_fileconflict(handle, conflicts, ALPM_FILECONFLICT_TARGET, path, alpm_pkg_get_name(p1), alpm_pkg_get_name(p2)); - if(handle->pm_errno == PM_ERR_MEMORY) { + if(handle->pm_errno == ALPM_ERR_MEMORY) { FREELIST(conflicts); FREELIST(common_files); return NULL; @@ -535,7 +535,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle, if(!resolved_conflict) { conflicts = add_fileconflict(handle, conflicts, ALPM_FILECONFLICT_FILESYSTEM, path, p1->name, NULL); - if(handle->pm_errno == PM_ERR_MEMORY) { + if(handle->pm_errno == ALPM_ERR_MEMORY) { FREELIST(conflicts); if(dbpkg) { /* only freed if it was generated from filelist_operation() */ diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index b7f0c9a3..17f26e90 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -51,9 +51,9 @@ alpm_db_t SYMEXPORT *alpm_db_register_sync(alpm_handle_t *handle, const char *tr /* Sanity checks */ CHECK_HANDLE(handle, return NULL); ASSERT(treename != NULL && strlen(treename) != 0, - RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL)); + RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL)); /* Do not register a database if a transaction is on-going */ - ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, NULL)); + ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, NULL)); return _alpm_db_register_sync(handle, treename, check_sig); } @@ -78,7 +78,7 @@ int SYMEXPORT alpm_db_unregister_all(alpm_handle_t *handle) /* Sanity checks */ CHECK_HANDLE(handle, return -1); /* Do not unregister a database if a transaction is on-going */ - ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1)); + ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1)); /* unregister all sync dbs */ for(i = handle->dbs_sync; i; i = i->next) { @@ -101,7 +101,7 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db) /* Do not unregister a database if a transaction is on-going */ handle = db->handle; handle->pm_errno = 0; - ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1)); + ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1)); if(db == handle->db_local) { handle->db_local = NULL; @@ -120,7 +120,7 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db) } if(!found) { - RET_ERR(handle, PM_ERR_DB_NOT_FOUND, -1); + RET_ERR(handle, ALPM_ERR_DB_NOT_FOUND, -1); } db->ops->unregister(db); @@ -168,7 +168,7 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url) /* Sanity checks */ ASSERT(db != NULL, return -1); db->handle->pm_errno = 0; - ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1)); newurl = sanitize_url(url); if(!newurl) { @@ -194,7 +194,7 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url) /* Sanity checks */ ASSERT(db != NULL, return -1); db->handle->pm_errno = 0; - ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1)); newurl = sanitize_url(url); if(!newurl) { @@ -244,7 +244,7 @@ alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name) ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; ASSERT(name != NULL && strlen(name) != 0, - RET_ERR(db->handle, PM_ERR_WRONG_ARGS, NULL)); + RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, NULL)); return _alpm_db_get_pkgfromcache(db, name); } @@ -263,7 +263,7 @@ alpm_group_t SYMEXPORT *alpm_db_readgroup(alpm_db_t *db, const char *name) ASSERT(db != NULL, return NULL); db->handle->pm_errno = 0; ASSERT(name != NULL && strlen(name) != 0, - RET_ERR(db->handle, PM_ERR_WRONG_ARGS, NULL)); + RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, NULL)); return _alpm_db_get_groupfromcache(db, name); } @@ -292,11 +292,11 @@ int SYMEXPORT alpm_db_set_pkgreason(alpm_db_t *db, const char *name, alpm_pkgrea ASSERT(db != NULL, return -1); db->handle->pm_errno = 0; /* TODO assert db == db_local ? shouldn't need a db param at all here... */ - ASSERT(name != NULL, RET_ERR(db->handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(name != NULL, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1)); alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(db, name); if(pkg == NULL) { - RET_ERR(db->handle, PM_ERR_PKG_NOT_FOUND, -1); + RET_ERR(db->handle, ALPM_ERR_PKG_NOT_FOUND, -1); } _alpm_log(db->handle, ALPM_LOG_DEBUG, "setting install reason %u for %s/%s\n", reason, db->treename, name); @@ -308,7 +308,7 @@ int SYMEXPORT alpm_db_set_pkgreason(alpm_db_t *db, const char *name, alpm_pkgrea pkg->reason = reason; /* write DESC */ if(_alpm_local_db_write(db, pkg, INFRQ_DESC)) { - RET_ERR(db->handle, PM_ERR_DB_WRITE, -1); + RET_ERR(db->handle, ALPM_ERR_DB_WRITE, -1); } return 0; @@ -353,16 +353,16 @@ const char *_alpm_db_path(alpm_db_t *db) dbpath = alpm_option_get_dbpath(db->handle); if(!dbpath) { _alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n")); - RET_ERR(db->handle, PM_ERR_DB_OPEN, NULL); + RET_ERR(db->handle, ALPM_ERR_DB_OPEN, NULL); } if(db->is_local) { pathsize = strlen(dbpath) + strlen(db->treename) + 2; - CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, PM_ERR_MEMORY, NULL)); + CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL)); sprintf(db->_path, "%s%s/", dbpath, db->treename); } else { pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4; - CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, PM_ERR_MEMORY, NULL)); + CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL)); /* all sync DBs now reside in the sync/ subdir of the dbpath */ sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename); } @@ -381,7 +381,7 @@ char *_alpm_db_sig_path(alpm_db_t *db) return NULL; } len = strlen(dbfile) + strlen(".sig") + 1; - CALLOC(sigpath, len, sizeof(char), RET_ERR(db->handle, PM_ERR_MEMORY, NULL)); + CALLOC(sigpath, len, sizeof(char), RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL)); sprintf(sigpath, "%s.sig", dbfile); return sigpath; } @@ -412,7 +412,7 @@ alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles) _alpm_log(db->handle, ALPM_LOG_DEBUG, "searching for target '%s'\n", targ); if(regcomp(®, targ, REG_EXTENDED | REG_NOSUB | REG_ICASE | REG_NEWLINE) != 0) { - RET_ERR(db->handle, PM_ERR_INVALID_REGEX, NULL); + RET_ERR(db->handle, ALPM_ERR_INVALID_REGEX, NULL); } for(j = list; j; j = j->next) { @@ -510,7 +510,7 @@ alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db) } if(!(db->status & DB_STATUS_VALID)) { - RET_ERR(db->handle, PM_ERR_DB_INVALID, NULL); + RET_ERR(db->handle, ALPM_ERR_DB_INVALID, NULL); } if(!(db->status & DB_STATUS_PKGCACHE)) { @@ -672,7 +672,7 @@ alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db) } if(!(db->status & DB_STATUS_VALID)) { - RET_ERR(db->handle, PM_ERR_DB_INVALID, NULL); + RET_ERR(db->handle, ALPM_ERR_DB_INVALID, NULL); } if(!(db->status & DB_STATUS_GRPCACHE)) { diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c index f06e93cd..0319d291 100644 --- a/lib/libalpm/deps.c +++ b/lib/libalpm/deps.c @@ -637,9 +637,9 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep, } if(ignored) { /* resolvedeps will override these */ - handle->pm_errno = PM_ERR_PKG_IGNORED; + handle->pm_errno = ALPM_ERR_PKG_IGNORED; } else { - handle->pm_errno = PM_ERR_PKG_NOT_FOUND; + handle->pm_errno = ALPM_ERR_PKG_NOT_FOUND; } return NULL; } @@ -660,7 +660,7 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle, alpm_pkg_t *pkg; CHECK_HANDLE(handle, return NULL); - ASSERT(dbs, RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL)); + ASSERT(dbs, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL)); dep = _alpm_splitdep(depstring); ASSERT(dep, return NULL); @@ -734,7 +734,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t spkg = resolvedep(handle, missdep, handle->dbs_sync, *packages, 0); } if(!spkg) { - handle->pm_errno = PM_ERR_UNSATISFIED_DEPS; + handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS; char *missdepstring = alpm_dep_compute_string(missdep); _alpm_log(handle, ALPM_LOG_WARNING, _("cannot resolve \"%s\", a dependency of \"%s\"\n"), diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c index 0ce4332d..52364a0e 100644 --- a/lib/libalpm/diskspace.c +++ b/lib/libalpm/diskspace.c @@ -87,7 +87,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle) continue; } - CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, PM_ERR_MEMORY, NULL)); + CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); mp->mount_dir = strdup(mnt->mnt_dir); mp->mount_dir_len = strlen(mp->mount_dir); memcpy(&(mp->fsp), &fsp, sizeof(struct statvfs)); @@ -108,7 +108,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle) } for(; entries-- > 0; fsp++) { - CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(PM_ERR_MEMORY, NULL)); + CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(ALPM_ERR_MEMORY, NULL)); mp->mount_dir = strdup(fsp->f_mntonname); mp->mount_dir_len = strlen(mp->mount_dir); memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE)); @@ -193,7 +193,7 @@ static int calculate_installed_size(alpm_handle_t *handle, struct archive_entry *entry; if((archive = archive_read_new()) == NULL) { - handle->pm_errno = PM_ERR_LIBARCHIVE; + handle->pm_errno = ALPM_ERR_LIBARCHIVE; ret = -1; goto cleanup; } @@ -203,7 +203,7 @@ static int calculate_installed_size(alpm_handle_t *handle, if(archive_read_open_filename(archive, pkg->origin_data.file, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { - handle->pm_errno = PM_ERR_PKG_OPEN; + handle->pm_errno = ALPM_ERR_PKG_OPEN; ret = -1; goto cleanup; } @@ -246,7 +246,7 @@ static int calculate_installed_size(alpm_handle_t *handle, if(archive_read_data_skip(archive)) { _alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"), pkg->name, archive_error_string(archive)); - handle->pm_errno = PM_ERR_LIBARCHIVE; + handle->pm_errno = ALPM_ERR_LIBARCHIVE; break; } } @@ -350,7 +350,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle) FREELIST(mount_points); if(error) { - RET_ERR(handle, PM_ERR_DISK_SPACE, -1); + RET_ERR(handle, ALPM_ERR_DISK_SPACE, -1); } return 0; diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c index 0a9a81ad..dc8ee395 100644 --- a/lib/libalpm/dload.c +++ b/lib/libalpm/dload.c @@ -172,7 +172,7 @@ static int curl_download_internal(alpm_handle_t *handle, dlfile.filename = get_filename(url); if(!dlfile.filename || curl_gethost(url, hostname) != 0) { _alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), url); - RET_ERR(handle, PM_ERR_SERVER_BAD_URL, -1); + RET_ERR(handle, ALPM_ERR_SERVER_BAD_URL, -1); } destfile = get_fullpath(localpath, dlfile.filename, ""); @@ -248,7 +248,7 @@ static int curl_download_internal(alpm_handle_t *handle, goto cleanup; } else if(handle->curlerr != CURLE_OK) { if(!errors_ok) { - handle->pm_errno = PM_ERR_LIBCURL; + handle->pm_errno = ALPM_ERR_LIBCURL; _alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"), dlfile.filename, hostname, error_buffer); } else { @@ -278,7 +278,7 @@ static int curl_download_internal(alpm_handle_t *handle, * as actually being transferred during curl_easy_perform() */ if(!DOUBLE_EQ(remote_size, -1) && !DOUBLE_EQ(bytes_dl, -1) && !DOUBLE_EQ(bytes_dl, remote_size)) { - handle->pm_errno = PM_ERR_RETRIEVE; + handle->pm_errno = ALPM_ERR_RETRIEVE; _alpm_log(handle, ALPM_LOG_ERROR, _("%s appears to be truncated: %jd/%jd bytes\n"), dlfile.filename, (intmax_t)bytes_dl, (intmax_t)remote_size); goto cleanup; @@ -329,12 +329,12 @@ int _alpm_download(alpm_handle_t *handle, const char *url, const char *localpath return curl_download_internal(handle, url, localpath, force, allow_resume, errors_ok); #else - RET_ERR(handle, PM_ERR_EXTERNAL_DOWNLOAD, -1); + RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1); #endif } else { int ret = handle->fetchcb(url, localpath, force); if(ret == -1 && !errors_ok) { - RET_ERR(handle, PM_ERR_EXTERNAL_DOWNLOAD, -1); + RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1); } return ret; } @@ -370,7 +370,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url) int errors_ok = (handle->sigverify == PM_PGP_VERIFY_OPTIONAL); len = strlen(url) + 5; - CALLOC(sig_url, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, NULL)); + CALLOC(sig_url, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, NULL)); snprintf(sig_url, len, "%s.sig", url); ret = _alpm_download(handle, sig_url, cachedir, 1, 0, errors_ok); diff --git a/lib/libalpm/error.c b/lib/libalpm/error.c index 225d8859..8716109f 100644 --- a/lib/libalpm/error.c +++ b/lib/libalpm/error.c @@ -38,120 +38,120 @@ const char SYMEXPORT *alpm_strerror(enum _alpm_errno_t err) { switch(err) { /* System */ - case PM_ERR_MEMORY: + case ALPM_ERR_MEMORY: return _("out of memory!"); - case PM_ERR_SYSTEM: + case ALPM_ERR_SYSTEM: return _("unexpected system error"); - case PM_ERR_BADPERMS: + case ALPM_ERR_BADPERMS: return _("insufficient privileges"); - case PM_ERR_NOT_A_FILE: + case ALPM_ERR_NOT_A_FILE: return _("could not find or read file"); - case PM_ERR_NOT_A_DIR: + case ALPM_ERR_NOT_A_DIR: return _("could not find or read directory"); - case PM_ERR_WRONG_ARGS: + case ALPM_ERR_WRONG_ARGS: return _("wrong or NULL argument passed"); - case PM_ERR_DISK_SPACE: + case ALPM_ERR_DISK_SPACE: return _("not enough free disk space"); /* Interface */ - case PM_ERR_HANDLE_NULL: + case ALPM_ERR_HANDLE_NULL: return _("library not initialized"); - case PM_ERR_HANDLE_NOT_NULL: + case ALPM_ERR_HANDLE_NOT_NULL: return _("library already initialized"); - case PM_ERR_HANDLE_LOCK: + case ALPM_ERR_HANDLE_LOCK: return _("unable to lock database"); /* Databases */ - case PM_ERR_DB_OPEN: + case ALPM_ERR_DB_OPEN: return _("could not open database"); - case PM_ERR_DB_CREATE: + case ALPM_ERR_DB_CREATE: return _("could not create database"); - case PM_ERR_DB_NULL: + case ALPM_ERR_DB_NULL: return _("database not initialized"); - case PM_ERR_DB_NOT_NULL: + case ALPM_ERR_DB_NOT_NULL: return _("database already registered"); - case PM_ERR_DB_NOT_FOUND: + case ALPM_ERR_DB_NOT_FOUND: return _("could not find database"); - case PM_ERR_DB_INVALID: + case ALPM_ERR_DB_INVALID: return _("invalid or corrupted database"); - case PM_ERR_DB_VERSION: + case ALPM_ERR_DB_VERSION: return _("database is incorrect version"); - case PM_ERR_DB_WRITE: + case ALPM_ERR_DB_WRITE: return _("could not update database"); - case PM_ERR_DB_REMOVE: + case ALPM_ERR_DB_REMOVE: return _("could not remove database entry"); /* Servers */ - case PM_ERR_SERVER_BAD_URL: + case ALPM_ERR_SERVER_BAD_URL: return _("invalid url for server"); - case PM_ERR_SERVER_NONE: + case ALPM_ERR_SERVER_NONE: return _("no servers configured for repository"); /* Transactions */ - case PM_ERR_TRANS_NOT_NULL: + case ALPM_ERR_TRANS_NOT_NULL: return _("transaction already initialized"); - case PM_ERR_TRANS_NULL: + case ALPM_ERR_TRANS_NULL: return _("transaction not initialized"); - case PM_ERR_TRANS_DUP_TARGET: + case ALPM_ERR_TRANS_DUP_TARGET: return _("duplicate target"); - case PM_ERR_TRANS_NOT_INITIALIZED: + case ALPM_ERR_TRANS_NOT_INITIALIZED: return _("transaction not initialized"); - case PM_ERR_TRANS_NOT_PREPARED: + case ALPM_ERR_TRANS_NOT_PREPARED: return _("transaction not prepared"); - case PM_ERR_TRANS_ABORT: + case ALPM_ERR_TRANS_ABORT: return _("transaction aborted"); - case PM_ERR_TRANS_TYPE: + case ALPM_ERR_TRANS_TYPE: return _("operation not compatible with the transaction type"); - case PM_ERR_TRANS_NOT_LOCKED: + case ALPM_ERR_TRANS_NOT_LOCKED: return _("transaction commit attempt when database is not locked"); /* Packages */ - case PM_ERR_PKG_NOT_FOUND: + case ALPM_ERR_PKG_NOT_FOUND: return _("could not find or read package"); - case PM_ERR_PKG_IGNORED: + case ALPM_ERR_PKG_IGNORED: return _("operation cancelled due to ignorepkg"); - case PM_ERR_PKG_INVALID: + case ALPM_ERR_PKG_INVALID: return _("invalid or corrupted package"); - case PM_ERR_PKG_OPEN: + case ALPM_ERR_PKG_OPEN: return _("cannot open package file"); - case PM_ERR_PKG_CANT_REMOVE: + case ALPM_ERR_PKG_CANT_REMOVE: return _("cannot remove all files for package"); - case PM_ERR_PKG_INVALID_NAME: + case ALPM_ERR_PKG_INVALID_NAME: return _("package filename is not valid"); - case PM_ERR_PKG_INVALID_ARCH: + case ALPM_ERR_PKG_INVALID_ARCH: return _("package architecture is not valid"); - case PM_ERR_PKG_REPO_NOT_FOUND: + case ALPM_ERR_PKG_REPO_NOT_FOUND: return _("could not find repository for target"); /* Signatures */ - case PM_ERR_SIG_MISSINGDIR: + case ALPM_ERR_SIG_MISSINGDIR: return _("signature directory not configured correctly"); - case PM_ERR_SIG_INVALID: + case ALPM_ERR_SIG_INVALID: return _("invalid PGP signature"); - case PM_ERR_SIG_UNKNOWN: + case ALPM_ERR_SIG_UNKNOWN: return _("unknown PGP signature"); /* Deltas */ - case PM_ERR_DLT_INVALID: + case ALPM_ERR_DLT_INVALID: return _("invalid or corrupted delta"); - case PM_ERR_DLT_PATCHFAILED: + case ALPM_ERR_DLT_PATCHFAILED: return _("delta patch failed"); /* Dependencies */ - case PM_ERR_UNSATISFIED_DEPS: + case ALPM_ERR_UNSATISFIED_DEPS: return _("could not satisfy dependencies"); - case PM_ERR_CONFLICTING_DEPS: + case ALPM_ERR_CONFLICTING_DEPS: return _("conflicting dependencies"); - case PM_ERR_FILE_CONFLICTS: + case ALPM_ERR_FILE_CONFLICTS: return _("conflicting files"); /* Miscellaenous */ - case PM_ERR_RETRIEVE: + case ALPM_ERR_RETRIEVE: return _("failed to retrieve some files"); - case PM_ERR_INVALID_REGEX: + case ALPM_ERR_INVALID_REGEX: return _("invalid regular expression"); /* Errors from external libraries- our own wrapper error */ - case PM_ERR_LIBARCHIVE: + case ALPM_ERR_LIBARCHIVE: /* it would be nice to use archive_error_string() here, but that * requires the archive struct, so we can't. Just use a generic * error string instead. */ return _("libarchive error"); - case PM_ERR_LIBCURL: + case ALPM_ERR_LIBCURL: return _("download library error"); - case PM_ERR_GPGME: + case ALPM_ERR_GPGME: return _("gpgme error"); - case PM_ERR_EXTERNAL_DOWNLOAD: + case ALPM_ERR_EXTERNAL_DOWNLOAD: return _("error invoking external downloader"); /* Unknown error! */ default: diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c index 66fb935b..22f3fc8f 100644 --- a/lib/libalpm/handle.c +++ b/lib/libalpm/handle.c @@ -312,16 +312,16 @@ enum _alpm_errno_t _alpm_set_directory_option(const char *value, path = value; if(!path) { - return PM_ERR_WRONG_ARGS; + return ALPM_ERR_WRONG_ARGS; } if(must_exist) { if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) { - return PM_ERR_NOT_A_DIR; + return ALPM_ERR_NOT_A_DIR; } - CALLOC(real, PATH_MAX, sizeof(char), return PM_ERR_MEMORY); + CALLOC(real, PATH_MAX, sizeof(char), return ALPM_ERR_MEMORY); if(!realpath(path, real)) { free(real); - return PM_ERR_NOT_A_DIR; + return ALPM_ERR_NOT_A_DIR; } path = real; } @@ -331,7 +331,7 @@ enum _alpm_errno_t _alpm_set_directory_option(const char *value, } *storage = canonicalize_path(path); if(!*storage) { - return PM_ERR_MEMORY; + return ALPM_ERR_MEMORY; } free(real); return 0; @@ -342,13 +342,13 @@ int SYMEXPORT alpm_option_add_cachedir(alpm_handle_t *handle, const char *cached char *newcachedir; CHECK_HANDLE(handle, return -1); - ASSERT(cachedir != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(cachedir != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); /* don't stat the cachedir yet, as it may not even be needed. we can * fail later if it is needed and the path is invalid. */ newcachedir = canonicalize_path(cachedir); if(!newcachedir) { - RET_ERR(handle, PM_ERR_MEMORY, -1); + RET_ERR(handle, ALPM_ERR_MEMORY, -1); } handle->cachedirs = alpm_list_add(handle->cachedirs, newcachedir); _alpm_log(handle, ALPM_LOG_DEBUG, "option 'cachedir' = %s\n", newcachedir); @@ -376,11 +376,11 @@ int SYMEXPORT alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cac char *vdata = NULL; char *newcachedir; CHECK_HANDLE(handle, return -1); - ASSERT(cachedir != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(cachedir != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); newcachedir = canonicalize_path(cachedir); if(!newcachedir) { - RET_ERR(handle, PM_ERR_MEMORY, -1); + RET_ERR(handle, ALPM_ERR_MEMORY, -1); } handle->cachedirs = alpm_list_remove_str(handle->cachedirs, newcachedir, &vdata); FREE(newcachedir); @@ -397,7 +397,7 @@ int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile CHECK_HANDLE(handle, return -1); if(!logfile) { - handle->pm_errno = PM_ERR_WRONG_ARGS; + handle->pm_errno = ALPM_ERR_WRONG_ARGS; return -1; } @@ -420,7 +420,7 @@ int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir) { CHECK_HANDLE(handle, return -1); if(!gpgdir) { - handle->pm_errno = PM_ERR_WRONG_ARGS; + handle->pm_errno = ALPM_ERR_WRONG_ARGS; return -1; } @@ -577,7 +577,7 @@ int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace) int SYMEXPORT alpm_option_set_default_sigverify(alpm_handle_t *handle, pgp_verify_t level) { CHECK_HANDLE(handle, return -1); - ASSERT(level != PM_PGP_VERIFY_UNKNOWN, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(level != PM_PGP_VERIFY_UNKNOWN, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); handle->sigverify = level; return 0; } diff --git a/lib/libalpm/log.c b/lib/libalpm/log.c index eeeaef3c..692ff79c 100644 --- a/lib/libalpm/log.c +++ b/lib/libalpm/log.c @@ -53,11 +53,11 @@ int SYMEXPORT alpm_logaction(alpm_handle_t *handle, const char *fmt, ...) /* if we couldn't open it, we have an issue */ if(handle->logstream == NULL) { if(errno == EACCES) { - handle->pm_errno = PM_ERR_BADPERMS; + handle->pm_errno = ALPM_ERR_BADPERMS; } else if(errno == ENOENT) { - handle->pm_errno = PM_ERR_NOT_A_DIR; + handle->pm_errno = ALPM_ERR_NOT_A_DIR; } else { - handle->pm_errno = PM_ERR_SYSTEM; + handle->pm_errno = ALPM_ERR_SYSTEM; } return -1; } diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 21984b37..28fa08cb 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -65,7 +65,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg) pkg->handle->pm_errno = 0; /* We only inspect packages from sync repositories */ ASSERT(pkg->origin == PKG_FROM_SYNCDB, - RET_ERR(pkg->handle, PM_ERR_WRONG_ARGS, -1)); + RET_ERR(pkg->handle, ALPM_ERR_WRONG_ARGS, -1)); fpath = _alpm_filecache_find(pkg->handle, alpm_pkg_get_filename(pkg)); @@ -74,7 +74,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg) if(retval == 0) { return 0; } else if(retval == 1) { - pkg->handle->pm_errno = PM_ERR_PKG_INVALID; + pkg->handle->pm_errno = ALPM_ERR_PKG_INVALID; retval = -1; } diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c index a90cd13a..2d6fcf64 100644 --- a/lib/libalpm/remove.c +++ b/lib/libalpm/remove.c @@ -51,17 +51,17 @@ int SYMEXPORT alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg) /* Sanity checks */ CHECK_HANDLE(handle, return -1); - ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); - ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); + ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); trans = handle->trans; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); ASSERT(trans->state == STATE_INITIALIZED, - RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1)); + RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1)); pkgname = pkg->name; if(_alpm_pkg_find(trans->remove, pkgname)) { - RET_ERR(handle, PM_ERR_TRANS_DUP_TARGET, -1); + RET_ERR(handle, ALPM_ERR_TRANS_DUP_TARGET, -1); } _alpm_log(handle, ALPM_LOG_DEBUG, "adding package %s to the transaction remove list\n", @@ -166,7 +166,7 @@ int _alpm_remove_prepare(alpm_handle_t *handle, alpm_list_t **data) alpm_list_free_inner(lp, (alpm_list_fn_free)_alpm_depmiss_free); alpm_list_free(lp); } - RET_ERR(handle, PM_ERR_UNSATISFIED_DEPS, -1); + RET_ERR(handle, ALPM_ERR_UNSATISFIED_DEPS, -1); } } } @@ -321,7 +321,7 @@ int _alpm_upgraderemove_package(alpm_handle_t *handle, if(!can_remove_file(handle, lp->data, skip_remove)) { _alpm_log(handle, ALPM_LOG_DEBUG, "not removing package '%s', can't remove all files\n", pkgname); - RET_ERR(handle, PM_ERR_PKG_CANT_REMOVE, -1); + RET_ERR(handle, ALPM_ERR_PKG_CANT_REMOVE, -1); } filenum++; } @@ -397,7 +397,7 @@ int _alpm_remove_packages(alpm_handle_t *handle) if(!can_remove_file(handle, lp->data, NULL)) { _alpm_log(handle, ALPM_LOG_DEBUG, "not removing package '%s', can't remove all files\n", pkgname); - RET_ERR(handle, PM_ERR_PKG_CANT_REMOVE, -1); + RET_ERR(handle, ALPM_ERR_PKG_CANT_REMOVE, -1); } filenum++; } diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c index 8ac457af..1ac9963a 100644 --- a/lib/libalpm/signing.c +++ b/lib/libalpm/signing.c @@ -118,7 +118,7 @@ static int init_gpgme(alpm_handle_t *handle) sigdir = alpm_option_get_gpgdir(handle); if(!sigdir) { - RET_ERR(handle, PM_ERR_SIG_MISSINGDIR, 1); + RET_ERR(handle, ALPM_ERR_SIG_MISSINGDIR, 1); } /* calling gpgme_check_version() returns the current version and runs @@ -154,7 +154,7 @@ static int init_gpgme(alpm_handle_t *handle) error: _alpm_log(handle, ALPM_LOG_ERROR, _("GPGME error: %s\n"), gpgme_strerror(err)); - RET_ERR(handle, PM_ERR_GPGME, 1); + RET_ERR(handle, ALPM_ERR_GPGME, 1); } /** @@ -219,17 +219,17 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, FILE *file = NULL, *sigfile = NULL; if(!path || access(path, R_OK) != 0) { - RET_ERR(handle, PM_ERR_NOT_A_FILE, -1); + RET_ERR(handle, ALPM_ERR_NOT_A_FILE, -1); } if(!base64_sig) { size_t len = strlen(path) + 5; - CALLOC(sigpath, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, -1)); + CALLOC(sigpath, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(sigpath, len, "%s.sig", path); if(!access(sigpath, R_OK) == 0) { FREE(sigpath); - RET_ERR(handle, PM_ERR_SIG_UNKNOWN, -1); + RET_ERR(handle, ALPM_ERR_SIG_UNKNOWN, -1); } } @@ -250,7 +250,7 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, /* create our necessary data objects to verify the signature */ file = fopen(path, "rb"); if(file == NULL) { - handle->pm_errno = PM_ERR_NOT_A_FILE; + handle->pm_errno = ALPM_ERR_NOT_A_FILE; ret = -1; goto error; } @@ -273,7 +273,7 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, /* file-based, it is on disk */ sigfile = fopen(sigpath, "rb"); if(sigfile == NULL) { - handle->pm_errno = PM_ERR_NOT_A_FILE; + handle->pm_errno = ALPM_ERR_NOT_A_FILE; ret = -1; goto error; } @@ -320,16 +320,16 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path, } else if(gpgsig->summary & GPGME_SIGSUM_RED) { /* definite bad signature, error */ _alpm_log(handle, ALPM_LOG_DEBUG, "result: red signature\n"); - handle->pm_errno = PM_ERR_SIG_INVALID; + handle->pm_errno = ALPM_ERR_SIG_INVALID; ret = 1; } else if(gpgsig->summary & GPGME_SIGSUM_KEY_MISSING) { _alpm_log(handle, ALPM_LOG_DEBUG, "result: signature from unknown key\n"); - handle->pm_errno = PM_ERR_SIG_UNKNOWN; + handle->pm_errno = ALPM_ERR_SIG_UNKNOWN; ret = 1; } else { /* we'll capture everything else here */ _alpm_log(handle, ALPM_LOG_DEBUG, "result: invalid signature\n"); - handle->pm_errno = PM_ERR_SIG_INVALID; + handle->pm_errno = ALPM_ERR_SIG_INVALID; ret = 1; } @@ -350,7 +350,7 @@ error: FREE(decoded_sigdata); if(err != GPG_ERR_NO_ERROR) { _alpm_log(handle, ALPM_LOG_ERROR, _("GPGME error: %s\n"), gpgme_strerror(err)); - RET_ERR(handle, PM_ERR_GPGME, -1); + RET_ERR(handle, ALPM_ERR_GPGME, -1); } return ret; } diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 1537347e..d6b54ba0 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -94,8 +94,8 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade) trans = handle->trans; db_local = handle->db_local; dbs_sync = handle->dbs_sync; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1)); _alpm_log(handle, ALPM_LOG_DEBUG, "checking for package upgrades\n"); for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) { @@ -266,7 +266,7 @@ static int compute_download_size(alpm_pkg_t *newpkg) } fname = alpm_pkg_get_filename(newpkg); - ASSERT(fname != NULL, RET_ERR(handle, PM_ERR_PKG_INVALID_NAME, -1)); + ASSERT(fname != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1)); fpath = _alpm_filecache_find(handle, fname); if(fpath) { @@ -429,7 +429,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) sync = sync2; } else { _alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n")); - handle->pm_errno = PM_ERR_CONFLICTING_DEPS; + handle->pm_errno = ALPM_ERR_CONFLICTING_DEPS; ret = -1; if(data) { alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); @@ -493,7 +493,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) sync->removes = alpm_list_add(sync->removes, local); } else { /* abort */ _alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n")); - handle->pm_errno = PM_ERR_CONFLICTING_DEPS; + handle->pm_errno = ALPM_ERR_CONFLICTING_DEPS; ret = -1; if(data) { alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict); @@ -528,7 +528,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data) deps = alpm_checkdeps(handle, _alpm_db_get_pkgcache(handle->db_local), trans->remove, trans->add, 1); if(deps) { - handle->pm_errno = PM_ERR_UNSATISFIED_DEPS; + handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS; ret = -1; if(data) { *data = deps; @@ -612,11 +612,11 @@ static int apply_deltas(alpm_handle_t *handle) } else { /* len = cachedir len + from len + '/' + null */ len = strlen(cachedir) + strlen(d->from) + 2; - CALLOC(from, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, 1)); + CALLOC(from, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, 1)); snprintf(from, len, "%s/%s", cachedir, d->from); } len = strlen(cachedir) + strlen(d->to) + 2; - CALLOC(to, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, 1)); + CALLOC(to, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, 1)); snprintf(to, len, "%s/%s", cachedir, d->to); /* build the patch command */ @@ -652,7 +652,7 @@ static int apply_deltas(alpm_handle_t *handle) if(retval != 0) { /* one delta failed for this package, cancel the remaining ones */ EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_FAILED, NULL, NULL); - handle->pm_errno = PM_ERR_DLT_PATCHFAILED; + handle->pm_errno = ALPM_ERR_DLT_PATCHFAILED; ret = 1; break; } @@ -714,7 +714,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas, FREE(filepath); } if(errors) { - handle->pm_errno = PM_ERR_DLT_INVALID; + handle->pm_errno = ALPM_ERR_DLT_INVALID; return -1; } EVENT(trans, ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE, NULL, NULL); @@ -760,7 +760,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) const char *fname = NULL; fname = alpm_pkg_get_filename(spkg); - ASSERT(fname != NULL, RET_ERR(handle, PM_ERR_PKG_INVALID_NAME, -1)); + ASSERT(fname != NULL, RET_ERR(handle, ALPM_ERR_PKG_INVALID_NAME, -1)); alpm_list_t *delta_path = spkg->delta_path; if(delta_path) { /* using deltas */ @@ -794,7 +794,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) /* print server + filename into a buffer */ len = strlen(server_url) + strlen(filename) + 2; - CALLOC(fileurl, len, sizeof(char), RET_ERR(handle, PM_ERR_MEMORY, -1)); + CALLOC(fileurl, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); snprintf(fileurl, len, "%s/%s", server_url, filename); ret = _alpm_download(handle, fileurl, cachedir, 0, 1, 0); @@ -813,7 +813,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas) _alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"), current->treename); if(handle->pm_errno == 0) { - handle->pm_errno = PM_ERR_RETRIEVE; + handle->pm_errno = ALPM_ERR_RETRIEVE; } return -1; } @@ -901,7 +901,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) if(errors) { - RET_ERR(handle, PM_ERR_PKG_INVALID, -1); + RET_ERR(handle, ALPM_ERR_PKG_INVALID, -1); } if(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY) { @@ -926,7 +926,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data) alpm_list_free_inner(conflict, (alpm_list_fn_free)_alpm_fileconflict_free); alpm_list_free(conflict); } - RET_ERR(handle, PM_ERR_FILE_CONFLICTS, -1); + RET_ERR(handle, ALPM_ERR_FILE_CONFLICTS, -1); } EVENT(trans, ALPM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL); diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 01e7ccd8..26989499 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -57,23 +57,23 @@ int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags, /* Sanity checks */ CHECK_HANDLE(handle, return -1); - ASSERT(handle->trans == NULL, RET_ERR(handle, PM_ERR_TRANS_NOT_NULL, -1)); + ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1)); for(i = handle->dbs_sync; i; i = i->next) { const alpm_db_t *db = i->data; if(!(db->status & DB_STATUS_VALID)) { - RET_ERR(handle, PM_ERR_DB_INVALID, -1); + RET_ERR(handle, ALPM_ERR_DB_INVALID, -1); } } /* lock db */ if(!(flags & ALPM_TRANS_FLAG_NOLOCK)) { if(_alpm_handle_lock(handle)) { - RET_ERR(handle, PM_ERR_HANDLE_LOCK, -1); + RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1); } } - CALLOC(trans, 1, sizeof(alpm_trans_t), RET_ERR(handle, PM_ERR_MEMORY, -1)); + CALLOC(trans, 1, sizeof(alpm_trans_t), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); trans->flags = flags; trans->cb_event = event; trans->cb_conv = conv; @@ -102,7 +102,7 @@ static alpm_list_t *check_arch(alpm_handle_t *handle, alpm_list_t *pkgs) const char *pkgname = alpm_pkg_get_name(pkg); const char *pkgver = alpm_pkg_get_version(pkg); size_t len = strlen(pkgname) + strlen(pkgver) + strlen(pkgarch) + 3; - MALLOC(string, len, RET_ERR(handle, PM_ERR_MEMORY, invalid)); + MALLOC(string, len, RET_ERR(handle, ALPM_ERR_MEMORY, invalid)); sprintf(string, "%s-%s-%s", pkgname, pkgver, pkgarch); invalid = alpm_list_add(invalid, string); } @@ -117,12 +117,12 @@ int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data) /* Sanity checks */ CHECK_HANDLE(handle, return -1); - ASSERT(data != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1)); + ASSERT(data != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1)); trans = handle->trans; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, PM_ERR_TRANS_NOT_INITIALIZED, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1)); /* If there's nothing to do, return without complaining */ if(trans->add == NULL && trans->remove == NULL) { @@ -134,7 +134,7 @@ int SYMEXPORT alpm_trans_prepare(alpm_handle_t *handle, alpm_list_t **data) if(data) { *data = invalid; } - RET_ERR(handle, PM_ERR_PKG_INVALID_ARCH, -1); + RET_ERR(handle, ALPM_ERR_PKG_INVALID_ARCH, -1); } if(trans->add == NULL) { @@ -164,10 +164,10 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data) trans = handle->trans; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state == STATE_PREPARED, RET_ERR(handle, PM_ERR_TRANS_NOT_PREPARED, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state == STATE_PREPARED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_PREPARED, -1)); - ASSERT(!(trans->flags & ALPM_TRANS_FLAG_NOLOCK), RET_ERR(handle, PM_ERR_TRANS_NOT_LOCKED, -1)); + ASSERT(!(trans->flags & ALPM_TRANS_FLAG_NOLOCK), RET_ERR(handle, ALPM_ERR_TRANS_NOT_LOCKED, -1)); /* If there's nothing to do, return without complaining */ if(trans->add == NULL && trans->remove == NULL) { @@ -202,9 +202,9 @@ int SYMEXPORT alpm_trans_interrupt(alpm_handle_t *handle) CHECK_HANDLE(handle, return -1); trans = handle->trans; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); ASSERT(trans->state == STATE_COMMITING || trans->state == STATE_INTERRUPTED, - RET_ERR(handle, PM_ERR_TRANS_TYPE, -1)); + RET_ERR(handle, ALPM_ERR_TRANS_TYPE, -1)); trans->state = STATE_INTERRUPTED; @@ -220,8 +220,8 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle) CHECK_HANDLE(handle, return -1); trans = handle->trans; - ASSERT(trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); - ASSERT(trans->state != STATE_IDLE, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); + ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); + ASSERT(trans->state != STATE_IDLE, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); int nolock_flag = trans->flags & ALPM_TRANS_FLAG_NOLOCK; @@ -363,7 +363,7 @@ alpm_transflag_t SYMEXPORT alpm_trans_get_flags(alpm_handle_t *handle) { /* Sanity checks */ CHECK_HANDLE(handle, return -1); - ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, -1)); + ASSERT(handle->trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1)); return handle->trans->flags; } @@ -372,7 +372,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_add(alpm_handle_t *handle) { /* Sanity checks */ CHECK_HANDLE(handle, return NULL); - ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL)); + ASSERT(handle->trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, NULL)); return handle->trans->add; } @@ -381,7 +381,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_remove(alpm_handle_t *handle) { /* Sanity checks */ CHECK_HANDLE(handle, return NULL); - ASSERT(handle->trans != NULL, RET_ERR(handle, PM_ERR_TRANS_NULL, NULL)); + ASSERT(handle->trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, NULL)); return handle->trans->remove; } diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index ab4051b8..cd7f19c9 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -254,7 +254,7 @@ int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, int restore_cwd = 0; if((_archive = archive_read_new()) == NULL) { - RET_ERR(handle, PM_ERR_LIBARCHIVE, 1); + RET_ERR(handle, ALPM_ERR_LIBARCHIVE, 1); } archive_read_support_compression_all(_archive); @@ -264,7 +264,7 @@ int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { _alpm_log(handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), archive, archive_error_string(_archive)); - RET_ERR(handle, PM_ERR_PKG_OPEN, 1); + RET_ERR(handle, ALPM_ERR_PKG_OPEN, 1); } oldmask = umask(0022); |