pluginfeature: fix unexpected version check behaviour for git versions

check_version(1.23.1) would return TRUE for a git development version
like 1.23.0.1, which is quite confusing and somewhat unexpected.

We fixed this up in the version check macros already in !2501, so this
updates the run-time check accordingly as well.

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4513>
This commit is contained in:
Tim-Philipp Müller 2023-04-29 12:16:09 +01:00 committed by GStreamer Marge Bot
parent 66c15bc753
commit f64acbf9e5
3 changed files with 17 additions and 19 deletions

View file

@ -33400,8 +33400,13 @@ ranks are equal but the name of p2 comes before the name of p1</doc>
</parameters>
</function>
<method name="check_version" c:identifier="gst_plugin_feature_check_version">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpluginfeature.c">Checks whether the given plugin feature is at least
the required version</doc>
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpluginfeature.c">Checks whether the given plugin feature is at least the required version.
Note: Since version 1.24 this function no longer returns %TRUE if the
version is a git development version (e.g. 1.23.0.1) and the check is
for the "next" micro version, that is it will no longer return %TRUE for
e.g. 1.23.0.1 if the check is for 1.23.1. It is still possible to parse
the nano version from the string and do this check that way if needed.</doc>
<source-position filename="../subprojects/gstreamer/gst/gstpluginfeature.h"/>
<return-value transfer-ownership="none">
<doc xml:space="preserve" filename="../subprojects/gstreamer/gst/gstpluginfeature.c">%TRUE if the plugin feature has at least

View file

@ -310,8 +310,13 @@ gst_plugin_feature_list_debug (GList * list)
* @min_minor: minimum required minor version
* @min_micro: minimum required micro version
*
* Checks whether the given plugin feature is at least
* the required version
* Checks whether the given plugin feature is at least the required version.
*
* Note: Since version 1.24 this function no longer returns %TRUE if the
* version is a git development version (e.g. 1.23.0.1) and the check is
* for the "next" micro version, that is it will no longer return %TRUE for
* e.g. 1.23.0.1 if the check is for 1.23.1. It is still possible to parse
* the nano version from the string and do this check that way if needed.
*
* Returns: %TRUE if the plugin feature has at least
* the required version, otherwise %FALSE.
@ -355,10 +360,6 @@ gst_plugin_feature_check_version (GstPluginFeature * feature,
ret = FALSE;
else if (micro > min_micro)
ret = TRUE;
/* micro is 1 smaller but we have a nano version, this is the upcoming
* release of the requested version and we're ok then */
else if (nscan == 4 && nano > 0 && (micro + 1 == min_micro))
ret = TRUE;
else
ret = (micro == min_micro);

View file

@ -267,17 +267,9 @@ GST_START_TEST (test_version_checks)
GST_VERSION_MAJOR, GST_VERSION_MINOR + 1, GST_VERSION_MICRO) == TRUE,
"Unexpected version check result");
/* If the nano is set, then we expect that X.Y.Z-1.x >= X.Y.Z, so that a
* devel plugin is valid against an upcoming release */
if (GST_VERSION_NANO > 0) {
fail_unless (gst_default_registry_check_feature_version ("identity",
GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO + 1) ==
TRUE, "Unexpected version check result");
} else {
fail_if (gst_default_registry_check_feature_version ("identity",
GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO + 1) ==
TRUE, "Unexpected version check result");
}
fail_if (gst_default_registry_check_feature_version ("identity",
GST_VERSION_MAJOR, GST_VERSION_MINOR, GST_VERSION_MICRO + 1) ==
TRUE, "Unexpected version check result");
if (GST_VERSION_MAJOR > 0) {
fail_if (gst_default_registry_check_feature_version ("identity",