From e35d0c202c4e6feb891326fbdfa68917205d123c Mon Sep 17 00:00:00 2001 From: Juan RP Date: Tue, 21 Oct 2014 09:25:15 +0200 Subject: [PATCH] unpack: simplify pkg metadata extraction. There's no need to internalize props.plist because there are no changes compared to the pkg dictionary stored in the repo index, simply ignore it. The code only cares for the files.plist to check for obsolete files. --- lib/package_unpack.c | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/lib/package_unpack.c b/lib/package_unpack.c index 5c2e2855..9ee970b1 100644 --- a/lib/package_unpack.c +++ b/lib/package_unpack.c @@ -95,7 +95,7 @@ unpack_archive(struct xbps_handle *xhp, const char *fname, struct archive *ar) { - xbps_dictionary_t binpkg_propsd, binpkg_filesd, pkg_filesd; + xbps_dictionary_t binpkg_filesd, pkg_filesd; xbps_array_t array, obsoletes; xbps_object_t obj; xbps_data_t data; @@ -113,7 +113,7 @@ unpack_archive(struct xbps_handle *xhp, bool skip_extract, force, xucd_stats; uid_t euid; - binpkg_propsd = binpkg_filesd = pkg_filesd = NULL; + binpkg_filesd = pkg_filesd = NULL; force = preserve = update = file_exists = false; skip_obsoletes = xucd_stats = false; ar_rv = rv = entry_type = flags = 0; @@ -143,7 +143,7 @@ unpack_archive(struct xbps_handle *xhp, * First get all metadata files on archive in this order: * - INSTALL * - REMOVE - * - props.plist + * - props.plist but currently ignored * - files.plist * * The XBPS package must contain props and files plists, otherwise @@ -179,20 +179,16 @@ unpack_archive(struct xbps_handle *xhp, rv = EINVAL; goto out; } - } else if (strcmp("./props.plist", entry_pname) == 0) { - binpkg_propsd = xbps_archive_get_dictionary(ar, entry); - if (binpkg_propsd == NULL) { - rv = EINVAL; - goto out; - } } else if (strcmp("./files.plist", entry_pname) == 0) { binpkg_filesd = xbps_archive_get_dictionary(ar, entry); if (binpkg_filesd == NULL) { rv = EINVAL; goto out; } + } else { + archive_read_data_skip(ar); } - if (binpkg_propsd && binpkg_filesd) + if (binpkg_filesd) break; } /* @@ -208,7 +204,7 @@ unpack_archive(struct xbps_handle *xhp, /* * Bail out if required metadata files are not in archive. */ - if (binpkg_propsd == NULL || binpkg_filesd == NULL) { + if (binpkg_filesd == NULL) { xbps_set_cb_state(xhp, XBPS_STATE_UNPACK_FAIL, ENODEV, pkgver, "%s: [unpack] invalid binary package `%s'.", pkgver, fname); rv = ENODEV; @@ -547,8 +543,6 @@ unpack_archive(struct xbps_handle *xhp, out: if (xbps_object_type(binpkg_filesd) == XBPS_TYPE_DICTIONARY) xbps_object_release(binpkg_filesd); - if (xbps_object_type(binpkg_propsd) == XBPS_TYPE_DICTIONARY) - xbps_object_release(binpkg_propsd); if (pkgname != NULL) free(pkgname); if (instbuf != NULL)