From f2868856ee0f0b65ba21ea84f91b42e0867b3c35 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 21 Mar 2014 11:14:16 +0100 Subject: [PATCH] xbps-query: in local mode print all objs from pkgdb. --- NEWS | 3 ++- bin/xbps-query/show-info-files.c | 28 +++++++++++----------------- 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/NEWS b/NEWS index 85e20ad8..0e57cb89 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,7 @@ xbps-0.34 (???): - * xbps-query(8): now also prints the 'hold' object on installed packages. + * xbps-query(8): in local mode now prints all objects stored on its pkgdb entry + and its metaplist. * Fix #34 (xbps-uhelper fetch fails to download files from https://alioth.debian.org). The issue is that this HTTP server returns 406 (Not Acceptable) when the HTTP diff --git a/bin/xbps-query/show-info-files.c b/bin/xbps-query/show-info-files.c index 86866c82..5dda66da 100644 --- a/bin/xbps-query/show-info-files.c +++ b/bin/xbps-query/show-info-files.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2008-2013 Juan Romero Pardines. + * Copyright (c) 2008-2014 Juan Romero Pardines. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -237,10 +237,10 @@ show_pkg_info_from_metadir(struct xbps_handle *xhp, const char *pkg, const char *option) { + xbps_array_t allkeys; + xbps_object_t obj, obj2; xbps_dictionary_t d, pkgdb_d; - const char *instdate; - bool autoinst, hold; - pkg_state_t state; + const char *key; pkgdb_d = xbps_pkgdb_get_pkg(xhp, pkg); if (pkgdb_d == NULL) @@ -250,19 +250,13 @@ show_pkg_info_from_metadir(struct xbps_handle *xhp, if (d == NULL) return ENOENT; - if (xbps_dictionary_get_cstring_nocopy(pkgdb_d, - "install-date", &instdate)) - xbps_dictionary_set_cstring_nocopy(d, "install-date", - instdate); - - if (xbps_dictionary_get_bool(pkgdb_d, "automatic-install", &autoinst)) - xbps_dictionary_set_bool(d, "automatic-install", autoinst); - - if (xbps_dictionary_get_bool(pkgdb_d, "hold", &hold)) - xbps_dictionary_set_bool(d, "hold", hold); - - xbps_pkg_state_dictionary(pkgdb_d, &state); - xbps_set_pkg_state_dictionary(d, state); + allkeys = xbps_dictionary_all_keys(pkgdb_d); + for (unsigned int i = 0; i < xbps_array_count(allkeys); i++) { + obj = xbps_array_get(allkeys, i); + obj2 = xbps_dictionary_get_keysym(pkgdb_d, obj); + key = xbps_dictionary_keysym_cstring_nocopy(obj); + xbps_dictionary_set(d, key, obj2); + } if (option == NULL) show_pkg_info(d);