diff options
author | Dan McGee <dan@archlinux.org> | 2011-04-05 00:48:36 -0500 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-04-05 00:49:30 -0500 |
commit | c5addd94e3a817504688e684bf62786df7faa3e7 (patch) | |
tree | 0f15c4c3ea66d617709e1f3408ea045a38463b1e /lib/libalpm | |
parent | 2f71d1dc0084f7ee44afb9766e81847974820420 (diff) | |
parent | 272e9b355b17ab663ac4a0d9515d381dcf6f03ec (diff) |
Merge branch 'maint'
Conflicts:
lib/libalpm/be_sync.c
lib/libalpm/db.c
src/pacman/util.c
Diffstat (limited to 'lib/libalpm')
-rw-r--r-- | lib/libalpm/be_local.c | 2 | ||||
-rw-r--r-- | lib/libalpm/be_sync.c | 17 | ||||
-rw-r--r-- | lib/libalpm/db.c | 2 | ||||
-rw-r--r-- | lib/libalpm/package.c | 9 | ||||
-rw-r--r-- | lib/libalpm/pkghash.c | 3 | ||||
-rw-r--r-- | lib/libalpm/util.c | 1 |
6 files changed, 27 insertions, 7 deletions
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index 82c1d591..788b3c6f 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -405,7 +405,7 @@ static int local_db_populate(pmdb_t *db) * http://kerneltrap.org/mailarchive/linux-btrfs/2010/1/23/6723483/thread */ est_count = 0; - while((ent = readdir(dbdir)) != NULL) { + while(readdir(dbdir) != NULL) { est_count++; } rewinddir(dbdir); diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c index 756f784f..9183a074 100644 --- a/lib/libalpm/be_sync.c +++ b/lib/libalpm/be_sync.c @@ -236,9 +236,11 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive) case ARCHIVE_COMPRESSION_XZ: per_package = 143; break; +#ifdef ARCHIVE_COMPRESSION_UU case ARCHIVE_COMPRESSION_UU: per_package = 3543; break; +#endif default: /* assume it is at least somewhat compressed */ per_package = 200; @@ -248,6 +250,7 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive) static int sync_db_populate(pmdb_t *db) { + const char *dbpath; size_t est_count; int count = 0; struct stat buf; @@ -265,14 +268,22 @@ static int sync_db_populate(pmdb_t *db) archive_read_support_compression_all(archive); archive_read_support_format_all(archive); - if(archive_read_open_filename(archive, _alpm_db_path(db), + dbpath = _alpm_db_path(db); + if(!dbpath) { + /* pm_errno set in _alpm_db_path() */ + return 1; + } + + _alpm_log(PM_LOG_DEBUG, "opening database archive %s\n", dbpath); + + if(archive_read_open_filename(archive, dbpath, ARCHIVE_DEFAULT_BYTES_PER_BLOCK) != ARCHIVE_OK) { - _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), _alpm_db_path(db), + _alpm_log(PM_LOG_ERROR, _("could not open file %s: %s\n"), dbpath, archive_error_string(archive)); archive_read_finish(archive); RET_ERR(PM_ERR_DB_OPEN, 1); } - if(stat(_alpm_db_path(db), &buf) != 0) { + if(stat(dbpath, &buf) != 0) { RET_ERR(PM_ERR_DB_OPEN, 1); } est_count = estimate_package_count(&buf, archive); diff --git a/lib/libalpm/db.c b/lib/libalpm/db.c index cc01bbf4..51f9cf67 100644 --- a/lib/libalpm/db.c +++ b/lib/libalpm/db.c @@ -337,7 +337,7 @@ int SYMEXPORT alpm_db_set_pkgreason(pmdb_t *db, const char *name, pmpkgreason_t pkg->reason = reason; /* write DESC */ if(_alpm_local_db_write(db, pkg, INFRQ_DESC)) { - return -1; + RET_ERR(PM_ERR_DB_WRITE, -1); } return 0; diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 69c2b852..59a1283b 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -124,6 +124,10 @@ static alpm_list_t *_pkg_get_deltas(pmpkg_t *pkg) { return pkg->deltas; } static alpm_list_t *_pkg_get_files(pmpkg_t *pkg) { return pkg->files; } static alpm_list_t *_pkg_get_backup(pmpkg_t *pkg) { return pkg->backup; } +static void *_pkg_changelog_open(pmpkg_t *pkg) { return NULL; } +static size_t _pkg_changelog_read(void *ptr, size_t size, const pmpkg_t *pkg, const void *fp) { return 0; } +static int _pkg_changelog_close(const pmpkg_t *pkg, void *fp) { return EOF; } + /** The standard package operations struct. Get fields directly from the * struct itself with no abstraction layer or any type of lazy loading. */ @@ -142,6 +146,7 @@ struct pkg_operations default_pkg_ops = { .get_isize = _pkg_get_isize, .get_reason = _pkg_get_reason, .has_scriptlet = _pkg_has_scriptlet, + .get_licenses = _pkg_get_licenses, .get_groups = _pkg_get_groups, .get_depends = _pkg_get_depends, @@ -152,6 +157,10 @@ struct pkg_operations default_pkg_ops = { .get_deltas = _pkg_get_deltas, .get_files = _pkg_get_files, .get_backup = _pkg_get_backup, + + .changelog_open = _pkg_changelog_open, + .changelog_read = _pkg_changelog_read, + .changelog_close = _pkg_changelog_close, }; /* Public functions for getting package information. These functions diff --git a/lib/libalpm/pkghash.c b/lib/libalpm/pkghash.c index 761ca72d..b4dfcb6a 100644 --- a/lib/libalpm/pkghash.c +++ b/lib/libalpm/pkghash.c @@ -84,12 +84,11 @@ pmpkghash_t *_alpm_pkghash_create(size_t size) static size_t get_hash_position(unsigned long name_hash, pmpkghash_t *hash) { size_t position; - alpm_list_t *ptr; position = name_hash % hash->buckets; /* collision resolution using open addressing with linear probing */ - while((ptr = hash->hash_table[position]) != NULL) { + while(hash->hash_table[position] != NULL) { position = (position + 1) % hash->buckets; } diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index 660d4eb4..28cf8e51 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -34,6 +34,7 @@ #include <time.h> #include <syslog.h> #include <errno.h> +#include <limits.h> #include <sys/types.h> #include <sys/stat.h> #include <sys/wait.h> |