forked from ariadne/pkgconf
pkg: fill in a lot of the fuzzy matching stuff (but some of it may be wrong, needs to be looked at)
parent
7c0264ac7a
commit
892a03cd8c
|
@ -892,6 +892,7 @@ typedef struct {
|
||||||
typedef struct {
|
typedef struct {
|
||||||
const pkgconf_vercmp_res_func_t depcmp;
|
const pkgconf_vercmp_res_func_t depcmp;
|
||||||
const pkgconf_vercmp_res_func_t rulecmp[PKGCONF_CMP_COUNT];
|
const pkgconf_vercmp_res_func_t rulecmp[PKGCONF_CMP_COUNT];
|
||||||
|
const bool check_a[PKGCONF_CMP_COUNT];
|
||||||
} pkgconf_pkg_provides_vermatch_rule_t;
|
} pkgconf_pkg_provides_vermatch_rule_t;
|
||||||
|
|
||||||
static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_rules[] = {
|
static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_rules[] = {
|
||||||
|
@ -909,7 +910,13 @@ static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_
|
||||||
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
||||||
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
||||||
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
||||||
}
|
},
|
||||||
|
.check_a = {
|
||||||
|
[PKGCONF_CMP_GREATER_THAN] = true,
|
||||||
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_NOT_EQUAL] = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
[PKGCONF_CMP_GREATER_THAN] = {
|
[PKGCONF_CMP_GREATER_THAN] = {
|
||||||
.depcmp = pkgconf_pkg_comparator_gt,
|
.depcmp = pkgconf_pkg_comparator_gt,
|
||||||
|
@ -921,7 +928,13 @@ static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_
|
||||||
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
||||||
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
||||||
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
||||||
}
|
},
|
||||||
|
.check_a = {
|
||||||
|
[PKGCONF_CMP_LESS_THAN] = true,
|
||||||
|
[PKGCONF_CMP_LESS_THAN_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_NOT_EQUAL] = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
[PKGCONF_CMP_LESS_THAN_EQUAL] = {
|
[PKGCONF_CMP_LESS_THAN_EQUAL] = {
|
||||||
.depcmp = pkgconf_pkg_comparator_lte,
|
.depcmp = pkgconf_pkg_comparator_lte,
|
||||||
|
@ -933,7 +946,13 @@ static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_
|
||||||
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
||||||
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
||||||
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
||||||
}
|
},
|
||||||
|
.check_a = {
|
||||||
|
[PKGCONF_CMP_GREATER_THAN] = true,
|
||||||
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_NOT_EQUAL] = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
[PKGCONF_CMP_GREATER_THAN_EQUAL] = {
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = {
|
||||||
.depcmp = pkgconf_pkg_comparator_gte,
|
.depcmp = pkgconf_pkg_comparator_gte,
|
||||||
|
@ -945,7 +964,13 @@ static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_
|
||||||
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
||||||
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
||||||
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
||||||
}
|
},
|
||||||
|
.check_a = {
|
||||||
|
[PKGCONF_CMP_LESS_THAN] = true,
|
||||||
|
[PKGCONF_CMP_LESS_THAN_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_EQUAL] = true,
|
||||||
|
[PKGCONF_CMP_NOT_EQUAL] = true,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
[PKGCONF_CMP_EQUAL] = {
|
[PKGCONF_CMP_EQUAL] = {
|
||||||
.depcmp = pkgconf_pkg_comparator_eq,
|
.depcmp = pkgconf_pkg_comparator_eq,
|
||||||
|
@ -963,12 +988,12 @@ static const pkgconf_pkg_provides_vermatch_rule_t pkgconf_pkg_provides_vermatch_
|
||||||
.depcmp = pkgconf_pkg_comparator_ne,
|
.depcmp = pkgconf_pkg_comparator_ne,
|
||||||
.rulecmp = {
|
.rulecmp = {
|
||||||
[PKGCONF_CMP_ANY] = pkgconf_pkg_comparator_none,
|
[PKGCONF_CMP_ANY] = pkgconf_pkg_comparator_none,
|
||||||
[PKGCONF_CMP_LESS_THAN] = pkgconf_pkg_comparator_lt,
|
[PKGCONF_CMP_LESS_THAN] = pkgconf_pkg_comparator_ne,
|
||||||
[PKGCONF_CMP_GREATER_THAN] = pkgconf_pkg_comparator_gt,
|
[PKGCONF_CMP_GREATER_THAN] = pkgconf_pkg_comparator_ne,
|
||||||
[PKGCONF_CMP_LESS_THAN_EQUAL] = pkgconf_pkg_comparator_lte,
|
[PKGCONF_CMP_LESS_THAN_EQUAL] = pkgconf_pkg_comparator_ne,
|
||||||
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_gte,
|
[PKGCONF_CMP_GREATER_THAN_EQUAL] = pkgconf_pkg_comparator_ne,
|
||||||
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_any,
|
[PKGCONF_CMP_EQUAL] = pkgconf_pkg_comparator_ne,
|
||||||
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_ne
|
[PKGCONF_CMP_NOT_EQUAL] = pkgconf_pkg_comparator_eq
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -988,7 +1013,7 @@ pkgconf_pkg_scan_provides_vercmp(const pkgconf_dependency_t *pkgdep, const pkgco
|
||||||
if (rule == NULL)
|
if (rule == NULL)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!rule->depcmp(provider->version, pkgdep->version))
|
if (rule->check_a[provider->compare] && !rule->depcmp(provider->version, pkgdep->version))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (rule->rulecmp[provider->compare] != NULL &&
|
if (rule->rulecmp[provider->compare] != NULL &&
|
||||||
|
|
|
@ -3,4 +3,4 @@ Description: A testing pkg-config file
|
||||||
Version: 1.2.3
|
Version: 1.2.3
|
||||||
Libs: -lfoo
|
Libs: -lfoo
|
||||||
Cflags: -I/usr/include/foo
|
Cflags: -I/usr/include/foo
|
||||||
Provides: provides-test-foo = 1.0.0, provides-test-baz >= 1.1.0, provides-test-moo <= 1.2.0
|
Provides: provides-test-foo = 1.0.0, provides-test-bar > 1.1.0, provides-test-baz >= 1.1.0, provides-test-quux < 1.2.0, provides-test-moo <= 1.2.0
|
||||||
|
|
|
@ -316,6 +316,105 @@ run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-foo > 1.0
|
||||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-foo < 1.0.0'; echo \$?" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-foo < 1.0.0'; echo \$?" \
|
||||||
"1"
|
"1"
|
||||||
|
|
||||||
|
# provides-test-bar > 1.1.0
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar = 1.1.1'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar >= 1.1.1'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar <= 1.1.1'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar != 1.1.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar != 1.1.1'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar > 1.1.1'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar <= 1.1.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar < 1.2.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-bar > 1.2.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
|
||||||
|
# provides-test-baz >= 1.1.0
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz = 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz >= 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz <= 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz != 1.1.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz != 1.0.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz > 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz < 1.1.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-baz < 1.2.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
|
||||||
|
# provides-test-quux < 1.2.0
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux = 1.1.9'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux >= 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux >= 1.1.9'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux >= 1.2.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux <= 1.2.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux <= 1.1.9'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux != 1.2.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux != 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux != 1.0.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux > 1.1.9'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux > 1.2.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux < 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-quux < 1.2.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
|
||||||
|
# provides-test-moo <= 1.2.0
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo = 1.2.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo >= 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo >= 1.2.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo >= 1.2.1'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo <= 1.2.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo != 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo != 1.0.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo > 1.1.9'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo > 1.2.0'; echo \$?" \
|
||||||
|
"1"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo < 1.1.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} --libs 'provides-test-moo < 1.2.0'; echo \$?" \
|
||||||
|
"0"
|
||||||
|
|
||||||
|
|
||||||
# 11) tests for internal getopt implementation with options at the end
|
# 11) tests for internal getopt implementation with options at the end
|
||||||
if [ "x@STRICT_MODE@" = "xno" ]; then
|
if [ "x@STRICT_MODE@" = "xno" ]; then
|
||||||
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} foo --libs" \
|
run_test "PKG_CONFIG_PATH='${selfdir}/lib1' ${1} foo --libs" \
|
||||||
|
|
Loading…
Reference in New Issue