diff options
author | Richard Hughes <richard@hughsie.com> | 2018-02-21 13:14:51 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2018-02-21 13:14:53 +0000 |
commit | c688b5e0a66927907ed3e1f8c4b6acbfa2c60374 (patch) | |
tree | 272bd0de8c40347e768ec651375fff7ff7768e03 /libappstream-glib | |
parent | 92487d5e9e3cb01233d2bb7267c4071f3ac953e3 (diff) | |
download | appstream-glib-c688b5e0a66927907ed3e1f8c4b6acbfa2c60374.tar.gz |
Do not fail to validate if the timestamps are out of order
If we use the same metainfo.xml file for unstable and stable releases we can't
sort by 'version' *and* 'timestamp'. Pick the former so versions from the same
branch can be grouped together.
Fixes https://github.com/hughsie/appstream-glib/issues/222
Diffstat (limited to 'libappstream-glib')
-rw-r--r-- | libappstream-glib/as-app-validate.c | 20 | ||||
-rw-r--r-- | libappstream-glib/as-self-test.c | 6 |
2 files changed, 2 insertions, 24 deletions
diff --git a/libappstream-glib/as-app-validate.c b/libappstream-glib/as-app-validate.c index 70c4920..efb76a2 100644 --- a/libappstream-glib/as-app-validate.c +++ b/libappstream-glib/as-app-validate.c @@ -953,26 +953,6 @@ as_app_validate_releases (AsApp *app, AsAppValidateHelper *helper, GError **erro } } - /* check the timestamps go down each time */ - if (releases->len > 1) { - AsRelease *release_old = g_ptr_array_index (releases, 0); - for (guint i = 1; i < releases->len; i++) { - AsRelease *release = g_ptr_array_index (releases, i); - guint64 timestamp = as_release_get_timestamp (release); - guint64 timestamp_old = as_release_get_timestamp (release_old); - if (timestamp == 0 || timestamp_old == 0) - continue; - if (timestamp > timestamp_old) { - ai_app_validate_add (helper, - AS_PROBLEM_KIND_TAG_INVALID, - "<release> timestamps are not in order " - "[%" G_GUINT64_FORMAT " before %" G_GUINT64_FORMAT "]", - timestamp_old, timestamp); - } - release_old = release; - } - } - return TRUE; } diff --git a/libappstream-glib/as-self-test.c b/libappstream-glib/as-self-test.c index fb4ccf8..d5fa597 100644 --- a/libappstream-glib/as-self-test.c +++ b/libappstream-glib/as-self-test.c @@ -2194,8 +2194,6 @@ as_test_app_validate_file_bad_func (void) as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_INVALID, "<release> versions are not in order"); as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_INVALID, - "<release> timestamps are not in order"); - as_test_app_validate_check (probs, AS_PROBLEM_KIND_TAG_INVALID, "<release> version was duplicated"); as_test_app_validate_check (probs, AS_PROBLEM_KIND_ATTRIBUTE_INVALID, "<release> timestamp is in the future"); @@ -2203,7 +2201,7 @@ as_test_app_validate_file_bad_func (void) "<content_rating> required for game"); as_test_app_validate_check (probs, AS_PROBLEM_KIND_MARKUP_INVALID, "<id> has invalid character"); - g_assert_cmpint (probs->len, ==, 35); + g_assert_cmpint (probs->len, ==, 34); /* again, harder */ probs2 = as_app_validate (app, AS_APP_VALIDATE_FLAG_STRICT, &error); @@ -2211,7 +2209,7 @@ as_test_app_validate_file_bad_func (void) g_assert (probs2 != NULL); as_test_app_validate_check (probs2, AS_PROBLEM_KIND_TAG_INVALID, "XML data contains unknown tag"); - g_assert_cmpint (probs2->len, ==, 41); + g_assert_cmpint (probs2->len, ==, 40); } static void |