Compare commits

...

55 Commits

Author SHA1 Message Date
Petr Písař 2d26db3a98 doc: Requires.private is used for header inclusion
ci/woodpecker/push/woodpecker Pipeline failed Details
Document that "pkgconf --cflags" inherits paths for including headers
from dependencies listed in Requires.private.

https://github.com/pkgconf/pkgconf/issues/300
https://github.com/pkgconf/pkgconf/issues/352
2024-04-25 23:50:21 -07:00
Pierce a8a492e2e4 Fix typo in README.md
ci/woodpecker/push/woodpecker Pipeline failed Details
2024-04-25 23:49:39 -07:00
Ismael Luceno c583d49a37 pkg.m4: Abort by default if no pkgconf
ci/woodpecker/push/woodpecker Pipeline failed Details
Provide a second optional argument to PKG_PROG_PKG_CONFIG with an action to
take if no pkgconf is found, and default to aborting.

Too many configure scripts in the wild don't handle an empty PKG_CONFIG,
resulting in weird error messages through the run, which often confuse
users.

Authors wishing to fallback to other methods can either return to the old
behavior by specifying [:] as an action, or use [PKG_CONFIG=false] and call
pkg-config macros normally, handling the fallback as any other failure.

Users can override PKG_CONFIG in the command line so this should imply no
regression.

Closes: https://github.com/pkgconf/pkgconf/issues/350
Ref: https://gitlab.freedesktop.org/pkg-config/pkg-config/-/issues/69
Signed-off-by: Ismael Luceno <ismael@iodev.co.uk>
2024-04-25 23:48:18 -07:00
Ariadne Conill 06120a8769 pkgconf 2.2.0 2024-03-27 18:39:44 +00:00
Ariadne Conill 7a8532f849 queue: remove no longer used root package reference when walking dependency graphs 2024-03-27 18:39:43 +00:00
Ariadne Conill a3d7ecb31b Use libpkgconf.so.5 due to ABI changes 2024-03-27 11:31:48 -07:00
Kai Pastor e2a8080cbf Reuse static solution for general solution 2024-03-27 11:15:04 -07:00
Kai Pastor 883b57df47 Cache packages from explicit file requests 2024-03-27 11:15:04 -07:00
Kai Pastor 194dde096b Update expected test results 2024-03-27 11:15:04 -07:00
Kai Pastor 78d53ea012 Revise serials, traversal, flattening
Remove the 'traverse_serial' fields which were added in 2.1.1.
Use the 'serial' field to track the current traversal.
Stop using 'identifier' to sort packages in the flattened solution.
Directly construct the flattened solution by a specific walk which
also preserves the relative order in Requires and Requires.private.
The topological sort is a single list, so don't fill requires_private.
Purely private dependencies are marked in dependency flags.
The ancestor flag is a pkg property, not a client property.
2024-03-27 11:15:04 -07:00
Kai Pastor 4090ba3e0d Clarify tracing messages 2024-03-27 11:15:04 -07:00
Kai Pastor 5eb79f6651 Add tests for lib order 2024-03-27 11:15:04 -07:00
Kai Pastor e7c9bdb317 Don't print 'required by <VIRTUAL-PACKAGE>' 2024-03-27 11:09:16 -07:00
Kai Pastor 4e01010d6f Mark user input in error message 2024-03-27 11:09:16 -07:00
Kai Pastor 6219af9a0a Color private-reachable nodes gray 2024-03-27 11:06:30 -07:00
Kai Pastor eaf1a2d804 Resolve user request for digraph 2024-03-27 11:06:30 -07:00
Kai Pastor d6753888b8 Update test expected results 2024-03-27 11:06:30 -07:00
Kai Pastor f95e8d4428 Print digraph for user request perspective 2024-03-27 11:06:30 -07:00
Kai Pastor db63c8ee0b Show edges for flattened order 2024-03-27 11:06:30 -07:00
Kai Pastor b6e04e2d47 pkgconf 2.1.1
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
2024-02-04 03:26:15 -08:00
Ariadne Conill 2edf954f3a Update NEWS for pkgconf 2.1.1 2024-02-04 03:25:54 -08:00
Ariadne Conill d8924aced5 Update gitignore to catch all of the autoconf-generated files
ci/woodpecker/push/woodpecker Pipeline was successful Details
2024-02-04 03:16:14 -08:00
Ariadne Conill 80b5011e69 Use traverse_serial to short circuit graph evaluation for already visited nodes.
In our previous attempt to optimize this problem, we did not track the type of the
visit to the node, e.g. whether it came from evaluating Requires or Requires.private,
which resulted in some solutions being correctly incalculated due to greedy optimization
of the dependency graph.

We reintroduce this optimization by adding a second traversal serial as well as
re-introducing the PROPF_VISITED node property as well as a new PROPF_VISITED_PRIVATE
node property flag.  This allows a node to be revisted at maximum two times per
traversal level.

Co-authored-by: Yi Chou <yich@google.com>
2024-02-04 03:04:52 -08:00
Kai Pastor 4a3adf3457 Test digraph completeness for private-libs-duplication
ci/woodpecker/push/woodpecker Pipeline was successful Details
Complements 45073b7.
2024-02-04 02:37:14 -08:00
Kai Pastor 5825e2c6d6 Fix crash on two-word expressions
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-12-05 10:50:18 -07:00
Kai Pastor b2f8386c32 Fix --modversion output 2023-12-05 10:50:18 -07:00
Kai Pastor 125af82dbe Test --modversion with constraint 2023-12-05 10:50:18 -07:00
Sam James 08f4a9da15 NEWS: fix typo
ci/woodpecker/push/woodpecker Pipeline was successful Details
Signed-off-by: Sam James <sam@gentoo.org>
2023-11-29 12:03:11 -08:00
Stefan Weil a4ecd42bf3 Fix it's -> its
Signed-off-by: Stefan Weil <sw@weilnetz.de>
2023-11-29 12:02:44 -08:00
Ariadne Conill 61d39ad899 pkgconf 2.1.0.
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
2023-11-22 18:46:19 +00:00
Ariadne Conill 5fb09af863 queue: ensure the initial solution is cleaned up when it is no longer needed
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-11-22 18:43:04 +00:00
Ariadne Conill d0038689fd build: add metapackage-3.pc to testsuite files
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-11-22 18:30:21 +00:00
Ariadne Conill 31512b210b add NEWS for pkgconf 2.1.0.
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-11-22 18:24:29 +00:00
Ariadne Conill 5f6c5320e5 cli: add simple --solution applet for dumping the solver solution
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-11-22 18:13:18 +00:00
Ariadne Conill f3540de30d queue: clarify the relationship between a flattened dep and its parent
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-11-22 18:13:07 +00:00
Kai Pastor be1ea7888b Separate input world from output world
ci/woodpecker/push/woodpecker Pipeline was successful Details
2023-11-22 10:11:21 -08:00
Kai Pastor 45073b7460 Circular deps: track ancestors, not serial 2023-11-22 10:09:22 -08:00
Victor Westerhuis 948297b5b8 Search XDG Base Directories for personality files
Try $XDG_DATA_HOME/pkgconfig/personality.d and $XDG_DATA_DIRS/pkgconfig/personality.d.
2023-11-22 10:07:41 -08:00
Sam James d454f62c73 libpkgconf: fix -Walloc-size
GCC 14 introduces a new -Walloc-size included in -Wextra which gives:
```
libpkgconf/personality.c:260:11: warning: allocation of insufficient size '1' for type 'pkgconf_cross_personality_t' {aka 'struct pkgconf_cross_personality_'} with size '48' [-Walloc-size]
libpkgconf/queue.c:46:33: warning: allocation of insufficient size '1' for type 'pkgconf_queue_t' {aka'struct pkgconf_queue_'} with size '16' [-Walloc-size]
libpkgconf/client.c:164:33: warning: allocation of insufficient size '1' for type 'pkgconf_client_t' {aka 'struct pkgconf_client_'} with size '120' [-Walloc-size]
libpkgconf/path.c:105:14: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '24' [-Walloc-size]
libpkgconf/path.c:237:22: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '24' [-Walloc-size]
libpkgconf/tuple.c:239:34: warning: allocation of insufficient size '1' for type 'pkgconf_tuple_t' {aka 'struct pkgconf_tuple_'} with size '24' [-Walloc-size]
libpkgconf/dependency.c:133:13: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '44' [-Walloc-size]
libpkgconf/dependency.c:472:17: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '44' [-Walloc-size]
libpkgconf/fragment.c:146:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '24' [-Walloc-size]
libpkgconf/fragment.c:195:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '24' [-Walloc-size]
libpkgconf/fragment.c:356:14: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '24' [-Walloc-size]
libpkgconf/pkg.c:422:13: warning: allocation of insufficient size '1' for type 'pkgconf_pkg_t' {aka 'struct pkgconf_pkg_'} with size '188' [-Walloc-size]
libpkgconf/client.c:164:33: warning: allocation of insufficient size '1' for type 'pkgconf_client_t' {aka 'struct pkgconf_client_'} with size '224' [-Walloc-size]
libpkgconf/personality.c:260:11: warning: allocation of insufficient size '1' for type 'pkgconf_cross_personality_t' {aka 'struct pkgconf_cross_personality_'} with size '96' [-Walloc-size]
libpkgconf/dependency.c:133:13: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '80' [-Walloc-size]
libpkgconf/dependency.c:472:17: warning: allocation of insufficient size '1' for type 'pkgconf_dependency_t' {aka 'struct pkgconf_dependency_'} with size '80' [-Walloc-size]
libpkgconf/path.c:105:14: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '48' [-Walloc-size]
libpkgconf/path.c:237:22: warning: allocation of insufficient size '1' for type 'pkgconf_path_t' {aka 'struct pkgconf_path_'} with size '48' [-Walloc-size]
libpkgconf/queue.c:46:33: warning: allocation of insufficient size '1' for type 'pkgconf_queue_t' {aka 'struct pkgconf_queue_'} with size '32' [-Walloc-size]
libpkgconf/tuple.c:239:34: warning: allocation of insufficient size '1' for type 'pkgconf_tuple_t' {aka 'struct pkgconf_tuple_'} with size '48' [-Walloc-size]
libpkgconf/fragment.c:146:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '48' [-Walloc-size]
libpkgconf/fragment.c:195:22: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '48' [-Walloc-size]
libpkgconf/fragment.c:356:14: warning: allocation of insufficient size '1' for type 'pkgconf_fragment_t' {aka 'struct pkgconf_fragment_'} with size '48' [-Walloc-size]
libpkgconf/pkg.c:422:13: warning: allocation of insufficient size '1' for type 'pkgconf_pkg_t' {aka 'struct pkgconf_pkg_'} with size '360' [-Walloc-size]
```

The calloc prototype is:
```
void *calloc(size_t nmemb, size_t size);
    ```

So, just swap the number of members and size arguments to match the prototype, as
we're initialising 1 struct of size `sizeof(struct ...)`. GCC then sees we're not
doing anything wrong.

The only exception there is for argv which I fixed while at it.

Signed-off-by: Sam James <sam@gentoo.org>
2023-11-22 10:06:14 -08:00
Ariadne Conill 752a9825dc queue: demote requires to requires.private when processing requires.private parents
ci/woodpecker/push/woodpecker Pipeline failed Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 07:22:59 +00:00
Ariadne Conill 86c43b4e3d cli: --digraph: use directed relationships as part of the visualization
ci/woodpecker/push/woodpecker Pipeline failed Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 07:10:47 +00:00
Ariadne Conill 4db8031402 cli: --digraph: properly visualize requires.private edges
ci/woodpecker/push/woodpecker Pipeline failed Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 07:06:29 +00:00
Kai Pastor eb087a6c84 Test simple metapackage
ci/woodpecker/push/woodpecker Pipeline failed Details
2023-10-09 06:48:59 +00:00
Colin Gillespie dd6a8e3fc7 cli: trim trailing whitespace from package arguments
ci/woodpecker/push/woodpecker Pipeline was successful Details
Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
2023-10-09 06:36:47 +00:00
Ariadne Conill 97d907ba93 cli: remove strncmp() from modversion comparison
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-09 06:35:26 +00:00
Peter Kokot a4033ab9c6 Update AX_CHECK_COMPILE_FLAG to serial 6
ci/woodpecker/push/woodpecker Pipeline failed Details
curl --output m4/ax_check_compile_flag.m4 \
https://raw.githubusercontent.com/autoconf-archive/autoconf-archive/master/m4/ax_check_compile_flag.m4
2023-10-08 22:50:31 +00:00
L. E. Segovia a7c29fec18 meson: Add with-system options
ci/woodpecker/push/woodpecker Pipeline failed Details
Fixes #283
2023-10-08 22:49:22 +00:00
Xi Ruoyao 962a5e96b7 cli: fix --modversion not showing version with versioned query
ci/woodpecker/push/woodpecker Pipeline failed Details
Fixes #317.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2023-10-08 22:47:51 +00:00
Colin Gillespie 5aeb469b81 libpkgconf: fix memory leak
ci/woodpecker/push/woodpecker Pipeline was successful Details
Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
2023-10-08 22:46:53 +00:00
Ariadne Conill 652aff9790 path: add pkgconf_path_prepend API for --with-path
ci/woodpecker/push/woodpecker Pipeline was successful Details
Otherwise, PKG_CONFIG_PATH and PKG_CONFIG_LIBDIR elements would be processed backwards.

Fixes: 384ade5 (path: prepend paths rather than append paths when processing --with-path arguments)
Closes: #250
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-10-08 22:27:56 +00:00
Ariadne Conill a6fb59a0ed pkgconf 2.0.3.
ci/woodpecker/push/woodpecker Pipeline was successful Details
ci/woodpecker/tag/woodpecker Pipeline was successful Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-09-03 04:18:48 +00:00
Ariadne Conill 3f07015d3a add new test files to build system
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-09-03 04:18:48 +00:00
Ariadne Conill ee702658cd use PRIu64 format specifiers for some uint64 identifiers in trace logging
ci/woodpecker/push/woodpecker Pipeline was successful Details
Signed-off-by: Ariadne Conill <ariadne@dereferenced.org>
2023-09-02 21:05:03 -07:00
Colin Gillespie 66994f1533 cli: fix --modversion not showing version in various cases
ci/woodpecker/push/woodpecker Pipeline was successful Details
There are numerous edge cases where version is wrong or missing when
matching the dependency queue to resolved packages. This adds the
dependency name as it appears in the dependency queue to each package as
it is resolved, allowing for a simple and correct comparison when
printing.

Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
2023-09-02 20:57:46 -07:00
Colin Gillespie 9cddd22bbc tests: add regression tests for --modversion
Signed-off-by: Colin Gillespie <colin@cgillespie.xyz>
2023-09-02 20:57:46 -07:00
29 changed files with 713 additions and 263 deletions

49
.gitignore vendored
View File

@ -1,13 +1,19 @@
Makefile
Makefile.in
.dirstamp
stamp-h*
*.h.in~
*.o
*.og
*.op
*.lo
*.gcno
*.gcda
*.gcov
core
.gdb_history
.libs
.deps
*.exe
@ -16,8 +22,8 @@ core
*.orig
*.patch
*.rej
/tests/run.sh
# autoconf stuff
/aclocal.m4
/autom4te.cache/
/buildsys.mk
@ -26,8 +32,47 @@ core
/config.log
/config.status
/configure
/compile
/config.guess
/config.sub
/depcomp
/install-sh
/missing
# programs
/bomtool
/pkgconf
/pkgconf-gcov
/pkgconf-profile
Makefile
# libtool
/libtool
/ltmain.sh
/libpkgconf.la
/m4/libtool.m4
/m4/lt~obsolete.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
# pkgconfig file
/libpkgconf.pc
# autoheader
/libpkgconf/config.h
/libpkgconf/config.h.in
# tests
/Kyuafile
/tests/Kyuafile
/tests/basic
/tests/builtins
/tests/conflicts
/tests/framework
/tests/parser
/tests/provides
/tests/regress
/tests/requires
/tests/sysroot
/tests/test_env.sh
/tests/version

View File

@ -27,6 +27,8 @@ EXTRA_DIST = pkg.m4 \
tests/lib1/paren-quoting.pc \
tests/lib1/argv-parse-3.pc \
tests/lib1/foo.pc \
tests/lib1/foobar.pc \
tests/lib1/unavailable-provider.pc \
tests/lib1/prefix-foo1.pc \
tests/lib1/argv-parse.pc \
tests/lib1/framework-1.pc \
@ -93,6 +95,7 @@ EXTRA_DIST = pkg.m4 \
tests/lib1/metapackage.pc \
tests/lib1/metapackage-1.pc \
tests/lib1/metapackage-2.pc \
tests/lib1/metapackage-3.pc \
tests/lib1/explicit-sysroot.pc \
tests/lib1/escaped-backslash.pc \
tests/lib1/cflags-internal.pc \
@ -156,7 +159,7 @@ libpkgconf_la_SOURCES = \
libpkgconf/path.c \
libpkgconf/personality.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 5:0:0 -export-symbols-regex '^pkgconf_'
dist_man_MANS = \
man/pkgconf.1 \

View File

@ -39,7 +39,7 @@ all: pkgconf-lite
libpkgconf/config.h:
@echo '#define PACKAGE_NAME "pkgconf-lite"' >> $@
@echo '#define PACKAGE_BUGREPORT "https://git.dereferenced.org/pkgconf/pkgconf/issues"' >> $@
@echo '#define PACKAGE_VERSION "2.0.2"' >> $@
@echo '#define PACKAGE_VERSION "2.2.0"' >> $@
@echo '#define PACKAGE PACKAGE_NAME " " PACKAGE_VERSION' >> $@
@echo '#define HAVE_STRLCPY' >> $@
@echo '#define HAVE_STRLCAT' >> $@

75
NEWS
View File

@ -1,6 +1,81 @@
Changes from previous version of pkgconf
========================================
Changes from 2.1.1 to 2.2.0:
----------------------------
* libpkgconf SOVERSION is now 5.
* Significant solver rework to flatten both requires and requires.private
dependencies in a single pass. Improves performance slightly and ensures
proper dependency order.
Patches by Kai Pastor.
* Improve `--digraph` output to reflect more of the solver's state in the
rendered dependency graph.
Patches by Kai Pastor.
* Do not reference the graph root by name when presenting error messages about
directly requested dependency nodes.
Patch by Kai Pastor.
Changes from 2.1.0 to 2.1.1:
----------------------------
* Documentation fixes from Sam James and Stefan Weil.
* Fix --modversion with constraints.
Patch by Kai Pastor.
* Reintroduce an optimization to the dependency graph walker which avoids
revisiting already visited nodes.
Patch by Yi Chou with some modifications.
* Add a regression test to check that the dependency flattener is working
as expected.
Patch by Kai Pastor.
Changes from 2.0.3 to 2.1.0:
----------------------------
* Do not flatten the solver solution into the original world used as
input to the solver.
Patches by Kai Pastor.
* Fix warnings with GCC 14 -Walloc-size.
Patch by Sam James.
* Add --solution to the pkgconf CLI to dump the solver state.
* Improve the --digraph output to clarify cancelled edges in a given
solution.
* Demote requires dependencies to requires.private when a parent
dependency is pulled in via requires.private.
* Trim trailing whitespace when processing package arguments.
Patch by Colin Gillespie.
* Avoid strncmp() in --modversion version comparison.
Patch by Colin Gillespie.
* Update autoconf compile flag checking macro.
Patch by Peter Kokot.
* Add system default path configuration to Meson.
Patch by L. E. Segovia.
* Fix order of PKG_CONFIG_LIBDIR and PKG_CONFIG_PATH element processing.
Changes from 2.0.2 to 2.0.3:
----------------------------
* Fix some edge-cases with the new `--modversion` implementation
and add additional regression tests.
Patch by Colin Gillespie.
* Fix some format specifiers to use PRIu64 in debug tracing.
Changes from 2.0.1 to 2.0.2:
----------------------------

View File

@ -50,7 +50,7 @@ As previously mentioned, pkgconf makes optimizations to the linker flags in both
case of static and shared linking in order to avoid overlinking binaries and also
simplifies the `CFLAGS` and `LIBS` output of the pkgconf tool for improved readability.
This functionality depends on the pkg-config module properly declaring it's dependency
This functionality depends on the pkg-config module properly declaring its dependency
tree instead of using `Libs` and `Cflags` fields to directly link against other modules
which have pkg-config metadata files installed.
@ -116,7 +116,7 @@ flags like so:
pkgconf is compiled using [Meson](https://mesonbuild.com) on Windows. In theory, you could also use
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 pkgconf is typically built
much earlier than Meson.
$ meson setup build -Dtests=disabled

View File

@ -71,6 +71,7 @@
#define PKG_DUMP_PERSONALITY (((uint64_t) 1) << 43)
#define PKG_SHARED (((uint64_t) 1) << 44)
#define PKG_DUMP_LICENSE (((uint64_t) 1) << 45)
#define PKG_SOLUTION (((uint64_t) 1) << 46)
static pkgconf_client_t pkg_client;
static const pkgconf_fragment_render_ops_t *want_render_ops = NULL;
@ -253,32 +254,71 @@ apply_provides(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
#ifndef PKGCONF_LITE
static void
print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
print_digraph_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
{
pkgconf_node_t *node;
(void) client;
(void) unused;
pkgconf_pkg_t **last_seen = data;
printf("\"%s\" [fontname=Sans fontsize=8]\n", pkg->id);
if(pkg->flags & PKGCONF_PKG_PROPF_VIRTUAL)
return;
if (pkg->flags & PKGCONF_PKG_PROPF_VISITED_PRIVATE)
printf("\"%s\" [fontname=Sans fontsize=8 fontcolor=gray color=gray]\n", pkg->id);
else
printf("\"%s\" [fontname=Sans fontsize=8]\n", pkg->id);
if (last_seen != NULL)
{
if (*last_seen != NULL)
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=red]\n", (*last_seen)->id, pkg->id);
*last_seen = pkg;
}
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
{
pkgconf_dependency_t *dep = node->data;
const char *dep_id = (dep->match != NULL) ? dep->match->id : dep->package;
printf("\"%s\" -- \"%s\" [fontname=Sans fontsize=8]\n", dep->package, pkg->id);
if ((dep->flags & PKGCONF_PKG_DEPF_PRIVATE) == 0)
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8]\n", pkg->id, dep_id);
else
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep_id);
}
PKGCONF_FOREACH_LIST_ENTRY(pkg->requires_private.head, node)
{
pkgconf_dependency_t *dep = node->data;
const char *dep_id = (dep->match != NULL) ? dep->match->id : dep->package;
printf("\"%s\" -> \"%s\" [fontname=Sans fontsize=8 color=gray]\n", pkg->id, dep_id);
}
}
static bool
apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int maxdepth)
{
int eflag;
pkgconf_list_t *list = data;
pkgconf_pkg_t *last_seen = NULL;
pkgconf_node_t *iter;
printf("graph deptree {\n");
printf("digraph deptree {\n");
printf("edge [color=blue len=7.5 fontname=Sans fontsize=8]\n");
printf("node [fontname=Sans fontsize=8]\n");
printf("\"user:request\" [fontname=Sans fontsize=8]\n");
eflag = pkgconf_pkg_traverse(client, world, print_digraph_node, unused, maxdepth, 0);
PKGCONF_FOREACH_LIST_ENTRY(list->head, iter)
{
pkgconf_queue_t *pkgq = iter->data;
pkgconf_pkg_t *pkg = pkgconf_pkg_find(client, pkgq->package);
printf("\"user:request\" -> \"%s\" [fontname=Sans fontsize=8]\n", pkg == NULL ? pkgq->package : pkg->id);
if (pkg != NULL)
pkgconf_pkg_unref(client, pkg);
}
eflag = pkgconf_pkg_traverse(client, world, print_digraph_node, &last_seen, maxdepth, 0);
if (eflag != PKGCONF_PKG_ERRF_OK)
return false;
@ -286,6 +326,25 @@ apply_digraph(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int
printf("}\n");
return true;
}
static void
print_solution_node(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *unused)
{
(void) client;
(void) unused;
printf("%s (%"PRIu64")\n", pkg->id, pkg->identifier);
}
static bool
apply_print_solution(pkgconf_client_t *client, pkgconf_pkg_t *world, void *unused, int maxdepth)
{
int eflag;
eflag = pkgconf_pkg_traverse(client, world, print_solution_node, unused, maxdepth, 0);
return eflag == PKGCONF_PKG_ERRF_OK;
}
#endif
static bool
@ -306,7 +365,12 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int
pkgconf_dependency_t *dep = world_iter->data;
pkgconf_pkg_t *pkg = dep->match;
if (strncmp(pkg->id, queue_node->package, strlen(pkg->id)))
const size_t name_len = strlen(pkg->why);
if (name_len > strlen(queue_node->package) ||
strncmp(pkg->why, queue_node->package, name_len) ||
(queue_node->package[name_len] != 0 &&
!isspace(queue_node->package[name_len]) &&
!PKGCONF_IS_OPERATOR_CHAR(queue_node->package[name_len])))
continue;
if (pkg->version != NULL) {
@ -315,6 +379,8 @@ apply_modversion(pkgconf_client_t *client, pkgconf_pkg_t *world, void *data, int
printf("%s\n", pkg->version);
}
break;
}
}
@ -724,6 +790,7 @@ usage(void)
printf(" --print-variables print all known variables in module to stdout\n");
#ifndef PKGCONF_LITE
printf(" --digraph print entire dependency graph in graphviz 'dot' format\n");
printf(" --solution print dependency graph solution in a simple format\n");
#endif
printf(" --keep-system-cflags keep -I%s entries in cflags output\n", SYSTEM_INCLUDEDIR);
printf(" --keep-system-libs keep -L%s entries in libs output\n", SYSTEM_LIBDIR);
@ -876,6 +943,7 @@ main(int argc, char *argv[])
{ "print-variables", no_argument, &want_flags, PKG_VARIABLES|PKG_PRINT_ERRORS, },
#ifndef PKGCONF_LITE
{ "digraph", no_argument, &want_flags, PKG_DIGRAPH, },
{ "solution", no_argument, &want_flags, PKG_SOLUTION, },
#endif
{ "help", no_argument, &want_flags, PKG_HELP, },
{ "env-only", no_argument, &want_flags, PKG_ENV_ONLY, },
@ -965,7 +1033,7 @@ main(int argc, char *argv[])
logfile_arg = pkg_optarg;
break;
case 42:
pkgconf_path_add(pkg_optarg, &dir_list, true);
pkgconf_path_prepend(pkg_optarg, &dir_list, true);
break;
case 43:
pkgconf_client_set_prefix_varname(&pkg_client, pkg_optarg);
@ -1339,7 +1407,8 @@ cleanup3:
while (1)
{
const char *package = argv[pkg_optind];
char *package = argv[pkg_optind];
char *end;
if (package == NULL)
break;
@ -1359,11 +1428,24 @@ cleanup3:
continue;
}
end = package + strlen(package) - 1;
while(end > package && isspace((unsigned char)end[0])) end--;
end[1] = '\0';
if (argv[pkg_optind + 1] == NULL || !PKGCONF_IS_OPERATOR_CHAR(*(argv[pkg_optind + 1])))
{
pkgconf_queue_push(&pkgq, package);
pkg_optind++;
}
else if (argv[pkg_optind + 2] == NULL)
{
char packagebuf[PKGCONF_BUFSIZE];
snprintf(packagebuf, sizeof packagebuf, "%s %s", package, argv[pkg_optind + 1]);
pkg_optind += 2;
pkgconf_queue_push(&pkgq, packagebuf);
}
else
{
char packagebuf[PKGCONF_BUFSIZE];
@ -1432,7 +1514,13 @@ cleanup3:
if ((want_flags & PKG_DIGRAPH) == PKG_DIGRAPH)
{
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
apply_digraph(&pkg_client, &world, NULL, 2);
apply_digraph(&pkg_client, &world, &pkgq, 2);
}
if ((want_flags & PKG_SOLUTION) == PKG_SOLUTION)
{
want_flags &= ~(PKG_CFLAGS|PKG_LIBS);
apply_print_solution(&pkg_client, &world, NULL, 2);
}
#endif
@ -1488,20 +1576,8 @@ cleanup3:
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;
goto out;
}
}
apply_libs(&pkg_client, &world, NULL, 2);
}

View File

@ -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.
AC_PREREQ([2.71])
AC_INIT([pkgconf],[2.0.2],[https://github.com/pkgconf/pkgconf/issues/new])
AC_INIT([pkgconf],[2.2.0],[https://github.com/pkgconf/pkgconf/issues/new])
AC_CONFIG_SRCDIR([cli/main.c])
AC_CONFIG_MACRO_DIR([m4])
AX_CHECK_COMPILE_FLAG([-Wall], [CFLAGS="$CFLAGS -Wall"])

View File

@ -51,7 +51,7 @@ The `dependency` module provides support for building `dependency lists` (the ba
.. 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 its child dependency nodes.
:param pkgconf_list_t* list: The dependency list to release.
:return: nothing

View File

@ -72,7 +72,7 @@ pkgconf_argv_split(const char *src, int *argc, char ***argv)
memset(buf, 0, strlen(src) + 1);
*argv = calloc(sizeof (void *), argv_size);
*argv = calloc(argv_size, sizeof (void *));
(*argv)[argc_count] = dst_iter;
while (*src_iter)

View File

@ -161,7 +161,7 @@ pkgconf_client_init(pkgconf_client_t *client, pkgconf_error_handler_func_t error
pkgconf_client_t *
pkgconf_client_new(pkgconf_error_handler_func_t error_handler, void *error_handler_data, const pkgconf_cross_personality_t *personality)
{
pkgconf_client_t *out = calloc(sizeof(pkgconf_client_t), 1);
pkgconf_client_t *out = calloc(1, sizeof(pkgconf_client_t));
pkgconf_client_init(out, error_handler, error_handler_data, personality);
return out;
}

View File

@ -130,7 +130,7 @@ pkgconf_dependency_addraw(pkgconf_client_t *client, pkgconf_list_t *list, const
{
pkgconf_dependency_t *dep;
dep = calloc(sizeof(pkgconf_dependency_t), 1);
dep = calloc(1, sizeof(pkgconf_dependency_t));
dep->package = pkgconf_strndup(package, package_sz);
if (version_sz != 0)
@ -262,7 +262,7 @@ pkgconf_dependency_unref(pkgconf_client_t *client, pkgconf_dependency_t *dep)
*
* .. 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 its child dependency nodes.
*
* :param pkgconf_list_t* list: The dependency list to release.
* :return: nothing
@ -469,7 +469,7 @@ pkgconf_dependency_copy(pkgconf_client_t *client, const pkgconf_dependency_t *de
{
pkgconf_dependency_t *new_dep;
new_dep = calloc(sizeof(pkgconf_dependency_t), 1);
new_dep = calloc(1, sizeof(pkgconf_dependency_t));
new_dep->package = strdup(dep->package);
if (dep->version != NULL)

View File

@ -143,7 +143,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
if (strlen(string) > 1 && !pkgconf_fragment_is_special(string))
{
frag = calloc(sizeof(pkgconf_fragment_t), 1);
frag = calloc(1, sizeof(pkgconf_fragment_t));
frag->type = *(string + 1);
frag->data = pkgconf_fragment_copy_munged(client, string + 2, flags);
@ -192,7 +192,7 @@ pkgconf_fragment_add(const pkgconf_client_t *client, pkgconf_list_t *list, const
}
}
frag = calloc(sizeof(pkgconf_fragment_t), 1);
frag = calloc(1, sizeof(pkgconf_fragment_t));
frag->type = 0;
frag->data = strdup(string);
@ -353,7 +353,7 @@ pkgconf_fragment_copy(const pkgconf_client_t *client, pkgconf_list_t *list, cons
else if (!is_private && !pkgconf_fragment_can_merge_back(base, client->flags, is_private) && (pkgconf_fragment_lookup(list, base) != NULL))
return;
frag = calloc(sizeof(pkgconf_fragment_t), 1);
frag = calloc(1, sizeof(pkgconf_fragment_t));
frag->type = base->type;
frag->merged = base->merged;
@ -427,7 +427,7 @@ fragment_quote(const pkgconf_fragment_t *frag)
if (frag->data == NULL)
return NULL;
out = dst = calloc(outlen, 1);
out = dst = calloc(1, outlen);
for (; *src; src++)
{

View File

@ -16,6 +16,7 @@
#ifndef LIBPKGCONF__LIBPKGCONF_H
#define LIBPKGCONF__LIBPKGCONF_H
#include <inttypes.h>
#include <stdio.h>
#include <stdarg.h>
#include <stddef.h>
@ -80,8 +81,8 @@ typedef struct pkgconf_queue_ pkgconf_queue_t;
#define PKGCONF_FOREACH_LIST_ENTRY_REVERSE(tail, value) \
for ((value) = (tail); (value) != NULL; (value) = (value)->prev)
#define LIBPKGCONF_VERSION 20002
#define LIBPKGCONF_VERSION_STR "2.0.2"
#define LIBPKGCONF_VERSION 20200
#define LIBPKGCONF_VERSION_STR "2.2.0"
struct pkgconf_queue_ {
pkgconf_node_t iter;
@ -136,6 +137,8 @@ struct pkgconf_path_ {
#define PKGCONF_PKG_PROPF_CACHED 0x02
#define PKGCONF_PKG_PROPF_UNINSTALLED 0x08
#define PKGCONF_PKG_PROPF_VIRTUAL 0x10
#define PKGCONF_PKG_PROPF_ANCESTOR 0x20
#define PKGCONF_PKG_PROPF_VISITED_PRIVATE 0x40
struct pkgconf_pkg_ {
int refcount;
@ -149,6 +152,7 @@ struct pkgconf_pkg_ {
char *license;
char *maintainer;
char *copyright;
char *why;
pkgconf_list_t libs;
pkgconf_list_t libs_private;
@ -409,6 +413,7 @@ PKGCONF_API void pkgconf_audit_log_dependency(pkgconf_client_t *client, const pk
/* path.c */
PKGCONF_API void pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter);
PKGCONF_API void pkgconf_path_prepend(const char *text, pkgconf_list_t *dirlist, bool filter);
PKGCONF_API size_t pkgconf_path_split(const char *text, pkgconf_list_t *dirlist, bool filter);
PKGCONF_API size_t pkgconf_path_build_from_environ(const char *envvarname, const char *fallback, pkgconf_list_t *dirlist, bool filter);
PKGCONF_API bool pkgconf_path_match_list(const char *path, const pkgconf_list_t *dirlist);

View File

@ -58,6 +58,51 @@ path_list_contains_entry(const char *text, pkgconf_list_t *dirlist)
* variables.
*/
static pkgconf_path_t *
prepare_path_node(const char *text, pkgconf_list_t *dirlist, bool filter)
{
pkgconf_path_t *node;
char path[PKGCONF_ITEM_SIZE];
pkgconf_strlcpy(path, text, sizeof path);
pkgconf_path_relocate(path, sizeof path);
#ifdef PKGCONF_CACHE_INODES
struct stat st;
if (filter)
{
if (lstat(path, &st) == -1)
return NULL;
if (S_ISLNK(st.st_mode))
{
char pathbuf[PKGCONF_ITEM_SIZE * 4];
char *linkdest = realpath(path, pathbuf);
if (linkdest != NULL && stat(linkdest, &st) == -1)
return NULL;
}
if (path_list_contains_entry(path, dirlist, &st))
return NULL;
}
#else
if (filter && path_list_contains_entry(path, dirlist))
return NULL;
#endif
node = calloc(1, sizeof(pkgconf_path_t));
node->path = strdup(path);
#ifdef PKGCONF_CACHE_INODES
if (filter) {
node->handle_path = (void *)(intptr_t) st.st_ino;
node->handle_device = (void *)(intptr_t) st.st_dev;
}
#endif
return node;
}
/*
* !doc
*
@ -73,44 +118,31 @@ path_list_contains_entry(const char *text, pkgconf_list_t *dirlist)
void
pkgconf_path_add(const char *text, pkgconf_list_t *dirlist, bool filter)
{
pkgconf_path_t *node;
char path[PKGCONF_ITEM_SIZE];
pkgconf_strlcpy(path, text, sizeof path);
pkgconf_path_relocate(path, sizeof path);
#ifdef PKGCONF_CACHE_INODES
struct stat st;
if (filter)
{
if (lstat(path, &st) == -1)
return;
if (S_ISLNK(st.st_mode))
{
char pathbuf[PKGCONF_ITEM_SIZE * 4];
char *linkdest = realpath(path, pathbuf);
if (linkdest != NULL && stat(linkdest, &st) == -1)
return;
}
if (path_list_contains_entry(path, dirlist, &st))
return;
}
#else
if (filter && path_list_contains_entry(path, dirlist))
pkgconf_path_t *node = prepare_path_node(text, dirlist, filter);
if (node == NULL)
return;
#endif
node = calloc(sizeof(pkgconf_path_t), 1);
node->path = strdup(path);
pkgconf_node_insert_tail(&node->lnode, node, dirlist);
}
#ifdef PKGCONF_CACHE_INODES
if (filter) {
node->handle_path = (void *)(intptr_t) st.st_ino;
node->handle_device = (void *)(intptr_t) st.st_dev;
}
#endif
/*
* !doc
*
* .. c:function:: void pkgconf_path_prepend(const char *text, pkgconf_list_t *dirlist)
*
* Prepends a path node to a path list. If the path is already in the list, do nothing.
*
* :param char* text: The path text to add as a path node.
* :param pkgconf_list_t* dirlist: The path list to add the path node to.
* :param bool filter: Whether to perform duplicate filtering.
* :return: nothing
*/
void
pkgconf_path_prepend(const char *text, pkgconf_list_t *dirlist, bool filter)
{
pkgconf_path_t *node = prepare_path_node(text, dirlist, filter);
if (node == NULL)
return;
pkgconf_node_insert(&node->lnode, node, dirlist);
}
@ -234,7 +266,7 @@ pkgconf_path_copy_list(pkgconf_list_t *dst, const pkgconf_list_t *src)
{
pkgconf_path_t *srcpath = n->data, *path;
path = calloc(sizeof(pkgconf_path_t), 1);
path = calloc(1, sizeof(pkgconf_path_t));
path->path = strdup(srcpath->path);
#ifdef PKGCONF_CACHE_INODES

View File

@ -241,23 +241,25 @@ personality_warn_func(void *p, const char *fmt, ...)
}
static pkgconf_cross_personality_t *
load_personality_with_path(const char *path, const char *triplet)
load_personality_with_path(const char *path, const char *triplet, bool datadir)
{
char pathbuf[PKGCONF_ITEM_SIZE];
FILE *f;
pkgconf_cross_personality_t *p;
/* if triplet is null, assume that path is a direct path to the personality file */
if (triplet != NULL)
snprintf(pathbuf, sizeof pathbuf, "%s/%s.personality", path, triplet);
else
if (triplet == NULL)
pkgconf_strlcpy(pathbuf, path, sizeof pathbuf);
else if (datadir)
snprintf(pathbuf, sizeof pathbuf, "%s/pkgconfig/personality.d/%s.personality", path, triplet);
else
snprintf(pathbuf, sizeof pathbuf, "%s/%s.personality", path, triplet);
f = fopen(pathbuf, "r");
if (f == NULL)
return NULL;
p = calloc(sizeof(pkgconf_cross_personality_t), 1);
p = calloc(1, sizeof(pkgconf_cross_personality_t));
if (triplet != NULL)
p->name = strdup(triplet);
pkgconf_parser_parse(f, p, personality_parser_ops, personality_warn_func, pathbuf);
@ -281,21 +283,51 @@ pkgconf_cross_personality_find(const char *triplet)
pkgconf_list_t plist = PKGCONF_LIST_INITIALIZER;
pkgconf_node_t *n;
pkgconf_cross_personality_t *out = NULL;
#if ! defined(_WIN32) && ! defined(__HAIKU__)
char pathbuf[PKGCONF_ITEM_SIZE];
const char *envvar;
#endif
out = load_personality_with_path(triplet, NULL);
out = load_personality_with_path(triplet, NULL, false);
if (out != NULL)
return out;
if (!valid_triplet(triplet))
return NULL;
#if ! defined(_WIN32) && ! defined(__HAIKU__)
envvar = getenv("XDG_DATA_HOME");
if (envvar != NULL)
pkgconf_path_add(envvar, &plist, true);
else {
envvar = getenv("HOME");
if (envvar != NULL) {
pkgconf_strlcpy(pathbuf, envvar, sizeof pathbuf);
pkgconf_strlcat(pathbuf, "/.local/share", sizeof pathbuf);
pkgconf_path_add(pathbuf, &plist, true);
}
}
pkgconf_path_build_from_environ("XDG_DATA_DIRS", "/usr/local/share" PKG_CONFIG_PATH_SEP_S "/usr/share", &plist, true);
PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)
{
pkgconf_path_t *pn = n->data;
out = load_personality_with_path(pn->path, triplet, true);
if (out != NULL)
goto finish;
}
pkgconf_path_free(&plist);
#endif
pkgconf_path_split(PERSONALITY_PATH, &plist, true);
PKGCONF_FOREACH_LIST_ENTRY(plist.head, n)
{
pkgconf_path_t *pn = n->data;
out = load_personality_with_path(pn->path, triplet);
out = load_personality_with_path(pn->path, triplet, false);
if (out != NULL)
goto finish;
}

View File

@ -250,7 +250,7 @@ determine_prefix(const pkgconf_pkg_t *pkg, char *buf, size_t buflen)
static char *
convert_path_to_value(const char *path)
{
char *buf = calloc((strlen(path) + 1) * 2, 1);
char *buf = calloc(1, (strlen(path) + 1) * 2);
char *bptr = buf;
const char *i;
@ -419,7 +419,7 @@ pkgconf_pkg_new_from_file(pkgconf_client_t *client, const char *filename, FILE *
pkgconf_pkg_t *pkg;
char *idptr;
pkg = calloc(sizeof(pkgconf_pkg_t), 1);
pkg = calloc(1, sizeof(pkgconf_pkg_t));
pkg->owner = client;
pkg->filename = strdup(filename);
pkg->pc_filedir = pkg_get_parent_dir(pkg);
@ -546,6 +546,9 @@ pkgconf_pkg_free(pkgconf_client_t *client, pkgconf_pkg_t *pkg)
if (pkg->copyright != NULL)
free(pkg->copyright);
if (pkg->why != NULL)
free(pkg->why);
free(pkg);
}
@ -772,15 +775,13 @@ pkgconf_pkg_find(pkgconf_client_t *client, const char *name)
{
if ((f = fopen(name, "r")) != NULL)
{
pkgconf_pkg_t *pkg;
PKGCONF_TRACE(client, "%s is a file", name);
pkg = pkgconf_pkg_new_from_file(client, name, f, 0);
if (pkg != NULL)
{
pkgconf_path_add(pkg->pc_filedir, &client->dir_list, true);
return pkg;
goto out;
}
}
}
@ -1398,19 +1399,24 @@ pkgconf_pkg_verify_dependency(pkgconf_client_t *client, pkgconf_dependency_t *pk
return NULL;
}
return pkgconf_pkg_scan_providers(client, pkgdep, eflags);
}
if (pkg->id == NULL)
pkg->id = strdup(pkgdep->package);
if (pkgconf_pkg_comparator_impls[pkgdep->compare](pkg->version, pkgdep->version) != true)
{
if (eflags != NULL)
*eflags |= PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH;
pkg = pkgconf_pkg_scan_providers(client, pkgdep, eflags);
}
else
pkgdep->match = pkgconf_pkg_ref(client, pkg);
{
if (pkg->id == NULL)
pkg->id = strdup(pkgdep->package);
if (pkgconf_pkg_comparator_impls[pkgdep->compare](pkg->version, pkgdep->version) != true)
{
if (eflags != NULL)
*eflags |= PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH;
}
else
pkgdep->match = pkgconf_pkg_ref(client, pkg);
}
if (pkg != NULL && pkg->why == NULL)
pkg->why = strdup(pkgdep->package);
return pkg;
}
@ -1448,7 +1454,11 @@ pkgconf_pkg_report_graph_error(pkgconf_client_t *client, pkgconf_pkg_t *parent,
client->already_sent_notice = true;
}
pkgconf_error(client, "Package '%s', required by '%s', not found\n", node->package, parent->id);
if (parent->flags & PKGCONF_PKG_PROPF_VIRTUAL)
pkgconf_error(client, "Package '%s' not found\n", node->package);
else
pkgconf_error(client, "Package '%s', required by '%s', not found\n", node->package, parent->id);
pkgconf_audit_log(client, "%s NOT-FOUND\n", node->package);
}
else if (eflags & PKGCONF_PKG_ERRF_PACKAGE_VER_MISMATCH)
@ -1479,6 +1489,8 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
pkgconf_node_t *node, *next;
parent->flags |= PKGCONF_PKG_PROPF_ANCESTOR;
PKGCONF_FOREACH_LIST_ENTRY_SAFE(deplist->head, next, node)
{
unsigned int eflags_local = PKGCONF_PKG_ERRF_OK;
@ -1499,10 +1511,8 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
if (pkgdep == NULL)
continue;
if (pkgdep->serial == client->serial && !(parent->flags & PKGCONF_PKG_PROPF_VIRTUAL))
if((pkgdep->flags & PKGCONF_PKG_PROPF_ANCESTOR) != 0)
{
pkgdep->identifier = ++client->identifier;
/* In this case we have a circular reference.
* We break that by deleteing the circular node from the
* the list, so that we dont create a situation where
@ -1530,13 +1540,13 @@ pkgconf_pkg_walk_list(pkgconf_client_t *client,
pkgconf_audit_log_dependency(client, pkgdep, depnode);
pkgdep->identifier = ++client->identifier;
pkgdep->serial = client->serial;
eflags |= pkgconf_pkg_traverse_main(client, pkgdep, func, data, depth - 1, skip_flags);
next:
pkgconf_pkg_unref(client, pkgdep);
}
parent->flags &= ~PKGCONF_PKG_PROPF_ANCESTOR;
return eflags;
}
@ -1616,7 +1626,17 @@ pkgconf_pkg_traverse_main(pkgconf_client_t *client,
if (maxdepth == 0)
return eflags;
PKGCONF_TRACE(client, "%s: level %d, serial %lu", root->id, maxdepth, client->serial);
/* Short-circuit if we have already visited this node.
*/
if (root->serial == client->serial)
return eflags;
root->serial = client->serial;
if (root->identifier == 0)
root->identifier = ++client->identifier;
PKGCONF_TRACE(client, "%s: level %d, serial %"PRIu64, root->id, maxdepth, client->serial);
if ((root->flags & PKGCONF_PKG_PROPF_VIRTUAL) != PKGCONF_PKG_PROPF_VIRTUAL || (client->flags & PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL) != PKGCONF_PKG_PKGF_SKIP_ROOT_VIRTUAL)
{
@ -1624,21 +1644,23 @@ pkgconf_pkg_traverse_main(pkgconf_client_t *client,
func(client, root, data);
}
if (!(client->flags & PKGCONF_PKG_PKGF_SKIP_CONFLICTS))
if (!(client->flags & PKGCONF_PKG_PKGF_SKIP_CONFLICTS) && root->conflicts.head != NULL)
{
PKGCONF_TRACE(client, "%s: walking 'Conflicts' list", root->id);
eflags = pkgconf_pkg_walk_conflicts_list(client, root, &root->conflicts);
if (eflags != PKGCONF_PKG_ERRF_OK)
return eflags;
}
PKGCONF_TRACE(client, "%s: walking requires list", root->id);
PKGCONF_TRACE(client, "%s: walking 'Requires' list", root->id);
eflags = pkgconf_pkg_walk_list(client, root, &root->required, func, data, maxdepth, skip_flags);
if (eflags != PKGCONF_PKG_ERRF_OK)
return eflags;
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
{
PKGCONF_TRACE(client, "%s: walking requires.private list", root->id);
PKGCONF_TRACE(client, "%s: walking 'Requires.private' list", root->id);
/* XXX: ugly */
client->flags |= PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE;
@ -1663,6 +1685,9 @@ pkgconf_pkg_traverse(pkgconf_client_t *client,
if (root->flags & PKGCONF_PKG_PROPF_VIRTUAL)
client->serial++;
if ((client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE) == 0)
skip_flags |= PKGCONF_PKG_DEPF_PRIVATE;
return pkgconf_pkg_traverse_main(client, root, func, data, maxdepth, skip_flags);
}

View File

@ -43,7 +43,7 @@
void
pkgconf_queue_push(pkgconf_list_t *list, const char *package)
{
pkgconf_queue_t *pkgq = calloc(sizeof(pkgconf_queue_t), 1);
pkgconf_queue_t *pkgq = calloc(1, sizeof(pkgconf_queue_t));
pkgq->package = strdup(package);
pkgconf_node_insert_tail(&pkgq->iter, pkgq, list);
@ -103,149 +103,175 @@ pkgconf_queue_free(pkgconf_list_t *list)
}
static void
pkgconf_queue_collect_dependents(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
pkgconf_queue_mark_public(pkgconf_client_t *client, pkgconf_pkg_t *pkg, void *data)
{
if (pkg->flags & PKGCONF_PKG_PROPF_VISITED_PRIVATE)
{
pkgconf_list_t *list = data;
pkgconf_node_t *node;
PKGCONF_FOREACH_LIST_ENTRY(list->head, node)
{
pkgconf_dependency_t *dep = node->data;
if (dep->match == pkg)
dep->flags &= ~PKGCONF_PKG_DEPF_PRIVATE;
}
pkg->flags &= ~PKGCONF_PKG_PROPF_VISITED_PRIVATE;
PKGCONF_TRACE(client, "%s: updated, public", pkg->id);
}
}
static unsigned int
pkgconf_queue_collect_dependencies_main(pkgconf_client_t *client,
pkgconf_pkg_t *root,
void *data,
int maxdepth);
static inline unsigned int
pkgconf_queue_collect_dependencies_walk(pkgconf_client_t *client,
pkgconf_list_t *deplist,
void *data,
int depth)
{
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
pkgconf_node_t *node;
pkgconf_pkg_t *world = data;
if (pkg == world)
return;
PKGCONF_FOREACH_LIST_ENTRY(pkg->required.head, node)
{
pkgconf_dependency_t *flattened_dep;
flattened_dep = pkgconf_dependency_copy(client, node->data);
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_dependency_t *flattened_dep;
flattened_dep = pkgconf_dependency_copy(client, node->data);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->requires_private);
}
}
}
static int
dep_sort_cmp(const void *a, const void *b)
{
const pkgconf_dependency_t *depA = *(void **) a;
const pkgconf_dependency_t *depB = *(void **) b;
return depB->match->identifier - depA->match->identifier;
}
static inline void
flatten_dependency_set(pkgconf_client_t *client, pkgconf_list_t *list)
{
pkgconf_node_t *node, *next;
pkgconf_dependency_t **deps = NULL;
size_t dep_count = 0, i;
PKGCONF_FOREACH_LIST_ENTRY_SAFE(list->head, next, node)
PKGCONF_FOREACH_LIST_ENTRY_REVERSE(deplist->tail, node)
{
pkgconf_dependency_t *dep = node->data;
pkgconf_pkg_t *pkg = pkgconf_pkg_verify_dependency(client, dep, NULL);
pkgconf_dependency_t *flattened_dep;
pkgconf_pkg_t *pkg = dep->match;
if (pkg == NULL)
if (*dep->package == '\0')
continue;
if (pkg->serial == client->serial)
{
pkgconf_node_delete(node, list);
pkgconf_dependency_unref(client, dep);
goto next;
}
if (dep->match == NULL)
if (pkg == NULL)
{
PKGCONF_TRACE(client, "WTF: unmatched dependency %p <%s>", dep, dep->package);
abort();
}
/* for virtuals, we need to check to see if there are dupes */
for (i = 0; i < dep_count; i++)
{
pkgconf_dependency_t *other_dep = deps[i];
PKGCONF_TRACE(client, "dedup %s = %s?", dep->package, other_dep->package);
if (!strcmp(dep->package, other_dep->package))
{
PKGCONF_TRACE(client, "skipping, "SIZE_FMT_SPECIFIER" deps", dep_count);
goto next;
}
}
pkg->serial = client->serial;
/* copy to the deps table */
dep_count++;
deps = pkgconf_reallocarray(deps, dep_count, sizeof (void *));
deps[dep_count - 1] = dep;
PKGCONF_TRACE(client, "added %s to dep table", dep->package);
next:
pkgconf_pkg_unref(client, pkg);
}
if (deps == NULL)
return;
qsort(deps, dep_count, sizeof (void *), dep_sort_cmp);
/* zero the list and start readding */
pkgconf_list_zero(list);
for (i = 0; i < dep_count; i++)
{
pkgconf_dependency_t *dep = deps[i];
if (dep->match == NULL)
if (pkg->serial == client->serial)
continue;
memset(&dep->iter, '\0', sizeof (dep->iter));
pkgconf_node_insert(&dep->iter, dep, list);
if (client->flags & PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE)
pkg->flags |= PKGCONF_PKG_PROPF_VISITED_PRIVATE;
else
pkg->flags &= ~PKGCONF_PKG_PROPF_VISITED_PRIVATE;
PKGCONF_TRACE(client, "slot "SIZE_FMT_SPECIFIER": dep %s matched to %p<%s> id "SIZE_FMT_SPECIFIER, i, dep->package, dep->match, dep->match->id, dep->match->identifier);
eflags |= pkgconf_queue_collect_dependencies_main(client, pkg, data, depth - 1);
flattened_dep = pkgconf_dependency_copy(client, dep);
pkgconf_node_insert(&flattened_dep->iter, flattened_dep, &world->required);
}
free(deps);
return eflags;
}
static unsigned int
pkgconf_queue_collect_dependencies_main(pkgconf_client_t *client,
pkgconf_pkg_t *root,
void *data,
int maxdepth)
{
unsigned int eflags = PKGCONF_PKG_ERRF_OK;
if (maxdepth == 0)
return eflags;
/* Short-circuit if we have already visited this node.
*/
if (root->serial == client->serial)
return eflags;
root->serial = client->serial;
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
{
PKGCONF_TRACE(client, "%s: collecting private dependencies, level %d", root->id, maxdepth);
/* XXX: ugly */
const unsigned int saved_flags = client->flags;
client->flags |= PKGCONF_PKG_PKGF_ITER_PKG_IS_PRIVATE;
eflags = pkgconf_queue_collect_dependencies_walk(client, &root->requires_private, data, maxdepth);
client->flags = saved_flags;
if (eflags != PKGCONF_PKG_ERRF_OK)
return eflags;
}
PKGCONF_TRACE(client, "%s: collecting public dependencies, level %d", root->id, maxdepth);
eflags = pkgconf_queue_collect_dependencies_walk(client, &root->required, data, maxdepth);
if (eflags != PKGCONF_PKG_ERRF_OK)
return eflags;
PKGCONF_TRACE(client, "%s: finished, %s", root->id, (root->flags & PKGCONF_PKG_PROPF_VISITED_PRIVATE) ? "private" : "public");
return eflags;
}
static inline unsigned int
pkgconf_queue_collect_dependencies(pkgconf_client_t *client,
pkgconf_pkg_t *root,
void *data,
int maxdepth)
{
++client->serial;
return pkgconf_queue_collect_dependencies_main(client, root, data, maxdepth);
}
static inline unsigned int
pkgconf_queue_verify(pkgconf_client_t *client, pkgconf_pkg_t *world, pkgconf_list_t *list, int maxdepth)
{
unsigned int result;
const unsigned int saved_flags = client->flags;
pkgconf_pkg_t initial_world = {
.id = "user:request",
.realname = "virtual world package",
.flags = PKGCONF_PKG_PROPF_STATIC | PKGCONF_PKG_PROPF_VIRTUAL,
};
if (!pkgconf_queue_compile(client, world, list))
if (!pkgconf_queue_compile(client, &initial_world, list))
{
pkgconf_solution_free(client, &initial_world);
return PKGCONF_PKG_ERRF_DEPGRAPH_BREAK;
}
/* collect all the dependencies */
result = pkgconf_pkg_traverse(client, world, pkgconf_queue_collect_dependents, world, maxdepth, 0);
PKGCONF_TRACE(client, "solving");
result = pkgconf_pkg_traverse(client, &initial_world, NULL, NULL, maxdepth, 0);
if (result != PKGCONF_PKG_ERRF_OK)
{
pkgconf_solution_free(client, &initial_world);
return result;
}
/* flatten the dependency set using serials.
* we copy the dependencies to a vector, and then erase the list.
* then we copy them back to the list.
*/
++client->serial;
PKGCONF_TRACE(client, "flattening");
result = pkgconf_queue_collect_dependencies(client, &initial_world, world, maxdepth);
if (result != PKGCONF_PKG_ERRF_OK)
{
pkgconf_solution_free(client, &initial_world);
return result;
}
PKGCONF_TRACE(client, "flattening requires deps");
flatten_dependency_set(client, &world->required);
if (client->flags & PKGCONF_PKG_PKGF_SEARCH_PRIVATE)
{
PKGCONF_TRACE(client, "marking public deps");
client->flags &= ~PKGCONF_PKG_PKGF_SEARCH_PRIVATE;
client->flags |= PKGCONF_PKG_PKGF_SKIP_CONFLICTS;
result = pkgconf_pkg_traverse(client, &initial_world, pkgconf_queue_mark_public, &world->required, maxdepth, 0);
client->flags = saved_flags;
if (result != PKGCONF_PKG_ERRF_OK)
{
pkgconf_solution_free(client, &initial_world);
return result;
}
}
++client->serial;
PKGCONF_TRACE(client, "flattening requires.private deps");
flatten_dependency_set(client, &world->requires_private);
/* free the initial solution */
pkgconf_solution_free(client, &initial_world);
return PKGCONF_PKG_ERRF_OK;
}

View File

@ -156,7 +156,7 @@ pkgconf_tuple_find_delete(pkgconf_list_t *list, const char *key)
static char *
dequote(const char *value)
{
char *buf = calloc((strlen(value) + 1) * 2, 1);
char *buf = calloc(1, (strlen(value) + 1) * 2);
char *bptr = buf;
const char *i;
char quote = 0;
@ -236,7 +236,7 @@ pkgconf_tuple_t *
pkgconf_tuple_add(const pkgconf_client_t *client, pkgconf_list_t *list, const char *key, const char *value, bool parse, unsigned int flags)
{
char *dequote_value;
pkgconf_tuple_t *tuple = calloc(sizeof(pkgconf_tuple_t), 1);
pkgconf_tuple_t *tuple = calloc(1, sizeof(pkgconf_tuple_t));
pkgconf_tuple_find_delete(list, key);

View File

@ -29,33 +29,12 @@
# Copyright (c) 2008 Guido U. Draheim <guidod@gmx.de>
# Copyright (c) 2011 Maarten Bosmans <mkbosmans@gmail.com>
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
# Free Software Foundation, either version 3 of the License, or (at your
# option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program. If not, see <https://www.gnu.org/licenses/>.
#
# As a special exception, the respective Autoconf Macro's copyright owner
# gives unlimited permission to copy, distribute and modify the configure
# scripts that are the output of Autoconf when processing the Macro. You
# need not follow the terms of the GNU General Public License when using
# or distributing such scripts, even though portions of the text of the
# Macro appear in them. The GNU General Public License (GPL) does govern
# all other use of the material that constitutes the Autoconf Macro.
#
# This special exception to the GPL applies to versions of the Autoconf
# Macro released by the Autoconf Archive. When you make and distribute a
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
# Copying and distribution of this file, with or without modification, are
# permitted in any medium without royalty provided the copyright notice
# and this notice are preserved. This file is offered as-is, without any
# warranty.
#serial 5
#serial 6
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
[AC_PREREQ(2.64)dnl for _AC_LANG_PREFIX and AS_VAR_IF

View File

@ -126,9 +126,10 @@ All dependencies must be satisfied or the pkg-config implementation must not use
the package.
(optional; dependency list)
.It Requires.private
Required dependencies that must be met for the package to be usable for static linking.
Required dependencies that must be met for the package to be usable for header
inclusion and static linking.
All dependencies must be satisfied or the pkg-config implementation must not use
the package for static linking.
the package for header inclusion and static linking.
(optional; dependency list)
.It Conflicts
Dependencies that must not be met for the package to be usable.

View File

@ -1,5 +1,5 @@
project('pkgconf', 'c',
version : '2.0.2',
version : '2.2.0',
license : 'ISC',
meson_version : '>=0.49',
default_options : ['c_std=c99'],
@ -49,8 +49,18 @@ foreach f : ['libdir', 'datadir']
personality_path += [join_paths(get_option('prefix'), get_option(f), 'pkgconfig', 'personality.d')]
endforeach
cdata.set_quoted('SYSTEM_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
cdata.set_quoted('SYSTEM_INCLUDEDIR', join_paths(get_option('prefix'), get_option('includedir')))
SYSTEM_LIBDIR = get_option('with-system-libdir')
if SYSTEM_LIBDIR != ''
cdata.set_quoted('SYSTEM_LIBDIR', SYSTEM_LIBDIR)
else
cdata.set_quoted('SYSTEM_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
endif
SYSTEM_INCLUDEDIR = get_option('with-system-includedir')
if SYSTEM_INCLUDEDIR != ''
cdata.set_quoted('SYSTEM_INCLUDEDIR', SYSTEM_INCLUDEDIR)
else
cdata.set_quoted('SYSTEM_INCLUDEDIR', join_paths(get_option('prefix'), get_option('includedir')))
endif
cdata.set_quoted('PKG_DEFAULT_PATH', ':'.join(default_path))
cdata.set_quoted('PERSONALITY_PATH', ':'.join(personality_path))
cdata.set_quoted('PACKAGE_NAME', meson.project_name())
@ -86,8 +96,8 @@ libpkgconf = library('pkgconf',
'libpkgconf/tuple.c',
c_args: ['-DLIBPKGCONF_EXPORT', build_static],
install : true,
version : '4.0.0',
soversion : '4',
version : '5.0.0',
soversion : '5',
)
# For other projects using libpkgconfig as a subproject

View File

@ -3,3 +3,17 @@ option(
type: 'feature',
description: 'Build tests which depends upon the kyua framework',
)
option(
'with-system-libdir',
type: 'string',
value: '',
description: 'Specify the system library directory (default {prefix}/{libdir})'
)
option(
'with-system-includedir',
type: 'string',
value: '',
description: 'Specify the system include directory (default {prefix}/{includedir})'
)

13
pkg.m4
View File

@ -46,8 +46,8 @@ 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])])
])dnl PKG_PREREQ
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION])
dnl ----------------------------------
dnl PKG_PROG_PKG_CONFIG([MIN-VERSION], [ACTION-IF-NOT-FOUND])
dnl ---------------------------------------------------------
dnl Since: 0.16
dnl
dnl Search for the pkg-config tool and set the PKG_CONFIG variable to
@ -55,6 +55,12 @@ dnl first found in the path. Checks that the version of pkg-config found
dnl is at least MIN-VERSION. If MIN-VERSION is not specified, 0.9.0 is
dnl used since that's the first version where most current features of
dnl pkg-config existed.
dnl
dnl If pkg-config is not found or older than specified, it will result
dnl in an empty PKG_CONFIG variable. To avoid widespread issues with
dnl scripts not checking it, ACTION-IF-NOT-FOUND defaults to aborting.
dnl You can specify [PKG_CONFIG=false] as an action instead, which would
dnl result in pkg-config tests failing, but no bogus error messages.
AC_DEFUN([PKG_PROG_PKG_CONFIG],
[m4_pattern_forbid([^_?PKG_[A-Z_]+$])
m4_pattern_allow([^PKG_CONFIG(_(PATH|LIBDIR|SYSROOT_DIR|ALLOW_SYSTEM_(CFLAGS|LIBS)))?$])
@ -75,6 +81,9 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
fi
if test -z "$PKG_CONFIG"; then
m4_default([$2], [AC_MSG_ERROR([pkg-config not found])])
fi[]dnl
])dnl PKG_PROG_PKG_CONFIG

View File

@ -29,6 +29,7 @@ tests_init \
libs_circular_directpc \
libs_static \
libs_static_ordering \
libs_metapackage \
license_isc \
license_noassertion \
modversion_noflatten \
@ -230,7 +231,7 @@ libs_circular1_body()
libs_circular_directpc_body()
{
atf_check \
-o inline:"-lcircular-2 -lcircular-3 -lcircular-1\n" \
-o inline:"-lcircular-3 -lcircular-1 -lcircular-2\n" \
pkgconf --libs ${selfdir}/lib1/circular-3.pc
}
@ -250,6 +251,14 @@ libs_static_ordering_body()
pkgconf --libs foo bar
}
libs_metapackage_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib -lbar -lfoo\n" \
pkgconf --static --libs metapackage-3
}
pkg_config_path_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1${PATH_SEP}${selfdir}/lib2"

12
tests/lib1/foobar.pc Normal file
View File

@ -0,0 +1,12 @@
prefix=/test
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: foobar
Description: A testing pkg-config file
Version: 3.2.1
Libs: -L${libdir} -lfoobar
Cflags: -fPIC -I${includedir}/foobar
Cflags.private: -DFOOBAR_STATIC
License: ISC

View File

@ -0,0 +1,4 @@
Name: metapackage-3
Version: 0.1
Description: metapackage for testing purposes
Requires.private: bar

View File

@ -0,0 +1,11 @@
prefix=/test
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: unavailable_provider
Description: Provides an otherwise unavailable package
Version: 1.2.3
Provides: unavailable = 1.2.3
Libs: -lunavailable
Cflags:

View File

@ -23,7 +23,13 @@ tests_init \
idirafter_munge_order \
idirafter_munge_sysroot \
idirafter_ordering \
modversion_common_prefix \
modversion_fullpath \
modversion_provides \
modversion_uninstalled \
modversion_one_word_expression \
modversion_two_word_expression \
modversion_three_word_expression \
pcpath \
virtual_variable \
fragment_collision \
@ -275,8 +281,44 @@ billion_laughs_body()
pkgconf --with-path="${selfdir}/lib1" --validate billion-laughs
}
modversion_common_prefix_body()
{
atf_check -o inline:"foo: 1.2.3\nfoobar: 3.2.1\n" \
pkgconf --with-path="${selfdir}/lib1" --modversion --verbose foo foobar
}
modversion_fullpath_body()
{
atf_check -o inline:"1.2.3\n" \
pkgconf --modversion "${selfdir}/lib1/foo.pc"
}
modversion_provides_body()
{
atf_check -o inline:"1.2.3\n" \
pkgconf --with-path="${selfdir}/lib1" --modversion unavailable
}
modversion_uninstalled_body()
{
atf_check -o inline:"1.2.3\n" \
pkgconf --with-path="${selfdir}/lib1" --modversion omg
}
modversion_one_word_expression_body()
{
atf_check -o inline:"1.2.3\n" \
pkgconf --with-path="${selfdir}/lib1" --modversion "foo > 1.0"
}
modversion_two_word_expression_body()
{
atf_check -o inline:"1.2.3\n" \
pkgconf --with-path="${selfdir}/lib1" --modversion foo "> 1.0"
}
modversion_three_word_expression_body()
{
atf_check -o inline:"1.2.3\n" \
pkgconf --with-path="${selfdir}/lib1" --modversion foo ">" 1.0
}

View File

@ -10,6 +10,10 @@ tests_init \
argv_parse2 \
static_cflags \
private_duplication \
private_duplication_digraph \
foo_bar \
bar_foo \
foo_metapackage_3 \
libs_static2 \
missing \
requires_internal \
@ -37,7 +41,7 @@ libs_static_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib -lbaz -L/test/lib -lzee -L/test/lib -lfoo\n" \
-o inline:"-L/test/lib -lbaz -L/test/lib -lzee -lfoo\n" \
pkgconf --static --libs baz
}
@ -45,7 +49,7 @@ libs_static_pure_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-L/test/lib -lbaz -L/test/lib -lfoo\n" \
-o inline:"-L/test/lib -lbaz -lfoo\n" \
pkgconf --static --pure --libs baz
}
@ -69,10 +73,46 @@ private_duplication_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lprivate -lbaz -lzee -lbar -lfoo -lfoo\n" \
-o inline:"-lprivate -lbaz -lzee -lbar -lfoo\n" \
pkgconf --static --libs-only-l private-libs-duplication
}
private_duplication_digraph_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o 'match:"user:request" -> "private-libs-duplication"' \
-o 'match:"private-libs-duplication" -> "bar"' \
-o 'match:"private-libs-duplication" -> "baz"' \
-o 'match:"bar" -> "foo"' \
-o 'match:"baz" -> "foo"' \
pkgconf --static --libs-only-l private-libs-duplication --digraph
}
bar_foo_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lbar -lfoo\n" \
pkgconf --static --libs-only-l bar foo
}
foo_bar_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lbar -lfoo\n" \
pkgconf --static --libs-only-l foo bar
}
foo_metapackage_3_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"
atf_check \
-o inline:"-lbar -lfoo\n" \
pkgconf --static --libs-only-l foo metapackage-3
}
libs_static2_body()
{
export PKG_CONFIG_PATH="${selfdir}/lib1"