xbps-dgraph: simplify.
This commit is contained in:
parent
0b50672a33
commit
8c4d41ccfd
@ -87,6 +87,7 @@ struct pkgdep {
|
|||||||
const char *pkgver;
|
const char *pkgver;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static xbps_dictionary_t confd;
|
||||||
static SLIST_HEAD(pkgdep_head, pkgdep) pkgdep_list =
|
static SLIST_HEAD(pkgdep_head, pkgdep) pkgdep_list =
|
||||||
SLIST_HEAD_INITIALIZER(pkgdep_list);
|
SLIST_HEAD_INITIALIZER(pkgdep_list);
|
||||||
|
|
||||||
@ -193,9 +194,7 @@ generate_conf_file(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
write_conf_property_on_stream(FILE *f,
|
write_conf_property_on_stream(FILE *f, const char *section)
|
||||||
const char *section,
|
|
||||||
xbps_dictionary_t confd)
|
|
||||||
{
|
{
|
||||||
xbps_array_t allkeys, allkeys2;
|
xbps_array_t allkeys, allkeys2;
|
||||||
xbps_dictionary_keysym_t dksym, dksym2;
|
xbps_dictionary_keysym_t dksym, dksym2;
|
||||||
@ -268,7 +267,6 @@ parse_array_in_pkg_dictionary(FILE *f, xbps_dictionary_t plistd,
|
|||||||
fprintf(f, " main -> %s [label=\"%s\"];\n",
|
fprintf(f, " main -> %s [label=\"%s\"];\n",
|
||||||
keyname, convert_proptype_to_string(keyobj));
|
keyname, convert_proptype_to_string(keyobj));
|
||||||
|
|
||||||
xbps_dictionary_get_cstring_nocopy(sub_confd, "opt-style", &cfprop);
|
|
||||||
/*
|
/*
|
||||||
* Process array objects.
|
* Process array objects.
|
||||||
*/
|
*/
|
||||||
@ -415,7 +413,6 @@ static void
|
|||||||
create_dot_graph(struct xbps_handle *xhp,
|
create_dot_graph(struct xbps_handle *xhp,
|
||||||
FILE *f,
|
FILE *f,
|
||||||
xbps_dictionary_t plistd,
|
xbps_dictionary_t plistd,
|
||||||
xbps_dictionary_t confd,
|
|
||||||
bool repomode,
|
bool repomode,
|
||||||
bool fulldepgraph)
|
bool fulldepgraph)
|
||||||
{
|
{
|
||||||
@ -436,27 +433,23 @@ create_dot_graph(struct xbps_handle *xhp,
|
|||||||
* Process the graph section in config file.
|
* Process the graph section in config file.
|
||||||
*/
|
*/
|
||||||
fprintf(f, " graph [");
|
fprintf(f, " graph [");
|
||||||
write_conf_property_on_stream(f, "graph", confd);
|
write_conf_property_on_stream(f, "graph");
|
||||||
fprintf(f, ",label=\"[XBPS] %s metadata properties\"];\n", pkgver);
|
fprintf(f, ",label=\"[XBPS] %s metadata properties\"];\n", pkgver);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process the edge section in config file.
|
* Process the edge section in config file.
|
||||||
*/
|
*/
|
||||||
fprintf(f, " edge [");
|
fprintf(f, " edge [");
|
||||||
write_conf_property_on_stream(f, "edge", confd);
|
write_conf_property_on_stream(f, "edge");
|
||||||
fprintf(f, "];\n");
|
fprintf(f, "];\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Process the node section in config file.
|
* Process the node section in config file.
|
||||||
*/
|
*/
|
||||||
fprintf(f, " node [");
|
fprintf(f, " node [");
|
||||||
write_conf_property_on_stream(f, "node", confd);
|
write_conf_property_on_stream(f, "node");
|
||||||
fprintf(f, "];\n");
|
fprintf(f, "];\n");
|
||||||
|
|
||||||
/*
|
|
||||||
* Process all objects in package's dictionary from its metadata
|
|
||||||
* property list file, aka XBPS_META_PATH/.<pkgname>.plist
|
|
||||||
*/
|
|
||||||
if (fulldepgraph) {
|
if (fulldepgraph) {
|
||||||
if (repomode) {
|
if (repomode) {
|
||||||
rdeps = xbps_rpool_get_pkg_fulldeptree(xhp, pkgver);
|
rdeps = xbps_rpool_get_pkg_fulldeptree(xhp, pkgver);
|
||||||
@ -498,7 +491,7 @@ create_dot_graph(struct xbps_handle *xhp,
|
|||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
xbps_dictionary_t plistd, confd = NULL;
|
xbps_dictionary_t plistd = NULL;
|
||||||
struct xbps_handle xh;
|
struct xbps_handle xh;
|
||||||
FILE *f = NULL;
|
FILE *f = NULL;
|
||||||
const char *conf_file = NULL, *rootdir = NULL;
|
const char *conf_file = NULL, *rootdir = NULL;
|
||||||
@ -585,9 +578,9 @@ main(int argc, char **argv)
|
|||||||
* Create the dot(1) graph!
|
* Create the dot(1) graph!
|
||||||
*/
|
*/
|
||||||
if (fulldepgraph) {
|
if (fulldepgraph) {
|
||||||
create_dot_graph(&xh, f, plistd, confd, repomode, true);
|
create_dot_graph(&xh, f, plistd, repomode, true);
|
||||||
} else {
|
} else {
|
||||||
create_dot_graph(&xh, f, plistd, confd, repomode, false);
|
create_dot_graph(&xh, f, plistd, repomode, false);
|
||||||
}
|
}
|
||||||
exit(EXIT_SUCCESS);
|
exit(EXIT_SUCCESS);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user