summaryrefslogtreecommitdiff
path: root/lib/libalpm/be_package.c
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2011-07-03 14:44:57 -0500
committerDan McGee <dan@archlinux.org>2011-07-03 14:44:57 -0500
commit1ce7f39ad73c5c96870c6036014afad3d49a8edf (patch)
tree616b3259a2a6c4bcad5a5433a02985352c60699d /lib/libalpm/be_package.c
parentc839415e3fb4bcde11de3cb7595cec93501bed13 (diff)
parentafc96f2ab3d05f14a73e81f871164f01423b5572 (diff)
downloadpacman-1ce7f39ad73c5c96870c6036014afad3d49a8edf.tar.xz
Merge remote-tracking branch 'allan/ALPM'
Conflicts: lib/libalpm/be_local.c lib/libalpm/be_package.c lib/libalpm/conflict.c lib/libalpm/diskspace.c lib/libalpm/dload.c lib/libalpm/remove.c
Diffstat (limited to 'lib/libalpm/be_package.c')
-rw-r--r--lib/libalpm/be_package.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index da5076e5..af213241 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -52,7 +52,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
const char *pkgfile = pkg->origin_data.file;
if((archive = archive_read_new()) == NULL) {
- RET_ERR(pkg->handle, PM_ERR_LIBARCHIVE, NULL);
+ RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, NULL);
}
archive_read_support_compression_all(archive);
@@ -60,7 +60,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
if(archive_read_open_filename(archive, pkgfile,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
- RET_ERR(pkg->handle, PM_ERR_PKG_OPEN, NULL);
+ RET_ERR(pkg->handle, ALPM_ERR_PKG_OPEN, NULL);
}
while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
@@ -92,7 +92,7 @@ static size_t _package_changelog_read(void *ptr, size_t size,
ssize_t sret = archive_read_data((struct archive *)fp, ptr, size);
/* Report error (negative values) */
if(sret < 0) {
- RET_ERR(pkg->handle, PM_ERR_LIBARCHIVE, 0);
+ RET_ERR(pkg->handle, ALPM_ERR_LIBARCHIVE, 0);
} else {
return (size_t)sret;
}
@@ -158,7 +158,7 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
ptr = line;
key = strsep(&ptr, "=");
if(key == NULL || ptr == NULL) {
- _alpm_log(handle, PM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
+ _alpm_log(handle, ALPM_LOG_DEBUG, "%s: syntax error in description file line %d\n",
newpkg->name ? newpkg->name : "error", linenum);
} else {
key = _alpm_strtrim(key);
@@ -209,14 +209,14 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
} else if(strcmp(key, "makepkgopt") == 0) {
/* not used atm */
} else {
- _alpm_log(handle, PM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
+ _alpm_log(handle, ALPM_LOG_DEBUG, "%s: unknown key '%s' in description file line %d\n",
newpkg->name ? newpkg->name : "error", key, linenum);
}
}
line[0] = '\0';
}
if(ret != ARCHIVE_EOF) {
- _alpm_log(handle, PM_LOG_DEBUG, "error parsing package descfile\n");
+ _alpm_log(handle, ALPM_LOG_DEBUG, "error parsing package descfile\n");
return -1;
}
@@ -244,47 +244,47 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
size_t files_count = 0;
if(pkgfile == NULL || strlen(pkgfile) == 0) {
- RET_ERR(handle, PM_ERR_WRONG_ARGS, NULL);
+ RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
}
/* attempt to stat the package file, ensure it exists */
if(stat(pkgfile, &st) == 0) {
newpkg = _alpm_pkg_new();
if(newpkg == NULL) {
- RET_ERR(handle, PM_ERR_MEMORY, NULL);
+ RET_ERR(handle, ALPM_ERR_MEMORY, NULL);
}
newpkg->filename = strdup(pkgfile);
newpkg->size = st.st_size;
} else {
/* couldn't stat the pkgfile, return an error */
- RET_ERR(handle, PM_ERR_PKG_OPEN, NULL);
+ RET_ERR(handle, ALPM_ERR_PKG_OPEN, NULL);
}
/* first steps- validate the package file */
- _alpm_log(handle, PM_LOG_DEBUG, "md5sum: %s\n", md5sum);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "md5sum: %s\n", md5sum);
if(md5sum) {
- _alpm_log(handle, PM_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) {
alpm_pkg_free(newpkg);
- RET_ERR(handle, PM_ERR_PKG_INVALID, NULL);
+ RET_ERR(handle, ALPM_ERR_PKG_INVALID, NULL);
}
}
- _alpm_log(handle, PM_LOG_DEBUG, "base64_sig: %s\n", base64_sig);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "base64_sig: %s\n", base64_sig);
if(check_sig != PM_PGP_VERIFY_NEVER) {
- _alpm_log(handle, PM_LOG_DEBUG, "checking signature for %s\n", pkgfile);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "checking signature for %s\n", pkgfile);
ret = _alpm_gpgme_checksig(handle, pkgfile, base64_sig);
if((check_sig == PM_PGP_VERIFY_ALWAYS && ret != 0) ||
(check_sig == PM_PGP_VERIFY_OPTIONAL && ret == 1)) {
alpm_pkg_free(newpkg);
- RET_ERR(handle, PM_ERR_SIG_INVALID, NULL);
+ RET_ERR(handle, ALPM_ERR_SIG_INVALID, NULL);
}
}
/* next- try to create an archive object to read in the package */
if((archive = archive_read_new()) == NULL) {
alpm_pkg_free(newpkg);
- RET_ERR(handle, PM_ERR_LIBARCHIVE, NULL);
+ RET_ERR(handle, ALPM_ERR_LIBARCHIVE, NULL);
}
archive_read_support_compression_all(archive);
@@ -293,10 +293,10 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
if(archive_read_open_filename(archive, pkgfile,
ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) {
alpm_pkg_free(newpkg);
- RET_ERR(handle, PM_ERR_PKG_OPEN, NULL);
+ RET_ERR(handle, ALPM_ERR_PKG_OPEN, NULL);
}
- _alpm_log(handle, PM_LOG_DEBUG, "starting package load for %s\n", pkgfile);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "starting package load for %s\n", pkgfile);
/* If full is false, only read through the archive until we find our needed
* metadata. If it is true, read through the entire archive, which serves
@@ -307,16 +307,16 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
if(strcmp(entry_name, ".PKGINFO") == 0) {
/* parse the info file */
if(parse_descfile(handle, archive, newpkg) != 0) {
- _alpm_log(handle, PM_LOG_ERROR, _("could not parse package description file in %s\n"),
+ _alpm_log(handle, ALPM_LOG_ERROR, _("could not parse package description file in %s\n"),
pkgfile);
goto pkg_invalid;
}
if(newpkg->name == NULL || strlen(newpkg->name) == 0) {
- _alpm_log(handle, PM_LOG_ERROR, _("missing package name in %s\n"), pkgfile);
+ _alpm_log(handle, ALPM_LOG_ERROR, _("missing package name in %s\n"), pkgfile);
goto pkg_invalid;
}
if(newpkg->version == NULL || strlen(newpkg->version) == 0) {
- _alpm_log(handle, PM_LOG_ERROR, _("missing package version in %s\n"), pkgfile);
+ _alpm_log(handle, ALPM_LOG_ERROR, _("missing package version in %s\n"), pkgfile);
goto pkg_invalid;
}
config = 1;
@@ -338,9 +338,9 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
}
if(archive_read_data_skip(archive)) {
- _alpm_log(handle, PM_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));
- handle->pm_errno = PM_ERR_LIBARCHIVE;
+ handle->pm_errno = ALPM_ERR_LIBARCHIVE;
goto error;
}
@@ -351,14 +351,14 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
}
if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occured */
- _alpm_log(handle, PM_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));
- handle->pm_errno = PM_ERR_LIBARCHIVE;
+ handle->pm_errno = ALPM_ERR_LIBARCHIVE;
goto error;
}
if(!config) {
- _alpm_log(handle, PM_LOG_ERROR, _("missing package metadata in %s\n"), pkgfile);
+ _alpm_log(handle, ALPM_LOG_ERROR, _("missing package metadata in %s\n"), pkgfile);
goto pkg_invalid;
}
@@ -372,7 +372,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
if(full) {
/* "checking for conflicts" requires a sorted list, ensure that here */
- _alpm_log(handle, PM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
+ _alpm_log(handle, ALPM_LOG_DEBUG, "sorting package filelist for %s\n", pkgfile);
newpkg->files = alpm_list_msort(newpkg->files, files_count,
_alpm_files_cmp);
newpkg->infolevel = INFRQ_ALL;
@@ -387,7 +387,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle, const char *pkgfile,
return newpkg;
pkg_invalid:
- handle->pm_errno = PM_ERR_PKG_INVALID;
+ handle->pm_errno = ALPM_ERR_PKG_INVALID;
error:
_alpm_pkg_free(newpkg);
archive_read_finish(archive);
@@ -399,7 +399,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
pgp_verify_t check_sig, alpm_pkg_t **pkg)
{
CHECK_HANDLE(handle, return -1);
- ASSERT(pkg != NULL, RET_ERR(handle, PM_ERR_WRONG_ARGS, -1));
+ ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
*pkg = _alpm_pkg_load_internal(handle, filename, full, NULL, NULL, check_sig);
if(*pkg == NULL) {