From 69dafea1c8f4737b51e32ac1b9427076c70728c1 Mon Sep 17 00:00:00 2001 From: Tollef Fog Heen Date: Sun, 23 Mar 2008 21:39:07 +0100 Subject: [PATCH] 2008-03-23 Tollef Fog Heen * check/check-conflicts, check/conflicts-test.pc: New test, testing that conflicts work as they should. * pkg.c (verify_package): Make the conflicts check not only check package versions, but also package names. This makes conflicts functional, something they were not before. --- ChangeLog | 7 +++++++ check/Makefile.am | 3 ++- check/check-conflicts | 16 ++++++++++++++++ check/conflicts-test.pc | 6 ++++++ check/public-dep.pc | 1 - pkg.c | 7 ++++--- 6 files changed, 35 insertions(+), 5 deletions(-) create mode 100755 check/check-conflicts create mode 100644 check/conflicts-test.pc diff --git a/ChangeLog b/ChangeLog index 56012ca..df3374c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,12 @@ 2008-03-23 Tollef Fog Heen + * check/check-conflicts, check/conflicts-test.pc: New test, + testing that conflicts work as they should. + + * pkg.c (verify_package): Make the conflicts check not only check + package versions, but also package names. This makes conflicts + functional, something they were not before. + * check/check-requires-private: Remove unnecessary set -x * check/check-cflags, check/check-define-variable, diff --git a/check/Makefile.am b/check/Makefile.am index df199c7..772c8ad 100644 --- a/check/Makefile.am +++ b/check/Makefile.am @@ -1,6 +1,7 @@ TESTS = check-cflags check-libs check-define-variable \ - check-libs-private check-requires-private check-includedir + check-libs-private check-requires-private check-includedir \ + check-conflicts EXTRA_DIST = $(TESTS) common simple.pc requires-test.pc public-dep.pc \ private-dep.pc includedir.pc diff --git a/check/check-conflicts b/check/check-conflicts new file mode 100755 index 0000000..8092ba9 --- /dev/null +++ b/check/check-conflicts @@ -0,0 +1,16 @@ +#! /bin/sh + +# Make sure we're POSIX +if [ "$PKG_CONFIG_SHELL_IS_POSIX" != "1" ]; then + PKG_CONFIG_SHELL_IS_POSIX=1 PATH=`getconf PATH` exec sh $0 "$@" +fi + +set -e + +. ${srcdir}/common + +ARGS="--libs conflicts-test" +RESULT="-L/public-dep/lib -lpublic-dep" + +run_test + diff --git a/check/conflicts-test.pc b/check/conflicts-test.pc new file mode 100644 index 0000000..aadebf0 --- /dev/null +++ b/check/conflicts-test.pc @@ -0,0 +1,6 @@ +Name: Conflicts test package +Description: Dummy pkgconfig test package for testing Conflicts +Version: 1.0.0 +Requires: public-dep +Conflicts: simple + diff --git a/check/public-dep.pc b/check/public-dep.pc index 7350e5d..66af831 100644 --- a/check/public-dep.pc +++ b/check/public-dep.pc @@ -3,4 +3,3 @@ Description: Dummy pkgconfig test package for testing Requires/Requires.private Version: 1.0.0 Libs: -L/public-dep/lib -lpublic-dep Cflags: -I/public-dep/include - diff --git a/pkg.c b/pkg.c index 540d793..0d750fd 100644 --- a/pkg.c +++ b/pkg.c @@ -842,9 +842,10 @@ verify_package (Package *pkg) { RequiredVersion *ver = conflicts_iter->data; - if (version_test (ver->comparison, - req->version, - ver->version)) + if (strcmp (ver->name, req->key) == 0 && + version_test (ver->comparison, + req->version, + ver->version)) { verbose_error ("Version %s of %s creates a conflict.\n" "(%s %s %s conflicts with %s %s)\n", -- 2.39.5