From 7249c08bdf6beacc087607db558ef16d3527b9b6 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sat, 8 Dec 2007 23:42:04 -0600 Subject: Improve changelog handling through addition of open/read/close functions Thanks to Allan for inspiring all this work on what was one little TODO item in the codebase. :) Change changelog handling so we can now dump a changelog from both installed packages and package files (fixes FS#7371). We do this by moving all of the machinery to the backend where it should have been in the first place. The changelog reading is now done through a open/read/close interface similar to the fopen/fread/fclose functions (can you guess how it is done?). It is buffered by the frontend, so programs using the library can read as much or as little as they want at a time. Unfortunately, I could not implement a changelog_feof function due to some shortcomings of libarchive. However, I left the stub code in there, commented out, in case it becomes possible later or anyone wants to take a stab at it. Original-work-by: Allan McRae Improved-by: Chantry Xavier Signed-off-by: Dan McGee --- lib/libalpm/alpm.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/libalpm/alpm.h') diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h index 1e18ad95..c98adc5f 100644 --- a/lib/libalpm/alpm.h +++ b/lib/libalpm/alpm.h @@ -216,6 +216,11 @@ alpm_list_t *alpm_pkg_get_deltas(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_replaces(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_files(pmpkg_t *pkg); alpm_list_t *alpm_pkg_get_backup(pmpkg_t *pkg); +void *alpm_pkg_changelog_open(pmpkg_t *pkg); +size_t alpm_pkg_changelog_read(void *ptr, size_t size, + const pmpkg_t *pkg, const void *fp); +/*int alpm_pkg_changelog_feof(const pmpkg_t *pkg, void *fp);*/ +int alpm_pkg_changelog_close(const pmpkg_t *pkg, void *fp); unsigned short alpm_pkg_has_scriptlet(pmpkg_t *pkg); unsigned long alpm_pkg_download_size(pmpkg_t *newpkg, pmdb_t *db_local); -- cgit v1.2.3-2-g168b