forked from ariadne/pkgconf
libpkgconf: implement PKG_CONFIG_LOG style auditing (closes #88)
parent
41e0a65870
commit
45d422c484
|
@ -28,7 +28,25 @@ pkgconf_audit_log(const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list va;
|
va_list va;
|
||||||
|
|
||||||
|
if (pkgconf_auditf == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
va_start(va, format);
|
va_start(va, format);
|
||||||
vfprintf(pkgconf_auditf, format, va);
|
vfprintf(pkgconf_auditf, format, va);
|
||||||
va_end(va);
|
va_end(va);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
pkgconf_audit_log_dependency(const pkgconf_pkg_t *dep, const pkgconf_dependency_t *depnode)
|
||||||
|
{
|
||||||
|
if (pkgconf_auditf == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
|
fprintf(pkgconf_auditf, "%s ", dep->id);
|
||||||
|
if (depnode->version != NULL && depnode->compare != PKGCONF_CMP_ANY)
|
||||||
|
{
|
||||||
|
fprintf(pkgconf_auditf, "%s %s ", pkgconf_pkg_get_comparator(depnode), depnode->version);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(pkgconf_auditf, "[%s]\n", dep->version);
|
||||||
|
}
|
||||||
|
|
|
@ -154,7 +154,7 @@ pkgconf_pkg_t *pkgconf_pkg_find(const char *name, unsigned int flags);
|
||||||
unsigned int pkgconf_pkg_traverse(pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth, unsigned int flags);
|
unsigned int pkgconf_pkg_traverse(pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth, unsigned int flags);
|
||||||
unsigned int pkgconf_pkg_verify_graph(pkgconf_pkg_t *root, int depth, unsigned int flags);
|
unsigned int pkgconf_pkg_verify_graph(pkgconf_pkg_t *root, int depth, unsigned int flags);
|
||||||
pkgconf_pkg_t *pkgconf_pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags);
|
pkgconf_pkg_t *pkgconf_pkg_verify_dependency(pkgconf_dependency_t *pkgdep, unsigned int flags, unsigned int *eflags);
|
||||||
const char *pkgconf_pkg_get_comparator(pkgconf_dependency_t *pkgdep);
|
const char *pkgconf_pkg_get_comparator(const pkgconf_dependency_t *pkgdep);
|
||||||
int pkgconf_pkg_cflags(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
|
int pkgconf_pkg_cflags(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
|
||||||
int pkgconf_pkg_libs(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
|
int pkgconf_pkg_libs(pkgconf_pkg_t *root, pkgconf_list_t *list, int maxdepth, unsigned int flags);
|
||||||
pkgconf_pkg_comparator_t pkgconf_pkg_comparator_lookup_by_name(const char *name);
|
pkgconf_pkg_comparator_t pkgconf_pkg_comparator_lookup_by_name(const char *name);
|
||||||
|
@ -209,5 +209,6 @@ void pkgconf_cache_free(void);
|
||||||
/* audit.c */
|
/* audit.c */
|
||||||
void pkgconf_audit_open_log(FILE *auditf);
|
void pkgconf_audit_open_log(FILE *auditf);
|
||||||
void pkgconf_audit_log(const char *format, ...) PRINTFLIKE(1, 2);
|
void pkgconf_audit_log(const char *format, ...) PRINTFLIKE(1, 2);
|
||||||
|
void pkgconf_audit_log_dependency(const pkgconf_pkg_t *dep, const pkgconf_dependency_t *depnode);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -741,7 +741,7 @@ static pkgconf_vercmp_res_func_t pkgconf_pkg_comparator_impls[PKGCONF_CMP_SIZE +
|
||||||
* returns the comparator used in a depgraph dependency node as a string.
|
* returns the comparator used in a depgraph dependency node as a string.
|
||||||
*/
|
*/
|
||||||
const char *
|
const char *
|
||||||
pkgconf_pkg_get_comparator(pkgconf_dependency_t *pkgdep)
|
pkgconf_pkg_get_comparator(const pkgconf_dependency_t *pkgdep)
|
||||||
{
|
{
|
||||||
const pkgconf_pkg_comparator_name_t *i;
|
const pkgconf_pkg_comparator_name_t *i;
|
||||||
|
|
||||||
|
@ -844,6 +844,7 @@ pkgconf_pkg_report_graph_error(pkgconf_pkg_t *parent, pkgconf_pkg_t *pkg, pkgcon
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_error("Package '%s', required by '%s', not found\n", node->package, parent->id);
|
pkgconf_error("Package '%s', required by '%s', not found\n", node->package, parent->id);
|
||||||
|
pkgconf_audit_log("%s NOT-FOUND\n", node->package);
|
||||||
}
|
}
|
||||||
else if (eflags & PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH)
|
else if (eflags & PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH)
|
||||||
{
|
{
|
||||||
|
@ -898,6 +899,8 @@ pkgconf_pkg_walk_list(pkgconf_pkg_t *parent,
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pkgconf_audit_log_dependency(pkgdep, depnode);
|
||||||
|
|
||||||
pkgdep->flags |= PKGCONF_PKG_PROPF_SEEN;
|
pkgdep->flags |= PKGCONF_PKG_PROPF_SEEN;
|
||||||
eflags |= pkgconf_pkg_traverse(pkgdep, func, data, depth - 1, flags);
|
eflags |= pkgconf_pkg_traverse(pkgdep, func, data, depth - 1, flags);
|
||||||
pkgdep->flags &= ~PKGCONF_PKG_PROPF_SEEN;
|
pkgdep->flags &= ~PKGCONF_PKG_PROPF_SEEN;
|
||||||
|
|
Loading…
Reference in New Issue