[pacman-dev] [PATCH] Allow files entries to be read from a sync database

Dan McGee dan at archlinux.org
Tue Jan 18 19:50:33 EST 2011


Nothing will use this yet, but we might as well read the info in while
processing the database. The drawback would be vastly increased memory
usage, so we might want to add a flag enabling/disabling the loading of this
data.

This will at least for now be unused by pacman, but a pkgfile.c program at
least now has the option of using standard libalpm interfaces to search for
file ownership.

Signed-off-by: Dan McGee <dan at archlinux.org>
---
Thoughts from the peanut gallery?

-Dan

 lib/libalpm/be_sync.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index b11499c..58ff3c3 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -282,7 +282,7 @@ static int sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entr
 	}
 
 	if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
-			|| strcmp(filename, "deltas") == 0) {
+			|| strcmp(filename, "deltas") == 0 || strcmp(filename, "files") == 0) {
 		while(_alpm_archive_fgets(archive, &buf) == ARCHIVE_OK) {
 			char *line = _alpm_strtrim(buf.line);
 
@@ -357,6 +357,8 @@ static int sync_db_read(pmdb_t *db, struct archive *archive, struct archive_entr
 				READ_AND_STORE_ALL(pkg->provides);
 			} else if(strcmp(line, "%DELTAS%") == 0) {
 				READ_AND_STORE_ALL(pkg->deltas);
+			} else if(strcmp(line, "%FILES%") == 0) {
+				READ_AND_STORE_ALL(pkg->files);
 			}
 		}
 	} else {
-- 
1.7.3.5



More information about the pacman-dev mailing list