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-12-2008, 11:54 AM
Xavier
 
Default Move the cache stuff where it should be

http://code.toofishes.net/gitweb.cgi?p=pacman.git;a=commitdiff;h=4bef7544e11 6a681e9de180c3e17f457491b0d78

This stuff still requires fixing, right? I see these functions are now
declared in db.h, but we probably need generic functions here.
So the names are wrong. Maybe we could just rename them with :
s/cache/list or something.
Actually, it seems like we mostly need get_pkglist and free_pkglist.
And same for grouplist.
I don't know why we need to handle add_pkgincache and
remove_pkgfromcache manually.
These are called just after db_write and db_remove respectively. So
the implementation of these two db functions in the cache backend
could handle the cache themselves.
Hm well, just after writing this, I see there is a problem with the
db_update code :

/* remove the old dir */
_alpm_log(PM_LOG_DEBUG, "flushing database %s
", db->path);
for(lp = _alpm_db_get_pkgcache(db); lp; lp = lp->next) {
pmpkg_t *pkg = lp->data;
if(pkg && _alpm_db_remove(db, pkg) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not remove database entry
%s%s
"), db->treename,
alpm_pkg_get_name(pkg));
RET_ERR(PM_ERR_DB_REMOVE, -1);
}
}

/* Cache needs to be rebuilt */
_alpm_db_free_pkgcache(db);

I remember there was the same problem with db_unregister /
db_unregister_all. We have to walk through the list and remove its
items one by one. I am still not sure how to do that correctly in C.
But it reminds me of the java Iterator interface where this is
possible:
http://java.sun.com/j2se/1.4.2/docs/api/java/util/Iterator.html
while(it.hasnext()) {
it.next();
it.remove();
}

Well, I don't know, but imo it would be better if the rest of libalpm
code didn't have to deal with this cache stuff at all.

_______________________________________________
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 12:24 PM.

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