xbps-dgraph: completely updated and working as before.
This commit is contained in:
parent
f868dd7816
commit
6b397198bf
@ -48,8 +48,9 @@
|
|||||||
* Object key for optional objects in package dictionary.
|
* Object key for optional objects in package dictionary.
|
||||||
*/
|
*/
|
||||||
static const char *optional_objs[] = {
|
static const char *optional_objs[] = {
|
||||||
"conflicts", "conf_files", "replaces", "run_depends", "preserve",
|
"conflicts", "provides", "replaces", "run_depends", "preserve",
|
||||||
"files", "dirs", "links", "provides", "homepage", "license"
|
"homepage", "license", "packaged_with", "build_options",
|
||||||
|
"install_script", "remove_script", "long_desc", "requiredby"
|
||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -239,29 +240,23 @@ strip_dashes_from_key(const char *str)
|
|||||||
static void
|
static void
|
||||||
parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd,
|
parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd,
|
||||||
prop_dictionary_t sub_confd,
|
prop_dictionary_t sub_confd,
|
||||||
prop_array_t allkeys,
|
prop_array_t allkeys)
|
||||||
bool parse_pkgdb)
|
|
||||||
{
|
{
|
||||||
prop_dictionary_keysym_t dksym;
|
prop_dictionary_keysym_t dksym;
|
||||||
prop_object_t keyobj, sub_keyobj;
|
prop_object_t keyobj, sub_keyobj;
|
||||||
size_t i, x;
|
unsigned int i, x;
|
||||||
const char *tmpkeyname, *cfprop, *optnodetmp;
|
const char *tmpkeyname, *cfprop, *optnodetmp;
|
||||||
char *optnode, *keyname;
|
char *optnode, *keyname;
|
||||||
|
|
||||||
for (i = 0; i < prop_array_count(allkeys); i++) {
|
for (i = 0; i < prop_array_count(allkeys); i++) {
|
||||||
dksym = prop_array_get(allkeys, i);
|
dksym = prop_array_get(allkeys, i);
|
||||||
tmpkeyname = prop_dictionary_keysym_cstring_nocopy(dksym);
|
tmpkeyname = prop_dictionary_keysym_cstring_nocopy(dksym);
|
||||||
|
|
||||||
/*
|
|
||||||
* While parsing package's dictionary from pkgdb, we are
|
|
||||||
* only interested in the "automatic-install" object.
|
|
||||||
*/
|
|
||||||
if (parse_pkgdb &&
|
|
||||||
(strcmp(tmpkeyname, "automatic-install")))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Ignore these objects */
|
/* Ignore these objects */
|
||||||
if (strcmp(tmpkeyname, "source-revisions") == 0)
|
if ((strcmp(tmpkeyname, "source-revisions") == 0) ||
|
||||||
|
(strcmp(tmpkeyname, "files") == 0) ||
|
||||||
|
(strcmp(tmpkeyname, "conf_files") == 0) ||
|
||||||
|
(strcmp(tmpkeyname, "dirs") == 0) ||
|
||||||
|
(strcmp(tmpkeyname, "links") == 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
keyobj = prop_dictionary_get_keysym(plistd, dksym);
|
keyobj = prop_dictionary_get_keysym(plistd, dksym);
|
||||||
@ -292,17 +287,17 @@ 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++) {
|
||||||
|
sub_keyobj = prop_array_get(keyobj, x);
|
||||||
|
if (prop_object_type(sub_keyobj) == PROP_TYPE_STRING) {
|
||||||
/*
|
/*
|
||||||
* Process arrays of strings.
|
* Process arrays of strings.
|
||||||
*/
|
*/
|
||||||
sub_keyobj = prop_array_get(keyobj, x);
|
fprintf(f, " %s -> %s_%u_string "
|
||||||
if (prop_object_type(sub_keyobj) == PROP_TYPE_STRING) {
|
|
||||||
fprintf(f, " %s -> %s_%zu_string "
|
|
||||||
"[label=\"string\"];\n",
|
"[label=\"string\"];\n",
|
||||||
keyname, keyname, x);
|
keyname, keyname, x);
|
||||||
prop_dictionary_get_cstring_nocopy(sub_confd,
|
prop_dictionary_get_cstring_nocopy(sub_confd,
|
||||||
"style", &cfprop);
|
"style", &cfprop);
|
||||||
fprintf(f, " %s_%zu_string [style=\"%s\",",
|
fprintf(f, " %s_%u_string [style=\"%s\",",
|
||||||
keyname, x, cfprop);
|
keyname, x, cfprop);
|
||||||
prop_dictionary_get_cstring_nocopy(sub_confd,
|
prop_dictionary_get_cstring_nocopy(sub_confd,
|
||||||
"fillcolor", &cfprop);
|
"fillcolor", &cfprop);
|
||||||
@ -338,8 +333,11 @@ parse_array_in_pkg_dictionary(FILE *f, prop_dictionary_t plistd,
|
|||||||
fprintf(f, ",label=\"%s\"",
|
fprintf(f, ",label=\"%s\"",
|
||||||
prop_bool_true(keyobj) ? "true" : "false");
|
prop_bool_true(keyobj) ? "true" : "false");
|
||||||
break;
|
break;
|
||||||
|
case PROP_TYPE_DATA:
|
||||||
|
fprintf(f, ",label=\"%zu bytes\"", prop_data_size(keyobj));
|
||||||
|
break;
|
||||||
case PROP_TYPE_NUMBER:
|
case PROP_TYPE_NUMBER:
|
||||||
fprintf(f, ",label=\"%"PRIu64"\"",
|
fprintf(f, ",label=\"%"PRIu64"\" bytes",
|
||||||
prop_number_unsigned_integer_value(keyobj));
|
prop_number_unsigned_integer_value(keyobj));
|
||||||
break;
|
break;
|
||||||
case PROP_TYPE_STRING:
|
case PROP_TYPE_STRING:
|
||||||
@ -371,8 +369,8 @@ create_dot_graph(struct xbps_handle *xhp,
|
|||||||
prop_dictionary_t confd,
|
prop_dictionary_t confd,
|
||||||
bool revdeps)
|
bool revdeps)
|
||||||
{
|
{
|
||||||
prop_dictionary_t sub_confd, regpkgd = NULL;
|
prop_dictionary_t sub_confd;
|
||||||
prop_array_t allkeys;
|
prop_array_t allkeys, rdeps;
|
||||||
const char *pkgver, *cfprop;
|
const char *pkgver, *cfprop;
|
||||||
|
|
||||||
prop_dictionary_get_cstring_nocopy(plistd, "pkgver", &pkgver);
|
prop_dictionary_get_cstring_nocopy(plistd, "pkgver", &pkgver);
|
||||||
@ -422,23 +420,12 @@ create_dot_graph(struct xbps_handle *xhp,
|
|||||||
* Process all objects in package's dictionary from its metadata
|
* Process all objects in package's dictionary from its metadata
|
||||||
* property list file, aka XBPS_META_PATH/metadata/<pkgname>/XBPS_PKGPROPS.
|
* property list file, aka XBPS_META_PATH/metadata/<pkgname>/XBPS_PKGPROPS.
|
||||||
*/
|
*/
|
||||||
allkeys = prop_dictionary_all_keys(plistd);
|
|
||||||
parse_array_in_pkg_dictionary(f, plistd, sub_confd, allkeys, false);
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Process all objects in package's dictionary from pkgdb property
|
|
||||||
* list file, aka XBPS_META_PATH/XBPS_PKGDB.
|
|
||||||
*/
|
|
||||||
if (revdeps) {
|
if (revdeps) {
|
||||||
regpkgd = xbps_pkgdb_get_pkg(xhp, pkgver);
|
rdeps = xbps_pkgdb_get_pkg_revdeps(xhp, pkgver);
|
||||||
if (regpkgd == NULL)
|
prop_dictionary_set(plistd, "requiredby", rdeps);
|
||||||
die("cannot find '%s' dictionary on %s!",
|
|
||||||
pkgver, XBPS_PKGDB);
|
|
||||||
|
|
||||||
allkeys = prop_dictionary_all_keys(regpkgd);
|
|
||||||
parse_array_in_pkg_dictionary(f, regpkgd, sub_confd,
|
|
||||||
allkeys, true);
|
|
||||||
}
|
}
|
||||||
|
allkeys = prop_dictionary_all_keys(plistd);
|
||||||
|
parse_array_in_pkg_dictionary(f, plistd, sub_confd, allkeys);
|
||||||
/*
|
/*
|
||||||
* Terminate the stream...
|
* Terminate the stream...
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user