FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 05-13-2008, 12:02 AM
Dan McGee
 
Default Fix rewinddir regression

Commit 046003844739416ff6d168dd2dec76490adb0727 caused a regression when
rereading the pkgcache after updating the on-disk databases. A rewinddir
call was errantly removed. This patch looks a bit more significant than
simply replacing the rewinddir command, but that is what it does in addition
to moving the db pkgcache population to a new _alpm_db_populate method and
removing what I'm 99% positive are extra calls setting pkg->origin data.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/be_files.c | 17 +++++++++++++++++
lib/libalpm/cache.c | 13 ++-----------
lib/libalpm/db.h | 1 +
3 files changed, 20 insertions(+), 11 deletions(-)

diff --git a/lib/libalpm/be_files.c b/lib/libalpm/be_files.c
index 1e59055..7261e06 100644
--- a/lib/libalpm/be_files.c
+++ b/lib/libalpm/be_files.c
@@ -373,6 +373,23 @@ pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target)
return(pkg);
}

+int _alpm_db_populate(pmdb_t *db)
+{
+ pmpkg_t *info;
+ int count = 0;
+
+ rewinddir(db->handle);
+ while((info = _alpm_db_scan(db, NULL)) != NULL) {
+ _alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'
",
+ alpm_pkg_get_name(info), db->treename);
+ /* add to the collection */
+ db->pkgcache = alpm_list_add(db->pkgcache, info);
+ count++;
+ }
+
+ return(count);
+}
+
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq)
{
FILE *fp = NULL;
diff --git a/lib/libalpm/cache.c b/lib/libalpm/cache.c
index fcd555e..57784e8 100644
--- a/lib/libalpm/cache.c
+++ b/lib/libalpm/cache.c
@@ -40,8 +40,7 @@
*/
int _alpm_db_load_pkgcache(pmdb_t *db)
{
- pmpkg_t *info;
- int count = 0;
+ int count;

ALPM_LOG_FUNC;

@@ -54,15 +53,7 @@ int _alpm_db_load_pkgcache(pmdb_t *db)
_alpm_log(PM_LOG_DEBUG, "loading package cache for repository '%s'
",
db->treename);

- while((info = _alpm_db_scan(db, NULL)) != NULL) {
- _alpm_log(PM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'
",
- alpm_pkg_get_name(info), db->treename);
- info->origin = PKG_FROM_CACHE;
- info->origin_data.db = db;
- /* add to the collection */
- db->pkgcache = alpm_list_add(db->pkgcache, info);
- count++;
- }
+ count = _alpm_db_populate(db);

db->pkgcache = alpm_list_msort(db->pkgcache, count, _alpm_pkg_cmp);
return(0);
diff --git a/lib/libalpm/db.h b/lib/libalpm/db.h
index f6e0c3c..17cf317 100644
--- a/lib/libalpm/db.h
+++ b/lib/libalpm/db.h
@@ -63,6 +63,7 @@ alpm_list_t *_alpm_db_whatprovides(pmdb_t *db, const char *package);
int _alpm_db_open(pmdb_t *db);
void _alpm_db_close(pmdb_t *db);
pmpkg_t *_alpm_db_scan(pmdb_t *db, const char *target);
+int _alpm_db_populate(pmdb_t *db);
int _alpm_db_read(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_write(pmdb_t *db, pmpkg_t *info, pmdbinfrq_t inforeq);
int _alpm_db_remove(pmdb_t *db, pmpkg_t *info);
--
1.5.5.1


_______________________________________________
pacman-dev mailing list
pacman-dev@archlinux.org
http://archlinux.org/mailman/listinfo/pacman-dev
 

Thread Tools




All times are GMT. The time now is 09:13 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org