Compare commits

...

3 Commits

Author SHA1 Message Date
Ariadne Conill 72e429ae70 tuple: use ${pc_sysrootdir} instead of client->sysroot_dir where relevant
ci/woodpecker/push/woodpecker Pipeline was successful Details
2022-06-26 19:35:19 +00:00
Ariadne Conill 7fa632a658 tests: sysroot: add additional tests 2022-06-26 19:34:54 +00:00
Ariadne Conill 9950312fde tests: add additional test fixtures 2022-06-26 19:34:39 +00:00
6 changed files with 55 additions and 6 deletions

View File

@ -100,6 +100,8 @@ EXTRA_DIST = pkg.m4 \
tests/lib1/orphaned-requires-private.pc \
tests/lib1/sysroot-dir-2.pc \
tests/lib1/sysroot-dir-3.pc \
tests/lib1/sysroot-dir-4.pc \
tests/lib1/sysroot-dir-5.pc \
$(test_scripts) \
doc/conf.py \
doc/extract.py \

View File

@ -330,15 +330,19 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
*
* Finally, we call pkgconf_path_relocate() to clean the path of spurious elements.
*/
const char *sysroot_dir = pkgconf_tuple_find(client, vars, "pc_sysrootdir");
if (sysroot_dir == NULL)
sysroot_dir = client->sysroot_dir;
if (*buf == '/' &&
client->sysroot_dir != NULL &&
strcmp(client->sysroot_dir, "/") != 0 &&
strlen(buf) > strlen(client->sysroot_dir) &&
strstr(buf + strlen(client->sysroot_dir), client->sysroot_dir) != NULL)
sysroot_dir != NULL &&
strcmp(sysroot_dir, "/") != 0 &&
strlen(buf) > strlen(sysroot_dir) &&
strstr(buf + strlen(sysroot_dir), sysroot_dir) != NULL)
{
char cleanpath[PKGCONF_ITEM_SIZE];
pkgconf_strlcpy(cleanpath, buf + strlen(client->sysroot_dir), sizeof cleanpath);
pkgconf_strlcpy(cleanpath, buf + strlen(sysroot_dir), sizeof cleanpath);
pkgconf_path_relocate(cleanpath, sizeof cleanpath);
return strdup(cleanpath);

View File

@ -1,4 +1,4 @@
prefix=/sysroot
prefix=/sysroot/usr
includedir=${prefix}/include
libdir=${prefix}/lib

View File

@ -0,0 +1,9 @@
prefix=${pc_sysrootdir}/usr
includedir=${prefix}/include
libdir=${prefix}/lib
Name: sysroot-dir
Description: Package for testing whether sysroot dirs are repeated or not
Version: 1
CFlags: -I${includedir}
Libs: -L${libdir} -lfoo

View File

@ -0,0 +1,9 @@
prefix=/sysroot/usr
includedir=${prefix}/include
libdir=${prefix}/lib
Name: sysroot-dir
Description: Package for testing whether sysroot dirs are repeated or not
Version: 1
CFlags: -I${includedir}
Libs: -L${libdir} -lfoo

View File

@ -6,6 +6,7 @@ tests_init \
cflags \
variable \
do_not_eat_slash \
do_not_duplicate_sysroot_dir
do_not_eat_slash_body()
{
@ -36,3 +37,27 @@ variable_body()
-o inline:"${SYSROOT_DIR}/test/include\n" \
pkgconf --variable=includedir foo
}
do_not_duplicate_sysroot_dir_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
export PKG_CONFIG_SYSROOT_DIR="/sysroot"
atf_check \
-o inline:"-I/sysroot/usr/include \n" \
pkgconf --cflags sysroot-dir-2
atf_check \
-o inline:"-I/sysroot/usr/include \n" \
pkgconf --cflags sysroot-dir-3
atf_check \
-o inline:"-I/sysroot/usr/include \n" \
pkgconf --cflags sysroot-dir-5
export PKG_CONFIG_SYSROOT_DIR="${SYSROOT_DIR}"
atf_check \
-o inline:"-I${SYSROOT_DIR}/usr/include \n" \
pkgconf --cflags sysroot-dir-4
}