libpkgconf: tuple: handle sysroot without the need of PKGCONF_PKG_PKGF_MUNGE_SYSROOT_PREFIX

feature/tap-sh
William Pitcock 2016-12-09 21:32:55 -06:00
parent f8de5bf161
commit 792cd7c8e6
2 changed files with 5 additions and 13 deletions

View File

@ -121,6 +121,9 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
const char *ptr;
char *bptr = buf;
if (*value == '/' && client->sysroot_dir != NULL && strncmp(value, client->sysroot_dir, strlen(client->sysroot_dir)))
bptr += strlcpy(buf, client->sysroot_dir, sizeof buf);
for (ptr = value; *ptr != '\0' && bptr - buf < PKGCONF_BUFSIZE; ptr++)
{
if (*ptr != '$' || (*ptr == '$' && *(ptr + 1) != '{'))

15
main.c
View File

@ -61,7 +61,6 @@ static uint64_t want_flags;
static int maximum_traverse_depth = 2000;
static char *want_variable = NULL;
static char *sysroot_dir = NULL;
FILE *error_msgout = NULL;
FILE *logfile_out = NULL;
@ -364,22 +363,11 @@ print_variable(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data, unsigne
{
if (*(req->buf) == '\0')
{
memset(req->buf, 0, sizeof(req->buf));
if (*var == '/' && (flags & PKGCONF_PKG_PKGF_MUNGE_SYSROOT_PREFIX) &&
(sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))))
strlcat(req->buf, sysroot_dir, sizeof(req->buf));
strlcat(req->buf, var, sizeof(req->buf));
strlcpy(req->buf, var, sizeof(req->buf));
return;
}
strlcat(req->buf, " ", sizeof(req->buf));
if (*var == '/' && (flags & PKGCONF_PKG_PKGF_MUNGE_SYSROOT_PREFIX) &&
(sysroot_dir != NULL && strncmp(var, sysroot_dir, strlen(sysroot_dir))))
strlcat(req->buf, sysroot_dir, sizeof(req->buf));
strlcat(req->buf, var, sizeof(req->buf));
}
}
@ -641,6 +629,7 @@ main(int argc, char *argv[])
int ret;
pkgconf_list_t pkgq = PKGCONF_LIST_INITIALIZER;
char *builddir;
char *sysroot_dir;
char *required_pkgconfig_version = NULL;
char *required_exact_module_version = NULL;
char *required_max_module_version = NULL;