forked from ariadne/pkgconf
Compare commits
No commits in common. "094dc384688a506a03f578f35501d4d638c1fad4" and "918b6609923e8d1edf2a8d6183b32c37580b4164" have entirely different histories.
094dc38468
...
918b660992
|
@ -35,7 +35,7 @@ jobs:
|
||||||
# the code assumes msvc style printf atm
|
# the code assumes msvc style printf atm
|
||||||
export CFLAGS=-D__USE_MINGW_ANSI_STDIO=0
|
export CFLAGS=-D__USE_MINGW_ANSI_STDIO=0
|
||||||
|
|
||||||
meson -Dtests=disabled _build
|
meson -Dtests=false _build
|
||||||
meson compile -C _build
|
meson compile -C _build
|
||||||
|
|
||||||
debian-meson:
|
debian-meson:
|
||||||
|
@ -53,37 +53,13 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
meson _build -Dwerror=true
|
meson _build
|
||||||
meson compile -C _build
|
meson compile -C _build
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: |
|
run: |
|
||||||
meson test -v -C _build
|
meson test -v -C _build
|
||||||
|
|
||||||
debian-meson-asan:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
container:
|
|
||||||
image: debian:testing
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Update system and add dependencies
|
|
||||||
run: |
|
|
||||||
apt-get update
|
|
||||||
apt-get install -y kyua atf-sh build-essential meson
|
|
||||||
|
|
||||||
- name: Build
|
|
||||||
run: |
|
|
||||||
meson _build -Db_sanitize=address
|
|
||||||
meson compile -C _build
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: |
|
|
||||||
meson test -v -C _build
|
|
||||||
env:
|
|
||||||
ASAN_OPTIONS: "exitcode=7"
|
|
||||||
|
|
||||||
debian-autotools:
|
debian-autotools:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
container:
|
||||||
|
@ -122,7 +98,7 @@ jobs:
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: |
|
run: |
|
||||||
meson _build -Dwerror=true
|
meson _build
|
||||||
meson compile -C _build
|
meson compile -C _build
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
|
|
|
@ -4,22 +4,7 @@ pipeline:
|
||||||
commands:
|
commands:
|
||||||
- apt-get update
|
- apt-get update
|
||||||
- apt-get install -y kyua atf-sh build-essential meson
|
- apt-get install -y kyua atf-sh build-essential meson
|
||||||
- meson _build -Dwerror=true
|
- meson _build
|
||||||
- meson compile -C _build
|
|
||||||
- meson test -v -C _build
|
|
||||||
when:
|
|
||||||
matrix:
|
|
||||||
IMAGE: debian
|
|
||||||
BUILD: meson
|
|
||||||
|
|
||||||
debian-meson-asan:
|
|
||||||
image: debian:testing
|
|
||||||
environment:
|
|
||||||
- ASAN_OPTIONS="exitcode=7"
|
|
||||||
commands:
|
|
||||||
- apt-get update
|
|
||||||
- apt-get install -y kyua atf-sh build-essential meson
|
|
||||||
- meson _build -Db_sanitize=address
|
|
||||||
- meson compile -C _build
|
- meson compile -C _build
|
||||||
- meson test -v -C _build
|
- meson test -v -C _build
|
||||||
when:
|
when:
|
||||||
|
@ -45,7 +30,7 @@ pipeline:
|
||||||
image: alpine
|
image: alpine
|
||||||
commands:
|
commands:
|
||||||
- apk add -U --no-cache kyua atf build-base meson
|
- apk add -U --no-cache kyua atf build-base meson
|
||||||
- meson _build -Dwerror=true
|
- meson _build
|
||||||
- meson compile -C _build
|
- meson compile -C _build
|
||||||
- meson test -v -C _build
|
- meson test -v -C _build
|
||||||
when:
|
when:
|
||||||
|
|
19
Makefile.am
19
Makefile.am
|
@ -11,7 +11,7 @@ nodist_pkgconfig_DATA = libpkgconf.pc
|
||||||
|
|
||||||
AM_CFLAGS = -DPERSONALITY_PATH=\"$(personality_dir)\" -DPKG_DEFAULT_PATH=\"$(pkg_default_dir)\" -DSYSTEM_INCLUDEDIR=\"$(system_includedir)\" -DSYSTEM_LIBDIR=\"$(system_libdir)\"
|
AM_CFLAGS = -DPERSONALITY_PATH=\"$(personality_dir)\" -DPKG_DEFAULT_PATH=\"$(pkg_default_dir)\" -DSYSTEM_INCLUDEDIR=\"$(system_includedir)\" -DSYSTEM_LIBDIR=\"$(system_libdir)\"
|
||||||
|
|
||||||
bin_PROGRAMS = pkgconf bomtool
|
bin_PROGRAMS = pkgconf
|
||||||
lib_LTLIBRARIES = libpkgconf.la
|
lib_LTLIBRARIES = libpkgconf.la
|
||||||
|
|
||||||
EXTRA_DIST = pkg.m4 \
|
EXTRA_DIST = pkg.m4 \
|
||||||
|
@ -22,7 +22,6 @@ EXTRA_DIST = pkg.m4 \
|
||||||
libpkgconf/win-dirent.h \
|
libpkgconf/win-dirent.h \
|
||||||
tests/lib-relocatable/lib/pkgconfig/foo.pc \
|
tests/lib-relocatable/lib/pkgconfig/foo.pc \
|
||||||
tests/lib1/argv-parse-2.pc \
|
tests/lib1/argv-parse-2.pc \
|
||||||
tests/lib1/billion-laughs.pc \
|
|
||||||
tests/lib1/dos-lineendings.pc \
|
tests/lib1/dos-lineendings.pc \
|
||||||
tests/lib1/paren-quoting.pc \
|
tests/lib1/paren-quoting.pc \
|
||||||
tests/lib1/argv-parse-3.pc \
|
tests/lib1/argv-parse-3.pc \
|
||||||
|
@ -90,9 +89,6 @@ EXTRA_DIST = pkg.m4 \
|
||||||
tests/lib1/malformed-1.pc \
|
tests/lib1/malformed-1.pc \
|
||||||
tests/lib1/malformed-quoting.pc \
|
tests/lib1/malformed-quoting.pc \
|
||||||
tests/lib1/malformed-version.pc \
|
tests/lib1/malformed-version.pc \
|
||||||
tests/lib1/metapackage.pc \
|
|
||||||
tests/lib1/metapackage-1.pc \
|
|
||||||
tests/lib1/metapackage-2.pc \
|
|
||||||
tests/lib1/explicit-sysroot.pc \
|
tests/lib1/explicit-sysroot.pc \
|
||||||
tests/lib1/escaped-backslash.pc \
|
tests/lib1/escaped-backslash.pc \
|
||||||
tests/lib1/cflags-internal.pc \
|
tests/lib1/cflags-internal.pc \
|
||||||
|
@ -135,8 +131,7 @@ test_scripts= tests/meson.build \
|
||||||
tests/sysroot.sh \
|
tests/sysroot.sh \
|
||||||
tests/version.sh
|
tests/version.sh
|
||||||
|
|
||||||
test_sh = $(filter-out tests/meson.build, $(test_scripts))
|
check_SCRIPTS= $(test_scripts:.sh=)
|
||||||
check_SCRIPTS = $(test_sh:.sh=)
|
|
||||||
|
|
||||||
SUFFIXES= .sh
|
SUFFIXES= .sh
|
||||||
|
|
||||||
|
@ -156,7 +151,7 @@ libpkgconf_la_SOURCES = \
|
||||||
libpkgconf/path.c \
|
libpkgconf/path.c \
|
||||||
libpkgconf/personality.c \
|
libpkgconf/personality.c \
|
||||||
libpkgconf/parser.c
|
libpkgconf/parser.c
|
||||||
libpkgconf_la_LDFLAGS = -no-undefined -version-info 4:0:0 -export-symbols-regex '^pkgconf_'
|
libpkgconf_la_LDFLAGS = -no-undefined -version-info 3:0:0 -export-symbols-regex '^pkgconf_'
|
||||||
|
|
||||||
dist_man_MANS = \
|
dist_man_MANS = \
|
||||||
man/pkgconf.1 \
|
man/pkgconf.1 \
|
||||||
|
@ -169,17 +164,11 @@ pkgconf_SOURCES = \
|
||||||
cli/main.c \
|
cli/main.c \
|
||||||
cli/getopt_long.c \
|
cli/getopt_long.c \
|
||||||
cli/renderer-msvc.c
|
cli/renderer-msvc.c
|
||||||
pkgconf_CPPFLAGS = -I$(top_srcdir)/libpkgconf -I$(top_srcdir)/cli
|
pkgconf_CPPFLAGS = -Ilibpkgconf -Icli
|
||||||
noinst_HEADERS = \
|
noinst_HEADERS = \
|
||||||
cli/getopt_long.h \
|
cli/getopt_long.h \
|
||||||
cli/renderer-msvc.h
|
cli/renderer-msvc.h
|
||||||
|
|
||||||
bomtool_LDADD = libpkgconf.la
|
|
||||||
bomtool_SOURCES = \
|
|
||||||
cli/bomtool/main.c \
|
|
||||||
cli/getopt_long.c
|
|
||||||
bomtool_CPPFLAGS = -I$(top_srcdir)/libpkgconf -I$(top_srcdir)/cli -I$(top_srcdir)/cli/bomtool
|
|
||||||
|
|
||||||
dist_doc_DATA = README.md AUTHORS
|
dist_doc_DATA = README.md AUTHORS
|
||||||
|
|
||||||
m4datadir = $(datadir)/aclocal
|
m4datadir = $(datadir)/aclocal
|
||||||
|
|
98
NEWS
98
NEWS
|
@ -1,110 +1,14 @@
|
||||||
Changes from previous version of pkgconf
|
Changes from previous version of pkgconf
|
||||||
========================================
|
========================================
|
||||||
|
|
||||||
Changes from 1.9.4 to 1.9.5:
|
Changes from 1.8.0 to 1.8.1:
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
||||||
* Fix incorrect assumptions involving the use of ctype(3) functions.
|
|
||||||
Patch by Taylor R Campbell.
|
|
||||||
|
|
||||||
* Fix detection of provided functions on autoconf.
|
|
||||||
Patches by Harmen Stoppels.
|
|
||||||
|
|
||||||
* Fix deletion of tests/meson.build by the autoconf build system.
|
|
||||||
Patch by h30032433.
|
|
||||||
|
|
||||||
* Fix quoting rules in argvsplit.c.
|
|
||||||
Patch by huyubiao.
|
|
||||||
|
|
||||||
* Update libpkgconf documentation and documentation building scripts.
|
|
||||||
Patches by Andrew Shadura.
|
|
||||||
|
|
||||||
* Enforce maximum package count correctly for --modversion.
|
|
||||||
|
|
||||||
Changes from 1.9.3 to 1.9.4:
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
* Fix a buffer overflow vulnerability involving very large variable expansions.
|
|
||||||
CVE-2023-24056
|
|
||||||
|
|
||||||
* Fix a bunch of minor regressions with the solver.
|
|
||||||
|
|
||||||
* Create separate solutions for `--cflags` and `--libs` when `--static` is not
|
|
||||||
used.
|
|
||||||
|
|
||||||
* Remove final trailing whitespace in pkgconf_fragment_render_buf().
|
|
||||||
|
|
||||||
* Revert broken pkg.m4 change involving querying module versions in
|
|
||||||
PKG_CHECK_MODULES.
|
|
||||||
|
|
||||||
* Fix handling of tildes in version strings.
|
|
||||||
|
|
||||||
* Various C99 formatting string fixes involving SIZE_FMT_SPECIFIER.
|
|
||||||
|
|
||||||
Changes from 1.9.2 to 1.9.3:
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
* Fix a bunch of minor code issues pointed out using Clang static analyzer.
|
|
||||||
|
|
||||||
* New API: pkgconf_solution_free(), which frees a compiled solution graph.
|
|
||||||
|
|
||||||
* Fix behavior when overriding global variables with `--define-variable`.
|
|
||||||
|
|
||||||
Changes from 1.9.1 to 1.9.2:
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
* Do not try to break dependency cycles across dependency lists. This causes
|
|
||||||
the solved graph to sometimes miss required dependency nodes because the
|
|
||||||
solver detected an incorrect dependency cycle.
|
|
||||||
|
|
||||||
* New API: pkgconf_queue_solve(), which replaces pkgconf_queue_apply().
|
|
||||||
pkgconf_queue_apply is now deprecated and should not be used in new code.
|
|
||||||
|
|
||||||
Changes from 1.9.0 to 1.9.1:
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
* Skip graph flattening and traversal for query types which only make sense
|
|
||||||
for a single pkg-config module.
|
|
||||||
|
|
||||||
The old solver walked these graphs with --maximum-traverse-depth=1 in
|
|
||||||
these cases, but this is no longer helpful because the graph is flattened
|
|
||||||
by the new solver.
|
|
||||||
|
|
||||||
Changes from 1.8.0 to 1.9.0:
|
|
||||||
----------------------------
|
|
||||||
|
|
||||||
* pkgconf 1.9.0 is the first testing release in the pkgconf 2.0 development
|
|
||||||
series. While it is believed to be suitable for production, there may be
|
|
||||||
bugs due to the overall redesign of the solver and other initiatives.
|
|
||||||
Additionally, a future release of pkgconf plans will have additional ABI
|
|
||||||
breaks for the libpkgconf library before the pkgconf 2.0 release is cut.
|
|
||||||
|
|
||||||
* There is now a new solver that is designed to provide higher performance
|
|
||||||
with complicated graphs, which works by flattening the dependency graph
|
|
||||||
into a smaller set of dependencies. This graph can then be evaluated
|
|
||||||
instead of the original dependency graph without having to visit every
|
|
||||||
edge in the graph.
|
|
||||||
|
|
||||||
NOTE: This solver, while providing significant performance improvements,
|
|
||||||
does so, at the cost of changed behavior for some edge cases (such as
|
|
||||||
circular dependencies).
|
|
||||||
|
|
||||||
* Bug fixes:
|
* Bug fixes:
|
||||||
- Resolved several memory leaks with edge cases when using libpkgconf
|
- Resolved several memory leaks with edge cases when using libpkgconf
|
||||||
directly.
|
directly.
|
||||||
- pkgconf CLI now consistently frees libpkgconf resources under all
|
- pkgconf CLI now consistently frees libpkgconf resources under all
|
||||||
circumstances.
|
circumstances.
|
||||||
- SYSROOT rules are no longer applied to `-uninstalled` packages by
|
|
||||||
default. Use `PKG_CONFIG_PKGCONF1_SYSROOT_RULES` for legacy behavior.
|
|
||||||
|
|
||||||
* A new `--license` selector has been added to the pkgconf CLI. This uses
|
|
||||||
SPDX expressions which can be set as the `License` field in `.pc` files.
|
|
||||||
See the `pc(5)` manpage for more information.
|
|
||||||
|
|
||||||
* The canonical location for pkgconf maintenance going forward is
|
|
||||||
<https://gitea.treehouse.systems/ariadne/pkgconf>. This is presently
|
|
||||||
mirrored to GitHub for user convenience, but that mirroring will
|
|
||||||
be terminated at some point (due to GitHub Copilot).
|
|
||||||
|
|
||||||
Changes from 1.7.4 to 1.8.0:
|
Changes from 1.7.4 to 1.8.0:
|
||||||
----------------------------
|
----------------------------
|
||||||
|
|
|
@ -119,7 +119,7 @@ pkgconf is compiled using [Meson](https://mesonbuild.com) on Windows. In theory,
|
||||||
Meson to build on UNIX, but this is not recommended at this time as it pkgconf is typically built
|
Meson to build on UNIX, but this is not recommended at this time as it pkgconf is typically built
|
||||||
much earlier than Meson.
|
much earlier than Meson.
|
||||||
|
|
||||||
$ meson setup build -Dtests=disabled
|
$ meson setup build -Dtests=false
|
||||||
$ meson compile -C build
|
$ meson compile -C build
|
||||||
$ meson install -C build
|
$ meson install -C build
|
||||||
|
|
||||||
|
|
|
@ -1,365 +0,0 @@
|
||||||
/*
|
|
||||||
* bomtool/main.c
|
|
||||||
* main() routine, printer functions
|
|
||||||
*
|
|
||||||
* Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019
|
|
||||||
* pkgconf authors (see AUTHORS).
|
|
||||||
*
|
|
||||||
* Permission to use, copy, modify, and/or distribute this software for any
|
|
||||||
* purpose with or without fee is hereby granted, provided that the above
|
|
||||||
* copyright notice and this permission notice appear in all copies.
|
|
||||||
*
|
|
||||||
* This software is provided 'as is' and without any warranty, express or
|
|
||||||
* implied. In no event shall the authors be liable for any damages arising
|
|
||||||
* from the use of this software.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "libpkgconf/config.h"
|
|
||||||
#include <libpkgconf/stdinc.h>
|
|
||||||
#include <libpkgconf/libpkgconf.h>
|
|
||||||
#include "getopt_long.h"
|
|
||||||
|
|
||||||
#define PKG_VERSION (((uint64_t) 1) << 1)
|
|
||||||
#define PKG_ABOUT (((uint64_t) 1) << 2)
|
|
||||||
#define PKG_HELP (((uint64_t) 1) << 3)
|
|
||||||
|
|
||||||
static const char *spdx_version = "SPDX-2.2";
|
|
||||||
static const char *bom_license = "CC0-1.0";
|
|
||||||
static const char *document_ref = "SPDXRef-DOCUMENT";
|
|
||||||
|
|
||||||
static pkgconf_client_t pkg_client;
|
|
||||||
static uint64_t want_flags;
|
|
||||||
static size_t maximum_package_count = 0;
|
|
||||||
static int maximum_traverse_depth = 2000;
|
|
||||||
FILE *error_msgout = NULL;
|
|
||||||
|
|
||||||
static bool
|
|
||||||
error_handler(const char *msg, const pkgconf_client_t *client, void *data)
|
|
||||||
{
|
|
||||||
(void) client;
|
|
||||||
(void) data;
|
|
||||||
fprintf(error_msgout, "%s", msg);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
sbom_spdx_identity(pkgconf_pkg_t *pkg)
|
|
||||||
{
|
|
||||||
static char buf[PKGCONF_ITEM_SIZE];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof buf, "%sC64%s", pkg->id, pkg->version);
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
sbom_name(pkgconf_pkg_t *world)
|
|
||||||
{
|
|
||||||
static char buf[PKGCONF_BUFSIZE];
|
|
||||||
pkgconf_node_t *node;
|
|
||||||
|
|
||||||
pkgconf_strlcpy(buf, "SBOM-SPDX", sizeof buf);
|
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, node)
|
|
||||||
{
|
|
||||||
pkgconf_dependency_t *dep = node->data;
|
|
||||||
pkgconf_pkg_t *match = dep->match;
|
|
||||||
|
|
||||||
if (!dep->match)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pkgconf_strlcat(buf, "-", sizeof buf);
|
|
||||||
pkgconf_strlcat(buf, sbom_spdx_identity(match), sizeof buf);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
write_sbom_header(pkgconf_client_t *client, pkgconf_pkg_t *world)
|
|
||||||
{
|
|
||||||
(void) client;
|
|
||||||
(void) world;
|
|
||||||
|
|
||||||
printf("SPDXVersion: %s\n", spdx_version);
|
|
||||||
printf("DataLicense: %s\n", bom_license);
|
|
||||||
printf("SPDXID: %s\n", document_ref);
|
|
||||||
printf("DocumentName: %s\n", sbom_name(world));
|
|
||||||
printf("DocumentNamespace: https://spdx.org/spdxdocs/bomtool-%s\n", PACKAGE_VERSION);
|
|
||||||
printf("Creator: Tool: bomtool %s\n", PACKAGE_VERSION);
|
|
||||||
|
|
||||||
printf("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *
|
|
||||||
sbom_identity(pkgconf_pkg_t *pkg)
|
|
||||||
{
|
|
||||||
static char buf[PKGCONF_ITEM_SIZE];
|
|
||||||
|
|
||||||
snprintf(buf, sizeof buf, "%s@%s", pkg->id, pkg->version);
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
write_sbom_package(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
|
|
||||||
{
|
|
||||||
(void) client;
|
|
||||||
(void) unused;
|
|
||||||
|
|
||||||
if (pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
printf("##### Package: %s\n\n", sbom_identity(pkg));
|
|
||||||
|
|
||||||
printf("PackageName: %s\n", sbom_identity(pkg));
|
|
||||||
printf("SPDXID: SPDXRef-Package-%s\n", sbom_spdx_identity(pkg));
|
|
||||||
printf("PackageVersion: %s\n", pkg->version);
|
|
||||||
printf("PackageDownloadLocation: NOASSERTION\n");
|
|
||||||
printf("PackageVerificationCode: NOASSERTION\n");
|
|
||||||
|
|
||||||
/* XXX: What about projects? */
|
|
||||||
if (pkg->maintainer != NULL)
|
|
||||||
printf("PackageSupplier: Person: %s\n", pkg->maintainer);
|
|
||||||
|
|
||||||
if (pkg->url != NULL)
|
|
||||||
printf("PackageHomePage: %s\n", pkg->url);
|
|
||||||
|
|
||||||
printf("PackageLicenseDeclared: %s\n", pkg->license != NULL ? pkg->license : "NOASSERTION");
|
|
||||||
|
|
||||||
if (pkg->copyright != NULL)
|
|
||||||
printf("PackageCopyrightText: <text>%s</text>\n", pkg->copyright);
|
|
||||||
|
|
||||||
if (pkg->description != NULL)
|
|
||||||
printf("PackageSummary: <text>%s</text>\n", pkg->description);
|
|
||||||
|
|
||||||
printf("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
write_sbom_relationships(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
|
|
||||||
{
|
|
||||||
(void) client;
|
|
||||||
(void) unused;
|
|
||||||
|
|
||||||
char baseref[PKGCONF_ITEM_SIZE];
|
|
||||||
pkgconf_node_t *node;
|
|
||||||
|
|
||||||
if (pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
snprintf(baseref, sizeof baseref, "SPDXRef-Package-%sC64%s", pkg->id, pkg->version);
|
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
|
|
||||||
{
|
|
||||||
pkgconf_dependency_t *dep = node->data;
|
|
||||||
pkgconf_pkg_t *match = dep->match;
|
|
||||||
|
|
||||||
if (!dep->match)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
printf("Relationship: %s DEPENDS_ON SPDXRef-Package-%s\n", baseref, sbom_spdx_identity(match));
|
|
||||||
printf("Relationship: SPDXRef-Package-%s DEPENDENCY_OF %s\n", sbom_spdx_identity(match), baseref);
|
|
||||||
}
|
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
|
|
||||||
{
|
|
||||||
pkgconf_dependency_t *dep = node->data;
|
|
||||||
pkgconf_pkg_t *match = dep->match;
|
|
||||||
|
|
||||||
if (!dep->match)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
printf("Relationship: %s DEPENDS_ON SPDXRef-Package-%s\n", baseref, sbom_spdx_identity(match));
|
|
||||||
printf("Relationship: SPDXRef-Package-%s DEV_DEPENDENCY_OF %s\n", sbom_spdx_identity(match), baseref);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pkg->required.head != NULL || pkg->requires_private.head != NULL)
|
|
||||||
printf("\n\n");
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
generate_sbom_from_world(pkgconf_client_t *client, pkgconf_pkg_t *world)
|
|
||||||
{
|
|
||||||
int eflag;
|
|
||||||
pkgconf_node_t *node;
|
|
||||||
|
|
||||||
write_sbom_header(client, world);
|
|
||||||
|
|
||||||
eflag = pkgconf_pkg_traverse(client, world, write_sbom_package, NULL, maximum_traverse_depth, 0);
|
|
||||||
if (eflag != PKGCONF_PKG_ERRF_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
eflag = pkgconf_pkg_traverse(client, world, write_sbom_relationships, NULL, maximum_traverse_depth, 0);
|
|
||||||
if (eflag != PKGCONF_PKG_ERRF_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(world->required.head, node)
|
|
||||||
{
|
|
||||||
pkgconf_dependency_t *dep = node->data;
|
|
||||||
pkgconf_pkg_t *match = dep->match;
|
|
||||||
|
|
||||||
if (!dep->match)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
printf("Relationship: %s DESCRIBES SPDXRef-Package-%s\n", document_ref, sbom_spdx_identity(match));
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
version(void)
|
|
||||||
{
|
|
||||||
printf("bomtool %s\n", PACKAGE_VERSION);
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
about(void)
|
|
||||||
{
|
|
||||||
printf("bomtool (%s %s)\n", PACKAGE_NAME, PACKAGE_VERSION);
|
|
||||||
printf("Copyright (c) 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, 2021\n");
|
|
||||||
printf(" pkgconf authors (see AUTHORS in documentation directory).\n\n");
|
|
||||||
printf("Permission to use, copy, modify, and/or distribute this software for any\n");
|
|
||||||
printf("purpose with or without fee is hereby granted, provided that the above\n");
|
|
||||||
printf("copyright notice and this permission notice appear in all copies.\n\n");
|
|
||||||
printf("This software is provided 'as is' and without any warranty, express or\n");
|
|
||||||
printf("implied. In no event shall the authors be liable for any damages arising\n");
|
|
||||||
printf("from the use of this software.\n\n");
|
|
||||||
printf("Report bugs at <%s>.\n", PACKAGE_BUGREPORT);
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
usage(void)
|
|
||||||
{
|
|
||||||
printf("usage: bomtool [--flags] [modules]\n");
|
|
||||||
|
|
||||||
printf("\nbasic options:\n\n");
|
|
||||||
|
|
||||||
printf(" --help this message\n");
|
|
||||||
printf(" --about print bomtool version and license to stdout\n");
|
|
||||||
printf(" --version print bomtool version to stdout\n");
|
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char *argv[])
|
|
||||||
{
|
|
||||||
int ret = EXIT_SUCCESS;
|
|
||||||
pkgconf_list_t pkgq = PKGCONF_LIST_INITIALIZER;
|
|
||||||
unsigned int want_client_flags = PKGCONF_PKG_PKGF_SEARCH_PRIVATE;
|
|
||||||
pkgconf_cross_personality_t *personality = pkgconf_cross_personality_default();
|
|
||||||
pkgconf_pkg_t world = {
|
|
||||||
.id = "virtual:world",
|
|
||||||
.realname = "virtual world package",
|
|
||||||
.flags = PKGCONF_PKG_PROPF_STATIC | PKGCONF_PKG_PROPF_VIRTUAL,
|
|
||||||
};
|
|
||||||
|
|
||||||
error_msgout = stderr;
|
|
||||||
|
|
||||||
struct pkg_option options[] = {
|
|
||||||
{ "version", no_argument, &want_flags, PKG_VERSION, },
|
|
||||||
{ "about", no_argument, &want_flags, PKG_ABOUT, },
|
|
||||||
{ "help", no_argument, &want_flags, PKG_HELP, },
|
|
||||||
{ NULL, 0, NULL, 0 }
|
|
||||||
};
|
|
||||||
|
|
||||||
while ((ret = pkg_getopt_long_only(argc, argv, "", options, NULL)) != -1)
|
|
||||||
{
|
|
||||||
switch (ret)
|
|
||||||
{
|
|
||||||
case '?':
|
|
||||||
case ':':
|
|
||||||
return EXIT_FAILURE;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pkgconf_client_init(&pkg_client, error_handler, NULL, personality);
|
|
||||||
|
|
||||||
/* we have determined what features we want most likely. in some cases, we override later. */
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags);
|
|
||||||
|
|
||||||
/* at this point, want_client_flags should be set, so build the dir list */
|
|
||||||
pkgconf_client_dir_list_build(&pkg_client, personality);
|
|
||||||
|
|
||||||
if ((want_flags & PKG_ABOUT) == PKG_ABOUT)
|
|
||||||
return about();
|
|
||||||
|
|
||||||
if ((want_flags & PKG_VERSION) == PKG_VERSION)
|
|
||||||
return version();
|
|
||||||
|
|
||||||
if ((want_flags & PKG_HELP) == PKG_HELP)
|
|
||||||
return usage();
|
|
||||||
|
|
||||||
while (1)
|
|
||||||
{
|
|
||||||
const char *package = argv[pkg_optind];
|
|
||||||
|
|
||||||
if (package == NULL)
|
|
||||||
break;
|
|
||||||
|
|
||||||
/* check if there is a limit to the number of packages allowed to be included, if so and we have hit
|
|
||||||
* the limit, stop adding packages to the queue.
|
|
||||||
*/
|
|
||||||
if (maximum_package_count > 0 && pkgq.length > maximum_package_count)
|
|
||||||
break;
|
|
||||||
|
|
||||||
while (isspace((unsigned char)package[0]))
|
|
||||||
package++;
|
|
||||||
|
|
||||||
/* skip empty packages */
|
|
||||||
if (package[0] == '\0') {
|
|
||||||
pkg_optind++;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1])))
|
|
||||||
{
|
|
||||||
pkgconf_queue_push(&pkgq, package);
|
|
||||||
pkg_optind++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
char packagebuf[PKGCONF_BUFSIZE];
|
|
||||||
|
|
||||||
snprintf(packagebuf, sizeof packagebuf, "%s %s %s", package, argv[pkg_optind + 1], argv[pkg_optind + 2]);
|
|
||||||
pkg_optind += 3;
|
|
||||||
|
|
||||||
pkgconf_queue_push(&pkgq, packagebuf);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (pkgq.head == NULL)
|
|
||||||
{
|
|
||||||
fprintf(stderr, "Please specify at least one package name on the command line.\n");
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = EXIT_SUCCESS;
|
|
||||||
|
|
||||||
if (!pkgconf_queue_solve(&pkg_client, &pkgq, &world, maximum_traverse_depth))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!generate_sbom_from_world(&pkg_client, &world))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
out:
|
|
||||||
pkgconf_solution_free(&pkg_client, &world);
|
|
||||||
pkgconf_queue_free(&pkgq);
|
|
||||||
pkgconf_cross_personality_deinit(personality);
|
|
||||||
pkgconf_client_deinit(&pkg_client);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
236
cli/main.c
236
cli/main.c
|
@ -70,7 +70,6 @@
|
||||||
#define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42)
|
#define PKG_INTERNAL_CFLAGS (((uint64_t) 1) << 42)
|
||||||
#define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43)
|
#define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43)
|
||||||
#define PKG_SHARED (((uint64_t) 1) << 44)
|
#define PKG_SHARED (((uint64_t) 1) << 44)
|
||||||
#define PKG_DUMP_LICENSE (((uint64_t) 1) << 45)
|
|
||||||
|
|
||||||
static pkgconf_client_t pkg_client;
|
static pkgconf_client_t pkg_client;
|
||||||
static const pkgconf_fragment_render_ops_t *want_render_ops = NULL;
|
static const pkgconf_fragment_render_ops_t *want_render_ops = NULL;
|
||||||
|
@ -407,8 +406,7 @@ apply_env(pkgconf_client_t *client, pkgconf_pkg_t *world, void *env_prefix_p, in
|
||||||
char workbuf[PKGCONF_ITEM_SIZE];
|
char workbuf[PKGCONF_ITEM_SIZE];
|
||||||
|
|
||||||
for (it = want_env_prefix; *it != '\0'; it++)
|
for (it = want_env_prefix; *it != '\0'; it++)
|
||||||
if (!isalpha((unsigned char)*it) &&
|
if (!isalpha(*it) && !isdigit(*it))
|
||||||
!isdigit((unsigned char)*it))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
snprintf(workbuf, sizeof workbuf, "%s_CFLAGS", want_env_prefix);
|
snprintf(workbuf, sizeof workbuf, "%s_CFLAGS", want_env_prefix);
|
||||||
|
@ -586,32 +584,6 @@ apply_simulate(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int m
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
|
||||||
print_license(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
|
|
||||||
{
|
|
||||||
(void) client;
|
|
||||||
(void) data;
|
|
||||||
|
|
||||||
if (pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* NOASSERTION is the default when the license is unknown, per SPDX spec § 3.15 */
|
|
||||||
printf("%s: %s\n", pkg->id, pkg->license != NULL ? pkg->license : "NOASSERTION");
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool
|
|
||||||
apply_license(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
|
|
||||||
{
|
|
||||||
int eflag;
|
|
||||||
|
|
||||||
eflag = pkgconf_pkg_traverse(client, world, print_license, data, maxdepth, 0);
|
|
||||||
|
|
||||||
if (eflag != PKGCONF_PKG_ERRF_OK)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
version(void)
|
version(void)
|
||||||
{
|
{
|
||||||
|
@ -715,7 +687,6 @@ usage(void)
|
||||||
printf(" --path show the exact filenames for any matching .pc files\n");
|
printf(" --path show the exact filenames for any matching .pc files\n");
|
||||||
printf(" --modversion print the specified module's version to stdout\n");
|
printf(" --modversion print the specified module's version to stdout\n");
|
||||||
printf(" --internal-cflags do not filter 'internal' cflags from output\n");
|
printf(" --internal-cflags do not filter 'internal' cflags from output\n");
|
||||||
printf(" --license print the specified module's license to stdout if known\n");
|
|
||||||
|
|
||||||
printf("\nfiltering output:\n\n");
|
printf("\nfiltering output:\n\n");
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
|
@ -823,11 +794,6 @@ main(int argc, char *argv[])
|
||||||
unsigned int want_client_flags = PKGCONF_PKG_PKGF_NONE;
|
unsigned int want_client_flags = PKGCONF_PKG_PKGF_NONE;
|
||||||
pkgconf_cross_personality_t *personality = NULL;
|
pkgconf_cross_personality_t *personality = NULL;
|
||||||
bool opened_error_msgout = false;
|
bool opened_error_msgout = false;
|
||||||
pkgconf_pkg_t world = {
|
|
||||||
.id = "virtual:world",
|
|
||||||
.realname = "virtual world package",
|
|
||||||
.flags = PKGCONF_PKG_PROPF_STATIC | PKGCONF_PKG_PROPF_VIRTUAL,
|
|
||||||
};
|
|
||||||
|
|
||||||
want_flags = 0;
|
want_flags = 0;
|
||||||
|
|
||||||
|
@ -908,7 +874,6 @@ main(int argc, char *argv[])
|
||||||
{ "dump-personality", no_argument, &want_flags, PKG_DUMP_PERSONALITY },
|
{ "dump-personality", no_argument, &want_flags, PKG_DUMP_PERSONALITY },
|
||||||
{ "personality", required_argument, NULL, 53 },
|
{ "personality", required_argument, NULL, 53 },
|
||||||
#endif
|
#endif
|
||||||
{ "license", no_argument, &want_flags, PKG_DUMP_LICENSE },
|
|
||||||
{ NULL, 0, NULL, 0 }
|
{ NULL, 0, NULL, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1111,11 +1076,17 @@ main(int argc, char *argv[])
|
||||||
if ((want_flags & PKG_INTERNAL_CFLAGS) == PKG_INTERNAL_CFLAGS)
|
if ((want_flags & PKG_INTERNAL_CFLAGS) == PKG_INTERNAL_CFLAGS)
|
||||||
want_client_flags |= PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS;
|
want_client_flags |= PKGCONF_PKG_PKGF_DONT_FILTER_INTERNAL_CFLAGS;
|
||||||
|
|
||||||
|
#ifdef XXX_NOTYET
|
||||||
/* if these selectors are used, it means that we are inquiring about a single package.
|
/* if these selectors are used, it means that we are inquiring about a single package.
|
||||||
* so signal to libpkgconf that we do not want to use the dependency resolver for more than one level,
|
* so signal to libpkgconf that we do not want to use the dependency resolver for more than one level,
|
||||||
* and also limit the SAT problem to a single package.
|
* and also limit the SAT problem to a single package.
|
||||||
|
*
|
||||||
|
* i disabled this because too many upstream maintainers are still invoking pkg-config correctly to have
|
||||||
|
* the more sane behaviour as default. use --maximum-traverse-depth=1 or PKG_CONFIG_MAXIMUM_TRAVERSE_DEPTH
|
||||||
|
* environment variable to get the same results in meantime.
|
||||||
*/
|
*/
|
||||||
if (((want_flags & PKG_REQUIRES) == PKG_REQUIRES ||
|
if ((want_flags & PKG_EXISTS) == 0 &&
|
||||||
|
((want_flags & PKG_REQUIRES) == PKG_REQUIRES ||
|
||||||
(want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE ||
|
(want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE ||
|
||||||
(want_flags & PKG_PROVIDES) == PKG_PROVIDES ||
|
(want_flags & PKG_PROVIDES) == PKG_PROVIDES ||
|
||||||
(want_flags & PKG_VARIABLES) == PKG_VARIABLES ||
|
(want_flags & PKG_VARIABLES) == PKG_VARIABLES ||
|
||||||
|
@ -1126,6 +1097,7 @@ main(int argc, char *argv[])
|
||||||
maximum_package_count = 1;
|
maximum_package_count = 1;
|
||||||
maximum_traverse_depth = 1;
|
maximum_traverse_depth = 1;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (getenv("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") != NULL)
|
if (getenv("PKG_CONFIG_ALLOW_SYSTEM_CFLAGS") != NULL)
|
||||||
want_flags |= PKG_KEEP_SYSTEM_CFLAGS;
|
want_flags |= PKG_KEEP_SYSTEM_CFLAGS;
|
||||||
|
@ -1136,12 +1108,6 @@ main(int argc, char *argv[])
|
||||||
if ((builddir = getenv("PKG_CONFIG_TOP_BUILD_DIR")) != NULL)
|
if ((builddir = getenv("PKG_CONFIG_TOP_BUILD_DIR")) != NULL)
|
||||||
pkgconf_client_set_buildroot_dir(&pkg_client, builddir);
|
pkgconf_client_set_buildroot_dir(&pkg_client, builddir);
|
||||||
|
|
||||||
if ((want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE ||
|
|
||||||
(want_flags & PKG_CFLAGS))
|
|
||||||
{
|
|
||||||
want_client_flags |= PKGCONF_PKG_PKGF_SEARCH_PRIVATE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((sysroot_dir = getenv("PKG_CONFIG_SYSROOT_DIR")) != NULL)
|
if ((sysroot_dir = getenv("PKG_CONFIG_SYSROOT_DIR")) != NULL)
|
||||||
{
|
{
|
||||||
const char *destdir;
|
const char *destdir;
|
||||||
|
@ -1196,7 +1162,7 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
if (required_module_version != NULL)
|
if (required_module_version != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg = NULL;
|
pkgconf_pkg_t *pkg;
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
||||||
|
|
||||||
|
@ -1217,26 +1183,22 @@ main(int argc, char *argv[])
|
||||||
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
||||||
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
goto cleanup;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkgconf_compare_version(pkg->version, required_module_version) >= 0)
|
if (pkgconf_compare_version(pkg->version, required_module_version) >= 0)
|
||||||
{
|
{
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
goto cleanup;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
cleanup:
|
|
||||||
if (pkg != NULL)
|
|
||||||
pkgconf_pkg_unref(&pkg_client, pkg);
|
|
||||||
pkgconf_dependency_free(&deplist);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else if (required_exact_module_version != NULL)
|
else if (required_exact_module_version != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg = NULL;
|
pkgconf_pkg_t *pkg;
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
||||||
|
|
||||||
|
@ -1257,26 +1219,22 @@ cleanup:
|
||||||
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
||||||
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
goto cleanup2;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0)
|
if (pkgconf_compare_version(pkg->version, required_exact_module_version) == 0)
|
||||||
{
|
{
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
goto cleanup2;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
cleanup2:
|
|
||||||
if (pkg != NULL)
|
|
||||||
pkgconf_pkg_unref(&pkg_client, pkg);
|
|
||||||
pkgconf_dependency_free(&deplist);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
else if (required_max_module_version != NULL)
|
else if (required_max_module_version != NULL)
|
||||||
{
|
{
|
||||||
pkgconf_pkg_t *pkg = NULL;
|
pkgconf_pkg_t *pkg;
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
pkgconf_list_t deplist = PKGCONF_LIST_INITIALIZER;
|
||||||
|
|
||||||
|
@ -1297,21 +1255,17 @@ cleanup2:
|
||||||
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
pkgconf_error(&pkg_client, "Package '%s' was not found\n", pkgiter->package);
|
||||||
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
goto cleanup3;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0)
|
if (pkgconf_compare_version(pkg->version, required_max_module_version) <= 0)
|
||||||
{
|
{
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
goto cleanup3;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
cleanup3:
|
|
||||||
if (pkg != NULL)
|
|
||||||
pkgconf_pkg_unref(&pkg_client, pkg);
|
|
||||||
pkgconf_dependency_free(&deplist);
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1325,10 +1279,10 @@ cleanup3:
|
||||||
/* check if there is a limit to the number of packages allowed to be included, if so and we have hit
|
/* check if there is a limit to the number of packages allowed to be included, if so and we have hit
|
||||||
* the limit, stop adding packages to the queue.
|
* the limit, stop adding packages to the queue.
|
||||||
*/
|
*/
|
||||||
if (maximum_package_count > 0 && pkgq.length >= maximum_package_count)
|
if (maximum_package_count > 0 && pkgq.length > maximum_package_count)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
while (isspace((unsigned char)package[0]))
|
while (isspace((unsigned int)package[0]))
|
||||||
package++;
|
package++;
|
||||||
|
|
||||||
/* skip empty packages */
|
/* skip empty packages */
|
||||||
|
@ -1362,62 +1316,80 @@ cleanup3:
|
||||||
|
|
||||||
ret = EXIT_SUCCESS;
|
ret = EXIT_SUCCESS;
|
||||||
|
|
||||||
if (!pkgconf_queue_solve(&pkg_client, &pkgq, &world, maximum_traverse_depth))
|
|
||||||
{
|
|
||||||
ret = EXIT_FAILURE;
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
if ((want_flags & PKG_SIMULATE) == PKG_SIMULATE)
|
if ((want_flags & PKG_SIMULATE) == PKG_SIMULATE)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ERRORS);
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ERRORS);
|
||||||
apply_simulate(&pkg_client, &world, NULL, -1);
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_simulate, -1, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((want_flags & PKG_VALIDATE) == PKG_VALIDATE)
|
if (!pkgconf_queue_validate(&pkg_client, &pkgq, maximum_traverse_depth))
|
||||||
goto out;
|
|
||||||
|
|
||||||
if ((want_flags & PKG_DUMP_LICENSE) == PKG_DUMP_LICENSE)
|
|
||||||
{
|
{
|
||||||
apply_license(&pkg_client, &world, &ret, 2);
|
ret = EXIT_FAILURE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((want_flags & PKG_VALIDATE) == PKG_VALIDATE)
|
||||||
|
return 0;
|
||||||
|
|
||||||
if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED)
|
if ((want_flags & PKG_UNINSTALLED) == PKG_UNINSTALLED)
|
||||||
{
|
{
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
apply_uninstalled(&pkg_client, &world, &ret, 2);
|
pkgconf_queue_apply(&pkg_client, &pkgq, apply_uninstalled, maximum_traverse_depth, &ret);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (want_env_prefix != NULL)
|
if (want_env_prefix != NULL)
|
||||||
{
|
{
|
||||||
apply_env(&pkg_client, &world, want_env_prefix, 2);
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_env, maximum_traverse_depth, want_env_prefix))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
want_flags = 0;
|
want_flags = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_PROVIDES) == PKG_PROVIDES)
|
if ((want_flags & PKG_PROVIDES) == PKG_PROVIDES)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
apply_provides(&pkg_client, &world, NULL, 2);
|
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_provides, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
if ((want_flags & PKG_DIGRAPH) == PKG_DIGRAPH)
|
if ((want_flags & PKG_DIGRAPH) == PKG_DIGRAPH)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
apply_digraph(&pkg_client, &world, NULL, 2);
|
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_digraph, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION)
|
if ((want_flags & PKG_MODVERSION) == PKG_MODVERSION)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
apply_modversion(&pkg_client, &world, NULL, 2);
|
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_modversion, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_PATH) == PKG_PATH)
|
if ((want_flags & PKG_PATH) == PKG_PATH)
|
||||||
|
@ -1425,13 +1397,22 @@ cleanup3:
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
||||||
apply_path(&pkg_client, &world, NULL, 2);
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_path, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES)
|
if ((want_flags & PKG_VARIABLES) == PKG_VARIABLES)
|
||||||
{
|
{
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
apply_variables(&pkg_client, &world, NULL, 2);
|
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variables, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (want_variable)
|
if (want_variable)
|
||||||
|
@ -1439,55 +1420,66 @@ cleanup3:
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL);
|
||||||
apply_variable(&pkg_client, &world, want_variable, 2);
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_variable, maximum_traverse_depth, want_variable))
|
||||||
}
|
|
||||||
|
|
||||||
if ((want_flags & PKG_REQUIRES) == PKG_REQUIRES)
|
|
||||||
{
|
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
|
||||||
apply_requires(&pkg_client, &world, NULL, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE)
|
|
||||||
{
|
|
||||||
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
|
||||||
|
|
||||||
apply_requires_private(&pkg_client, &world, NULL, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((want_flags & PKG_CFLAGS))
|
|
||||||
{
|
|
||||||
apply_cflags(&pkg_client, &world, NULL, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((want_flags & PKG_LIBS))
|
|
||||||
{
|
|
||||||
if (want_flags & PKG_CFLAGS)
|
|
||||||
printf(" ");
|
|
||||||
|
|
||||||
if (!(want_flags & PKG_STATIC))
|
|
||||||
{
|
|
||||||
pkgconf_client_set_flags(&pkg_client, pkg_client.flags & ~PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
|
|
||||||
|
|
||||||
/* redo the solution for the library set: free the solution itself, and any cached graph nodes */
|
|
||||||
pkgconf_solution_free(&pkg_client, &world);
|
|
||||||
pkgconf_cache_free(&pkg_client);
|
|
||||||
|
|
||||||
if (!pkgconf_queue_solve(&pkg_client, &pkgq, &world, maximum_traverse_depth))
|
|
||||||
{
|
{
|
||||||
ret = EXIT_FAILURE;
|
ret = EXIT_FAILURE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
apply_libs(&pkg_client, &world, NULL, 2);
|
if ((want_flags & PKG_REQUIRES) == PKG_REQUIRES)
|
||||||
|
{
|
||||||
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((want_flags & PKG_REQUIRES_PRIVATE) == PKG_REQUIRES_PRIVATE)
|
||||||
|
{
|
||||||
|
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
|
||||||
|
|
||||||
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
|
||||||
|
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_requires_private, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgconf_client_set_flags(&pkg_client, want_client_flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((want_flags & PKG_CFLAGS))
|
||||||
|
{
|
||||||
|
pkgconf_client_set_flags(&pkg_client, want_client_flags | PKGCONF_PKG_PKGF_SEARCH_PRIVATE);
|
||||||
|
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_cflags, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out_println;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgconf_client_set_flags(&pkg_client, want_client_flags);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((want_flags & PKG_LIBS))
|
||||||
|
{
|
||||||
|
if (!pkgconf_queue_apply(&pkg_client, &pkgq, apply_libs, maximum_traverse_depth, NULL))
|
||||||
|
{
|
||||||
|
ret = EXIT_FAILURE;
|
||||||
|
goto out_println;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out_println:
|
||||||
if (want_flags & (PKG_CFLAGS|PKG_LIBS))
|
if (want_flags & (PKG_CFLAGS|PKG_LIBS))
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
out:
|
out:
|
||||||
pkgconf_solution_free(&pkg_client, &world);
|
|
||||||
pkgconf_queue_free(&pkgq);
|
pkgconf_queue_free(&pkgq);
|
||||||
pkgconf_cross_personality_deinit(personality);
|
pkgconf_cross_personality_deinit(personality);
|
||||||
pkgconf_client_deinit(&pkg_client);
|
pkgconf_client_deinit(&pkg_client);
|
||||||
|
|
|
@ -149,6 +149,7 @@ msvc_renderer_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, b
|
||||||
{
|
{
|
||||||
cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining);
|
cnt = pkgconf_strlcpy(bptr, ".lib", buf_remaining);
|
||||||
bptr += cnt;
|
bptr += cnt;
|
||||||
|
buf_remaining -= cnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (escape)
|
if (escape)
|
||||||
|
|
|
@ -12,7 +12,7 @@ dnl implied. In no event shall the authors be liable for any damages arising
|
||||||
dnl from the use of this software.
|
dnl from the use of this software.
|
||||||
|
|
||||||
AC_PREREQ([2.71])
|
AC_PREREQ([2.71])
|
||||||
AC_INIT([pkgconf],[1.9.5],[https://github.com/pkgconf/pkgconf/issues/new])
|
AC_INIT([pkgconf],[1.8.0],[https://github.com/pkgconf/pkgconf/issues/new])
|
||||||
AC_CONFIG_SRCDIR([cli/main.c])
|
AC_CONFIG_SRCDIR([cli/main.c])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
|
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])
|
||||||
|
@ -22,8 +22,7 @@ AX_CHECK_COMPILE_FLAG([-std=gnu99], [CFLAGS="$CFLAGS -std=gnu99"], [
|
||||||
AX_CHECK_COMPILE_FLAG([-std=c99], [CFLAGS="$CFLAGS -std=c99"])
|
AX_CHECK_COMPILE_FLAG([-std=c99], [CFLAGS="$CFLAGS -std=c99"])
|
||||||
])
|
])
|
||||||
AC_CONFIG_HEADERS([libpkgconf/config.h])
|
AC_CONFIG_HEADERS([libpkgconf/config.h])
|
||||||
AC_CHECK_DECLS([strlcpy, strlcat, strndup], [], [], [[#include <string.h>]])
|
AC_CHECK_FUNCS([strlcpy strlcat strndup reallocarray])
|
||||||
AC_CHECK_DECLS([reallocarray])
|
|
||||||
AC_CHECK_HEADERS([sys/stat.h])
|
AC_CHECK_HEADERS([sys/stat.h])
|
||||||
AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects])
|
AM_INIT_AUTOMAKE([foreign dist-xz subdir-objects])
|
||||||
AM_SILENT_RULES([yes])
|
AM_SILENT_RULES([yes])
|
||||||
|
|
|
@ -70,21 +70,21 @@ def extract_comments(filename):
|
||||||
while True:
|
while True:
|
||||||
char = source_file.read(1)
|
char = source_file.read(1)
|
||||||
if not char:
|
if not char:
|
||||||
if state == 3 or state == 4:
|
if state is 3 or state is 4:
|
||||||
raise UnterminatedCommentError()
|
raise UnterminatedCommentError()
|
||||||
if state == 2:
|
if state is 2:
|
||||||
# Was in single line comment. Create comment.
|
# Was in single line comment. Create comment.
|
||||||
comment = Comment(current_comment, line_counter, False)
|
comment = Comment(current_comment, line_counter, False)
|
||||||
comments.append(comment)
|
comments.append(comment)
|
||||||
return comments
|
return comments
|
||||||
if state == 0:
|
if state is 0:
|
||||||
# Waiting for comment start character or beginning of
|
# Waiting for comment start character or beginning of
|
||||||
# string.
|
# string.
|
||||||
if char == '/':
|
if char == '/':
|
||||||
state = 1
|
state = 1
|
||||||
elif char == '"':
|
elif char == '"':
|
||||||
state = 5
|
state = 5
|
||||||
elif state == 1:
|
elif state is 1:
|
||||||
# Found comment start character, classify next character and
|
# Found comment start character, classify next character and
|
||||||
# determine if single or multiline comment.
|
# determine if single or multiline comment.
|
||||||
if char == '/':
|
if char == '/':
|
||||||
|
@ -94,7 +94,7 @@ def extract_comments(filename):
|
||||||
state = 3
|
state = 3
|
||||||
else:
|
else:
|
||||||
state = 0
|
state = 0
|
||||||
elif state == 2:
|
elif state is 2:
|
||||||
# In single line comment, read characters until EOL.
|
# In single line comment, read characters until EOL.
|
||||||
if char == '\n':
|
if char == '\n':
|
||||||
comment = Comment(current_comment, line_counter, False)
|
comment = Comment(current_comment, line_counter, False)
|
||||||
|
@ -103,14 +103,14 @@ def extract_comments(filename):
|
||||||
state = 0
|
state = 0
|
||||||
else:
|
else:
|
||||||
current_comment += char
|
current_comment += char
|
||||||
elif state == 3:
|
elif state is 3:
|
||||||
# In multi-line comment, add characters until '*'
|
# In multi-line comment, add characters until '*'
|
||||||
# encountered.
|
# encountered.
|
||||||
if char == '*':
|
if char == '*':
|
||||||
state = 4
|
state = 4
|
||||||
else:
|
else:
|
||||||
current_comment += char
|
current_comment += char
|
||||||
elif state == 4:
|
elif state is 4:
|
||||||
# In multi-line comment with asterisk found. Determine if
|
# In multi-line comment with asterisk found. Determine if
|
||||||
# comment is ending.
|
# comment is ending.
|
||||||
if char == '/':
|
if char == '/':
|
||||||
|
@ -125,13 +125,13 @@ def extract_comments(filename):
|
||||||
if char != '*':
|
if char != '*':
|
||||||
current_comment += char
|
current_comment += char
|
||||||
state = 3
|
state = 3
|
||||||
elif state == 5:
|
elif state is 5:
|
||||||
# In string literal, expect literal end or escape char.
|
# In string literal, expect literal end or escape char.
|
||||||
if char == '"':
|
if char == '"':
|
||||||
state = 0
|
state = 0
|
||||||
elif char == '\\':
|
elif char == '\\':
|
||||||
state = 6
|
state = 6
|
||||||
elif state == 6:
|
elif state is 6:
|
||||||
# In string literal, escaping current char.
|
# In string literal, escaping current char.
|
||||||
state = 5
|
state = 5
|
||||||
if char == '\n':
|
if char == '\n':
|
||||||
|
|
|
@ -9,32 +9,21 @@ in parallel.
|
||||||
Client objects are not thread safe, in other words, a client object should not be shared across
|
Client objects are not thread safe, in other words, a client object should not be shared across
|
||||||
thread boundaries.
|
thread boundaries.
|
||||||
|
|
||||||
.. c:function:: void pkgconf_client_dir_list_build(pkgconf_client_t *client)
|
.. c:function:: void pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler)
|
||||||
|
|
||||||
Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is set on the client,
|
|
||||||
then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the
|
|
||||||
``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to bootstrap.
|
|
||||||
:return: nothing
|
|
||||||
|
|
||||||
.. c:function:: void pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
|
|
||||||
|
|
||||||
Initialise a pkgconf client object.
|
Initialise a pkgconf client object.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The client to initialise.
|
:param pkgconf_client_t* client: The client to initialise.
|
||||||
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
||||||
:param void* error_handler_data: user data passed to optional error handler
|
:param void* error_handler_data: user data passed to optional error handler
|
||||||
:param pkgconf_cross_personality_t* personality: the cross-compile personality to use for defaults
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: pkgconf_client_t* pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
|
.. c:function:: pkgconf_client_t* pkgconf_client_new(pkgconf_error_handler_func_t error_handler)
|
||||||
|
|
||||||
Allocate and initialise a pkgconf client object.
|
Allocate and initialise a pkgconf client object.
|
||||||
|
|
||||||
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
:param pkgconf_error_handler_func_t error_handler: An optional error handler to use for logging errors.
|
||||||
:param void* error_handler_data: user data passed to optional error handler
|
:param void* error_handler_data: user data passed to optional error handler
|
||||||
:param pkgconf_cross_personality_t* personality: cross-compile personality to use
|
|
||||||
:return: A pkgconf client object.
|
:return: A pkgconf client object.
|
||||||
:rtype: pkgconf_client_t*
|
:rtype: pkgconf_client_t*
|
||||||
|
|
||||||
|
@ -108,14 +97,11 @@ thread boundaries.
|
||||||
:return: true if the warn handler processed the message, else false.
|
:return: true if the warn handler processed the message, else false.
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
|
|
||||||
.. c:function:: bool pkgconf_trace(const pkgconf_client_t *client, const char *filename, size_t len, const char *funcname, const char *format, ...)
|
.. c:function:: bool pkgconf_trace(const pkgconf_client_t *client, const char *format, ...)
|
||||||
|
|
||||||
Report a message to a client-registered trace handler.
|
Report a message to a client-registered trace handler.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to report the trace message to.
|
:param pkgconf_client_t* client: The pkgconf client object to report the trace message to.
|
||||||
:param char* filename: The file the function is in.
|
|
||||||
:param size_t lineno: The line number currently being executed.
|
|
||||||
:param char* funcname: The function name to use.
|
|
||||||
:param char* format: A printf-style format string to use for formatting the trace message.
|
:param char* format: A printf-style format string to use for formatting the trace message.
|
||||||
:return: true if the trace handler processed the message, else false.
|
:return: true if the trace handler processed the message, else false.
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
|
|
|
@ -14,7 +14,6 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param char* package: The package `atom` to set on the dependency node.
|
:param char* package: The package `atom` to set on the dependency node.
|
||||||
:param char* version: The package `version` to set on the dependency node.
|
:param char* version: The package `version` to set on the dependency node.
|
||||||
:param pkgconf_pkg_comparator_t compare: The comparison operator to set on the dependency node.
|
:param pkgconf_pkg_comparator_t compare: The comparison operator to set on the dependency node.
|
||||||
:param uint flags: Any flags to attach to the dependency node.
|
|
||||||
:return: A dependency node.
|
:return: A dependency node.
|
||||||
:rtype: pkgconf_dependency_t *
|
:rtype: pkgconf_dependency_t *
|
||||||
|
|
||||||
|
@ -26,29 +25,6 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param pkgconf_dependency_t* tail: The dependency node to add to the tail of the dependency list.
|
:param pkgconf_dependency_t* tail: The dependency node to add to the tail of the dependency list.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: void pkgconf_dependency_free_one(pkgconf_dependency_t *dep)
|
|
||||||
|
|
||||||
Frees a dependency node.
|
|
||||||
|
|
||||||
:param pkgconf_dependency_t* dep: The dependency node to free.
|
|
||||||
:return: nothing
|
|
||||||
|
|
||||||
.. c:function:: pkgconf_dependency_t *pkgconf_dependency_ref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
|
|
||||||
|
|
||||||
Increases a dependency node's refcount.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
|
|
||||||
:param pkgconf_dependency_t* dep: The dependency to increase the refcount of.
|
|
||||||
:return: the dependency node on success, else NULL
|
|
||||||
|
|
||||||
.. c:function:: void pkgconf_dependency_unref(pkgconf_client_t *owner, pkgconf_dependency_t *dep)
|
|
||||||
|
|
||||||
Decreases a dependency node's refcount and frees it if necessary.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* owner: The client object which owns the memory of this dependency node.
|
|
||||||
:param pkgconf_dependency_t* dep: The dependency to decrease the refcount of.
|
|
||||||
:return: nothing
|
|
||||||
|
|
||||||
.. c:function:: void pkgconf_dependency_free(pkgconf_list_t *list)
|
.. c:function:: void pkgconf_dependency_free(pkgconf_list_t *list)
|
||||||
|
|
||||||
Release a dependency list and it's child dependency nodes.
|
Release a dependency list and it's child dependency nodes.
|
||||||
|
@ -65,7 +41,6 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param pkgconf_client_t* client: The client object that owns the package this dependency list belongs to.
|
:param pkgconf_client_t* client: The client object that owns the package this dependency list belongs to.
|
||||||
:param pkgconf_list_t* deplist_head: The dependency list to populate with dependency nodes.
|
:param pkgconf_list_t* deplist_head: The dependency list to populate with dependency nodes.
|
||||||
:param char* depends: The dependency data to parse.
|
:param char* depends: The dependency data to parse.
|
||||||
:param uint flags: Any flags to attach to the dependency nodes.
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: void pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends)
|
.. c:function:: void pkgconf_dependency_parse(const pkgconf_client_t *client, pkgconf_pkg_t *pkg, pkgconf_list_t *deplist, const char *depends)
|
||||||
|
@ -78,13 +53,4 @@ The `dependency` module provides support for building `dependency lists` (the ba
|
||||||
:param pkgconf_pkg_t* pkg: The package object that owns this dependency list.
|
:param pkgconf_pkg_t* pkg: The package object that owns this dependency list.
|
||||||
:param pkgconf_list_t* deplist: The dependency list to populate with dependency nodes.
|
:param pkgconf_list_t* deplist: The dependency list to populate with dependency nodes.
|
||||||
:param char* depends: The dependency data to parse.
|
:param char* depends: The dependency data to parse.
|
||||||
:param uint flags: Any flags to attach to the dependency nodes.
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: pkgconf_dependency_t *pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *dep)
|
|
||||||
|
|
||||||
Copies a dependency node to a new one.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The client object that will own this dependency.
|
|
||||||
:param pkgconf_dependency_t* dep: The dependency node to copy.
|
|
||||||
:return: a pointer to a new dependency node, else NULL
|
|
||||||
|
|
|
@ -6,14 +6,13 @@ The `fragment` module provides low-level management and rendering of fragment li
|
||||||
`fragment list` contains various `fragments` of text (such as ``-I /usr/include``) in a matter
|
`fragment list` contains various `fragments` of text (such as ``-I /usr/include``) in a matter
|
||||||
which is composable, mergeable and reorderable.
|
which is composable, mergeable and reorderable.
|
||||||
|
|
||||||
.. c:function:: void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string, unsigned int flags)
|
.. c:function:: void pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *string)
|
||||||
|
|
||||||
Adds a `fragment` of text to a `fragment list`, possibly modifying the fragment if a sysroot is set.
|
Adds a `fragment` of text to a `fragment list`, possibly modifying the fragment if a sysroot is set.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
||||||
:param pkgconf_list_t* list: The fragment list.
|
:param pkgconf_list_t* list: The fragment list.
|
||||||
:param char* string: The string of text to add as a fragment to the fragment list.
|
:param char* string: The string of text to add as a fragment to the fragment list.
|
||||||
:param uint flags: Parsing-related flags for the package.
|
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: bool pkgconf_fragment_has_system_dir(const pkgconf_client_t *client, const pkgconf_fragment_t *frag)
|
.. c:function:: bool pkgconf_fragment_has_system_dir(const pkgconf_client_t *client, const pkgconf_fragment_t *frag)
|
||||||
|
@ -111,6 +110,5 @@ which is composable, mergeable and reorderable.
|
||||||
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
:param pkgconf_client_t* client: The pkgconf client being accessed.
|
||||||
:param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
:param pkgconf_list_t* list: The `fragment list` to add the fragment entries to.
|
||||||
:param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
:param pkgconf_list_t* vars: A list of variables to use for variable substitution.
|
||||||
:param uint flags: Any parsing flags to be aware of.
|
|
||||||
:param char* value: The string to parse into fragments.
|
:param char* value: The string to parse into fragments.
|
||||||
:return: true on success, false on parse error
|
:return: true on success, false on parse error
|
||||||
|
|
|
@ -25,12 +25,12 @@ variables.
|
||||||
:return: number of path nodes added to the path list
|
:return: number of path nodes added to the path list
|
||||||
:rtype: size_t
|
:rtype: size_t
|
||||||
|
|
||||||
.. c:function:: size_t pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist)
|
.. c:function:: size_t pkgconf_path_build_from_environ(const char *environ, const char *fallback, pkgconf_list_t *dirlist)
|
||||||
|
|
||||||
Adds the paths specified in an environment variable to a path list. If the environment variable is not set,
|
Adds the paths specified in an environment variable to a path list. If the environment variable is not set,
|
||||||
an optional default set of paths is added.
|
an optional default set of paths is added.
|
||||||
|
|
||||||
:param char* envvarname: The environment variable to look up.
|
:param char* environ: The environment variable to look up.
|
||||||
:param char* fallback: The fallback paths to use if the environment variable is not set.
|
:param char* fallback: The fallback paths to use if the environment variable is not set.
|
||||||
:param pkgconf_list_t* dirlist: The path list to add the path nodes to.
|
:param pkgconf_list_t* dirlist: The path list to add the path nodes to.
|
||||||
:param bool filter: Whether to perform duplicate filtering.
|
:param bool filter: Whether to perform duplicate filtering.
|
||||||
|
@ -46,14 +46,6 @@ variables.
|
||||||
:return: true if the path list has a matching prefix, otherwise false
|
:return: true if the path list has a matching prefix, otherwise false
|
||||||
:rtype: bool
|
:rtype: bool
|
||||||
|
|
||||||
.. c:function:: void pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src)
|
|
||||||
|
|
||||||
Copies a path list to another path list.
|
|
||||||
|
|
||||||
:param pkgconf_list_t* dst: The path list to copy to.
|
|
||||||
:param pkgconf_list_t* src: The path list to copy from.
|
|
||||||
:return: nothing
|
|
||||||
|
|
||||||
.. c:function:: void pkgconf_path_free(pkgconf_list_t *dirlist)
|
.. c:function:: void pkgconf_path_free(pkgconf_list_t *dirlist)
|
||||||
|
|
||||||
Releases any path nodes attached to the given path list.
|
Releases any path nodes attached to the given path list.
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
|
|
||||||
libpkgconf `personality` module
|
|
||||||
=========================
|
|
||||||
|
|
||||||
.. c:function:: const pkgconf_cross_personality_t *pkgconf_cross_personality_default(void)
|
|
||||||
|
|
||||||
Returns the default cross-compile personality.
|
|
||||||
|
|
||||||
Not thread safe.
|
|
||||||
|
|
||||||
:rtype: pkgconf_cross_personality_t*
|
|
||||||
:return: the default cross-compile personality
|
|
||||||
|
|
||||||
.. c:function:: void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *)
|
|
||||||
|
|
||||||
Decrements the count of default cross personality instances.
|
|
||||||
|
|
||||||
Not thread safe.
|
|
||||||
|
|
||||||
:rtype: void
|
|
||||||
|
|
||||||
.. c:function:: pkgconf_cross_personality_t *pkgconf_cross_personality_find(const char *triplet)
|
|
||||||
|
|
||||||
Attempts to find a cross-compile personality given a triplet.
|
|
||||||
|
|
||||||
:rtype: pkgconf_cross_personality_t*
|
|
||||||
:return: the default cross-compile personality
|
|
|
@ -5,14 +5,22 @@ libpkgconf `pkg` module
|
||||||
The `pkg` module provides dependency resolution services and the overall `.pc` file parsing
|
The `pkg` module provides dependency resolution services and the overall `.pc` file parsing
|
||||||
routines.
|
routines.
|
||||||
|
|
||||||
.. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f, unsigned int flags)
|
.. c:function:: void pkgconf_pkg_dir_list_build(pkgconf_client_t *client)
|
||||||
|
|
||||||
|
Bootstraps the package search paths. If the ``PKGCONF_PKG_PKGF_ENV_ONLY`` `flag` is set on the client,
|
||||||
|
then only the ``PKG_CONFIG_PATH`` environment variable will be used, otherwise both the
|
||||||
|
``PKG_CONFIG_PATH`` and ``PKG_CONFIG_LIBDIR`` environment variables will be used.
|
||||||
|
|
||||||
|
:param pkgconf_client_t* client: The pkgconf client object to bootstrap.
|
||||||
|
:return: nothing
|
||||||
|
|
||||||
|
.. c:function:: pkgconf_pkg_t *pkgconf_pkg_new_from_file(const pkgconf_client_t *client, const char *filename, FILE *f)
|
||||||
|
|
||||||
Parse a .pc file into a pkgconf_pkg_t object structure.
|
Parse a .pc file into a pkgconf_pkg_t object structure.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
:param char* filename: The filename of the package file (including full path).
|
:param char* filename: The filename of the package file (including full path).
|
||||||
:param FILE* f: The file object to read from.
|
:param FILE* f: The file object to read from.
|
||||||
:param uint flags: The flags to use when parsing.
|
|
||||||
:returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
:returns: A ``pkgconf_pkg_t`` object which contains the package data.
|
||||||
:rtype: pkgconf_pkg_t *
|
:rtype: pkgconf_pkg_t *
|
||||||
|
|
||||||
|
@ -68,7 +76,7 @@ routines.
|
||||||
|
|
||||||
:param char* a: The first version to compare in the pair.
|
:param char* a: The first version to compare in the pair.
|
||||||
:param char* b: The second version to compare in the pair.
|
:param char* b: The second version to compare in the pair.
|
||||||
:return: -1 if the first version is less than, 0 if both versions are equal, 1 if the second version is less than.
|
:return: -1 if the first version is greater, 0 if both versions are equal, 1 if the second version is greater.
|
||||||
:rtype: int
|
:rtype: int
|
||||||
|
|
||||||
.. c:function:: pkgconf_pkg_t *pkgconf_builtin_pkg_get(const char *name)
|
.. c:function:: pkgconf_pkg_t *pkgconf_builtin_pkg_get(const char *name)
|
||||||
|
@ -118,7 +126,7 @@ routines.
|
||||||
:return: On success, ``PKGCONF_PKG_ERRF_OK`` (0), else an error code.
|
:return: On success, ``PKGCONF_PKG_ERRF_OK`` (0), else an error code.
|
||||||
:rtype: unsigned int
|
:rtype: unsigned int
|
||||||
|
|
||||||
.. c:function:: unsigned int pkgconf_pkg_traverse(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth, unsigned int skip_flags)
|
.. c:function:: unsigned int pkgconf_pkg_traverse(pkgconf_client_t *client, pkgconf_pkg_t *root, pkgconf_pkg_traverse_func_t func, void *data, int maxdepth)
|
||||||
|
|
||||||
Walk and resolve the dependency graph up to `maxdepth` levels.
|
Walk and resolve the dependency graph up to `maxdepth` levels.
|
||||||
|
|
||||||
|
@ -127,7 +135,6 @@ routines.
|
||||||
:param pkgconf_pkg_traverse_func_t func: A traversal function to call for each resolved node in the dependency graph.
|
:param pkgconf_pkg_traverse_func_t func: A traversal function to call for each resolved node in the dependency graph.
|
||||||
:param void* data: An opaque pointer to data to be passed to the traversal function.
|
:param void* data: An opaque pointer to data to be passed to the traversal function.
|
||||||
:param int maxdepth: The maximum depth to walk the dependency graph for. -1 means infinite recursion.
|
:param int maxdepth: The maximum depth to walk the dependency graph for. -1 means infinite recursion.
|
||||||
:param uint skip_flags: Skip over dependency nodes containing the specified flags. A setting of 0 skips no dependency nodes.
|
|
||||||
:return: ``PKGCONF_PKG_ERRF_OK`` on success, else an error code.
|
:return: ``PKGCONF_PKG_ERRF_OK`` on success, else an error code.
|
||||||
:rtype: unsigned int
|
:rtype: unsigned int
|
||||||
|
|
||||||
|
|
|
@ -33,32 +33,11 @@ Using the `queue` module functions is the recommended way of working with depend
|
||||||
:param pkgconf_list_t* list: The dependency resolution queue to release.
|
:param pkgconf_list_t* list: The dependency resolution queue to release.
|
||||||
:return: nothing
|
:return: nothing
|
||||||
|
|
||||||
.. c:function:: void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth)
|
|
||||||
|
|
||||||
Removes references to package nodes contained in a solution.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
|
||||||
:param pkgconf_pkg_t* world: The root for the generated dependency graph. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
|
||||||
:returns: nothing
|
|
||||||
|
|
||||||
.. c:function:: bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth)
|
|
||||||
|
|
||||||
Solves and flattens the dependency graph for the supplied dependency list.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
|
||||||
:param pkgconf_list_t* list: The list of dependency requests to consider.
|
|
||||||
:param pkgconf_pkg_t* world: The root for the generated dependency graph, provided by the caller. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
|
||||||
:param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
|
|
||||||
:returns: true if the dependency resolver found a solution, otherwise false.
|
|
||||||
:rtype: bool
|
|
||||||
|
|
||||||
.. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
.. c:function:: void pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
||||||
|
|
||||||
Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
||||||
feed the solution to a callback function if a complete dependency graph is found.
|
feed the solution to a callback function if a complete dependency graph is found.
|
||||||
|
|
||||||
This function should not be used in new code. Use pkgconf_queue_solve instead.
|
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
:param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
:param pkgconf_list_t* list: The list of dependency requests to consider.
|
:param pkgconf_list_t* list: The list of dependency requests to consider.
|
||||||
:param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
:param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
||||||
|
|
|
@ -64,14 +64,13 @@ attached to a given client object.
|
||||||
:return: the value of the variable or ``NULL``
|
:return: the value of the variable or ``NULL``
|
||||||
:rtype: char *
|
:rtype: char *
|
||||||
|
|
||||||
.. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value, unsigned int flags)
|
.. c:function:: char *pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const char *value)
|
||||||
|
|
||||||
Parse an expression for variable substitution.
|
Parse an expression for variable substitution.
|
||||||
|
|
||||||
:param pkgconf_client_t* client: The pkgconf client object to access.
|
:param pkgconf_client_t* client: The pkgconf client object to access.
|
||||||
:param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
:param pkgconf_list_t* list: The variable list to search for variables (along side the global variable list).
|
||||||
:param char* value: The ``key=value`` string to parse.
|
:param char* value: The ``key=value`` string to parse.
|
||||||
:param uint flags: Any flags to consider while parsing.
|
|
||||||
:return: the variable data with any variables substituted
|
:return: the variable data with any variables substituted
|
||||||
:rtype: char *
|
:rtype: char *
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@ libpkgconf - an API for managing `pkg-config` modules
|
||||||
libpkgconf-dependency
|
libpkgconf-dependency
|
||||||
libpkgconf-fragment
|
libpkgconf-fragment
|
||||||
libpkgconf-path
|
libpkgconf-path
|
||||||
libpkgconf-personality
|
|
||||||
libpkgconf-pkg
|
libpkgconf-pkg
|
||||||
libpkgconf-queue
|
libpkgconf-queue
|
||||||
libpkgconf-tuple
|
libpkgconf-tuple
|
||||||
|
|
|
@ -5,8 +5,7 @@ libdir=@libdir@
|
||||||
|
|
||||||
Name: libpkgconf
|
Name: libpkgconf
|
||||||
Description: a library for accessing and manipulating development framework configuration
|
Description: a library for accessing and manipulating development framework configuration
|
||||||
URL: https://gitea.treehouse.systems/ariadne/pkgconf
|
URL: http://github.com/pkgconf/pkgconf
|
||||||
License: ISC
|
|
||||||
Version: @PACKAGE_VERSION@
|
Version: @PACKAGE_VERSION@
|
||||||
CFlags: -I${includedir}/pkgconf
|
CFlags: -I${includedir}/pkgconf
|
||||||
Libs: -L${libdir} -lpkgconf
|
Libs: -L${libdir} -lpkgconf
|
||||||
|
|
|
@ -80,7 +80,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
if (escaped)
|
if (escaped)
|
||||||
{
|
{
|
||||||
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
/* POSIX: only \CHAR is special inside a double quote if CHAR is {$, `, ", \, newline}. */
|
||||||
if (quote == '"')
|
if (quote == '\"')
|
||||||
{
|
{
|
||||||
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
if (!(*src_iter == '$' || *src_iter == '`' || *src_iter == '"' || *src_iter == '\\'))
|
||||||
*dst_iter++ = '\\';
|
*dst_iter++ = '\\';
|
||||||
|
@ -88,9 +88,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
}
|
|
||||||
|
|
||||||
escaped = false;
|
escaped = false;
|
||||||
}
|
}
|
||||||
|
@ -103,7 +101,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
else
|
else
|
||||||
*dst_iter++ = *src_iter;
|
*dst_iter++ = *src_iter;
|
||||||
}
|
}
|
||||||
else if (isspace((unsigned char)*src_iter))
|
else if (isspace((unsigned int)*src_iter))
|
||||||
{
|
{
|
||||||
if ((*argv)[argc_count] != NULL)
|
if ((*argv)[argc_count] != NULL)
|
||||||
{
|
{
|
||||||
|
@ -120,9 +118,11 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
|
||||||
}
|
}
|
||||||
else switch(*src_iter)
|
else switch(*src_iter)
|
||||||
{
|
{
|
||||||
|
#ifndef _WIN32
|
||||||
case '\\':
|
case '\\':
|
||||||
escaped = true;
|
escaped = true;
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case '\"':
|
case '\"':
|
||||||
case '\'':
|
case '\'':
|
||||||
|
|
|
@ -20,12 +20,11 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
#include <libpkgconf/bsdstubs.h>
|
#include <libpkgconf/bsdstubs.h>
|
||||||
#include <libpkgconf/config.h>
|
#include <libpkgconf/config.h>
|
||||||
|
|
||||||
#if !HAVE_DECL_STRLCPY
|
#ifndef HAVE_STRLCPY
|
||||||
/*
|
/*
|
||||||
* Copy src to string dst of size siz. At most siz-1 characters
|
* Copy src to string dst of size siz. At most siz-1 characters
|
||||||
* will be copied. Always NUL terminates (unless siz == 0).
|
* will be copied. Always NUL terminates (unless siz == 0).
|
||||||
|
@ -58,7 +57,7 @@ strlcpy(char *dst, const char *src, size_t siz)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !HAVE_DECL_STRLCAT
|
#ifndef HAVE_STRLCAT
|
||||||
/*
|
/*
|
||||||
* Appends src to string dst of size siz (unlike strncat, siz is the
|
* Appends src to string dst of size siz (unlike strncat, siz is the
|
||||||
* full size of dst, not space left). At most siz-1 characters
|
* full size of dst, not space left). At most siz-1 characters
|
||||||
|
@ -107,7 +106,7 @@ strlcat(char *dst, const char *src, size_t siz)
|
||||||
* from the use of this software.
|
* from the use of this software.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if !HAVE_DECL_STRNDUP
|
#ifndef HAVE_STRNDUP
|
||||||
/*
|
/*
|
||||||
* Creates a memory buffer and copies at most 'len' characters to it.
|
* Creates a memory buffer and copies at most 'len' characters to it.
|
||||||
* If 'len' is less than the length of the source string, truncation occured.
|
* If 'len' is less than the length of the source string, truncation occured.
|
||||||
|
@ -139,7 +138,7 @@ pkgconf_strndup(const char *src, size_t len)
|
||||||
return strndup(src, len);
|
return strndup(src, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !HAVE_DECL_REALLOCARRAY
|
#ifndef HAVE_REALLOCARRAY
|
||||||
void *
|
void *
|
||||||
reallocarray(void *ptr, size_t m, size_t n)
|
reallocarray(void *ptr, size_t m, size_t n)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#include <libpkgconf/stdinc.h>
|
#include <libpkgconf/stdinc.h>
|
||||||
#include <libpkgconf/libpkgconf.h>
|
#include <libpkgconf/libpkgconf.h>
|
||||||
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -66,7 +64,7 @@ cache_dump(const pkgconf_client_t *client)
|
||||||
{
|
{
|
||||||
const pkgconf_pkg_t *pkg = client->cache_table[i];
|
const pkgconf_pkg_t *pkg = client->cache_table[i];
|
||||||
|
|
||||||
PKGCONF_TRACE(client, SIZE_FMT_SPECIFIER": %p(%s)",
|
PKGCONF_TRACE(client, "%zu: %p(%s)",
|
||||||
i, pkg, pkg == NULL ? "NULL" : pkg->id);
|
i, pkg, pkg == NULL ? "NULL" : pkg->id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -88,9 +86,6 @@ cache_dump(const pkgconf_client_t *client)
|
||||||
pkgconf_pkg_t *
|
pkgconf_pkg_t *
|
||||||
pkgconf_cache_lookup(pkgconf_client_t *client, const char *id)
|
pkgconf_cache_lookup(pkgconf_client_t *client, const char *id)
|
||||||
{
|
{
|
||||||
if (client->cache_table == NULL)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
pkgconf_pkg_t **pkg;
|
pkgconf_pkg_t **pkg;
|
||||||
|
|
||||||
pkg = bsearch(id, client->cache_table,
|
pkg = bsearch(id, client->cache_table,
|
||||||
|
@ -155,9 +150,6 @@ pkgconf_cache_add(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
void
|
void
|
||||||
pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
{
|
{
|
||||||
if (client->cache_table == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (pkg == NULL)
|
if (pkg == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -175,8 +167,6 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
if (slot == NULL)
|
if (slot == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(*slot)->flags &= ~PKGCONF_PKG_PROPF_CACHED;
|
|
||||||
pkgconf_pkg_unref(client, *slot);
|
|
||||||
*slot = NULL;
|
*slot = NULL;
|
||||||
|
|
||||||
qsort(client->cache_table, client->cache_count,
|
qsort(client->cache_table, client->cache_count,
|
||||||
|
@ -191,15 +181,19 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
}
|
}
|
||||||
|
|
||||||
client->cache_count--;
|
client->cache_count--;
|
||||||
if (client->cache_count > 0)
|
|
||||||
{
|
|
||||||
client->cache_table = pkgconf_reallocarray(client->cache_table,
|
client->cache_table = pkgconf_reallocarray(client->cache_table,
|
||||||
client->cache_count, sizeof(void *));
|
client->cache_count, sizeof(void *));
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
static inline void
|
||||||
|
clear_dependency_matches(pkgconf_list_t *list)
|
||||||
{
|
{
|
||||||
free(client->cache_table);
|
pkgconf_node_t *iter;
|
||||||
client->cache_table = NULL;
|
|
||||||
|
PKGCONF_FOREACH_LIST_ENTRY(list->head, iter)
|
||||||
|
{
|
||||||
|
pkgconf_dependency_t *dep = iter->data;
|
||||||
|
dep->match = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -217,15 +211,30 @@ pkgconf_cache_remove(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
void
|
void
|
||||||
pkgconf_cache_free(pkgconf_client_t *client)
|
pkgconf_cache_free(pkgconf_client_t *client)
|
||||||
{
|
{
|
||||||
if (client->cache_table == NULL)
|
pkgconf_pkg_t **cache_table;
|
||||||
return;
|
size_t i, count;
|
||||||
|
|
||||||
while (client->cache_count > 0)
|
cache_table = pkgconf_reallocarray(NULL, client->cache_count, sizeof (void *));
|
||||||
pkgconf_cache_remove(client, client->cache_table[0]);
|
memcpy(cache_table, client->cache_table,
|
||||||
|
client->cache_count * sizeof (void *));
|
||||||
|
|
||||||
free(client->cache_table);
|
/* first we clear cached match pointers */
|
||||||
client->cache_table = NULL;
|
for (i = 0, count = client->cache_count; i < count; i++)
|
||||||
client->cache_count = 0;
|
{
|
||||||
|
pkgconf_pkg_t *pkg = cache_table[i];
|
||||||
|
|
||||||
|
clear_dependency_matches(&pkg->required);
|
||||||
|
clear_dependency_matches(&pkg->requires_private);
|
||||||
|
clear_dependency_matches(&pkg->provides);
|
||||||
|
clear_dependency_matches(&pkg->conflicts);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* now forcibly free everything */
|
||||||
|
for (i = 0, count = client->cache_count; i < count; i++)
|
||||||
|
{
|
||||||
|
pkgconf_pkg_t *pkg = cache_table[i];
|
||||||
|
pkgconf_pkg_free(client, pkg);
|
||||||
|
}
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "cleared package cache");
|
PKGCONF_TRACE(client, "cleared package cache");
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,8 +98,6 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error
|
||||||
client->error_handler_data = error_handler_data;
|
client->error_handler_data = error_handler_data;
|
||||||
client->error_handler = error_handler;
|
client->error_handler = error_handler;
|
||||||
client->auditf = NULL;
|
client->auditf = NULL;
|
||||||
client->cache_table = NULL;
|
|
||||||
client->cache_count = 0;
|
|
||||||
|
|
||||||
#ifndef PKGCONF_LITE
|
#ifndef PKGCONF_LITE
|
||||||
if (client->trace_handler == NULL)
|
if (client->trace_handler == NULL)
|
||||||
|
|
|
@ -12,18 +12,6 @@
|
||||||
/* Define to 1 if you have the `reallocarray' function. */
|
/* Define to 1 if you have the `reallocarray' function. */
|
||||||
#mesondefine HAVE_REALLOCARRAY
|
#mesondefine HAVE_REALLOCARRAY
|
||||||
|
|
||||||
/* Define to 1 if you have the `strlcat' function. */
|
|
||||||
#mesondefine HAVE_DECL_STRLCAT
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strlcpy' function. */
|
|
||||||
#mesondefine HAVE_DECL_STRLCPY
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `strndup' function. */
|
|
||||||
#mesondefine HAVE_DECL_STRNDUP
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `reallocarray' function. */
|
|
||||||
#mesondefine HAVE_DECL_REALLOCARRAY
|
|
||||||
|
|
||||||
/* Name of package */
|
/* Name of package */
|
||||||
#mesondefine PACKAGE
|
#mesondefine PACKAGE
|
||||||
|
|
||||||
|
|
|
@ -113,16 +113,9 @@ add_or_replace_dependency_node(pkgconf_client_t *client, pkgconf_dependency_t *d
|
||||||
}
|
}
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "added dependency [%s] to list @%p; flags=%x", dependency_to_str(dep, depbuf, sizeof depbuf), list, dep->flags);
|
PKGCONF_TRACE(client, "added dependency [%s] to list @%p; flags=%x", dependency_to_str(dep, depbuf, sizeof depbuf), list, dep->flags);
|
||||||
pkgconf_node_insert_tail(&dep->iter, pkgconf_dependency_ref(dep->owner, dep), list);
|
pkgconf_node_insert_tail(&dep->iter, dep, list);
|
||||||
|
|
||||||
/* This dependency is intentionally unowned.
|
return pkgconf_dependency_ref(dep->owner, dep);
|
||||||
*
|
|
||||||
* Internally we have no use for the returned type, and usually just
|
|
||||||
* discard it. However, there is a publig pkgconf_dependency_add
|
|
||||||
* function, which references this return value before returning it,
|
|
||||||
* giving ownership at that point.
|
|
||||||
*/
|
|
||||||
return dep;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline pkgconf_dependency_t *
|
static inline pkgconf_dependency_t *
|
||||||
|
@ -163,10 +156,10 @@ pkgconf_dependency_addraw(pkgconf_client_t *client, pkgconf_list_t *list, const
|
||||||
pkgconf_dependency_t *
|
pkgconf_dependency_t *
|
||||||
pkgconf_dependency_add(pkgconf_client_t *client, pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare, unsigned int flags)
|
pkgconf_dependency_add(pkgconf_client_t *client, pkgconf_list_t *list, const char *package, const char *version, pkgconf_pkg_comparator_t compare, unsigned int flags)
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep;
|
if (version != NULL)
|
||||||
dep = pkgconf_dependency_addraw(client, list, package, strlen(package), version,
|
return pkgconf_dependency_addraw(client, list, package, strlen(package), version, strlen(version), compare, flags);
|
||||||
version != NULL ? strlen(version) : 0, compare, flags);
|
|
||||||
return pkgconf_dependency_ref(dep->owner, dep);
|
return pkgconf_dependency_addraw(client, list, package, strlen(package), NULL, 0, compare, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -229,7 +222,6 @@ pkgconf_dependency_ref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
dep->refcount++;
|
dep->refcount++;
|
||||||
PKGCONF_TRACE(client, "%s refcount@%p: %d", dep->package, dep, dep->refcount);
|
|
||||||
return dep;
|
return dep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -250,10 +242,7 @@ pkgconf_dependency_unref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
|
||||||
if (client != dep->owner)
|
if (client != dep->owner)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
--dep->refcount;
|
if (--dep->refcount <= 0)
|
||||||
PKGCONF_TRACE(client, "%s refcount@%p: %d", dep->package, dep, dep->refcount);
|
|
||||||
|
|
||||||
if (dep->refcount <= 0)
|
|
||||||
pkgconf_dependency_free_one(dep);
|
pkgconf_dependency_free_one(dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -279,8 +268,6 @@ pkgconf_dependency_free(pkgconf_list_t *list)
|
||||||
pkgconf_node_delete(&dep->iter, list);
|
pkgconf_node_delete(&dep->iter, list);
|
||||||
pkgconf_dependency_unref(dep->owner, dep);
|
pkgconf_dependency_unref(dep->owner, dep);
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_list_zero(list);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -329,11 +316,11 @@ pkgconf_dependency_parse_str(pkgconf_client_t *client, pkgconf_list_t *deplist_h
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case INSIDE_MODULE_NAME:
|
case INSIDE_MODULE_NAME:
|
||||||
if (isspace((unsigned char)*ptr))
|
if (isspace((unsigned int)*ptr))
|
||||||
{
|
{
|
||||||
const char *sptr = ptr;
|
const char *sptr = ptr;
|
||||||
|
|
||||||
while (*sptr && isspace((unsigned char)*sptr))
|
while (*sptr && isspace((unsigned int)*sptr))
|
||||||
sptr++;
|
sptr++;
|
||||||
|
|
||||||
if (*sptr == '\0')
|
if (*sptr == '\0')
|
||||||
|
@ -397,7 +384,7 @@ pkgconf_dependency_parse_str(pkgconf_client_t *client, pkgconf_list_t *deplist_h
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AFTER_OPERATOR:
|
case AFTER_OPERATOR:
|
||||||
if (!isspace((unsigned char)*ptr))
|
if (!isspace((unsigned int)*ptr))
|
||||||
{
|
{
|
||||||
vstart = ptr;
|
vstart = ptr;
|
||||||
state = INSIDE_VERSION;
|
state = INSIDE_VERSION;
|
||||||
|
|
|
@ -160,7 +160,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
|
||||||
pkgconf_fragment_t *parent = list->tail->data;
|
pkgconf_fragment_t *parent = list->tail->data;
|
||||||
|
|
||||||
/* only attempt to merge 'special' fragments together */
|
/* only attempt to merge 'special' fragments together */
|
||||||
if (!parent->type && parent->data != NULL && pkgconf_fragment_is_unmergeable(parent->data))
|
if (!parent->type && pkgconf_fragment_is_unmergeable(parent->data))
|
||||||
{
|
{
|
||||||
size_t len;
|
size_t len;
|
||||||
char *newdata;
|
char *newdata;
|
||||||
|
@ -531,7 +531,6 @@ fragment_render_buf(const pkgconf_list_t *list, char *buf, size_t buflen, bool e
|
||||||
free(quoted);
|
free(quoted);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node->next != NULL)
|
|
||||||
*bptr++ = ' ';
|
*bptr++ = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,8 @@ typedef struct pkgconf_cross_personality_ pkgconf_cross_personality_t;
|
||||||
#define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \
|
#define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \
|
||||||
for ((value) = (tail); (value) != NULL; (value) = (value)->prev)
|
for ((value) = (tail); (value) != NULL; (value) = (value)->prev)
|
||||||
|
|
||||||
#define LIBPKGCONF_VERSION 10905
|
#define LIBPKGCONF_VERSION 10700
|
||||||
#define LIBPKGCONF_VERSION_STR "1.9.5"
|
#define LIBPKGCONF_VERSION_STR "1.7.0"
|
||||||
|
|
||||||
struct pkgconf_fragment_ {
|
struct pkgconf_fragment_ {
|
||||||
pkgconf_node_t iter;
|
pkgconf_node_t iter;
|
||||||
|
@ -111,12 +111,8 @@ struct pkgconf_tuple_ {
|
||||||
|
|
||||||
char *key;
|
char *key;
|
||||||
char *value;
|
char *value;
|
||||||
|
|
||||||
unsigned int flags;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PKGCONF_PKG_TUPLEF_OVERRIDE 0x1
|
|
||||||
|
|
||||||
struct pkgconf_path_ {
|
struct pkgconf_path_ {
|
||||||
pkgconf_node_t lnode;
|
pkgconf_node_t lnode;
|
||||||
|
|
||||||
|
@ -140,9 +136,6 @@ struct pkgconf_pkg_ {
|
||||||
char *description;
|
char *description;
|
||||||
char *url;
|
char *url;
|
||||||
char *pc_filedir;
|
char *pc_filedir;
|
||||||
char *license;
|
|
||||||
char *maintainer;
|
|
||||||
char *copyright;
|
|
||||||
|
|
||||||
pkgconf_list_t libs;
|
pkgconf_list_t libs;
|
||||||
pkgconf_list_t libs_private;
|
pkgconf_list_t libs_private;
|
||||||
|
@ -249,7 +242,7 @@ PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_default(void)
|
||||||
PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_find(const char *triplet);
|
PKGCONF_API pkgconf_cross_personality_t *pkgconf_cross_personality_find(const char *triplet);
|
||||||
PKGCONF_API void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality);
|
PKGCONF_API void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *personality);
|
||||||
|
|
||||||
#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned char)(c)))
|
#define PKGCONF_IS_MODULE_SEPARATOR(c) ((c) == ',' || isspace ((unsigned int)(c)))
|
||||||
#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
|
#define PKGCONF_IS_OPERATOR_CHAR(c) ((c) == '<' || (c) == '>' || (c) == '!' || (c) == '=')
|
||||||
|
|
||||||
#define PKGCONF_PKG_PKGF_NONE 0x0000
|
#define PKGCONF_PKG_PKGF_NONE 0x0000
|
||||||
|
@ -272,7 +265,6 @@ PKGCONF_API void pkgconf_cross_personality_deinit(pkgconf_cross_personality_t *p
|
||||||
#define PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES 0x10000
|
#define PKGCONF_PKG_PKGF_PKGCONF1_SYSROOT_RULES 0x10000
|
||||||
|
|
||||||
#define PKGCONF_PKG_DEPF_INTERNAL 0x1
|
#define PKGCONF_PKG_DEPF_INTERNAL 0x1
|
||||||
#define PKGCONF_PKG_DEPF_PRIVATE 0x2
|
|
||||||
|
|
||||||
#define PKGCONF_PKG_ERRF_OK 0x0
|
#define PKGCONF_PKG_ERRF_OK 0x0
|
||||||
#define PKGCONF_PKG_ERRF_PACKAGE_NOT_FOUND 0x1
|
#define PKGCONF_PKG_ERRF_PACKAGE_NOT_FOUND 0x1
|
||||||
|
@ -306,11 +298,11 @@ PKGCONF_API bool pkgconf_default_error_handler(const char *msg, const pkgconf_cl
|
||||||
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
#if defined(__GNUC__) || defined(__INTEL_COMPILER)
|
||||||
#define PKGCONF_TRACE(client, ...) do { \
|
#define PKGCONF_TRACE(client, ...) do { \
|
||||||
pkgconf_trace(client, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__); \
|
pkgconf_trace(client, __FILE__, __LINE__, __PRETTY_FUNCTION__, __VA_ARGS__); \
|
||||||
} while (0)
|
} while (0);
|
||||||
#else
|
#else
|
||||||
#define PKGCONF_TRACE(client, ...) do { \
|
#define PKGCONF_TRACE(client, ...) do { \
|
||||||
pkgconf_trace(client, __FILE__, __LINE__, __func__, __VA_ARGS__); \
|
pkgconf_trace(client, __FILE__, __LINE__, __func__, __VA_ARGS__); \
|
||||||
} while (0)
|
} while (0);
|
||||||
#endif
|
#endif
|
||||||
#else
|
#else
|
||||||
#define PKGCONF_TRACE(client, ...)
|
#define PKGCONF_TRACE(client, ...)
|
||||||
|
@ -384,11 +376,9 @@ PKGCONF_API void pkgconf_tuple_define_global(pkgconf_client_t *client, const cha
|
||||||
/* queue.c */
|
/* queue.c */
|
||||||
PKGCONF_API void pkgconf_queue_push(pkgconf_list_t *list, const char *package);
|
PKGCONF_API void pkgconf_queue_push(pkgconf_list_t *list, const char *package);
|
||||||
PKGCONF_API bool pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list);
|
PKGCONF_API bool pkgconf_queue_compile(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list);
|
||||||
PKGCONF_API bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth);
|
|
||||||
PKGCONF_API void pkgconf_queue_free(pkgconf_list_t *list);
|
PKGCONF_API void pkgconf_queue_free(pkgconf_list_t *list);
|
||||||
PKGCONF_API bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data);
|
PKGCONF_API bool pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data);
|
||||||
PKGCONF_API bool pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth);
|
PKGCONF_API bool pkgconf_queue_validate(pkgconf_client_t *client, pkgconf_list_t *list, int maxdepth);
|
||||||
PKGCONF_API void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world);
|
|
||||||
|
|
||||||
/* cache.c */
|
/* cache.c */
|
||||||
PKGCONF_API pkgconf_pkg_t *pkgconf_cache_lookup(pkgconf_client_t *client, const char *id);
|
PKGCONF_API pkgconf_pkg_t *pkgconf_cache_lookup(pkgconf_client_t *client, const char *id);
|
||||||
|
|
|
@ -44,23 +44,14 @@ pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_operand_func_t *o
|
||||||
lineno++;
|
lineno++;
|
||||||
|
|
||||||
p = readbuf;
|
p = readbuf;
|
||||||
while (*p && isspace((unsigned char)*p))
|
while (*p && (isalpha((unsigned int)*p) || isdigit((unsigned int)*p) || *p == '_' || *p == '.'))
|
||||||
p++;
|
|
||||||
if (*p && p != readbuf)
|
|
||||||
{
|
|
||||||
warnfunc(data, "%s:" SIZE_FMT_SPECIFIER ": warning: whitespace encountered while parsing key section\n",
|
|
||||||
filename, lineno);
|
|
||||||
warned_key_whitespace = true;
|
|
||||||
}
|
|
||||||
key = p;
|
|
||||||
while (*p && (isalpha((unsigned char)*p) || isdigit((unsigned char)*p) || *p == '_' || *p == '.'))
|
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
if (!isalpha((unsigned char)*key) &&
|
key = readbuf;
|
||||||
!isdigit((unsigned char)*p))
|
if (!isalpha((unsigned int)*key) && !isdigit((unsigned int)*p))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
while (*p && isspace((unsigned char)*p))
|
while (*p && isspace((unsigned int)*p))
|
||||||
{
|
{
|
||||||
if (!warned_key_whitespace)
|
if (!warned_key_whitespace)
|
||||||
{
|
{
|
||||||
|
@ -81,12 +72,12 @@ pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_operand_func_t *o
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*p && isspace((unsigned char)*p))
|
while (*p && isspace((unsigned int)*p))
|
||||||
p++;
|
p++;
|
||||||
|
|
||||||
value = p;
|
value = p;
|
||||||
p = value + (strlen(value) - 1);
|
p = value + (strlen(value) - 1);
|
||||||
while (*p && isspace((unsigned char) *p) && p > value)
|
while (*p && isspace((unsigned int) *p) && p > value)
|
||||||
{
|
{
|
||||||
if (!warned_value_whitespace && op == '=')
|
if (!warned_value_whitespace && op == '=')
|
||||||
{
|
{
|
||||||
|
@ -98,6 +89,7 @@ pkgconf_parser_parse(FILE *f, void *data, const pkgconf_parser_operand_func_t *o
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
p--;
|
p--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ops[(unsigned char) op])
|
if (ops[(unsigned char) op])
|
||||||
ops[(unsigned char) op](data, lineno, key, value);
|
ops[(unsigned char) op](data, lineno, key, value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,13 +17,6 @@
|
||||||
#include <libpkgconf/stdinc.h>
|
#include <libpkgconf/stdinc.h>
|
||||||
#include <libpkgconf/libpkgconf.h>
|
#include <libpkgconf/libpkgconf.h>
|
||||||
|
|
||||||
/*
|
|
||||||
* !doc
|
|
||||||
*
|
|
||||||
* libpkgconf `personality` module
|
|
||||||
* =========================
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
# define strcasecmp _stricmp
|
# define strcasecmp _stricmp
|
||||||
#endif
|
#endif
|
||||||
|
@ -148,7 +141,7 @@ valid_triplet(const char *triplet)
|
||||||
const char *c = triplet;
|
const char *c = triplet;
|
||||||
|
|
||||||
for (; *c; c++)
|
for (; *c; c++)
|
||||||
if (!isalnum((unsigned char)*c) && *c != '-' && *c != '_')
|
if (!isalnum(*c) && *c != '-' && *c != '_')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -154,34 +154,19 @@ pkgconf_pkg_parser_internal_dependency_func(pkgconf_client_t *client, pkgconf_pk
|
||||||
pkgconf_dependency_parse(client, pkg, dest, value, PKGCONF_PKG_DEPF_INTERNAL);
|
pkgconf_dependency_parse(client, pkg, dest, value, PKGCONF_PKG_DEPF_INTERNAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* a variant of pkgconf_pkg_parser_dependency_func which colors the dependency node as a "private" dependency. */
|
|
||||||
static void
|
|
||||||
pkgconf_pkg_parser_private_dependency_func(pkgconf_client_t *client, pkgconf_pkg_t *pkg, const char *keyword, const size_t lineno, const ptrdiff_t offset, const char *value)
|
|
||||||
{
|
|
||||||
(void) keyword;
|
|
||||||
(void) lineno;
|
|
||||||
|
|
||||||
pkgconf_list_t *dest = (pkgconf_list_t *)((char *) pkg + offset);
|
|
||||||
pkgconf_dependency_parse(client, pkg, dest, value, PKGCONF_PKG_DEPF_PRIVATE);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* keep this in alphabetical order */
|
/* keep this in alphabetical order */
|
||||||
static const pkgconf_pkg_parser_keyword_pair_t pkgconf_pkg_parser_keyword_funcs[] = {
|
static const pkgconf_pkg_parser_keyword_pair_t pkgconf_pkg_parser_keyword_funcs[] = {
|
||||||
{"CFLAGS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags)},
|
{"CFLAGS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags)},
|
||||||
{"CFLAGS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags_private)},
|
{"CFLAGS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, cflags_private)},
|
||||||
{"Conflicts", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, conflicts)},
|
{"Conflicts", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, conflicts)},
|
||||||
{"Copyright", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, copyright)},
|
|
||||||
{"Description", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, description)},
|
{"Description", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, description)},
|
||||||
{"LIBS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs)},
|
{"LIBS", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs)},
|
||||||
{"LIBS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs_private)},
|
{"LIBS.private", pkgconf_pkg_parser_fragment_func, offsetof(pkgconf_pkg_t, libs_private)},
|
||||||
{"License", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, license)},
|
|
||||||
{"Maintainer", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, maintainer)},
|
|
||||||
{"Name", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, realname)},
|
{"Name", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, realname)},
|
||||||
{"Provides", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, provides)},
|
{"Provides", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, provides)},
|
||||||
{"Requires", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, required)},
|
{"Requires", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, required)},
|
||||||
{"Requires.internal", pkgconf_pkg_parser_internal_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
{"Requires.internal", pkgconf_pkg_parser_internal_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
||||||
{"Requires.private", pkgconf_pkg_parser_private_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
{"Requires.private", pkgconf_pkg_parser_dependency_func, offsetof(pkgconf_pkg_t, requires_private)},
|
||||||
{"URL", pkgconf_pkg_parser_tuple_func, offsetof(pkgconf_pkg_t, url)},
|
|
||||||
{"Version", pkgconf_pkg_parser_version_func, offsetof(pkgconf_pkg_t, version)},
|
{"Version", pkgconf_pkg_parser_version_func, offsetof(pkgconf_pkg_t, version)},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -466,8 +451,7 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
pkgconf_dependency_t *dep = pkgconf_dependency_add(client, &pkg->provides, pkg->id, pkg->version, PKGCONF_CMP_EQUAL, 0);
|
pkgconf_dependency_add(client, &pkg->provides, pkg->id, pkg->version, PKGCONF_CMP_EQUAL, 0);
|
||||||
pkgconf_dependency_unref(dep->owner, dep);
|
|
||||||
|
|
||||||
return pkgconf_pkg_ref(client, pkg);
|
return pkgconf_pkg_ref(client, pkg);
|
||||||
}
|
}
|
||||||
|
@ -530,15 +514,6 @@ pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
if (pkg->pc_filedir != NULL)
|
if (pkg->pc_filedir != NULL)
|
||||||
free(pkg->pc_filedir);
|
free(pkg->pc_filedir);
|
||||||
|
|
||||||
if (pkg->license != NULL)
|
|
||||||
free(pkg->license);
|
|
||||||
|
|
||||||
if (pkg->maintainer != NULL)
|
|
||||||
free(pkg->maintainer);
|
|
||||||
|
|
||||||
if (pkg->copyright != NULL)
|
|
||||||
free(pkg->copyright);
|
|
||||||
|
|
||||||
free(pkg);
|
free(pkg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,7 +536,7 @@ pkgconf_pkg_ref(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
PKGCONF_TRACE(client, "WTF: client %p refers to package %p owned by other client %p", client, pkg, pkg->owner);
|
PKGCONF_TRACE(client, "WTF: client %p refers to package %p owned by other client %p", client, pkg, pkg->owner);
|
||||||
|
|
||||||
pkg->refcount++;
|
pkg->refcount++;
|
||||||
PKGCONF_TRACE(client, "%s refcount@%p: %d", pkg->id, pkg, pkg->refcount);
|
PKGCONF_TRACE(client, "refcount@%p: %d", pkg, pkg->refcount);
|
||||||
|
|
||||||
return pkg;
|
return pkg;
|
||||||
}
|
}
|
||||||
|
@ -584,7 +559,7 @@ pkgconf_pkg_unref(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
|
||||||
PKGCONF_TRACE(client, "WTF: client %p unrefs package %p owned by other client %p", client, pkg, pkg->owner);
|
PKGCONF_TRACE(client, "WTF: client %p unrefs package %p owned by other client %p", client, pkg, pkg->owner);
|
||||||
|
|
||||||
pkg->refcount--;
|
pkg->refcount--;
|
||||||
PKGCONF_TRACE(pkg->owner, "%s refcount@%p: %d", pkg->id, pkg, pkg->refcount);
|
PKGCONF_TRACE(pkg->owner, "refcount@%p: %d", pkg, pkg->refcount);
|
||||||
|
|
||||||
if (pkg->refcount <= 0)
|
if (pkg->refcount <= 0)
|
||||||
pkgconf_pkg_free(pkg->owner, pkg);
|
pkgconf_pkg_free(pkg->owner, pkg);
|
||||||
|
@ -826,7 +801,7 @@ out:
|
||||||
*
|
*
|
||||||
* :param char* a: The first version to compare in the pair.
|
* :param char* a: The first version to compare in the pair.
|
||||||
* :param char* b: The second version to compare in the pair.
|
* :param char* b: The second version to compare in the pair.
|
||||||
* :return: -1 if the first version is less than, 0 if both versions are equal, 1 if the second version is less than.
|
* :return: -1 if the first version is greater, 0 if both versions are equal, 1 if the second version is greater.
|
||||||
* :rtype: int
|
* :rtype: int
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
|
@ -841,10 +816,10 @@ pkgconf_compare_version(const char *a, const char *b)
|
||||||
|
|
||||||
/* optimization: if version matches then it's the same version. */
|
/* optimization: if version matches then it's the same version. */
|
||||||
if (a == NULL)
|
if (a == NULL)
|
||||||
return -1;
|
return 1;
|
||||||
|
|
||||||
if (b == NULL)
|
if (b == NULL)
|
||||||
return 1;
|
return -1;
|
||||||
|
|
||||||
if (!strcasecmp(a, b))
|
if (!strcasecmp(a, b))
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -852,22 +827,22 @@ pkgconf_compare_version(const char *a, const char *b)
|
||||||
pkgconf_strlcpy(buf1, a, sizeof buf1);
|
pkgconf_strlcpy(buf1, a, sizeof buf1);
|
||||||
pkgconf_strlcpy(buf2, b, sizeof buf2);
|
pkgconf_strlcpy(buf2, b, sizeof buf2);
|
||||||
|
|
||||||
one = buf1;
|
one = str1 = buf1;
|
||||||
two = buf2;
|
two = str2 = buf2;
|
||||||
|
|
||||||
while (*one || *two)
|
while (*one || *two)
|
||||||
{
|
{
|
||||||
while (*one && !isalnum((unsigned char)*one) && *one != '~')
|
while (*one && !isalnum((unsigned int)*one) && *one != '~')
|
||||||
one++;
|
one++;
|
||||||
while (*two && !isalnum((unsigned char)*two) && *two != '~')
|
while (*two && !isalnum((unsigned int)*two) && *two != '~')
|
||||||
two++;
|
two++;
|
||||||
|
|
||||||
if (*one == '~' || *two == '~')
|
if (*one == '~' || *two == '~')
|
||||||
{
|
{
|
||||||
if (*one != '~')
|
if (*one != '~')
|
||||||
return 1;
|
|
||||||
if (*two != '~')
|
|
||||||
return -1;
|
return -1;
|
||||||
|
if (*two != '~')
|
||||||
|
return 1;
|
||||||
|
|
||||||
one++;
|
one++;
|
||||||
two++;
|
two++;
|
||||||
|
@ -880,22 +855,22 @@ pkgconf_compare_version(const char *a, const char *b)
|
||||||
str1 = one;
|
str1 = one;
|
||||||
str2 = two;
|
str2 = two;
|
||||||
|
|
||||||
if (isdigit((unsigned char)*str1))
|
if (isdigit((unsigned int)*str1))
|
||||||
{
|
{
|
||||||
while (*str1 && isdigit((unsigned char)*str1))
|
while (*str1 && isdigit((unsigned int)*str1))
|
||||||
str1++;
|
str1++;
|
||||||
|
|
||||||
while (*str2 && isdigit((unsigned char)*str2))
|
while (*str2 && isdigit((unsigned int)*str2))
|
||||||
str2++;
|
str2++;
|
||||||
|
|
||||||
isnum = true;
|
isnum = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
while (*str1 && isalpha((unsigned char)*str1))
|
while (*str1 && isalpha((unsigned int)*str1))
|
||||||
str1++;
|
str1++;
|
||||||
|
|
||||||
while (*str2 && isalpha((unsigned char)*str2))
|
while (*str2 && isalpha((unsigned int)*str2))
|
||||||
str2++;
|
str2++;
|
||||||
|
|
||||||
isnum = false;
|
isnum = false;
|
||||||
|
@ -988,7 +963,6 @@ static pkgconf_pkg_t pkgconf_virtual = {
|
||||||
.description = "virtual package defining pkgconf API version supported",
|
.description = "virtual package defining pkgconf API version supported",
|
||||||
.url = PACKAGE_BUGREPORT,
|
.url = PACKAGE_BUGREPORT,
|
||||||
.version = PACKAGE_VERSION,
|
.version = PACKAGE_VERSION,
|
||||||
.license = "ISC",
|
|
||||||
.flags = PKGCONF_PKG_PROPF_STATIC,
|
.flags = PKGCONF_PKG_PROPF_STATIC,
|
||||||
.vars = {
|
.vars = {
|
||||||
.head = &(pkgconf_node_t){
|
.head = &(pkgconf_node_t){
|
||||||
|
@ -1470,9 +1444,9 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
|
||||||
unsigned int skip_flags)
|
unsigned int skip_flags)
|
||||||
{
|
{
|
||||||
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
|
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
|
||||||
pkgconf_node_t *node, *next;
|
pkgconf_node_t *node;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY_SAFE(deplist->head, next, node)
|
PKGCONF_FOREACH_LIST_ENTRY(deplist->head, node)
|
||||||
{
|
{
|
||||||
unsigned int eflags_local = PKGCONF_PKG_ERRF_OK;
|
unsigned int eflags_local = PKGCONF_PKG_ERRF_OK;
|
||||||
pkgconf_dependency_t *depnode = node->data;
|
pkgconf_dependency_t *depnode = node->data;
|
||||||
|
@ -1492,41 +1466,24 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
|
||||||
if (pkgdep == NULL)
|
if (pkgdep == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pkgdep->serial == client->serial && !(parent->flags & PKGCONF_PKG_PROPF_VIRTUAL))
|
if (pkgdep->serial == client->serial)
|
||||||
{
|
{
|
||||||
pkgdep->hits++;
|
pkgdep->hits++;
|
||||||
|
pkgconf_pkg_unref(client, pkgdep);
|
||||||
/* In this case we have a circular reference.
|
continue;
|
||||||
* We break that by deleteing the circular node from the
|
|
||||||
* the list, so that we dont create a situation where
|
|
||||||
* memory is leaked due to circular ownership.
|
|
||||||
* i.e: A owns B owns A
|
|
||||||
*
|
|
||||||
* TODO(ariadne): Breaking circular references between Requires and Requires.private
|
|
||||||
* lists causes problems. Find a way to refactor the Requires.private list out.
|
|
||||||
*/
|
|
||||||
if (!(depnode->flags & PKGCONF_PKG_DEPF_PRIVATE) &&
|
|
||||||
!(parent->flags & PKGCONF_PKG_PROPF_VIRTUAL))
|
|
||||||
{
|
|
||||||
pkgconf_warn(client, "%s: breaking circular reference (%s -> %s -> %s)\n",
|
|
||||||
parent->id, parent->id, pkgdep->id, parent->id);
|
|
||||||
|
|
||||||
pkgconf_node_delete(node, deplist);
|
|
||||||
pkgconf_dependency_unref(client, depnode);
|
|
||||||
}
|
|
||||||
|
|
||||||
goto next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skip_flags && (depnode->flags & skip_flags) == skip_flags)
|
if (skip_flags && (depnode->flags & skip_flags) == skip_flags)
|
||||||
goto next;
|
{
|
||||||
|
pkgconf_pkg_unref(client, pkgdep);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
pkgconf_audit_log_dependency(client, pkgdep, depnode);
|
pkgconf_audit_log_dependency(client, pkgdep, depnode);
|
||||||
|
|
||||||
pkgdep->hits++;
|
pkgdep->hits++;
|
||||||
pkgdep->serial = client->serial;
|
pkgdep->serial = client->serial;
|
||||||
eflags |= pkgconf_pkg_traverse_main(client, pkgdep, func, data, depth - 1, skip_flags);
|
eflags |= pkgconf_pkg_traverse_main(client, pkgdep, func, data, depth - 1, skip_flags);
|
||||||
next:
|
|
||||||
pkgconf_pkg_unref(client, pkgdep);
|
pkgconf_pkg_unref(client, pkgdep);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1653,7 +1610,6 @@ pkgconf_pkg_traverse(pkgconf_client_t *client,
|
||||||
int maxdepth,
|
int maxdepth,
|
||||||
unsigned int skip_flags)
|
unsigned int skip_flags)
|
||||||
{
|
{
|
||||||
if (root->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
|
||||||
client->serial++;
|
client->serial++;
|
||||||
|
|
||||||
return pkgconf_pkg_traverse_main(client, root, func, data, maxdepth, skip_flags);
|
return pkgconf_pkg_traverse_main(client, root, func, data, maxdepth, skip_flags);
|
||||||
|
|
|
@ -125,8 +125,6 @@ pkgconf_queue_collect_dependents(pkgconf_client_t *client, pkgconf_pkg_t *pkg, v
|
||||||
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required);
|
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
|
|
||||||
{
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
|
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *flattened_dep;
|
pkgconf_dependency_t *flattened_dep;
|
||||||
|
@ -136,7 +134,6 @@ pkgconf_queue_collect_dependents(pkgconf_client_t *client, pkgconf_pkg_t *pkg, v
|
||||||
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private);
|
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dep_sort_cmp(const void *a, const void *b)
|
dep_sort_cmp(const void *a, const void *b)
|
||||||
|
@ -150,11 +147,11 @@ dep_sort_cmp(const void *a, const void *b)
|
||||||
static inline void
|
static inline void
|
||||||
flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
|
flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *node, *next;
|
pkgconf_node_t *node;
|
||||||
pkgconf_dependency_t **deps = NULL;
|
pkgconf_dependency_t **deps = NULL;
|
||||||
size_t dep_count = 0, i;
|
size_t dep_count = 0, i;
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
|
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep = node->data;
|
pkgconf_dependency_t *dep = node->data;
|
||||||
pkgconf_pkg_t *pkg = pkgconf_pkg_verify_dependency(client, dep, NULL);
|
pkgconf_pkg_t *pkg = pkgconf_pkg_verify_dependency(client, dep, NULL);
|
||||||
|
@ -163,11 +160,7 @@ flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pkg->serial == client->serial)
|
if (pkg->serial == client->serial)
|
||||||
{
|
continue;
|
||||||
pkgconf_node_delete(node, list);
|
|
||||||
pkgconf_dependency_unref(client, dep);
|
|
||||||
goto next;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (dep->match == NULL)
|
if (dep->match == NULL)
|
||||||
{
|
{
|
||||||
|
@ -184,7 +177,7 @@ flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
|
||||||
|
|
||||||
if (!strcmp(dep->package, other_dep->package))
|
if (!strcmp(dep->package, other_dep->package))
|
||||||
{
|
{
|
||||||
PKGCONF_TRACE(client, "skipping, "SIZE_FMT_SPECIFIER" deps", dep_count);
|
PKGCONF_TRACE(client, "skipping, %zu deps", dep_count);
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,12 +190,9 @@ flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
|
||||||
deps[dep_count - 1] = dep;
|
deps[dep_count - 1] = dep;
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "added %s to dep table", dep->package);
|
PKGCONF_TRACE(client, "added %s to dep table", dep->package);
|
||||||
next:
|
|
||||||
pkgconf_pkg_unref(client, pkg);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (deps == NULL)
|
next:;
|
||||||
return;
|
}
|
||||||
|
|
||||||
qsort(deps, dep_count, sizeof (void *), dep_sort_cmp);
|
qsort(deps, dep_count, sizeof (void *), dep_sort_cmp);
|
||||||
|
|
||||||
|
@ -213,13 +203,10 @@ next:
|
||||||
{
|
{
|
||||||
pkgconf_dependency_t *dep = deps[i];
|
pkgconf_dependency_t *dep = deps[i];
|
||||||
|
|
||||||
if (dep->match == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
memset(&dep->iter, '\0', sizeof (dep->iter));
|
memset(&dep->iter, '\0', sizeof (dep->iter));
|
||||||
pkgconf_node_insert(&dep->iter, dep, list);
|
pkgconf_node_insert(&dep->iter, dep, list);
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "slot "SIZE_FMT_SPECIFIER": dep %s matched to %p<%s> hits "SIZE_FMT_SPECIFIER, i, dep->package, dep->match, dep->match->id, dep->match->hits);
|
PKGCONF_TRACE(client, "slot %zu: dep %s matched to %p<%s> hits %lu", i, dep->package, dep->match, dep->match == NULL ? "NULL" : dep->match->id, dep->match->hits);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(deps);
|
free(deps);
|
||||||
|
@ -255,53 +242,6 @@ pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_lis
|
||||||
return PKGCONF_PKG_ERRF_OK;
|
return PKGCONF_PKG_ERRF_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* !doc
|
|
||||||
*
|
|
||||||
* .. c:function:: void pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world, int maxdepth)
|
|
||||||
*
|
|
||||||
* Removes references to package nodes contained in a solution.
|
|
||||||
*
|
|
||||||
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
|
||||||
* :param pkgconf_pkg_t* world: The root for the generated dependency graph. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
|
||||||
* :returns: nothing
|
|
||||||
*/
|
|
||||||
void
|
|
||||||
pkgconf_solution_free(pkgconf_client_t *client, pkgconf_pkg_t *world)
|
|
||||||
{
|
|
||||||
(void) client;
|
|
||||||
|
|
||||||
if (world->flags & PKGCONF_PKG_PROPF_VIRTUAL)
|
|
||||||
{
|
|
||||||
pkgconf_dependency_free(&world->required);
|
|
||||||
pkgconf_dependency_free(&world->requires_private);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* !doc
|
|
||||||
*
|
|
||||||
* .. c:function:: bool pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth)
|
|
||||||
*
|
|
||||||
* Solves and flattens the dependency graph for the supplied dependency list.
|
|
||||||
*
|
|
||||||
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
|
||||||
* :param pkgconf_list_t* list: The list of dependency requests to consider.
|
|
||||||
* :param pkgconf_pkg_t* world: The root for the generated dependency graph, provided by the caller. Should have PKGCONF_PKG_PROPF_VIRTUAL flag.
|
|
||||||
* :param int maxdepth: The maximum allowed depth for the dependency resolver. A depth of -1 means unlimited.
|
|
||||||
* :returns: true if the dependency resolver found a solution, otherwise false.
|
|
||||||
* :rtype: bool
|
|
||||||
*/
|
|
||||||
bool
|
|
||||||
pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_t *world, int maxdepth)
|
|
||||||
{
|
|
||||||
/* if maxdepth is one, then we will not traverse deeper than our virtual package. */
|
|
||||||
if (!maxdepth)
|
|
||||||
maxdepth = -1;
|
|
||||||
|
|
||||||
return pkgconf_queue_verify(client, world, list, maxdepth) == PKGCONF_PKG_ERRF_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -310,8 +250,6 @@ pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_
|
||||||
* Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
* Attempt to compile a dependency resolution queue into a dependency resolution problem, then attempt to solve the problem and
|
||||||
* feed the solution to a callback function if a complete dependency graph is found.
|
* feed the solution to a callback function if a complete dependency graph is found.
|
||||||
*
|
*
|
||||||
* This function should not be used in new code. Use pkgconf_queue_solve instead.
|
|
||||||
*
|
|
||||||
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
* :param pkgconf_client_t* client: The pkgconf client object to use for dependency resolution.
|
||||||
* :param pkgconf_list_t* list: The list of dependency requests to consider.
|
* :param pkgconf_list_t* list: The list of dependency requests to consider.
|
||||||
* :param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
* :param pkgconf_queue_apply_func_t func: The callback function to call if a solution is found by the dependency resolver.
|
||||||
|
@ -323,7 +261,6 @@ pkgconf_queue_solve(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_pkg_
|
||||||
bool
|
bool
|
||||||
pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queue_apply_func_t func, int maxdepth, void *data)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
|
||||||
pkgconf_pkg_t world = {
|
pkgconf_pkg_t world = {
|
||||||
.id = "virtual:world",
|
.id = "virtual:world",
|
||||||
.realname = "virtual world package",
|
.realname = "virtual world package",
|
||||||
|
@ -334,18 +271,19 @@ pkgconf_queue_apply(pkgconf_client_t *client, pkgconf_list_t *list, pkgconf_queu
|
||||||
if (!maxdepth)
|
if (!maxdepth)
|
||||||
maxdepth = -1;
|
maxdepth = -1;
|
||||||
|
|
||||||
if (!pkgconf_queue_solve(client, list, &world, maxdepth))
|
if (pkgconf_queue_verify(client, &world, list, maxdepth) != PKGCONF_PKG_ERRF_OK)
|
||||||
goto cleanup;
|
return false;
|
||||||
|
|
||||||
/* the world dependency set is flattened after it is returned from pkgconf_queue_verify */
|
/* the world dependency set is flattened after it is returned from pkgconf_queue_verify */
|
||||||
if (!func(client, &world, data, maxdepth))
|
if (!func(client, &world, data, maxdepth))
|
||||||
goto cleanup;
|
{
|
||||||
|
|
||||||
ret = true;
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
pkgconf_pkg_free(client, &world);
|
pkgconf_pkg_free(client, &world);
|
||||||
return ret;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pkgconf_pkg_free(client, &world);
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -48,22 +48,6 @@ pkgconf_tuple_add_global(pkgconf_client_t *client, const char *key, const char *
|
||||||
pkgconf_tuple_add(client, &client->global_vars, key, value, false, 0);
|
pkgconf_tuple_add(client, &client->global_vars, key, value, false, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static pkgconf_tuple_t *
|
|
||||||
lookup_global_tuple(const pkgconf_client_t *client, const char *key)
|
|
||||||
{
|
|
||||||
pkgconf_node_t *node;
|
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(client->global_vars.head, node)
|
|
||||||
{
|
|
||||||
pkgconf_tuple_t *tuple = node->data;
|
|
||||||
|
|
||||||
if (!strcmp(tuple->key, key))
|
|
||||||
return tuple;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -79,15 +63,19 @@ lookup_global_tuple(const pkgconf_client_t *client, const char *key)
|
||||||
char *
|
char *
|
||||||
pkgconf_tuple_find_global(const pkgconf_client_t *client, const char *key)
|
pkgconf_tuple_find_global(const pkgconf_client_t *client, const char *key)
|
||||||
{
|
{
|
||||||
pkgconf_tuple_t *tuple;
|
pkgconf_node_t *node;
|
||||||
|
|
||||||
tuple = lookup_global_tuple(client, key);
|
PKGCONF_FOREACH_LIST_ENTRY(client->global_vars.head, node)
|
||||||
if (tuple == NULL)
|
{
|
||||||
return NULL;
|
pkgconf_tuple_t *tuple = node->data;
|
||||||
|
|
||||||
|
if (!strcmp(tuple->key, key))
|
||||||
return tuple->value;
|
return tuple->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* !doc
|
* !doc
|
||||||
*
|
*
|
||||||
|
@ -120,18 +108,13 @@ pkgconf_tuple_define_global(pkgconf_client_t *client, const char *kv)
|
||||||
{
|
{
|
||||||
char *workbuf = strdup(kv);
|
char *workbuf = strdup(kv);
|
||||||
char *value;
|
char *value;
|
||||||
pkgconf_tuple_t *tuple;
|
|
||||||
|
|
||||||
value = strchr(workbuf, '=');
|
value = strchr(workbuf, '=');
|
||||||
if (value == NULL)
|
if (value == NULL)
|
||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
*value++ = '\0';
|
*value++ = '\0';
|
||||||
|
pkgconf_tuple_add_global(client, workbuf, value);
|
||||||
tuple = pkgconf_tuple_add(client, &client->global_vars, workbuf, value, false, 0);
|
|
||||||
if (tuple != NULL)
|
|
||||||
tuple->flags = PKGCONF_PKG_TUPLEF_OVERRIDE;
|
|
||||||
|
|
||||||
out:
|
out:
|
||||||
free(workbuf);
|
free(workbuf);
|
||||||
}
|
}
|
||||||
|
@ -274,11 +257,6 @@ char *
|
||||||
pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key)
|
pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key)
|
||||||
{
|
{
|
||||||
pkgconf_node_t *node;
|
pkgconf_node_t *node;
|
||||||
pkgconf_tuple_t *global_tuple;
|
|
||||||
|
|
||||||
global_tuple = lookup_global_tuple(client, key);
|
|
||||||
if (global_tuple != NULL && global_tuple->flags & PKGCONF_PKG_TUPLEF_OVERRIDE)
|
|
||||||
return global_tuple->value;
|
|
||||||
|
|
||||||
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
|
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
|
||||||
{
|
{
|
||||||
|
@ -288,10 +266,7 @@ pkgconf_tuple_find(const pkgconf_client_t *client, pkgconf_list_t *list, const c
|
||||||
return tuple->value;
|
return tuple->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (global_tuple != NULL)
|
return pkgconf_tuple_find_global(client, key);
|
||||||
return global_tuple->value;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -357,21 +332,12 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||||
|
|
||||||
PKGCONF_TRACE(client, "lookup tuple %s", varname);
|
PKGCONF_TRACE(client, "lookup tuple %s", varname);
|
||||||
|
|
||||||
size_t remain = PKGCONF_BUFSIZE - (bptr - buf);
|
|
||||||
ptr += (pptr - ptr);
|
ptr += (pptr - ptr);
|
||||||
kv = pkgconf_tuple_find_global(client, varname);
|
kv = pkgconf_tuple_find_global(client, varname);
|
||||||
if (kv != NULL)
|
if (kv != NULL)
|
||||||
{
|
{
|
||||||
size_t nlen = pkgconf_strlcpy(bptr, kv, remain);
|
strncpy(bptr, kv, PKGCONF_BUFSIZE - (bptr - buf));
|
||||||
if (nlen > remain)
|
bptr += strlen(kv);
|
||||||
{
|
|
||||||
pkgconf_warn(client, "warning: truncating very long variable to 64KB\n");
|
|
||||||
|
|
||||||
bptr = buf + (PKGCONF_BUFSIZE - 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bptr += nlen;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -379,21 +345,12 @@ pkgconf_tuple_parse(const pkgconf_client_t *client, pkgconf_list_t *vars, const
|
||||||
|
|
||||||
if (kv != NULL)
|
if (kv != NULL)
|
||||||
{
|
{
|
||||||
size_t nlen;
|
|
||||||
|
|
||||||
parsekv = pkgconf_tuple_parse(client, vars, kv, flags);
|
parsekv = pkgconf_tuple_parse(client, vars, kv, flags);
|
||||||
nlen = pkgconf_strlcpy(bptr, parsekv, remain);
|
|
||||||
|
strncpy(bptr, parsekv, PKGCONF_BUFSIZE - (bptr - buf));
|
||||||
|
bptr += strlen(parsekv);
|
||||||
|
|
||||||
free(parsekv);
|
free(parsekv);
|
||||||
|
|
||||||
if (nlen > remain)
|
|
||||||
{
|
|
||||||
pkgconf_warn(client, "warning: truncating very long variable to 64KB\n");
|
|
||||||
|
|
||||||
bptr = buf + (PKGCONF_BUFSIZE - 1);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
bptr += nlen;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -912,7 +912,7 @@ static int strverscmp(const char *a, const char *b)
|
||||||
|
|
||||||
/* Count backwards and find the leftmost digit */
|
/* Count backwards and find the leftmost digit */
|
||||||
j = i;
|
j = i;
|
||||||
while (j > 0 && isdigit((unsigned char)a[j-1])) {
|
while (j > 0 && isdigit(a[j-1])) {
|
||||||
--j;
|
--j;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -924,24 +924,23 @@ static int strverscmp(const char *a, const char *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* String with more digits is smaller, e.g 002 < 01 */
|
/* String with more digits is smaller, e.g 002 < 01 */
|
||||||
if (isdigit((unsigned char)a[j])) {
|
if (isdigit(a[j])) {
|
||||||
if (!isdigit((unsigned char)b[j])) {
|
if (!isdigit(b[j])) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
} else if ((unsigned char)isdigit(b[j])) {
|
} else if (isdigit(b[j])) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} else if ((unsigned char)isdigit(a[j]) &&
|
} else if (isdigit(a[j]) && isdigit(b[j])) {
|
||||||
isdigit((unsigned char)b[j])) {
|
|
||||||
/* Numeric comparison */
|
/* Numeric comparison */
|
||||||
size_t k1 = j;
|
size_t k1 = j;
|
||||||
size_t k2 = j;
|
size_t k2 = j;
|
||||||
|
|
||||||
/* Compute number of digits in each string */
|
/* Compute number of digits in each string */
|
||||||
while (isdigit((unsigned char)a[k1])) {
|
while (isdigit(a[k1])) {
|
||||||
k1++;
|
k1++;
|
||||||
}
|
}
|
||||||
while (isdigit((unsigned char)b[k2])) {
|
while (isdigit(b[k2])) {
|
||||||
k2++;
|
k2++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
13
man/pc.5
13
man/pc.5
|
@ -99,9 +99,6 @@ These flags are always used, regardless of whether static compilation is request
|
||||||
.It Cflags.private
|
.It Cflags.private
|
||||||
Required compiler flags for static compilation.
|
Required compiler flags for static compilation.
|
||||||
(optional; fragment list; pkgconf extension)
|
(optional; fragment list; pkgconf extension)
|
||||||
.It Copyright
|
|
||||||
A copyright attestation statement.
|
|
||||||
(optional; literal; pkgconf extension)
|
|
||||||
.It Libs
|
.It Libs
|
||||||
Required linking flags for this package.
|
Required linking flags for this package.
|
||||||
Libraries this package depends on for linking against it, which are not
|
Libraries this package depends on for linking against it, which are not
|
||||||
|
@ -113,13 +110,6 @@ statically.
|
||||||
Libraries this package depends on for linking against it statically, which are
|
Libraries this package depends on for linking against it statically, which are
|
||||||
not described as dependencies should be specified here.
|
not described as dependencies should be specified here.
|
||||||
(optional; fragment list)
|
(optional; fragment list)
|
||||||
.It License
|
|
||||||
The asserted SPDX license tag that should be applied to the given package.
|
|
||||||
(optional; literal; pkgconf extension)
|
|
||||||
.It Maintainer
|
|
||||||
The preferred contact for the maintainer. This should be in the format of a
|
|
||||||
name followed by an e-mail address or website.
|
|
||||||
(optional; literal; pkgconf extension)
|
|
||||||
.It Requires
|
.It Requires
|
||||||
Required dependencies that must be met for the package to be usable.
|
Required dependencies that must be met for the package to be usable.
|
||||||
All dependencies must be satisfied or the pkg-config implementation must not use
|
All dependencies must be satisfied or the pkg-config implementation must not use
|
||||||
|
@ -161,9 +151,6 @@ includedir=${prefix}/include
|
||||||
|
|
||||||
Name: libfoo # human-readable name
|
Name: libfoo # human-readable name
|
||||||
Description: an example library called libfoo # human-readable description
|
Description: an example library called libfoo # human-readable description
|
||||||
Copyright: Copyright (c) 2022 pkgconf project authors
|
|
||||||
License: Apache-2.0
|
|
||||||
Maintainer: the pkgconf project <http://www.pkgconf.org>
|
|
||||||
Version: 1.0
|
Version: 1.0
|
||||||
URL: http://www.pkgconf.org
|
URL: http://www.pkgconf.org
|
||||||
Requires: libbar > 2.0.0
|
Requires: libbar > 2.0.0
|
||||||
|
|
|
@ -36,7 +36,7 @@ Properties are set using RFC822-style stanzas which consist of a keyword, follow
|
||||||
by a colon (:) and then the value the property should be set to.
|
by a colon (:) and then the value the property should be set to.
|
||||||
Variable substitution is always performed regardless of property type.
|
Variable substitution is always performed regardless of property type.
|
||||||
.Pp
|
.Pp
|
||||||
There are three types of property:
|
There are two types of property:
|
||||||
.\"
|
.\"
|
||||||
.Bl -tag -width indent
|
.Bl -tag -width indent
|
||||||
.\"
|
.\"
|
||||||
|
|
59
meson.build
59
meson.build
|
@ -1,41 +1,27 @@
|
||||||
project('pkgconf', 'c',
|
project('pkgconf', 'c',
|
||||||
version : '1.9.5',
|
version : '1.8.0',
|
||||||
license : 'ISC',
|
license : 'ISC',
|
||||||
meson_version : '>=0.49',
|
meson_version : '>=0.47')
|
||||||
default_options : ['c_std=c99'],
|
|
||||||
)
|
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
|
||||||
add_project_arguments(
|
|
||||||
'-D_BSD_SOURCE',
|
|
||||||
'-D_DEFAULT_SOURCE',
|
|
||||||
cc.get_supported_arguments(
|
|
||||||
'-Wimplicit-function-declaration',
|
|
||||||
'-Wmisleading-indentation',
|
|
||||||
),
|
|
||||||
language : 'c',
|
|
||||||
)
|
|
||||||
|
|
||||||
cdata = configuration_data()
|
cdata = configuration_data()
|
||||||
|
|
||||||
check_functions = [
|
check_functions = [
|
||||||
['strlcat', 'string.h'],
|
['HAVE_STRLCAT', 'strlcat', 'string.h'],
|
||||||
['strlcpy', 'string.h'],
|
['HAVE_STRLCPY', 'strlcpy', 'string.h'],
|
||||||
['strndup', 'string.h'],
|
['HAVE_STRNDUP', 'strndup', 'string.h'],
|
||||||
['strdup', 'string.h'],
|
['HAVE_STRDUP', 'strdup', 'string.h'],
|
||||||
['strncasecmp', 'strings.h'],
|
['HAVE_STRNCASECMP', 'strncasecmp', 'strings.h'],
|
||||||
['strcasecmp', 'strings.h'],
|
['HAVE_STRCASECMP', 'strcasecmp', 'strings.h'],
|
||||||
['reallocarray', 'stdlib.h'],
|
['HAVE_REALLOCARRAY', 'reallocarray', 'stdlib.h'],
|
||||||
]
|
]
|
||||||
|
|
||||||
foreach f : check_functions
|
foreach f : check_functions
|
||||||
name = f[0].to_upper().underscorify()
|
if cc.has_function(f.get(1), prefix : '#define _BSD_SOURCE\n#include <' + f.get(2) + '>') and cc.has_header_symbol(f.get(2), f.get(1), prefix : '#define _BSD_SOURCE')
|
||||||
if cc.has_function(f[0], prefix : '#define _BSD_SOURCE\n#include <@0@>'.format(f[1])) and cc.has_header_symbol(f[1], f[0], prefix : '#define _BSD_SOURCE')
|
cdata.set(f.get(0), 1)
|
||||||
cdata.set('HAVE_@0@'.format(name), 1)
|
|
||||||
cdata.set('HAVE_DECL_@0@'.format(name), 1)
|
|
||||||
else
|
|
||||||
cdata.set('HAVE_DECL_@0@'.format(name), 0)
|
|
||||||
endif
|
endif
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
|
@ -56,8 +42,8 @@ cdata.set_quoted('PERSONALITY_PATH', ':'.join(personality_path))
|
||||||
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
|
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
|
||||||
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
cdata.set_quoted('PACKAGE_VERSION', meson.project_version())
|
||||||
cdata.set_quoted('PACKAGE_BUGREPORT', 'https://todo.sr.ht/~kaniini/pkgconf')
|
cdata.set_quoted('PACKAGE_BUGREPORT', 'https://todo.sr.ht/~kaniini/pkgconf')
|
||||||
cdata.set('abs_top_srcdir', meson.current_source_dir())
|
cdata.set('abs_top_srcdir', meson.source_root())
|
||||||
cdata.set('abs_top_builddir', meson.current_build_dir())
|
cdata.set('abs_top_builddir', meson.build_root())
|
||||||
|
|
||||||
|
|
||||||
subdir('libpkgconf')
|
subdir('libpkgconf')
|
||||||
|
@ -86,8 +72,8 @@ libpkgconf = library('pkgconf',
|
||||||
'libpkgconf/tuple.c',
|
'libpkgconf/tuple.c',
|
||||||
c_args: ['-DLIBPKGCONF_EXPORT', build_static],
|
c_args: ['-DLIBPKGCONF_EXPORT', build_static],
|
||||||
install : true,
|
install : true,
|
||||||
version : '4.0.0',
|
version : '3.0.0',
|
||||||
soversion : '4',
|
soversion : '3',
|
||||||
)
|
)
|
||||||
|
|
||||||
# For other projects using libpkgconfig as a subproject
|
# For other projects using libpkgconfig as a subproject
|
||||||
|
@ -121,12 +107,15 @@ pkgconf_exe = executable('pkgconf',
|
||||||
c_args: build_static,
|
c_args: build_static,
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
with_tests = get_option('tests')
|
if get_option('tests')
|
||||||
kyua_exe = find_program('kyua', required : with_tests, disabler : true)
|
kyua_exe = find_program('kyua')
|
||||||
atf_sh_exe = find_program('atf-sh', required : with_tests, disabler : true)
|
atf_sh_exe = find_program('atf-sh')
|
||||||
kyuafile = configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata)
|
test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile=' + join_paths(meson.build_root(), 'Kyuafile'), '--build-root=' + meson.build_root()])
|
||||||
test('kyua', kyua_exe, args : ['--config=none', 'test', '--kyuafile', kyuafile, '--build-root', meson.current_build_dir()])
|
|
||||||
|
|
||||||
|
configure_file(input : 'Kyuafile.in', output : 'Kyuafile', configuration : cdata)
|
||||||
subdir('tests')
|
subdir('tests')
|
||||||
|
endif
|
||||||
|
|
||||||
install_man('man/pkgconf.1')
|
install_man('man/pkgconf.1')
|
||||||
install_man('man/pkg.m4.7')
|
install_man('man/pkg.m4.7')
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
option(
|
option('tests', type: 'boolean', value: true,
|
||||||
'tests',
|
description: 'Build tests which depends upon the kyua framework'
|
||||||
type: 'feature',
|
|
||||||
description: 'Build tests which depends upon the kyua framework',
|
|
||||||
)
|
)
|
12
pkg.m4
12
pkg.m4
|
@ -1,5 +1,5 @@
|
||||||
# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*-
|
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
|
||||||
# serial 12 (pkg-config-0.29.2)
|
# serial 11 (pkg-config-0.29.1)
|
||||||
|
|
||||||
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
dnl Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
|
||||||
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
dnl Copyright © 2012-2015 Dan Nicholson <dbn.lists@gmail.com>
|
||||||
|
@ -41,7 +41,7 @@ dnl
|
||||||
dnl See the "Since" comment for each macro you use to see what version
|
dnl See the "Since" comment for each macro you use to see what version
|
||||||
dnl of the macros you require.
|
dnl of the macros you require.
|
||||||
m4_defun([PKG_PREREQ],
|
m4_defun([PKG_PREREQ],
|
||||||
[m4_define([PKG_MACROS_VERSION], [0.29.2])
|
[m4_define([PKG_MACROS_VERSION], [0.29.1])
|
||||||
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1,
|
||||||
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
[m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])])
|
||||||
])dnl PKG_PREREQ
|
])dnl PKG_PREREQ
|
||||||
|
@ -86,7 +86,7 @@ dnl Check to see whether a particular set of modules exists. Similar to
|
||||||
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
dnl PKG_CHECK_MODULES(), but does not set variables or print errors.
|
||||||
dnl
|
dnl
|
||||||
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
|
||||||
dnl only at the first occurrence in configure.ac, so if the first place
|
dnl only at the first occurence in configure.ac, so if the first place
|
||||||
dnl it's called might be skipped (such as if it is within an "if", you
|
dnl it's called might be skipped (such as if it is within an "if", you
|
||||||
dnl have to call PKG_CHECK_EXISTS manually
|
dnl have to call PKG_CHECK_EXISTS manually
|
||||||
AC_DEFUN([PKG_CHECK_EXISTS],
|
AC_DEFUN([PKG_CHECK_EXISTS],
|
||||||
|
@ -142,10 +142,11 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl
|
||||||
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl
|
||||||
|
|
||||||
pkg_failed=no
|
pkg_failed=no
|
||||||
AC_MSG_CHECKING([for $2])
|
AC_MSG_CHECKING([for $1])
|
||||||
|
|
||||||
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
_PKG_CONFIG([$1][_CFLAGS], [cflags], [$2])
|
||||||
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
_PKG_CONFIG([$1][_LIBS], [libs], [$2])
|
||||||
|
_PKG_CONFIG([$1][_VERSION], [modversion], [$2])
|
||||||
|
|
||||||
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS
|
||||||
and $1[]_LIBS to avoid the need to call pkg-config.
|
and $1[]_LIBS to avoid the need to call pkg-config.
|
||||||
|
@ -186,6 +187,7 @@ To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
|
||||||
else
|
else
|
||||||
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
|
||||||
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
|
||||||
|
$1[]_VERSION=$pkg_cv_[]$1[]_VERSION
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
$3
|
$3
|
||||||
fi[]dnl
|
fi[]dnl
|
||||||
|
|
|
@ -29,9 +29,6 @@ tests_init \
|
||||||
libs_circular_directpc \
|
libs_circular_directpc \
|
||||||
libs_static \
|
libs_static \
|
||||||
libs_static_ordering \
|
libs_static_ordering \
|
||||||
license_isc \
|
|
||||||
license_noassertion \
|
|
||||||
modversion_noflatten \
|
|
||||||
pkg_config_path \
|
pkg_config_path \
|
||||||
nolibs \
|
nolibs \
|
||||||
nocflags \
|
nocflags \
|
||||||
|
@ -179,7 +176,7 @@ exists_version_bad3_body()
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-s exit:1 \
|
-s exit:1 \
|
||||||
pkgconf --exists 'tilde >= 1.0.0'
|
pkgconf --exists 'tilde <= 1.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
exists_body()
|
exists_body()
|
||||||
|
@ -193,7 +190,7 @@ exists2_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
pkgconf --exists 'tilde <= 1.0.0'
|
pkgconf --exists 'tilde >= 1.0.0'
|
||||||
}
|
}
|
||||||
|
|
||||||
exists3_body()
|
exists3_body()
|
||||||
|
@ -215,22 +212,22 @@ libs_circular2_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"circular-1: breaking circular reference (circular-1 -> circular-2 -> circular-1)\n" \
|
-o inline:"-lcircular-3 -lcircular-1 -lcircular-2 \n" \
|
||||||
pkgconf circular-2 --validate
|
pkgconf --libs circular-2
|
||||||
}
|
}
|
||||||
|
|
||||||
libs_circular1_body()
|
libs_circular1_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"circular-3: breaking circular reference (circular-3 -> circular-1 -> circular-3)\n" \
|
-o inline:"-lcircular-2 -lcircular-3 -lcircular-1 \n" \
|
||||||
pkgconf circular-1 --validate
|
pkgconf --libs circular-1
|
||||||
}
|
}
|
||||||
|
|
||||||
libs_circular_directpc_body()
|
libs_circular_directpc_body()
|
||||||
{
|
{
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lcircular-2 -lcircular-3 -lcircular-1\n" \
|
-o inline:"-lcircular-1 -lcircular-2 -lcircular-3 \n" \
|
||||||
pkgconf --libs ${selfdir}/lib1/circular-3.pc
|
pkgconf --libs ${selfdir}/lib1/circular-3.pc
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -310,24 +307,3 @@ single_depth_selectors_body()
|
||||||
-o inline:"foo\n" \
|
-o inline:"foo\n" \
|
||||||
pkgconf --with-path=${selfdir}/lib3 --print-requires bar
|
pkgconf --with-path=${selfdir}/lib3 --print-requires bar
|
||||||
}
|
}
|
||||||
|
|
||||||
license_isc_body()
|
|
||||||
{
|
|
||||||
atf_check \
|
|
||||||
-o inline:"foo: ISC\n" \
|
|
||||||
pkgconf --with-path=${selfdir}/lib1 --license foo
|
|
||||||
}
|
|
||||||
|
|
||||||
license_noassertion_body()
|
|
||||||
{
|
|
||||||
atf_check \
|
|
||||||
-o inline:"bar: NOASSERTION\nfoo: ISC\n" \
|
|
||||||
pkgconf --with-path=${selfdir}/lib1 --license bar
|
|
||||||
}
|
|
||||||
|
|
||||||
modversion_noflatten_body()
|
|
||||||
{
|
|
||||||
atf_check \
|
|
||||||
-o inline:"1.3\n" \
|
|
||||||
pkgconf --with-path=${selfdir}/lib1 --modversion bar
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
v9=lol
|
|
||||||
v8=${v9}${v9}${v9}${v9}${v9}${v9}${v9}${v9}${v9}${v9}
|
|
||||||
v7=${v8}${v8}${v8}${v8}${v8}${v8}${v8}${v8}${v8}${v8}
|
|
||||||
v6=${v7}${v7}${v7}${v7}${v7}${v7}${v7}${v7}${v7}${v7}
|
|
||||||
v5=${v6}${v6}${v6}${v6}${v6}${v6}${v6}${v6}${v6}${v6}
|
|
||||||
v4=${v5}${v5}${v5}${v5}${v5}${v5}${v5}${v5}${v5}${v5}
|
|
||||||
v3=${v4}${v4}${v4}${v4}${v4}${v4}${v4}${v4}${v4}${v4}
|
|
||||||
v2=${v3}${v3}${v3}${v3}${v3}${v3}${v3}${v3}${v3}${v3}
|
|
||||||
v1=${v2}${v2}${v2}${v2}${v2}${v2}${v2}${v2}${v2}${v2}
|
|
||||||
v0=${v1}${v1}${v1}${v1}${v1}${v1}${v1}${v1}${v1}${v1}
|
|
||||||
Name: One Billion Laughs
|
|
||||||
Version: ${v0}
|
|
||||||
Description: Don't install this!
|
|
|
@ -9,4 +9,3 @@ Version: 1.2.3
|
||||||
Libs: -L${libdir} -lfoo
|
Libs: -L${libdir} -lfoo
|
||||||
Cflags: -fPIC -I${includedir}/foo
|
Cflags: -fPIC -I${includedir}/foo
|
||||||
Cflags.private: -DFOO_STATIC
|
Cflags.private: -DFOO_STATIC
|
||||||
License: ISC
|
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
Name: metapackage-1
|
|
||||||
Version: 0.1
|
|
||||||
Description: metapackage for testing purposes
|
|
||||||
Requires.private: metapackage-2
|
|
||||||
Libs: -lmetapackage-1
|
|
||||||
Cflags: -I/metapackage-1
|
|
|
@ -1,5 +0,0 @@
|
||||||
Name: metapackage-2
|
|
||||||
Version: 0.1
|
|
||||||
Description: metapackage for testing purposes
|
|
||||||
Libs: -lmetapackage-2
|
|
||||||
Cflags: -I/metapackage-2
|
|
|
@ -1,4 +0,0 @@
|
||||||
Name: metapackage
|
|
||||||
Version: 0.1
|
|
||||||
Description: metapackage for testing purposes
|
|
||||||
Requires: metapackage-1, metapackage-2
|
|
|
@ -7,4 +7,4 @@ Name: quotes
|
||||||
Description: A testing pkg-config file
|
Description: A testing pkg-config file
|
||||||
Version: 1.2.3
|
Version: 1.2.3
|
||||||
Libs: -L${libdir} -lfoo
|
Libs: -L${libdir} -lfoo
|
||||||
Cflags: -DQUOTED=\"bla\" -DA=\"escaped\ string\'\ \literal\" -DB="\1\$" -DC='bla'
|
Cflags: -DQUOTED=\"bla\"
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
prefix=/test\ with\ spaces
|
|
||||||
includedir=${prefix}/include
|
|
||||||
|
|
||||||
Name: spaces-in-paths
|
|
||||||
Version: 1
|
|
||||||
Description: test package for properly expanding spaces in variables
|
|
||||||
Cflags: -I${includedir} -I${includedir}/subdir
|
|
|
@ -1,10 +0,0 @@
|
||||||
prefix=/tëst
|
|
||||||
exec_prefix=${prefix}
|
|
||||||
libdir=${prefix}/lib
|
|
||||||
includedir=${prefix}/include
|
|
||||||
|
|
||||||
Name: utf8
|
|
||||||
Description: Library installed in a prefix with UTF-8
|
|
||||||
Version: 0
|
|
||||||
Libs: -L${libdir} -lutf8
|
|
||||||
Cflags: -I${includedir}
|
|
|
@ -18,5 +18,6 @@ tests = [
|
||||||
|
|
||||||
# yuck
|
# yuck
|
||||||
foreach test : tests
|
foreach test : tests
|
||||||
test_file = configure_file(input: test + '.sh', output: test, copy: true)
|
configure_file(input: test + '.sh', output: test, copy: true)
|
||||||
|
run_command('chmod', '755', join_paths(meson.build_root(), 'tests', test))
|
||||||
endforeach
|
endforeach
|
||||||
|
|
|
@ -142,7 +142,7 @@ quoted_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-DQUOTED=\\\"bla\\\" -DA=\\\"escaped\\ string\\\'\\ literal\\\" -DB=\\\\\\1\$ -DC=bla\n" \
|
-o inline:"-DQUOTED=\\\"bla\\\" \n" \
|
||||||
pkgconf --cflags quotes
|
pkgconf --cflags quotes
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,6 @@ tests_init \
|
||||||
depgraph_break_2 \
|
depgraph_break_2 \
|
||||||
depgraph_break_3 \
|
depgraph_break_3 \
|
||||||
define_variable \
|
define_variable \
|
||||||
define_variable_override \
|
|
||||||
variable \
|
variable \
|
||||||
keep_system_libs \
|
keep_system_libs \
|
||||||
libs \
|
libs \
|
||||||
|
@ -29,10 +28,7 @@ tests_init \
|
||||||
malformed_1 \
|
malformed_1 \
|
||||||
malformed_quoting \
|
malformed_quoting \
|
||||||
explicit_sysroot \
|
explicit_sysroot \
|
||||||
empty_tuple \
|
empty_tuple
|
||||||
solver_requires_private_debounce \
|
|
||||||
billion_laughs \
|
|
||||||
maximum_package_depth_off_by_one
|
|
||||||
|
|
||||||
# sysroot_munge \
|
# sysroot_munge \
|
||||||
|
|
||||||
|
@ -75,13 +71,6 @@ define_variable_body()
|
||||||
pkgconf --variable=typelibdir --define-variable='libdir=\${libdir}' typelibdir
|
pkgconf --variable=typelibdir --define-variable='libdir=\${libdir}' typelibdir
|
||||||
}
|
}
|
||||||
|
|
||||||
define_variable_override_body()
|
|
||||||
{
|
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
|
||||||
atf_check -o inline:"/test\n" \
|
|
||||||
pkgconf --variable=prefix --define-variable='prefix=/test' typelibdir
|
|
||||||
}
|
|
||||||
|
|
||||||
variable_body()
|
variable_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
|
@ -234,7 +223,7 @@ virtual_variable_body()
|
||||||
|
|
||||||
fragment_collision_body()
|
fragment_collision_body()
|
||||||
{
|
{
|
||||||
atf_check -o inline:"-D_BAZ -D_BAR -D_FOO -D_THREAD_SAFE -pthread\n" \
|
atf_check -o inline:"-D_BAZ -D_FOO -D_BAR -D_THREAD_SAFE -pthread \n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-collision
|
pkgconf --with-path="${selfdir}/lib1" --cflags fragment-collision
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -262,21 +251,3 @@ empty_tuple_body()
|
||||||
atf_check -o inline:"\n" \
|
atf_check -o inline:"\n" \
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags empty-tuple
|
pkgconf --with-path="${selfdir}/lib1" --cflags empty-tuple
|
||||||
}
|
}
|
||||||
|
|
||||||
solver_requires_private_debounce_body()
|
|
||||||
{
|
|
||||||
atf_check -o inline:"-I/metapackage-1 -I/metapackage-2 -lmetapackage-1 -lmetapackage-2\n" \
|
|
||||||
pkgconf --with-path="${selfdir}/lib1" --cflags --libs metapackage
|
|
||||||
}
|
|
||||||
|
|
||||||
billion_laughs_body()
|
|
||||||
{
|
|
||||||
atf_check -o inline:"warning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\nwarning: truncating very long variable to 64KB\n" \
|
|
||||||
pkgconf --with-path="${selfdir}/lib1" --validate billion-laughs
|
|
||||||
}
|
|
||||||
|
|
||||||
maximum_package_depth_off_by_one_body()
|
|
||||||
{
|
|
||||||
atf_check -o inline:"1.2.3\n" \
|
|
||||||
pkgconf --with-path="${selfdir}/lib1" --modversion foo bar baz
|
|
||||||
}
|
|
||||||
|
|
|
@ -69,7 +69,7 @@ private_duplication_body()
|
||||||
{
|
{
|
||||||
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
export PKG_CONFIG_PATH="${selfdir}/lib1"
|
||||||
atf_check \
|
atf_check \
|
||||||
-o inline:"-lprivate -lbaz -lzee -lbar -lfoo -lfoo\n" \
|
-o inline:"-lprivate -lfoo -lbaz -lzee -lfoo -lbar \n" \
|
||||||
pkgconf --static --libs-only-l private-libs-duplication
|
pkgconf --static --libs-only-l private-libs-duplication
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,7 +87,7 @@ missing_body()
|
||||||
atf_check \
|
atf_check \
|
||||||
-s exit:1 \
|
-s exit:1 \
|
||||||
-e ignore \
|
-e ignore \
|
||||||
-o ignore \
|
-o inline:"\n" \
|
||||||
pkgconf --cflags missing-require
|
pkgconf --cflags missing-require
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue