xbps-repo: also print binpkg compression type in the show target.

Now it looks like:

$ xbps-repo show xbps-devel
Fetching info from: /storage/xbps/packages
Filename: xbps-devel-20091128.i686.xbps (size: 69K)
SHA256: 2c54a61fbd128097692edc19a7c17bfb10d93b3f055b04171cd1e4d97cde79df
Compression type: xz
Package: xbps-devel
Installed size: 216K
Maintainer: Juan RP [xtraeme@gmail.com]
Architecture: i686
Version: 20091128
Description: The XBPS package system (development branch)
 The XBPS package system. A new, fast, from scratch and simple
 binary package manager. This packages includes code from a development
 branch available from https://launchpad.net/xbps
$

--HG--
extra : convert_revision : xtraeme%40gmail.com-20091128051134-qzqqnwd76tcxgxb0
This commit is contained in:
Juan RP 2009-11-28 06:11:34 +01:00
parent 8b3b5c9d1a
commit a85073f6e8
2 changed files with 14 additions and 1 deletions

View File

@ -73,6 +73,11 @@ show_pkg_info(prop_dictionary_t dict)
assert(dict != NULL);
assert(prop_dictionary_count(dict) != 0);
obj = prop_dictionary_get(dict, "archive-compression-type");
if (obj && prop_object_type(obj) == PROP_TYPE_STRING)
printf("Compression type: %s\n",
prop_string_cstring_nocopy(obj));
obj = prop_dictionary_get(dict, "pkgname");
if (obj && prop_object_type(obj) == PROP_TYPE_STRING)
printf("Package: %s\n", prop_string_cstring_nocopy(obj));

View File

@ -175,12 +175,17 @@ xbps_get_pkg_plist_dict_from_url(const char *url, const char *plistf)
prop_dictionary_t plistd = NULL;
struct archive *a;
struct archive_entry *entry;
const char *curpath;
const char *curpath, *comptype;
int i = 0;
if ((a = open_archive(url)) == NULL)
return NULL;
/*
* Save compression type string for future use.
*/
comptype = archive_compression_name(a);
while ((archive_read_next_header(a, &entry)) == ARCHIVE_OK) {
curpath = archive_entry_pathname(entry);
if (i >= 5) {
@ -201,6 +206,9 @@ xbps_get_pkg_plist_dict_from_url(const char *url, const char *plistf)
errno = EINVAL;
break;
}
prop_dictionary_set_cstring_nocopy(plistd,
"archive-compression-type", comptype);
break;
}
archive_read_finish(a);