1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-11-04 16:45:07 -05:00
pacman/lib/libalpm
Dan McGee 6cebd4e602 Complete rework of package accessor logic
Hopefully we've finally arrived at package handling nirvana, or at least
this commit will get us a heck of a lot closer. The former method of getting
the depends list for a package was the following:

1. call alpm_pkg_get_depends()
2. this method would check if the package came from the cache
3. if so, ensure our cache level is correct, otherwise call db_load
4. finally return the depends list

Why did this suck? Because getting the depends list from the package
shouldn't care about whether the package was loaded from a file, from the
'package cache', or some other system which we can't even use because the
damn thing is so complicated. It should just return the depends list.

So what does this commit change? It adds a pointer to a struct of function
pointers to every package for all of these 'package operations'  as I've
decided to call them (I know, sounds completely straightforward, right?). So
now when we call an alpm_pkg_get-* function, we don't do any of the cache
logic or anything else there- we let the actual backend handle it by
delegating all work to the method at pkg->ops->get_depends.

Now that be_package has achieved equal status with be_files, we can treat
packages from these completely different load points differently. We know a
package loaded from a zip file will have all of its fields populated, so
we can set up all its accessor functions to be direct accessors. On the
other hand, the packages loaded from the local and sync DBs are not always
fully-loaded, so their accessor functions are routed through the same logic
as before.

Net result? More code. However, this code now make it roughly 52 times
easier to open the door to something like a read-only tar.gz database
backend.

Are you still reading? I'm impressed. Looking at the patch will probably be
clearer than this long-winded explanation.

Signed-off-by: Dan McGee <dan@archlinux.org>
[Allan: rebase and adjust]
Signed-off-by: Allan McRae <allan@archlinux.org>
2010-10-13 23:53:18 +10:00
..
po Update gettext Makefiles to 0.18 2010-09-23 08:17:06 -05:00
.gitignore Remove unnecessary entries from .gitignore files 2007-07-16 16:49:28 -04:00
add.c Check return value of chdir and getcwd 2010-07-01 00:14:59 -05:00
add.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
alpm_list.c alpm_list_diff_sorted - make some arguments const 2010-03-25 21:31:37 -05:00
alpm_list.h alpm_list_diff_sorted - make some arguments const 2010-03-25 21:31:37 -05:00
alpm.c Fix libfetch configure checking 2010-09-06 11:20:51 -05:00
alpm.h Check return value of fwrite when copying files 2010-06-30 23:49:48 -05:00
backup.c Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
backup.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
be_files.c Complete rework of package accessor logic 2010-10-13 23:53:18 +10:00
be_package.c Complete rework of package accessor logic 2010-10-13 23:53:18 +10:00
cache.c Complete rework of package accessor logic 2010-10-13 23:53:18 +10:00
cache.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
conflict.c Fix some whitespace issues 2010-08-23 21:49:05 -05:00
conflict.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
db.c Introduce -D, --database 2010-05-05 10:37:01 -05:00
db.h Compute package download size outside _alpm_sync_prepare 2010-05-05 18:15:52 -05:00
delta.c More consistent printing of off_t and time_t 2010-03-25 21:58:35 -05:00
delta.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
deps.c Clarify testing within conditional statements 2010-06-21 01:04:58 +10:00
deps.h Partial fix for the phonon/qt issue 2010-05-18 11:33:00 -05:00
dload.c Fix libfetch configure checking 2010-09-06 11:20:51 -05:00
dload.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
error.c Fix libfetch configure checking 2010-09-06 11:20:51 -05:00
graph.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
group.c Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
group.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
handle.c Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
handle.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
log.c Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
log.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
Makefile.am Use OpenSSL MD5 crypto functions if available 2010-09-02 12:05:23 -05:00
md5.c libalpm md5: use larger and dynamic buffer 2010-09-02 10:33:21 -05:00
md5.h libalpm/md5: Fix license header 2008-06-03 21:31:31 -05:00
package.c Complete rework of package accessor logic 2010-10-13 23:53:18 +10:00
package.h Complete rework of package accessor logic 2010-10-13 23:53:18 +10:00
remove.c Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
remove.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
sync.c Allow local and sync db to be treated separately 2010-10-13 23:53:18 +10:00
sync.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
trans.c use execv to avoid using sh just to run ldconfig 2010-08-27 11:19:15 -05:00
trans.h Bump copyright dates to 2010 2010-03-14 19:46:59 -05:00
util.c Use OpenSSL MD5 crypto functions if available 2010-09-02 12:05:23 -05:00
util.h use execv to avoid using sh just to run ldconfig 2010-08-27 11:19:15 -05:00
version.c Remove call to function logger 2010-05-04 23:38:52 -05:00