2008-03-23 Tollef Fog Heen <tfheen@err.no>

* 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.
This commit is contained in:
Tollef Fog Heen 2008-03-23 21:39:07 +01:00
parent 15e72cef72
commit 69dafea1c8
6 changed files with 35 additions and 5 deletions

View file

@ -1,5 +1,12 @@
2008-03-23 Tollef Fog Heen <tfheen@err.no>
* 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,

View file

@ -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

16
check/check-conflicts Executable file
View file

@ -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

6
check/conflicts-test.pc Normal file
View file

@ -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

View file

@ -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

7
pkg.c
View file

@ -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",