xbps-dgraph: make this work again; needs more changes yet.
This commit is contained in:
parent
db1efb3aa6
commit
f868dd7816
@ -1,5 +1,5 @@
|
|||||||
/*-
|
/*-
|
||||||
* Copyright (c) 2010-2012 Juan Romero Pardines.
|
* Copyright (c) 2010-2013 Juan Romero Pardines.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
@ -49,7 +49,7 @@
|
|||||||
*/
|
*/
|
||||||
static const char *optional_objs[] = {
|
static const char *optional_objs[] = {
|
||||||
"conflicts", "conf_files", "replaces", "run_depends", "preserve",
|
"conflicts", "conf_files", "replaces", "run_depends", "preserve",
|
||||||
"requiredby", "provides", "homepage", "license"
|
"files", "dirs", "links", "provides", "homepage", "license"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -131,6 +131,8 @@ convert_proptype_to_string(prop_object_t obj)
|
|||||||
return "integer";
|
return "integer";
|
||||||
case PROP_TYPE_STRING:
|
case PROP_TYPE_STRING:
|
||||||
return "string";
|
return "string";
|
||||||
|
case PROP_TYPE_DATA:
|
||||||
|
return "data";
|
||||||
default:
|
default:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -252,12 +254,14 @@ parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd,
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* While parsing package's dictionary from pkgdb, we are
|
* While parsing package's dictionary from pkgdb, we are
|
||||||
* only interested in the "automatic-install" and "requiredby"
|
* only interested in the "automatic-install" object.
|
||||||
* objects.
|
|
||||||
*/
|
*/
|
||||||
if (parse_pkgdb &&
|
if (parse_pkgdb &&
|
||||||
(strcmp(tmpkeyname, "automatic-install")) &&
|
(strcmp(tmpkeyname, "automatic-install")))
|
||||||
(strcmp(tmpkeyname, "requiredby")))
|
continue;
|
||||||
|
|
||||||
|
/* Ignore these objects */
|
||||||
|
if (strcmp(tmpkeyname, "source-revisions") == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
keyobj = prop_dictionary_get_keysym(plistd, dksym);
|
keyobj = prop_dictionary_get_keysym(plistd, dksym);
|
||||||
@ -279,8 +283,7 @@ parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd,
|
|||||||
optnodetmp = optnode;
|
optnodetmp = optnode;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* We can assume that all arrays only contain strings, so
|
* Process array objects.
|
||||||
* this can be simplified.
|
|
||||||
*/
|
*/
|
||||||
prop_dictionary_get_cstring_nocopy(sub_confd, "style", &cfprop);
|
prop_dictionary_get_cstring_nocopy(sub_confd, "style", &cfprop);
|
||||||
if (prop_object_type(keyobj) == PROP_TYPE_ARRAY) {
|
if (prop_object_type(keyobj) == PROP_TYPE_ARRAY) {
|
||||||
@ -289,19 +292,24 @@ parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd,
|
|||||||
optnodetmp);
|
optnodetmp);
|
||||||
|
|
||||||
for (x = 0; x < prop_array_count(keyobj); x++) {
|
for (x = 0; x < prop_array_count(keyobj); x++) {
|
||||||
|
/*
|
||||||
|
* Process arrays of strings.
|
||||||
|
*/
|
||||||
sub_keyobj = prop_array_get(keyobj, x);
|
sub_keyobj = prop_array_get(keyobj, x);
|
||||||
fprintf(f, " %s -> %s_%zu_string "
|
if (prop_object_type(sub_keyobj) == PROP_TYPE_STRING) {
|
||||||
"[label=\"string\"];\n",
|
fprintf(f, " %s -> %s_%zu_string "
|
||||||
keyname, keyname, x);
|
"[label=\"string\"];\n",
|
||||||
prop_dictionary_get_cstring_nocopy(sub_confd,
|
keyname, keyname, x);
|
||||||
"style", &cfprop);
|
prop_dictionary_get_cstring_nocopy(sub_confd,
|
||||||
fprintf(f, " %s_%zu_string [style=\"%s\",",
|
"style", &cfprop);
|
||||||
keyname, x, cfprop);
|
fprintf(f, " %s_%zu_string [style=\"%s\",",
|
||||||
prop_dictionary_get_cstring_nocopy(sub_confd,
|
keyname, x, cfprop);
|
||||||
"fillcolor", &cfprop);
|
prop_dictionary_get_cstring_nocopy(sub_confd,
|
||||||
fprintf(f, "fillcolor=\"%s\","
|
"fillcolor", &cfprop);
|
||||||
"label=\"%s\"];\n", cfprop,
|
fprintf(f, "fillcolor=\"%s\","
|
||||||
prop_string_cstring_nocopy(sub_keyobj));
|
"label=\"%s\"];\n", cfprop,
|
||||||
|
prop_string_cstring_nocopy(sub_keyobj));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (optnode)
|
if (optnode)
|
||||||
free(optnode);
|
free(optnode);
|
||||||
@ -365,10 +373,9 @@ create_dot_graph(struct xbps_handle *xhp,
|
|||||||
{
|
{
|
||||||
prop_dictionary_t sub_confd, regpkgd = NULL;
|
prop_dictionary_t sub_confd, regpkgd = NULL;
|
||||||
prop_array_t allkeys;
|
prop_array_t allkeys;
|
||||||
const char *pkgver, *pkgn, *cfprop;
|
const char *pkgver, *cfprop;
|
||||||
|
|
||||||
prop_dictionary_get_cstring_nocopy(plistd, "pkgver", &pkgver);
|
prop_dictionary_get_cstring_nocopy(plistd, "pkgver", &pkgver);
|
||||||
prop_dictionary_get_cstring_nocopy(plistd, "pkgname", &pkgn);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Start filling the output file...
|
* Start filling the output file...
|
||||||
@ -423,10 +430,10 @@ create_dot_graph(struct xbps_handle *xhp,
|
|||||||
* list file, aka XBPS_META_PATH/XBPS_PKGDB.
|
* list file, aka XBPS_META_PATH/XBPS_PKGDB.
|
||||||
*/
|
*/
|
||||||
if (revdeps) {
|
if (revdeps) {
|
||||||
regpkgd = xbps_pkgdb_get_pkg(xhp, pkgn);
|
regpkgd = xbps_pkgdb_get_pkg(xhp, pkgver);
|
||||||
if (regpkgd == NULL)
|
if (regpkgd == NULL)
|
||||||
die("cannot find '%s' dictionary on %s!",
|
die("cannot find '%s' dictionary on %s!",
|
||||||
pkgn, XBPS_PKGDB);
|
pkgver, XBPS_PKGDB);
|
||||||
|
|
||||||
allkeys = prop_dictionary_all_keys(regpkgd);
|
allkeys = prop_dictionary_all_keys(regpkgd);
|
||||||
parse_array_in_pkg_dictionary(f, regpkgd, sub_confd,
|
parse_array_in_pkg_dictionary(f, regpkgd, sub_confd,
|
||||||
|
Loading…
Reference in New Issue
Block a user