Prefix _alpm_errno_t members with ALPM
Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
bd88a8d551
commit
afc96f2ab3
26 changed files with 287 additions and 287 deletions
|
@ -58,12 +58,12 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return -1);
|
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));
|
||||||
ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
trans = handle->trans;
|
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,
|
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;
|
pkgname = pkg->name;
|
||||||
pkgver = pkg->version;
|
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);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "adding package '%s'\n", pkgname);
|
||||||
|
|
||||||
if(_alpm_pkg_find(trans->add, 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);
|
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
|
/* we need access to the original entryname later after calls to
|
||||||
* archive_entry_set_pathname(), so we need to dupe it and free() later */
|
* 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) {
|
if(needbackup) {
|
||||||
char checkfile[PATH_MAX];
|
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) {
|
if(!backup->name || strcmp(backup->name, entryname_orig) != 0) {
|
||||||
continue;
|
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);
|
FREE(backup->hash);
|
||||||
backup->hash = newhash;
|
backup->hash = newhash;
|
||||||
}
|
}
|
||||||
|
@ -507,7 +507,7 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
|
||||||
if(oldpkg) {
|
if(oldpkg) {
|
||||||
/* set up fake remove transaction */
|
/* set up fake remove transaction */
|
||||||
if(_alpm_upgraderemove_package(handle, oldpkg, newpkg) == -1) {
|
if(_alpm_upgraderemove_package(handle, oldpkg, newpkg) == -1) {
|
||||||
handle->pm_errno = PM_ERR_TRANS_ABORT;
|
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
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)) {
|
if(_alpm_local_db_prepare(db, newpkg)) {
|
||||||
alpm_logaction(handle, "error: could not create database entry %s-%s\n",
|
alpm_logaction(handle, "error: could not create database entry %s-%s\n",
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
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;
|
ret = -1;
|
||||||
goto cleanup;
|
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");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "extracting files\n");
|
||||||
|
|
||||||
if((archive = archive_read_new()) == NULL) {
|
if((archive = archive_read_new()) == NULL) {
|
||||||
handle->pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
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);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "archive: %s\n", newpkg->origin_data.file);
|
||||||
if(archive_read_open_filename(archive, newpkg->origin_data.file,
|
if(archive_read_open_filename(archive, newpkg->origin_data.file,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
handle->pm_errno = PM_ERR_PKG_OPEN;
|
handle->pm_errno = ALPM_ERR_PKG_OPEN;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
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_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
||||||
alpm_logaction(handle, "error: could not update database entry %s-%s\n",
|
alpm_logaction(handle, "error: could not update database entry %s-%s\n",
|
||||||
alpm_pkg_get_name(newpkg), alpm_pkg_get_version(newpkg));
|
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;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -705,7 +705,7 @@ int _alpm_upgrade_packages(alpm_handle_t *handle)
|
||||||
if(commit_single_pkg(handle, newpkg, pkg_current, pkg_count)) {
|
if(commit_single_pkg(handle, newpkg, pkg_current, pkg_count)) {
|
||||||
/* something screwed up on the commit, abort the trans */
|
/* something screwed up on the commit, abort the trans */
|
||||||
trans->state = STATE_INTERRUPTED;
|
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 */
|
/* running ldconfig at this point could possibly screw system */
|
||||||
skip_ldconfig = 1;
|
skip_ldconfig = 1;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
|
|
|
@ -55,7 +55,7 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
|
||||||
alpm_handle_t *myhandle = _alpm_handle_new();
|
alpm_handle_t *myhandle = _alpm_handle_new();
|
||||||
|
|
||||||
if(myhandle == NULL) {
|
if(myhandle == NULL) {
|
||||||
myerr = PM_ERR_MEMORY;
|
myerr = ALPM_ERR_MEMORY;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
if((myerr = _alpm_set_directory_option(root, &(myhandle->root), 1))) {
|
if((myerr = _alpm_set_directory_option(root, &(myhandle->root), 1))) {
|
||||||
|
|
|
@ -1000,67 +1000,67 @@ char *alpm_compute_md5sum(const char *name);
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
enum _alpm_errno_t {
|
enum _alpm_errno_t {
|
||||||
PM_ERR_MEMORY = 1,
|
ALPM_ERR_MEMORY = 1,
|
||||||
PM_ERR_SYSTEM,
|
ALPM_ERR_SYSTEM,
|
||||||
PM_ERR_BADPERMS,
|
ALPM_ERR_BADPERMS,
|
||||||
PM_ERR_NOT_A_FILE,
|
ALPM_ERR_NOT_A_FILE,
|
||||||
PM_ERR_NOT_A_DIR,
|
ALPM_ERR_NOT_A_DIR,
|
||||||
PM_ERR_WRONG_ARGS,
|
ALPM_ERR_WRONG_ARGS,
|
||||||
PM_ERR_DISK_SPACE,
|
ALPM_ERR_DISK_SPACE,
|
||||||
/* Interface */
|
/* Interface */
|
||||||
PM_ERR_HANDLE_NULL,
|
ALPM_ERR_HANDLE_NULL,
|
||||||
PM_ERR_HANDLE_NOT_NULL,
|
ALPM_ERR_HANDLE_NOT_NULL,
|
||||||
PM_ERR_HANDLE_LOCK,
|
ALPM_ERR_HANDLE_LOCK,
|
||||||
/* Databases */
|
/* Databases */
|
||||||
PM_ERR_DB_OPEN,
|
ALPM_ERR_DB_OPEN,
|
||||||
PM_ERR_DB_CREATE,
|
ALPM_ERR_DB_CREATE,
|
||||||
PM_ERR_DB_NULL,
|
ALPM_ERR_DB_NULL,
|
||||||
PM_ERR_DB_NOT_NULL,
|
ALPM_ERR_DB_NOT_NULL,
|
||||||
PM_ERR_DB_NOT_FOUND,
|
ALPM_ERR_DB_NOT_FOUND,
|
||||||
PM_ERR_DB_INVALID,
|
ALPM_ERR_DB_INVALID,
|
||||||
PM_ERR_DB_VERSION,
|
ALPM_ERR_DB_VERSION,
|
||||||
PM_ERR_DB_WRITE,
|
ALPM_ERR_DB_WRITE,
|
||||||
PM_ERR_DB_REMOVE,
|
ALPM_ERR_DB_REMOVE,
|
||||||
/* Servers */
|
/* Servers */
|
||||||
PM_ERR_SERVER_BAD_URL,
|
ALPM_ERR_SERVER_BAD_URL,
|
||||||
PM_ERR_SERVER_NONE,
|
ALPM_ERR_SERVER_NONE,
|
||||||
/* Transactions */
|
/* Transactions */
|
||||||
PM_ERR_TRANS_NOT_NULL,
|
ALPM_ERR_TRANS_NOT_NULL,
|
||||||
PM_ERR_TRANS_NULL,
|
ALPM_ERR_TRANS_NULL,
|
||||||
PM_ERR_TRANS_DUP_TARGET,
|
ALPM_ERR_TRANS_DUP_TARGET,
|
||||||
PM_ERR_TRANS_NOT_INITIALIZED,
|
ALPM_ERR_TRANS_NOT_INITIALIZED,
|
||||||
PM_ERR_TRANS_NOT_PREPARED,
|
ALPM_ERR_TRANS_NOT_PREPARED,
|
||||||
PM_ERR_TRANS_ABORT,
|
ALPM_ERR_TRANS_ABORT,
|
||||||
PM_ERR_TRANS_TYPE,
|
ALPM_ERR_TRANS_TYPE,
|
||||||
PM_ERR_TRANS_NOT_LOCKED,
|
ALPM_ERR_TRANS_NOT_LOCKED,
|
||||||
/* Packages */
|
/* Packages */
|
||||||
PM_ERR_PKG_NOT_FOUND,
|
ALPM_ERR_PKG_NOT_FOUND,
|
||||||
PM_ERR_PKG_IGNORED,
|
ALPM_ERR_PKG_IGNORED,
|
||||||
PM_ERR_PKG_INVALID,
|
ALPM_ERR_PKG_INVALID,
|
||||||
PM_ERR_PKG_OPEN,
|
ALPM_ERR_PKG_OPEN,
|
||||||
PM_ERR_PKG_CANT_REMOVE,
|
ALPM_ERR_PKG_CANT_REMOVE,
|
||||||
PM_ERR_PKG_INVALID_NAME,
|
ALPM_ERR_PKG_INVALID_NAME,
|
||||||
PM_ERR_PKG_INVALID_ARCH,
|
ALPM_ERR_PKG_INVALID_ARCH,
|
||||||
PM_ERR_PKG_REPO_NOT_FOUND,
|
ALPM_ERR_PKG_REPO_NOT_FOUND,
|
||||||
/* Signatures */
|
/* Signatures */
|
||||||
PM_ERR_SIG_MISSINGDIR,
|
ALPM_ERR_SIG_MISSINGDIR,
|
||||||
PM_ERR_SIG_INVALID,
|
ALPM_ERR_SIG_INVALID,
|
||||||
PM_ERR_SIG_UNKNOWN,
|
ALPM_ERR_SIG_UNKNOWN,
|
||||||
/* Deltas */
|
/* Deltas */
|
||||||
PM_ERR_DLT_INVALID,
|
ALPM_ERR_DLT_INVALID,
|
||||||
PM_ERR_DLT_PATCHFAILED,
|
ALPM_ERR_DLT_PATCHFAILED,
|
||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
PM_ERR_UNSATISFIED_DEPS,
|
ALPM_ERR_UNSATISFIED_DEPS,
|
||||||
PM_ERR_CONFLICTING_DEPS,
|
ALPM_ERR_CONFLICTING_DEPS,
|
||||||
PM_ERR_FILE_CONFLICTS,
|
ALPM_ERR_FILE_CONFLICTS,
|
||||||
/* Misc */
|
/* Misc */
|
||||||
PM_ERR_RETRIEVE,
|
ALPM_ERR_RETRIEVE,
|
||||||
PM_ERR_INVALID_REGEX,
|
ALPM_ERR_INVALID_REGEX,
|
||||||
/* External library errors */
|
/* External library errors */
|
||||||
PM_ERR_LIBARCHIVE,
|
ALPM_ERR_LIBARCHIVE,
|
||||||
PM_ERR_LIBCURL,
|
ALPM_ERR_LIBCURL,
|
||||||
PM_ERR_EXTERNAL_DOWNLOAD,
|
ALPM_ERR_EXTERNAL_DOWNLOAD,
|
||||||
PM_ERR_GPGME
|
ALPM_ERR_GPGME
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returns the current error code from the handle. */
|
/** Returns the current error code from the handle. */
|
||||||
|
|
|
@ -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",
|
_alpm_log(db->handle, ALPM_LOG_DEBUG, "database dir '%s' does not exist, creating it\n",
|
||||||
path);
|
path);
|
||||||
if(_alpm_makepath(path) != 0) {
|
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)) {
|
} else if(!S_ISDIR(buf.st_mode)) {
|
||||||
_alpm_log(db->handle, ALPM_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) {
|
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;
|
return 0;
|
||||||
|
@ -328,7 +328,7 @@ static int local_db_validate(alpm_db_t *db)
|
||||||
|
|
||||||
dbpath = _alpm_db_path(db);
|
dbpath = _alpm_db_path(db);
|
||||||
if(dbpath == NULL) {
|
if(dbpath == NULL) {
|
||||||
RET_ERR(db->handle, PM_ERR_DB_OPEN, -1);
|
RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
|
||||||
}
|
}
|
||||||
dbdir = opendir(dbpath);
|
dbdir = opendir(dbpath);
|
||||||
if(dbdir == NULL) {
|
if(dbdir == NULL) {
|
||||||
|
@ -337,7 +337,7 @@ static int local_db_validate(alpm_db_t *db)
|
||||||
db->status |= DB_STATUS_VALID;
|
db->status |= DB_STATUS_VALID;
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} 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);
|
snprintf(path, PATH_MAX, "%s%s/depends", dbpath, name);
|
||||||
if(access(path, F_OK) == 0) {
|
if(access(path, F_OK) == 0) {
|
||||||
/* we found a depends file- bail */
|
/* we found a depends file- bail */
|
||||||
db->handle->pm_errno = PM_ERR_DB_VERSION;
|
db->handle->pm_errno = ALPM_ERR_DB_VERSION;
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -392,10 +392,10 @@ static int local_db_populate(alpm_db_t *db)
|
||||||
/* no database existing yet is not an error */
|
/* no database existing yet is not an error */
|
||||||
return 0;
|
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) {
|
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) {
|
if(buf.st_nlink >= 2) {
|
||||||
est_count = buf.st_nlink;
|
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);
|
db->pkgcache = _alpm_pkghash_create(est_count * 2);
|
||||||
if(db->pkgcache == NULL){
|
if(db->pkgcache == NULL){
|
||||||
closedir(dbdir);
|
closedir(dbdir);
|
||||||
RET_ERR(db->handle, PM_ERR_MEMORY, -1);
|
RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
while((ent = readdir(dbdir)) != NULL) {
|
while((ent = readdir(dbdir)) != NULL) {
|
||||||
|
@ -437,7 +437,7 @@ static int local_db_populate(alpm_db_t *db)
|
||||||
pkg = _alpm_pkg_new();
|
pkg = _alpm_pkg_new();
|
||||||
if(pkg == NULL) {
|
if(pkg == NULL) {
|
||||||
closedir(dbdir);
|
closedir(dbdir);
|
||||||
RET_ERR(db->handle, PM_ERR_MEMORY, -1);
|
RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
|
||||||
}
|
}
|
||||||
/* split the db entry name */
|
/* split the db entry name */
|
||||||
if(_alpm_splitname(name, &(pkg->name), &(pkg->version),
|
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);
|
dbpath = _alpm_db_path(db);
|
||||||
len = strlen(dbpath) + strlen(info->name) + strlen(info->version) + 3;
|
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);
|
sprintf(pkgpath, "%s%s-%s/", dbpath, info->name, info->version);
|
||||||
return pkgpath;
|
return pkgpath;
|
||||||
}
|
}
|
||||||
|
@ -928,7 +928,7 @@ alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle)
|
||||||
|
|
||||||
db = _alpm_db_new("local", 1);
|
db = _alpm_db_new("local", 1);
|
||||||
if(db == NULL) {
|
if(db == NULL) {
|
||||||
handle->pm_errno = PM_ERR_DB_CREATE;
|
handle->pm_errno = ALPM_ERR_DB_CREATE;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
db->ops = &local_db_ops;
|
db->ops = &local_db_ops;
|
||||||
|
|
|
@ -52,7 +52,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
|
||||||
const char *pkgfile = pkg->origin_data.file;
|
const char *pkgfile = pkg->origin_data.file;
|
||||||
|
|
||||||
if((archive = archive_read_new()) == NULL) {
|
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);
|
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,
|
if(archive_read_open_filename(archive, pkgfile,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
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) {
|
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);
|
ssize_t sret = archive_read_data((struct archive *)fp, ptr, size);
|
||||||
/* Report error (negative values) */
|
/* Report error (negative values) */
|
||||||
if(sret < 0) {
|
if(sret < 0) {
|
||||||
RET_ERR(pkg->handle, PM_ERR_LIBARCHIVE, 0);
|
RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, 0);
|
||||||
} else {
|
} else {
|
||||||
return (size_t)sret;
|
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;
|
size_t files_count = 0;
|
||||||
|
|
||||||
if(pkgfile == NULL || strlen(pkgfile) == 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 */
|
/* attempt to stat the package file, ensure it exists */
|
||||||
if(stat(pkgfile, &st) == 0) {
|
if(stat(pkgfile, &st) == 0) {
|
||||||
newpkg = _alpm_pkg_new();
|
newpkg = _alpm_pkg_new();
|
||||||
if(newpkg == NULL) {
|
if(newpkg == NULL) {
|
||||||
RET_ERR(handle, PM_ERR_MEMORY, NULL);
|
RET_ERR(handle, ALPM_ERR_MEMORY, NULL);
|
||||||
}
|
}
|
||||||
newpkg->filename = strdup(pkgfile);
|
newpkg->filename = strdup(pkgfile);
|
||||||
newpkg->size = st.st_size;
|
newpkg->size = st.st_size;
|
||||||
} else {
|
} else {
|
||||||
/* couldn't stat the pkgfile, return an error */
|
/* 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 */
|
/* 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);
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking md5sum for %s\n", pkgfile);
|
||||||
if(_alpm_test_md5sum(pkgfile, md5sum) != 0) {
|
if(_alpm_test_md5sum(pkgfile, md5sum) != 0) {
|
||||||
alpm_pkg_free(newpkg);
|
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) ||
|
if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
|
||||||
(check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
|
(check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
|
||||||
alpm_pkg_free(newpkg);
|
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 */
|
/* next- try to create an archive object to read in the package */
|
||||||
if((archive = archive_read_new()) == NULL) {
|
if((archive = archive_read_new()) == NULL) {
|
||||||
alpm_pkg_free(newpkg);
|
alpm_pkg_free(newpkg);
|
||||||
RET_ERR(handle, PM_ERR_LIBARCHIVE, NULL);
|
RET_ERR(handle, ALPM_ERR_LIBARCHIVE, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
archive_read_support_compression_all(archive);
|
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,
|
if(archive_read_open_filename(archive, pkgfile,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
alpm_pkg_free(newpkg);
|
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);
|
_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)) {
|
if(archive_read_data_skip(archive)) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
pkgfile, archive_error_string(archive));
|
pkgfile, archive_error_string(archive));
|
||||||
handle->pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
goto error;
|
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 */
|
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
pkgfile, archive_error_string(archive));
|
pkgfile, archive_error_string(archive));
|
||||||
handle->pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -379,7 +379,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
|
||||||
return newpkg;
|
return newpkg;
|
||||||
|
|
||||||
pkg_invalid:
|
pkg_invalid:
|
||||||
handle->pm_errno = PM_ERR_PKG_INVALID;
|
handle->pm_errno = ALPM_ERR_PKG_INVALID;
|
||||||
error:
|
error:
|
||||||
_alpm_pkg_free(newpkg);
|
_alpm_pkg_free(newpkg);
|
||||||
archive_read_finish(archive);
|
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)
|
pgp_verify_t check_sig, alpm_pkg_t **pkg)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
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);
|
*pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, check_sig);
|
||||||
if(*pkg == NULL) {
|
if(*pkg == NULL) {
|
||||||
|
|
|
@ -46,7 +46,7 @@ static char *get_sync_dir(alpm_handle_t *handle)
|
||||||
char *syncpath;
|
char *syncpath;
|
||||||
struct stat buf;
|
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/");
|
sprintf(syncpath, "%s%s", dbpath, "sync/");
|
||||||
|
|
||||||
if(stat(syncpath, &buf) != 0) {
|
if(stat(syncpath, &buf) != 0) {
|
||||||
|
@ -54,13 +54,13 @@ static char *get_sync_dir(alpm_handle_t *handle)
|
||||||
syncpath);
|
syncpath);
|
||||||
if(_alpm_makepath(syncpath) != 0) {
|
if(_alpm_makepath(syncpath) != 0) {
|
||||||
free(syncpath);
|
free(syncpath);
|
||||||
RET_ERR(handle, PM_ERR_SYSTEM, NULL);
|
RET_ERR(handle, ALPM_ERR_SYSTEM, NULL);
|
||||||
}
|
}
|
||||||
} else if(!S_ISDIR(buf.st_mode)) {
|
} else if(!S_ISDIR(buf.st_mode)) {
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING, _("removing invalid file: %s\n"), syncpath);
|
_alpm_log(handle, ALPM_LOG_WARNING, _("removing invalid file: %s\n"), syncpath);
|
||||||
if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) {
|
if(unlink(syncpath) != 0 || _alpm_makepath(syncpath) != 0) {
|
||||||
free(syncpath);
|
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);
|
ret = _alpm_gpgme_checksig(db->handle, dbpath, NULL);
|
||||||
if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
|
if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
|
||||||
(check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
|
(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);
|
ASSERT(db != NULL, return -1);
|
||||||
handle = db->handle;
|
handle = db->handle;
|
||||||
handle->pm_errno = 0;
|
handle->pm_errno = 0;
|
||||||
ASSERT(db != handle->db_local, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(db != handle->db_local, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
ASSERT(db->servers != NULL, RET_ERR(handle, PM_ERR_SERVER_NONE, -1));
|
ASSERT(db->servers != NULL, RET_ERR(handle, ALPM_ERR_SERVER_NONE, -1));
|
||||||
|
|
||||||
syncpath = get_sync_dir(handle);
|
syncpath = get_sync_dir(handle);
|
||||||
if(!syncpath) {
|
if(!syncpath) {
|
||||||
|
@ -170,7 +170,7 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
|
||||||
|
|
||||||
/* attempt to grab a lock */
|
/* attempt to grab a lock */
|
||||||
if(_alpm_handle_lock(handle)) {
|
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) {
|
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) */
|
/* print server + filename into a buffer (leave space for .sig) */
|
||||||
len = strlen(server) + strlen(db->treename) + 9;
|
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);
|
snprintf(fileurl, len, "%s/%s.db", server, db->treename);
|
||||||
|
|
||||||
ret = _alpm_download(handle, fileurl, syncpath, force, 0, 0);
|
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) {
|
if(pkg == NULL) {
|
||||||
pkg = _alpm_pkg_new();
|
pkg = _alpm_pkg_new();
|
||||||
if(pkg == NULL) {
|
if(pkg == NULL) {
|
||||||
RET_ERR(db->handle, PM_ERR_MEMORY, NULL);
|
RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkg->name = pkgname;
|
pkg->name = pkgname;
|
||||||
|
@ -371,7 +371,7 @@ static int sync_db_populate(alpm_db_t *db)
|
||||||
alpm_pkg_t *pkg = NULL;
|
alpm_pkg_t *pkg = NULL;
|
||||||
|
|
||||||
if((archive = archive_read_new()) == 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);
|
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,
|
_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), dbpath,
|
||||||
archive_error_string(archive));
|
archive_error_string(archive));
|
||||||
archive_read_finish(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) {
|
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);
|
est_count = estimate_package_count(&buf, archive);
|
||||||
|
|
||||||
/* initialize hash at 66% full */
|
/* initialize hash at 66% full */
|
||||||
db->pkgcache = _alpm_pkghash_create(est_count * 3 / 2);
|
db->pkgcache = _alpm_pkghash_create(est_count * 3 / 2);
|
||||||
if(db->pkgcache == NULL) {
|
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) {
|
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);
|
db = _alpm_db_new(treename, 0);
|
||||||
if(db == NULL) {
|
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->ops = &sync_db_ops;
|
||||||
db->handle = handle;
|
db->handle = handle;
|
||||||
|
|
|
@ -303,7 +303,7 @@ static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
|
||||||
return conflicts;
|
return conflicts;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
RET_ERR(handle, PM_ERR_MEMORY, conflicts);
|
RET_ERR(handle, ALPM_ERR_MEMORY, conflicts);
|
||||||
}
|
}
|
||||||
|
|
||||||
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
|
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,
|
conflicts = add_fileconflict(handle, conflicts,
|
||||||
ALPM_FILECONFLICT_TARGET, path,
|
ALPM_FILECONFLICT_TARGET, path,
|
||||||
alpm_pkg_get_name(p1), alpm_pkg_get_name(p2));
|
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(conflicts);
|
||||||
FREELIST(common_files);
|
FREELIST(common_files);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -535,7 +535,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
|
||||||
if(!resolved_conflict) {
|
if(!resolved_conflict) {
|
||||||
conflicts = add_fileconflict(handle, conflicts,
|
conflicts = add_fileconflict(handle, conflicts,
|
||||||
ALPM_FILECONFLICT_FILESYSTEM, path, p1->name, NULL);
|
ALPM_FILECONFLICT_FILESYSTEM, path, p1->name, NULL);
|
||||||
if(handle->pm_errno == PM_ERR_MEMORY) {
|
if(handle->pm_errno == ALPM_ERR_MEMORY) {
|
||||||
FREELIST(conflicts);
|
FREELIST(conflicts);
|
||||||
if(dbpkg) {
|
if(dbpkg) {
|
||||||
/* only freed if it was generated from filelist_operation() */
|
/* only freed if it was generated from filelist_operation() */
|
||||||
|
|
|
@ -51,9 +51,9 @@ alpm_db_t SYMEXPORT *alpm_db_register_sync(alpm_handle_t *handle, const char *tr
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return NULL);
|
CHECK_HANDLE(handle, return NULL);
|
||||||
ASSERT(treename != NULL && strlen(treename) != 0,
|
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 */
|
/* 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);
|
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 */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
/* Do not unregister a database if a transaction is on-going */
|
/* 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 */
|
/* unregister all sync dbs */
|
||||||
for(i = handle->dbs_sync; i; i = i->next) {
|
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 */
|
/* Do not unregister a database if a transaction is on-going */
|
||||||
handle = db->handle;
|
handle = db->handle;
|
||||||
handle->pm_errno = 0;
|
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) {
|
if(db == handle->db_local) {
|
||||||
handle->db_local = NULL;
|
handle->db_local = NULL;
|
||||||
|
@ -120,7 +120,7 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!found) {
|
if(!found) {
|
||||||
RET_ERR(handle, PM_ERR_DB_NOT_FOUND, -1);
|
RET_ERR(handle, ALPM_ERR_DB_NOT_FOUND, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
db->ops->unregister(db);
|
db->ops->unregister(db);
|
||||||
|
@ -168,7 +168,7 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
db->handle->pm_errno = 0;
|
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);
|
newurl = sanitize_url(url);
|
||||||
if(!newurl) {
|
if(!newurl) {
|
||||||
|
@ -194,7 +194,7 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
ASSERT(db != NULL, return -1);
|
ASSERT(db != NULL, return -1);
|
||||||
db->handle->pm_errno = 0;
|
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);
|
newurl = sanitize_url(url);
|
||||||
if(!newurl) {
|
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);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
ASSERT(name != NULL && strlen(name) != 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);
|
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);
|
ASSERT(db != NULL, return NULL);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
ASSERT(name != NULL && strlen(name) != 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);
|
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);
|
ASSERT(db != NULL, return -1);
|
||||||
db->handle->pm_errno = 0;
|
db->handle->pm_errno = 0;
|
||||||
/* TODO assert db == db_local ? shouldn't need a db param at all here... */
|
/* 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);
|
alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(db, name);
|
||||||
if(pkg == NULL) {
|
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);
|
_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;
|
pkg->reason = reason;
|
||||||
/* write DESC */
|
/* write DESC */
|
||||||
if(_alpm_local_db_write(db, pkg, INFRQ_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;
|
return 0;
|
||||||
|
@ -353,16 +353,16 @@ const char *_alpm_db_path(alpm_db_t *db)
|
||||||
dbpath = alpm_option_get_dbpath(db->handle);
|
dbpath = alpm_option_get_dbpath(db->handle);
|
||||||
if(!dbpath) {
|
if(!dbpath) {
|
||||||
_alpm_log(db->handle, ALPM_LOG_ERROR, _("database path is undefined\n"));
|
_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) {
|
if(db->is_local) {
|
||||||
pathsize = strlen(dbpath) + strlen(db->treename) + 2;
|
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);
|
sprintf(db->_path, "%s%s/", dbpath, db->treename);
|
||||||
} else {
|
} else {
|
||||||
pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4;
|
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 */
|
/* all sync DBs now reside in the sync/ subdir of the dbpath */
|
||||||
sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
|
sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ char *_alpm_db_sig_path(alpm_db_t *db)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
len = strlen(dbfile) + strlen(".sig") + 1;
|
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);
|
sprintf(sigpath, "%s.sig", dbfile);
|
||||||
return sigpath;
|
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);
|
_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) {
|
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) {
|
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)) {
|
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)) {
|
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)) {
|
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)) {
|
if(!(db->status & DB_STATUS_GRPCACHE)) {
|
||||||
|
|
|
@ -637,9 +637,9 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
|
||||||
}
|
}
|
||||||
|
|
||||||
if(ignored) { /* resolvedeps will override these */
|
if(ignored) { /* resolvedeps will override these */
|
||||||
handle->pm_errno = PM_ERR_PKG_IGNORED;
|
handle->pm_errno = ALPM_ERR_PKG_IGNORED;
|
||||||
} else {
|
} else {
|
||||||
handle->pm_errno = PM_ERR_PKG_NOT_FOUND;
|
handle->pm_errno = ALPM_ERR_PKG_NOT_FOUND;
|
||||||
}
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -660,7 +660,7 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
|
||||||
alpm_pkg_t *pkg;
|
alpm_pkg_t *pkg;
|
||||||
|
|
||||||
CHECK_HANDLE(handle, return NULL);
|
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);
|
dep = _alpm_splitdep(depstring);
|
||||||
ASSERT(dep, return NULL);
|
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);
|
spkg = resolvedep(handle, missdep, handle->dbs_sync, *packages, 0);
|
||||||
}
|
}
|
||||||
if(!spkg) {
|
if(!spkg) {
|
||||||
handle->pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS;
|
||||||
char *missdepstring = alpm_dep_compute_string(missdep);
|
char *missdepstring = alpm_dep_compute_string(missdep);
|
||||||
_alpm_log(handle, ALPM_LOG_WARNING,
|
_alpm_log(handle, ALPM_LOG_WARNING,
|
||||||
_("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
_("cannot resolve \"%s\", a dependency of \"%s\"\n"),
|
||||||
|
|
|
@ -87,7 +87,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
|
||||||
continue;
|
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 = strdup(mnt->mnt_dir);
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
memcpy(&(mp->fsp), &fsp, sizeof(struct statvfs));
|
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++) {
|
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 = strdup(fsp->f_mntonname);
|
||||||
mp->mount_dir_len = strlen(mp->mount_dir);
|
mp->mount_dir_len = strlen(mp->mount_dir);
|
||||||
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
|
||||||
|
@ -193,7 +193,7 @@ static int calculate_installed_size(alpm_handle_t *handle,
|
||||||
struct archive_entry *entry;
|
struct archive_entry *entry;
|
||||||
|
|
||||||
if((archive = archive_read_new()) == NULL) {
|
if((archive = archive_read_new()) == NULL) {
|
||||||
handle->pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
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,
|
if(archive_read_open_filename(archive, pkg->origin_data.file,
|
||||||
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
handle->pm_errno = PM_ERR_PKG_OPEN;
|
handle->pm_errno = ALPM_ERR_PKG_OPEN;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
@ -246,7 +246,7 @@ static int calculate_installed_size(alpm_handle_t *handle,
|
||||||
if(archive_read_data_skip(archive)) {
|
if(archive_read_data_skip(archive)) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("error while reading package %s: %s\n"),
|
||||||
pkg->name, archive_error_string(archive));
|
pkg->name, archive_error_string(archive));
|
||||||
handle->pm_errno = PM_ERR_LIBARCHIVE;
|
handle->pm_errno = ALPM_ERR_LIBARCHIVE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -350,7 +350,7 @@ int _alpm_check_diskspace(alpm_handle_t *handle)
|
||||||
FREELIST(mount_points);
|
FREELIST(mount_points);
|
||||||
|
|
||||||
if(error) {
|
if(error) {
|
||||||
RET_ERR(handle, PM_ERR_DISK_SPACE, -1);
|
RET_ERR(handle, ALPM_ERR_DISK_SPACE, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -172,7 +172,7 @@ static int curl_download_internal(alpm_handle_t *handle,
|
||||||
dlfile.filename = get_filename(url);
|
dlfile.filename = get_filename(url);
|
||||||
if(!dlfile.filename || curl_gethost(url, hostname) != 0) {
|
if(!dlfile.filename || curl_gethost(url, hostname) != 0) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("url '%s' is invalid\n"), url);
|
_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, "");
|
destfile = get_fullpath(localpath, dlfile.filename, "");
|
||||||
|
@ -248,7 +248,7 @@ static int curl_download_internal(alpm_handle_t *handle,
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
} else if(handle->curlerr != CURLE_OK) {
|
} else if(handle->curlerr != CURLE_OK) {
|
||||||
if(!errors_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"),
|
_alpm_log(handle, ALPM_LOG_ERROR, _("failed retrieving file '%s' from %s : %s\n"),
|
||||||
dlfile.filename, hostname, error_buffer);
|
dlfile.filename, hostname, error_buffer);
|
||||||
} else {
|
} else {
|
||||||
|
@ -278,7 +278,7 @@ static int curl_download_internal(alpm_handle_t *handle,
|
||||||
* as actually being transferred during curl_easy_perform() */
|
* as actually being transferred during curl_easy_perform() */
|
||||||
if(!DOUBLE_EQ(remote_size, -1) && !DOUBLE_EQ(bytes_dl, -1) &&
|
if(!DOUBLE_EQ(remote_size, -1) && !DOUBLE_EQ(bytes_dl, -1) &&
|
||||||
!DOUBLE_EQ(bytes_dl, remote_size)) {
|
!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"),
|
_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);
|
dlfile.filename, (intmax_t)bytes_dl, (intmax_t)remote_size);
|
||||||
goto cleanup;
|
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,
|
return curl_download_internal(handle, url, localpath,
|
||||||
force, allow_resume, errors_ok);
|
force, allow_resume, errors_ok);
|
||||||
#else
|
#else
|
||||||
RET_ERR(handle, PM_ERR_EXTERNAL_DOWNLOAD, -1);
|
RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
|
||||||
#endif
|
#endif
|
||||||
} else {
|
} else {
|
||||||
int ret = handle->fetchcb(url, localpath, force);
|
int ret = handle->fetchcb(url, localpath, force);
|
||||||
if(ret == -1 && !errors_ok) {
|
if(ret == -1 && !errors_ok) {
|
||||||
RET_ERR(handle, PM_ERR_EXTERNAL_DOWNLOAD, -1);
|
RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
|
||||||
}
|
}
|
||||||
return ret;
|
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);
|
int errors_ok = (handle->sigverify == PM_PGP_VERIFY_OPTIONAL);
|
||||||
|
|
||||||
len = strlen(url) + 5;
|
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);
|
snprintf(sig_url, len, "%s.sig", url);
|
||||||
|
|
||||||
ret = _alpm_download(handle, sig_url, cachedir, 1, 0, errors_ok);
|
ret = _alpm_download(handle, sig_url, cachedir, 1, 0, errors_ok);
|
||||||
|
|
|
@ -38,120 +38,120 @@ const char SYMEXPORT *alpm_strerror(enum _alpm_errno_t err)
|
||||||
{
|
{
|
||||||
switch(err) {
|
switch(err) {
|
||||||
/* System */
|
/* System */
|
||||||
case PM_ERR_MEMORY:
|
case ALPM_ERR_MEMORY:
|
||||||
return _("out of memory!");
|
return _("out of memory!");
|
||||||
case PM_ERR_SYSTEM:
|
case ALPM_ERR_SYSTEM:
|
||||||
return _("unexpected system error");
|
return _("unexpected system error");
|
||||||
case PM_ERR_BADPERMS:
|
case ALPM_ERR_BADPERMS:
|
||||||
return _("insufficient privileges");
|
return _("insufficient privileges");
|
||||||
case PM_ERR_NOT_A_FILE:
|
case ALPM_ERR_NOT_A_FILE:
|
||||||
return _("could not find or read 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");
|
return _("could not find or read directory");
|
||||||
case PM_ERR_WRONG_ARGS:
|
case ALPM_ERR_WRONG_ARGS:
|
||||||
return _("wrong or NULL argument passed");
|
return _("wrong or NULL argument passed");
|
||||||
case PM_ERR_DISK_SPACE:
|
case ALPM_ERR_DISK_SPACE:
|
||||||
return _("not enough free disk space");
|
return _("not enough free disk space");
|
||||||
/* Interface */
|
/* Interface */
|
||||||
case PM_ERR_HANDLE_NULL:
|
case ALPM_ERR_HANDLE_NULL:
|
||||||
return _("library not initialized");
|
return _("library not initialized");
|
||||||
case PM_ERR_HANDLE_NOT_NULL:
|
case ALPM_ERR_HANDLE_NOT_NULL:
|
||||||
return _("library already initialized");
|
return _("library already initialized");
|
||||||
case PM_ERR_HANDLE_LOCK:
|
case ALPM_ERR_HANDLE_LOCK:
|
||||||
return _("unable to lock database");
|
return _("unable to lock database");
|
||||||
/* Databases */
|
/* Databases */
|
||||||
case PM_ERR_DB_OPEN:
|
case ALPM_ERR_DB_OPEN:
|
||||||
return _("could not open database");
|
return _("could not open database");
|
||||||
case PM_ERR_DB_CREATE:
|
case ALPM_ERR_DB_CREATE:
|
||||||
return _("could not create database");
|
return _("could not create database");
|
||||||
case PM_ERR_DB_NULL:
|
case ALPM_ERR_DB_NULL:
|
||||||
return _("database not initialized");
|
return _("database not initialized");
|
||||||
case PM_ERR_DB_NOT_NULL:
|
case ALPM_ERR_DB_NOT_NULL:
|
||||||
return _("database already registered");
|
return _("database already registered");
|
||||||
case PM_ERR_DB_NOT_FOUND:
|
case ALPM_ERR_DB_NOT_FOUND:
|
||||||
return _("could not find database");
|
return _("could not find database");
|
||||||
case PM_ERR_DB_INVALID:
|
case ALPM_ERR_DB_INVALID:
|
||||||
return _("invalid or corrupted database");
|
return _("invalid or corrupted database");
|
||||||
case PM_ERR_DB_VERSION:
|
case ALPM_ERR_DB_VERSION:
|
||||||
return _("database is incorrect version");
|
return _("database is incorrect version");
|
||||||
case PM_ERR_DB_WRITE:
|
case ALPM_ERR_DB_WRITE:
|
||||||
return _("could not update database");
|
return _("could not update database");
|
||||||
case PM_ERR_DB_REMOVE:
|
case ALPM_ERR_DB_REMOVE:
|
||||||
return _("could not remove database entry");
|
return _("could not remove database entry");
|
||||||
/* Servers */
|
/* Servers */
|
||||||
case PM_ERR_SERVER_BAD_URL:
|
case ALPM_ERR_SERVER_BAD_URL:
|
||||||
return _("invalid url for server");
|
return _("invalid url for server");
|
||||||
case PM_ERR_SERVER_NONE:
|
case ALPM_ERR_SERVER_NONE:
|
||||||
return _("no servers configured for repository");
|
return _("no servers configured for repository");
|
||||||
/* Transactions */
|
/* Transactions */
|
||||||
case PM_ERR_TRANS_NOT_NULL:
|
case ALPM_ERR_TRANS_NOT_NULL:
|
||||||
return _("transaction already initialized");
|
return _("transaction already initialized");
|
||||||
case PM_ERR_TRANS_NULL:
|
case ALPM_ERR_TRANS_NULL:
|
||||||
return _("transaction not initialized");
|
return _("transaction not initialized");
|
||||||
case PM_ERR_TRANS_DUP_TARGET:
|
case ALPM_ERR_TRANS_DUP_TARGET:
|
||||||
return _("duplicate target");
|
return _("duplicate target");
|
||||||
case PM_ERR_TRANS_NOT_INITIALIZED:
|
case ALPM_ERR_TRANS_NOT_INITIALIZED:
|
||||||
return _("transaction not initialized");
|
return _("transaction not initialized");
|
||||||
case PM_ERR_TRANS_NOT_PREPARED:
|
case ALPM_ERR_TRANS_NOT_PREPARED:
|
||||||
return _("transaction not prepared");
|
return _("transaction not prepared");
|
||||||
case PM_ERR_TRANS_ABORT:
|
case ALPM_ERR_TRANS_ABORT:
|
||||||
return _("transaction aborted");
|
return _("transaction aborted");
|
||||||
case PM_ERR_TRANS_TYPE:
|
case ALPM_ERR_TRANS_TYPE:
|
||||||
return _("operation not compatible with the transaction 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");
|
return _("transaction commit attempt when database is not locked");
|
||||||
/* Packages */
|
/* Packages */
|
||||||
case PM_ERR_PKG_NOT_FOUND:
|
case ALPM_ERR_PKG_NOT_FOUND:
|
||||||
return _("could not find or read package");
|
return _("could not find or read package");
|
||||||
case PM_ERR_PKG_IGNORED:
|
case ALPM_ERR_PKG_IGNORED:
|
||||||
return _("operation cancelled due to ignorepkg");
|
return _("operation cancelled due to ignorepkg");
|
||||||
case PM_ERR_PKG_INVALID:
|
case ALPM_ERR_PKG_INVALID:
|
||||||
return _("invalid or corrupted package");
|
return _("invalid or corrupted package");
|
||||||
case PM_ERR_PKG_OPEN:
|
case ALPM_ERR_PKG_OPEN:
|
||||||
return _("cannot open package file");
|
return _("cannot open package file");
|
||||||
case PM_ERR_PKG_CANT_REMOVE:
|
case ALPM_ERR_PKG_CANT_REMOVE:
|
||||||
return _("cannot remove all files for package");
|
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");
|
return _("package filename is not valid");
|
||||||
case PM_ERR_PKG_INVALID_ARCH:
|
case ALPM_ERR_PKG_INVALID_ARCH:
|
||||||
return _("package architecture is not valid");
|
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");
|
return _("could not find repository for target");
|
||||||
/* Signatures */
|
/* Signatures */
|
||||||
case PM_ERR_SIG_MISSINGDIR:
|
case ALPM_ERR_SIG_MISSINGDIR:
|
||||||
return _("signature directory not configured correctly");
|
return _("signature directory not configured correctly");
|
||||||
case PM_ERR_SIG_INVALID:
|
case ALPM_ERR_SIG_INVALID:
|
||||||
return _("invalid PGP signature");
|
return _("invalid PGP signature");
|
||||||
case PM_ERR_SIG_UNKNOWN:
|
case ALPM_ERR_SIG_UNKNOWN:
|
||||||
return _("unknown PGP signature");
|
return _("unknown PGP signature");
|
||||||
/* Deltas */
|
/* Deltas */
|
||||||
case PM_ERR_DLT_INVALID:
|
case ALPM_ERR_DLT_INVALID:
|
||||||
return _("invalid or corrupted delta");
|
return _("invalid or corrupted delta");
|
||||||
case PM_ERR_DLT_PATCHFAILED:
|
case ALPM_ERR_DLT_PATCHFAILED:
|
||||||
return _("delta patch failed");
|
return _("delta patch failed");
|
||||||
/* Dependencies */
|
/* Dependencies */
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case ALPM_ERR_UNSATISFIED_DEPS:
|
||||||
return _("could not satisfy dependencies");
|
return _("could not satisfy dependencies");
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case ALPM_ERR_CONFLICTING_DEPS:
|
||||||
return _("conflicting dependencies");
|
return _("conflicting dependencies");
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case ALPM_ERR_FILE_CONFLICTS:
|
||||||
return _("conflicting files");
|
return _("conflicting files");
|
||||||
/* Miscellaenous */
|
/* Miscellaenous */
|
||||||
case PM_ERR_RETRIEVE:
|
case ALPM_ERR_RETRIEVE:
|
||||||
return _("failed to retrieve some files");
|
return _("failed to retrieve some files");
|
||||||
case PM_ERR_INVALID_REGEX:
|
case ALPM_ERR_INVALID_REGEX:
|
||||||
return _("invalid regular expression");
|
return _("invalid regular expression");
|
||||||
/* Errors from external libraries- our own wrapper error */
|
/* 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
|
/* it would be nice to use archive_error_string() here, but that
|
||||||
* requires the archive struct, so we can't. Just use a generic
|
* requires the archive struct, so we can't. Just use a generic
|
||||||
* error string instead. */
|
* error string instead. */
|
||||||
return _("libarchive error");
|
return _("libarchive error");
|
||||||
case PM_ERR_LIBCURL:
|
case ALPM_ERR_LIBCURL:
|
||||||
return _("download library error");
|
return _("download library error");
|
||||||
case PM_ERR_GPGME:
|
case ALPM_ERR_GPGME:
|
||||||
return _("gpgme error");
|
return _("gpgme error");
|
||||||
case PM_ERR_EXTERNAL_DOWNLOAD:
|
case ALPM_ERR_EXTERNAL_DOWNLOAD:
|
||||||
return _("error invoking external downloader");
|
return _("error invoking external downloader");
|
||||||
/* Unknown error! */
|
/* Unknown error! */
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -312,16 +312,16 @@ enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
||||||
|
|
||||||
path = value;
|
path = value;
|
||||||
if(!path) {
|
if(!path) {
|
||||||
return PM_ERR_WRONG_ARGS;
|
return ALPM_ERR_WRONG_ARGS;
|
||||||
}
|
}
|
||||||
if(must_exist) {
|
if(must_exist) {
|
||||||
if(stat(path, &st) == -1 || !S_ISDIR(st.st_mode)) {
|
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)) {
|
if(!realpath(path, real)) {
|
||||||
free(real);
|
free(real);
|
||||||
return PM_ERR_NOT_A_DIR;
|
return ALPM_ERR_NOT_A_DIR;
|
||||||
}
|
}
|
||||||
path = real;
|
path = real;
|
||||||
}
|
}
|
||||||
|
@ -331,7 +331,7 @@ enum _alpm_errno_t _alpm_set_directory_option(const char *value,
|
||||||
}
|
}
|
||||||
*storage = canonicalize_path(path);
|
*storage = canonicalize_path(path);
|
||||||
if(!*storage) {
|
if(!*storage) {
|
||||||
return PM_ERR_MEMORY;
|
return ALPM_ERR_MEMORY;
|
||||||
}
|
}
|
||||||
free(real);
|
free(real);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -342,13 +342,13 @@ int SYMEXPORT alpm_option_add_cachedir(alpm_handle_t *handle, const char *cached
|
||||||
char *newcachedir;
|
char *newcachedir;
|
||||||
|
|
||||||
CHECK_HANDLE(handle, return -1);
|
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
|
/* 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. */
|
* fail later if it is needed and the path is invalid. */
|
||||||
|
|
||||||
newcachedir = canonicalize_path(cachedir);
|
newcachedir = canonicalize_path(cachedir);
|
||||||
if(!newcachedir) {
|
if(!newcachedir) {
|
||||||
RET_ERR(handle, PM_ERR_MEMORY, -1);
|
RET_ERR(handle, ALPM_ERR_MEMORY, -1);
|
||||||
}
|
}
|
||||||
handle->cachedirs = alpm_list_add(handle->cachedirs, newcachedir);
|
handle->cachedirs = alpm_list_add(handle->cachedirs, newcachedir);
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "option 'cachedir' = %s\n", 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 *vdata = NULL;
|
||||||
char *newcachedir;
|
char *newcachedir;
|
||||||
CHECK_HANDLE(handle, return -1);
|
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);
|
newcachedir = canonicalize_path(cachedir);
|
||||||
if(!newcachedir) {
|
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);
|
handle->cachedirs = alpm_list_remove_str(handle->cachedirs, newcachedir, &vdata);
|
||||||
FREE(newcachedir);
|
FREE(newcachedir);
|
||||||
|
@ -397,7 +397,7 @@ int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile
|
||||||
|
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(!logfile) {
|
if(!logfile) {
|
||||||
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
handle->pm_errno = ALPM_ERR_WRONG_ARGS;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -420,7 +420,7 @@ int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
if(!gpgdir) {
|
if(!gpgdir) {
|
||||||
handle->pm_errno = PM_ERR_WRONG_ARGS;
|
handle->pm_errno = ALPM_ERR_WRONG_ARGS;
|
||||||
return -1;
|
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)
|
int SYMEXPORT alpm_option_set_default_sigverify(alpm_handle_t *handle, pgp_verify_t level)
|
||||||
{
|
{
|
||||||
CHECK_HANDLE(handle, return -1);
|
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;
|
handle->sigverify = level;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 we couldn't open it, we have an issue */
|
||||||
if(handle->logstream == NULL) {
|
if(handle->logstream == NULL) {
|
||||||
if(errno == EACCES) {
|
if(errno == EACCES) {
|
||||||
handle->pm_errno = PM_ERR_BADPERMS;
|
handle->pm_errno = ALPM_ERR_BADPERMS;
|
||||||
} else if(errno == ENOENT) {
|
} else if(errno == ENOENT) {
|
||||||
handle->pm_errno = PM_ERR_NOT_A_DIR;
|
handle->pm_errno = ALPM_ERR_NOT_A_DIR;
|
||||||
} else {
|
} else {
|
||||||
handle->pm_errno = PM_ERR_SYSTEM;
|
handle->pm_errno = ALPM_ERR_SYSTEM;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ int SYMEXPORT alpm_pkg_checkmd5sum(alpm_pkg_t *pkg)
|
||||||
pkg->handle->pm_errno = 0;
|
pkg->handle->pm_errno = 0;
|
||||||
/* We only inspect packages from sync repositories */
|
/* We only inspect packages from sync repositories */
|
||||||
ASSERT(pkg->origin == PKG_FROM_SYNCDB,
|
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));
|
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) {
|
if(retval == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
} else if(retval == 1) {
|
} else if(retval == 1) {
|
||||||
pkg->handle->pm_errno = PM_ERR_PKG_INVALID;
|
pkg->handle->pm_errno = ALPM_ERR_PKG_INVALID;
|
||||||
retval = -1;
|
retval = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,17 +51,17 @@ int SYMEXPORT alpm_remove_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return -1);
|
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));
|
||||||
ASSERT(handle == pkg->handle, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
|
ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
|
||||||
trans = handle->trans;
|
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,
|
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;
|
pkgname = pkg->name;
|
||||||
|
|
||||||
if(_alpm_pkg_find(trans->remove, pkgname)) {
|
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",
|
_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_inner(lp, (alpm_list_fn_free)_alpm_depmiss_free);
|
||||||
alpm_list_free(lp);
|
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)) {
|
if(!can_remove_file(handle, lp->data, skip_remove)) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG,
|
_alpm_log(handle, ALPM_LOG_DEBUG,
|
||||||
"not removing package '%s', can't remove all files\n", pkgname);
|
"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++;
|
filenum++;
|
||||||
}
|
}
|
||||||
|
@ -397,7 +397,7 @@ int _alpm_remove_packages(alpm_handle_t *handle)
|
||||||
if(!can_remove_file(handle, lp->data, NULL)) {
|
if(!can_remove_file(handle, lp->data, NULL)) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "not removing package '%s', can't remove all files\n",
|
_alpm_log(handle, ALPM_LOG_DEBUG, "not removing package '%s', can't remove all files\n",
|
||||||
pkgname);
|
pkgname);
|
||||||
RET_ERR(handle, PM_ERR_PKG_CANT_REMOVE, -1);
|
RET_ERR(handle, ALPM_ERR_PKG_CANT_REMOVE, -1);
|
||||||
}
|
}
|
||||||
filenum++;
|
filenum++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -118,7 +118,7 @@ static int init_gpgme(alpm_handle_t *handle)
|
||||||
|
|
||||||
sigdir = alpm_option_get_gpgdir(handle);
|
sigdir = alpm_option_get_gpgdir(handle);
|
||||||
if(!sigdir) {
|
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
|
/* calling gpgme_check_version() returns the current version and runs
|
||||||
|
@ -154,7 +154,7 @@ static int init_gpgme(alpm_handle_t *handle)
|
||||||
|
|
||||||
error:
|
error:
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("GPGME error: %s\n"), gpgme_strerror(err));
|
_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;
|
FILE *file = NULL, *sigfile = NULL;
|
||||||
|
|
||||||
if(!path || access(path, R_OK) != 0) {
|
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) {
|
if(!base64_sig) {
|
||||||
size_t len = strlen(path) + 5;
|
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);
|
snprintf(sigpath, len, "%s.sig", path);
|
||||||
|
|
||||||
if(!access(sigpath, R_OK) == 0) {
|
if(!access(sigpath, R_OK) == 0) {
|
||||||
FREE(sigpath);
|
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 */
|
/* create our necessary data objects to verify the signature */
|
||||||
file = fopen(path, "rb");
|
file = fopen(path, "rb");
|
||||||
if(file == NULL) {
|
if(file == NULL) {
|
||||||
handle->pm_errno = PM_ERR_NOT_A_FILE;
|
handle->pm_errno = ALPM_ERR_NOT_A_FILE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
|
||||||
/* file-based, it is on disk */
|
/* file-based, it is on disk */
|
||||||
sigfile = fopen(sigpath, "rb");
|
sigfile = fopen(sigpath, "rb");
|
||||||
if(sigfile == NULL) {
|
if(sigfile == NULL) {
|
||||||
handle->pm_errno = PM_ERR_NOT_A_FILE;
|
handle->pm_errno = ALPM_ERR_NOT_A_FILE;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
@ -320,16 +320,16 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
|
||||||
} else if(gpgsig->summary & GPGME_SIGSUM_RED) {
|
} else if(gpgsig->summary & GPGME_SIGSUM_RED) {
|
||||||
/* definite bad signature, error */
|
/* definite bad signature, error */
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "result: red signature\n");
|
_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;
|
ret = 1;
|
||||||
} else if(gpgsig->summary & GPGME_SIGSUM_KEY_MISSING) {
|
} else if(gpgsig->summary & GPGME_SIGSUM_KEY_MISSING) {
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "result: signature from unknown key\n");
|
_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;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
/* we'll capture everything else here */
|
/* we'll capture everything else here */
|
||||||
_alpm_log(handle, ALPM_LOG_DEBUG, "result: invalid signature\n");
|
_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;
|
ret = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ error:
|
||||||
FREE(decoded_sigdata);
|
FREE(decoded_sigdata);
|
||||||
if(err != GPG_ERR_NO_ERROR) {
|
if(err != GPG_ERR_NO_ERROR) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("GPGME error: %s\n"), gpgme_strerror(err));
|
_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;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,8 +94,8 @@ int SYMEXPORT alpm_sync_sysupgrade(alpm_handle_t *handle, int enable_downgrade)
|
||||||
trans = handle->trans;
|
trans = handle->trans;
|
||||||
db_local = handle->db_local;
|
db_local = handle->db_local;
|
||||||
dbs_sync = handle->dbs_sync;
|
dbs_sync = handle->dbs_sync;
|
||||||
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));
|
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");
|
_alpm_log(handle, ALPM_LOG_DEBUG, "checking for package upgrades\n");
|
||||||
for(i = _alpm_db_get_pkgcache(db_local); i; i = i->next) {
|
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);
|
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);
|
fpath = _alpm_filecache_find(handle, fname);
|
||||||
|
|
||||||
if(fpath) {
|
if(fpath) {
|
||||||
|
@ -429,7 +429,7 @@ int _alpm_sync_prepare(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
sync = sync2;
|
sync = sync2;
|
||||||
} else {
|
} else {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
_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;
|
ret = -1;
|
||||||
if(data) {
|
if(data) {
|
||||||
alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict);
|
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);
|
sync->removes = alpm_list_add(sync->removes, local);
|
||||||
} else { /* abort */
|
} else { /* abort */
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("unresolvable package conflicts detected\n"));
|
_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;
|
ret = -1;
|
||||||
if(data) {
|
if(data) {
|
||||||
alpm_conflict_t *newconflict = _alpm_conflict_dup(conflict);
|
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),
|
deps = alpm_checkdeps(handle, _alpm_db_get_pkgcache(handle->db_local),
|
||||||
trans->remove, trans->add, 1);
|
trans->remove, trans->add, 1);
|
||||||
if(deps) {
|
if(deps) {
|
||||||
handle->pm_errno = PM_ERR_UNSATISFIED_DEPS;
|
handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS;
|
||||||
ret = -1;
|
ret = -1;
|
||||||
if(data) {
|
if(data) {
|
||||||
*data = deps;
|
*data = deps;
|
||||||
|
@ -612,11 +612,11 @@ static int apply_deltas(alpm_handle_t *handle)
|
||||||
} else {
|
} else {
|
||||||
/* len = cachedir len + from len + '/' + null */
|
/* len = cachedir len + from len + '/' + null */
|
||||||
len = strlen(cachedir) + strlen(d->from) + 2;
|
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);
|
snprintf(from, len, "%s/%s", cachedir, d->from);
|
||||||
}
|
}
|
||||||
len = strlen(cachedir) + strlen(d->to) + 2;
|
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);
|
snprintf(to, len, "%s/%s", cachedir, d->to);
|
||||||
|
|
||||||
/* build the patch command */
|
/* build the patch command */
|
||||||
|
@ -652,7 +652,7 @@ static int apply_deltas(alpm_handle_t *handle)
|
||||||
if(retval != 0) {
|
if(retval != 0) {
|
||||||
/* one delta failed for this package, cancel the remaining ones */
|
/* one delta failed for this package, cancel the remaining ones */
|
||||||
EVENT(trans, ALPM_TRANS_EVT_DELTA_PATCH_FAILED, NULL, NULL);
|
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;
|
ret = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -714,7 +714,7 @@ static int validate_deltas(alpm_handle_t *handle, alpm_list_t *deltas,
|
||||||
FREE(filepath);
|
FREE(filepath);
|
||||||
}
|
}
|
||||||
if(errors) {
|
if(errors) {
|
||||||
handle->pm_errno = PM_ERR_DLT_INVALID;
|
handle->pm_errno = ALPM_ERR_DLT_INVALID;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
EVENT(trans, ALPM_TRANS_EVT_DELTA_INTEGRITY_DONE, NULL, NULL);
|
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;
|
const char *fname = NULL;
|
||||||
|
|
||||||
fname = alpm_pkg_get_filename(spkg);
|
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;
|
alpm_list_t *delta_path = spkg->delta_path;
|
||||||
if(delta_path) {
|
if(delta_path) {
|
||||||
/* using deltas */
|
/* using deltas */
|
||||||
|
@ -794,7 +794,7 @@ static int download_files(alpm_handle_t *handle, alpm_list_t **deltas)
|
||||||
|
|
||||||
/* print server + filename into a buffer */
|
/* print server + filename into a buffer */
|
||||||
len = strlen(server_url) + strlen(filename) + 2;
|
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);
|
snprintf(fileurl, len, "%s/%s", server_url, filename);
|
||||||
|
|
||||||
ret = _alpm_download(handle, fileurl, cachedir, 0, 1, 0);
|
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"),
|
_alpm_log(handle, ALPM_LOG_WARNING, _("failed to retrieve some files from %s\n"),
|
||||||
current->treename);
|
current->treename);
|
||||||
if(handle->pm_errno == 0) {
|
if(handle->pm_errno == 0) {
|
||||||
handle->pm_errno = PM_ERR_RETRIEVE;
|
handle->pm_errno = ALPM_ERR_RETRIEVE;
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -901,7 +901,7 @@ int _alpm_sync_commit(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
|
|
||||||
|
|
||||||
if(errors) {
|
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) {
|
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_inner(conflict, (alpm_list_fn_free)_alpm_fileconflict_free);
|
||||||
alpm_list_free(conflict);
|
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);
|
EVENT(trans, ALPM_TRANS_EVT_FILECONFLICTS_DONE, NULL, NULL);
|
||||||
|
|
|
@ -57,23 +57,23 @@ int SYMEXPORT alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags,
|
||||||
|
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return -1);
|
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) {
|
for(i = handle->dbs_sync; i; i = i->next) {
|
||||||
const alpm_db_t *db = i->data;
|
const alpm_db_t *db = i->data;
|
||||||
if(!(db->status & DB_STATUS_VALID)) {
|
if(!(db->status & DB_STATUS_VALID)) {
|
||||||
RET_ERR(handle, PM_ERR_DB_INVALID, -1);
|
RET_ERR(handle, ALPM_ERR_DB_INVALID, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lock db */
|
/* lock db */
|
||||||
if(!(flags & ALPM_TRANS_FLAG_NOLOCK)) {
|
if(!(flags & ALPM_TRANS_FLAG_NOLOCK)) {
|
||||||
if(_alpm_handle_lock(handle)) {
|
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->flags = flags;
|
||||||
trans->cb_event = event;
|
trans->cb_event = event;
|
||||||
trans->cb_conv = conv;
|
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 *pkgname = alpm_pkg_get_name(pkg);
|
||||||
const char *pkgver = alpm_pkg_get_version(pkg);
|
const char *pkgver = alpm_pkg_get_version(pkg);
|
||||||
size_t len = strlen(pkgname) + strlen(pkgver) + strlen(pkgarch) + 3;
|
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);
|
sprintf(string, "%s-%s-%s", pkgname, pkgver, pkgarch);
|
||||||
invalid = alpm_list_add(invalid, string);
|
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 */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return -1);
|
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;
|
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));
|
ASSERT(trans->state == STATE_INITIALIZED, RET_ERR(handle, ALPM_ERR_TRANS_NOT_INITIALIZED, -1));
|
||||||
|
|
||||||
/* If there's nothing to do, return without complaining */
|
/* If there's nothing to do, return without complaining */
|
||||||
if(trans->add == NULL && trans->remove == NULL) {
|
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) {
|
if(data) {
|
||||||
*data = invalid;
|
*data = invalid;
|
||||||
}
|
}
|
||||||
RET_ERR(handle, PM_ERR_PKG_INVALID_ARCH, -1);
|
RET_ERR(handle, ALPM_ERR_PKG_INVALID_ARCH, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(trans->add == NULL) {
|
if(trans->add == NULL) {
|
||||||
|
@ -164,10 +164,10 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data)
|
||||||
|
|
||||||
trans = handle->trans;
|
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_PREPARED, RET_ERR(handle, PM_ERR_TRANS_NOT_PREPARED, -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 there's nothing to do, return without complaining */
|
||||||
if(trans->add == NULL && trans->remove == NULL) {
|
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);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
|
||||||
trans = handle->trans;
|
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,
|
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;
|
trans->state = STATE_INTERRUPTED;
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@ int SYMEXPORT alpm_trans_release(alpm_handle_t *handle)
|
||||||
CHECK_HANDLE(handle, return -1);
|
CHECK_HANDLE(handle, return -1);
|
||||||
|
|
||||||
trans = handle->trans;
|
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_IDLE, RET_ERR(handle, PM_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;
|
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 */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return -1);
|
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;
|
return handle->trans->flags;
|
||||||
}
|
}
|
||||||
|
@ -372,7 +372,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_add(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return NULL);
|
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;
|
return handle->trans->add;
|
||||||
}
|
}
|
||||||
|
@ -381,7 +381,7 @@ alpm_list_t SYMEXPORT *alpm_trans_get_remove(alpm_handle_t *handle)
|
||||||
{
|
{
|
||||||
/* Sanity checks */
|
/* Sanity checks */
|
||||||
CHECK_HANDLE(handle, return NULL);
|
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;
|
return handle->trans->remove;
|
||||||
}
|
}
|
||||||
|
|
|
@ -254,7 +254,7 @@ int _alpm_unpack(alpm_handle_t *handle, const char *archive, const char *prefix,
|
||||||
int restore_cwd = 0;
|
int restore_cwd = 0;
|
||||||
|
|
||||||
if((_archive = archive_read_new()) == NULL) {
|
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);
|
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) {
|
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
|
||||||
_alpm_log(handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), archive,
|
_alpm_log(handle, ALPM_LOG_ERROR, _("could not open file %s: %s\n"), archive,
|
||||||
archive_error_string(_archive));
|
archive_error_string(_archive));
|
||||||
RET_ERR(handle, PM_ERR_PKG_OPEN, 1);
|
RET_ERR(handle, ALPM_ERR_PKG_OPEN, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
oldmask = umask(0022);
|
oldmask = umask(0022);
|
||||||
|
|
|
@ -449,7 +449,7 @@ static int setup_libalpm(void)
|
||||||
if(!handle) {
|
if(!handle) {
|
||||||
pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"),
|
pm_printf(ALPM_LOG_ERROR, _("failed to initialize alpm library (%s)\n"),
|
||||||
alpm_strerror(err));
|
alpm_strerror(err));
|
||||||
if(err == PM_ERR_DB_VERSION) {
|
if(err == ALPM_ERR_DB_VERSION) {
|
||||||
pm_printf(ALPM_LOG_ERROR, _(" try running pacman-db-upgrade\n"));
|
pm_printf(ALPM_LOG_ERROR, _(" try running pacman-db-upgrade\n"));
|
||||||
}
|
}
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -106,13 +106,13 @@ int pacman_remove(alpm_list_t *targets)
|
||||||
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
|
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
|
||||||
alpm_strerror(err));
|
alpm_strerror(err));
|
||||||
switch(err) {
|
switch(err) {
|
||||||
case PM_ERR_PKG_INVALID_ARCH:
|
case ALPM_ERR_PKG_INVALID_ARCH:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
char *pkg = alpm_list_getdata(i);
|
char *pkg = alpm_list_getdata(i);
|
||||||
printf(_(":: package %s does not have a valid architecture\n"), pkg);
|
printf(_(":: package %s does not have a valid architecture\n"), pkg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case ALPM_ERR_UNSATISFIED_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
alpm_depmissing_t *miss = alpm_list_getdata(i);
|
alpm_depmissing_t *miss = alpm_list_getdata(i);
|
||||||
char *depstring = alpm_dep_compute_string(miss->depend);
|
char *depstring = alpm_dep_compute_string(miss->depend);
|
||||||
|
|
|
@ -616,8 +616,8 @@ static int process_pkg(alpm_pkg_t *pkg)
|
||||||
|
|
||||||
if(ret == -1) {
|
if(ret == -1) {
|
||||||
enum _alpm_errno_t err = alpm_errno(config->handle);
|
enum _alpm_errno_t err = alpm_errno(config->handle);
|
||||||
if(err == PM_ERR_TRANS_DUP_TARGET
|
if(err == ALPM_ERR_TRANS_DUP_TARGET
|
||||||
|| err == PM_ERR_PKG_IGNORED) {
|
|| err == ALPM_ERR_PKG_IGNORED) {
|
||||||
/* just skip duplicate or ignored targets */
|
/* just skip duplicate or ignored targets */
|
||||||
pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg));
|
pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), alpm_pkg_get_name(pkg));
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -681,7 +681,7 @@ static int process_targname(alpm_list_t *dblist, char *targname)
|
||||||
alpm_pkg_t *pkg = alpm_find_dbs_satisfier(config->handle, dblist, targname);
|
alpm_pkg_t *pkg = alpm_find_dbs_satisfier(config->handle, dblist, targname);
|
||||||
|
|
||||||
/* #FS#23342 - skip ignored packages when user says no */
|
/* #FS#23342 - skip ignored packages when user says no */
|
||||||
if(alpm_errno(config->handle) == PM_ERR_PKG_IGNORED) {
|
if(alpm_errno(config->handle) == ALPM_ERR_PKG_IGNORED) {
|
||||||
pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), targname);
|
pm_printf(ALPM_LOG_WARNING, _("skipping target: %s\n"), targname);
|
||||||
/* TODO how to do this, we shouldn't be fucking with it from the frontend */
|
/* TODO how to do this, we shouldn't be fucking with it from the frontend */
|
||||||
/* pm_errno = 0; */
|
/* pm_errno = 0; */
|
||||||
|
@ -767,13 +767,13 @@ static int sync_trans(alpm_list_t *targets)
|
||||||
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
|
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
|
||||||
alpm_strerror(err));
|
alpm_strerror(err));
|
||||||
switch(err) {
|
switch(err) {
|
||||||
case PM_ERR_PKG_INVALID_ARCH:
|
case ALPM_ERR_PKG_INVALID_ARCH:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
char *pkg = alpm_list_getdata(i);
|
char *pkg = alpm_list_getdata(i);
|
||||||
printf(_(":: package %s does not have a valid architecture\n"), pkg);
|
printf(_(":: package %s does not have a valid architecture\n"), pkg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case ALPM_ERR_UNSATISFIED_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
alpm_depmissing_t *miss = alpm_list_getdata(i);
|
alpm_depmissing_t *miss = alpm_list_getdata(i);
|
||||||
char *depstring = alpm_dep_compute_string(miss->depend);
|
char *depstring = alpm_dep_compute_string(miss->depend);
|
||||||
|
@ -781,7 +781,7 @@ static int sync_trans(alpm_list_t *targets)
|
||||||
free(depstring);
|
free(depstring);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case ALPM_ERR_CONFLICTING_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
alpm_conflict_t *conflict = alpm_list_getdata(i);
|
alpm_conflict_t *conflict = alpm_list_getdata(i);
|
||||||
/* only print reason if it contains new information */
|
/* only print reason if it contains new information */
|
||||||
|
@ -834,7 +834,7 @@ static int sync_trans(alpm_list_t *targets)
|
||||||
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
|
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
|
||||||
alpm_strerror(err));
|
alpm_strerror(err));
|
||||||
switch(err) {
|
switch(err) {
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case ALPM_ERR_FILE_CONFLICTS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
alpm_fileconflict_t *conflict = alpm_list_getdata(i);
|
alpm_fileconflict_t *conflict = alpm_list_getdata(i);
|
||||||
switch(conflict->type) {
|
switch(conflict->type) {
|
||||||
|
@ -849,8 +849,8 @@ static int sync_trans(alpm_list_t *targets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_PKG_INVALID:
|
case ALPM_ERR_PKG_INVALID:
|
||||||
case PM_ERR_DLT_INVALID:
|
case ALPM_ERR_DLT_INVALID:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
char *filename = alpm_list_getdata(i);
|
char *filename = alpm_list_getdata(i);
|
||||||
printf(_("%s is invalid or corrupted\n"), filename);
|
printf(_("%s is invalid or corrupted\n"), filename);
|
||||||
|
|
|
@ -98,13 +98,13 @@ int pacman_upgrade(alpm_list_t *targets)
|
||||||
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
|
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to prepare transaction (%s)\n"),
|
||||||
alpm_strerror(err));
|
alpm_strerror(err));
|
||||||
switch(err) {
|
switch(err) {
|
||||||
case PM_ERR_PKG_INVALID_ARCH:
|
case ALPM_ERR_PKG_INVALID_ARCH:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
char *pkg = alpm_list_getdata(i);
|
char *pkg = alpm_list_getdata(i);
|
||||||
printf(_(":: package %s does not have a valid architecture\n"), pkg);
|
printf(_(":: package %s does not have a valid architecture\n"), pkg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_UNSATISFIED_DEPS:
|
case ALPM_ERR_UNSATISFIED_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
alpm_depmissing_t *miss = alpm_list_getdata(i);
|
alpm_depmissing_t *miss = alpm_list_getdata(i);
|
||||||
char *depstring = alpm_dep_compute_string(miss->depend);
|
char *depstring = alpm_dep_compute_string(miss->depend);
|
||||||
|
@ -116,7 +116,7 @@ int pacman_upgrade(alpm_list_t *targets)
|
||||||
free(depstring);
|
free(depstring);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_CONFLICTING_DEPS:
|
case ALPM_ERR_CONFLICTING_DEPS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
alpm_conflict_t *conflict = alpm_list_getdata(i);
|
alpm_conflict_t *conflict = alpm_list_getdata(i);
|
||||||
if(strcmp(conflict->package1, conflict->reason) == 0 ||
|
if(strcmp(conflict->package1, conflict->reason) == 0 ||
|
||||||
|
@ -166,7 +166,7 @@ int pacman_upgrade(alpm_list_t *targets)
|
||||||
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
|
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to commit transaction (%s)\n"),
|
||||||
alpm_strerror(err));
|
alpm_strerror(err));
|
||||||
switch(err) {
|
switch(err) {
|
||||||
case PM_ERR_FILE_CONFLICTS:
|
case ALPM_ERR_FILE_CONFLICTS:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
alpm_fileconflict_t *conflict = alpm_list_getdata(i);
|
alpm_fileconflict_t *conflict = alpm_list_getdata(i);
|
||||||
switch(conflict->type) {
|
switch(conflict->type) {
|
||||||
|
@ -181,8 +181,8 @@ int pacman_upgrade(alpm_list_t *targets)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case PM_ERR_PKG_INVALID:
|
case ALPM_ERR_PKG_INVALID:
|
||||||
case PM_ERR_DLT_INVALID:
|
case ALPM_ERR_DLT_INVALID:
|
||||||
for(i = data; i; i = alpm_list_next(i)) {
|
for(i = data; i; i = alpm_list_next(i)) {
|
||||||
char *filename = alpm_list_getdata(i);
|
char *filename = alpm_list_getdata(i);
|
||||||
printf(_("%s is invalid or corrupted\n"), filename);
|
printf(_("%s is invalid or corrupted\n"), filename);
|
||||||
|
|
|
@ -63,7 +63,7 @@ int trans_init(alpm_transflag_t flags)
|
||||||
enum _alpm_errno_t err = alpm_errno(config->handle);
|
enum _alpm_errno_t err = alpm_errno(config->handle);
|
||||||
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"),
|
pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"),
|
||||||
alpm_strerror(err));
|
alpm_strerror(err));
|
||||||
if(err == PM_ERR_HANDLE_LOCK) {
|
if(err == ALPM_ERR_HANDLE_LOCK) {
|
||||||
fprintf(stderr, _(" if you're sure a package manager is not already\n"
|
fprintf(stderr, _(" if you're sure a package manager is not already\n"
|
||||||
" running, you can remove %s\n"),
|
" running, you can remove %s\n"),
|
||||||
alpm_option_get_lockfile(config->handle));
|
alpm_option_get_lockfile(config->handle));
|
||||||
|
|
|
@ -62,11 +62,11 @@ int main(int argc, char *argv[])
|
||||||
|| pkg == NULL) {
|
|| pkg == NULL) {
|
||||||
err = alpm_errno(handle);
|
err = alpm_errno(handle);
|
||||||
switch(err) {
|
switch(err) {
|
||||||
case PM_ERR_PKG_OPEN:
|
case ALPM_ERR_PKG_OPEN:
|
||||||
printf("Cannot open the given file.\n");
|
printf("Cannot open the given file.\n");
|
||||||
break;
|
break;
|
||||||
case PM_ERR_LIBARCHIVE:
|
case ALPM_ERR_LIBARCHIVE:
|
||||||
case PM_ERR_PKG_INVALID:
|
case ALPM_ERR_PKG_INVALID:
|
||||||
printf("Package is invalid.\n");
|
printf("Package is invalid.\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Add table
Reference in a new issue