%check: pull in upstream fixes

This commit is contained in:
Rex Dieter 2016-08-18 10:59:26 -05:00
parent 33d8738c70
commit f16631d58a
3 changed files with 121 additions and 3 deletions

View File

@ -0,0 +1,61 @@
From 342a3f02d92421d6cc8d6b5f41db672396b94671 Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Thu, 11 Aug 2016 03:50:36 +0200
Subject: [PATCH 05/34] Resolve unit test failures on arm and mips
Printing guint64 values doesn't work the same on all platforms and was
wrongly implemented.
Good that we have unit tests!
This should resolve the issue in a (mostly) portable way.
---
src/as-xmldata.c | 4 ++--
src/as-yamldata.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/as-xmldata.c b/src/as-xmldata.c
index 465aed5..2ad2929 100644
--- a/src/as-xmldata.c
+++ b/src/as-xmldata.c
@@ -600,7 +600,7 @@ as_xmldata_process_releases_tag (AsXMLData *xdt, xmlNode *node, AsComponent *cpt
prop = (gchar*) xmlGetProp (iter, (xmlChar*) "timestamp");
if (prop != NULL) {
- timestamp = g_ascii_strtoll (prop, NULL, 10);
+ timestamp = atol (prop);
as_release_set_timestamp (release, timestamp);
g_free (prop);
}
@@ -1396,7 +1396,7 @@ as_xmldata_add_release_subnodes (AsXMLData *xdt, AsComponent *cpt, xmlNode *root
g_autofree gchar *time_str = NULL;
if (priv->mode == AS_PARSER_MODE_DISTRO) {
- time_str = g_strdup_printf ("%ld", unixtime);
+ time_str = g_strdup_printf ("%" G_GUINT64_FORMAT, unixtime);
xmlNewProp (subnode, (xmlChar*) "timestamp",
(xmlChar*) time_str);
} else {
diff --git a/src/as-yamldata.c b/src/as-yamldata.c
index 91b54f9..847dbae 100644
--- a/src/as-yamldata.c
+++ b/src/as-yamldata.c
@@ -679,7 +679,7 @@ as_yamldata_process_releases (AsYAMLData *ydt, GNode *node, AsComponent *cpt)
value = as_yaml_node_get_value (n);
if (g_strcmp0 (key, "unix-timestamp") == 0) {
- as_release_set_timestamp (rel, g_ascii_strtoll (value, NULL, 10));
+ as_release_set_timestamp (rel, atol (value));
} else if (g_strcmp0 (key, "date") == 0) {
g_autoptr(GDateTime) time;
time = as_iso8601_to_datetime (value);
@@ -1639,7 +1639,7 @@ as_yaml_data_emit_releases (AsYAMLData *ydt, yaml_emitter_t *emitter, AsComponen
g_autofree gchar *time_str = NULL;
if (priv->mode == AS_PARSER_MODE_DISTRO) {
- time_str = g_strdup_printf ("%ld", unixtime);
+ time_str = g_strdup_printf ("%" G_GUINT64_FORMAT, unixtime);
as_yaml_emit_entry (emitter, "unix-timestamp", time_str);
} else {
GTimeVal time;
--
2.7.4

View File

@ -0,0 +1,53 @@
From b54e9a0845b3db186a01a9227b89ee793fd1eab2 Mon Sep 17 00:00:00 2001
From: Matthias Klumpp <matthias@tenstral.net>
Date: Tue, 16 Aug 2016 19:11:26 +0200
Subject: [PATCH 30/34] Fix test failures on 32bit architectures
---
src/as-xmldata.c | 2 +-
tests/test-xmldata.c | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/as-xmldata.c b/src/as-xmldata.c
index ae73dc6..7686bdf 100644
--- a/src/as-xmldata.c
+++ b/src/as-xmldata.c
@@ -1423,7 +1423,7 @@ as_xmldata_add_release_subnodes (AsXMLData *xdt, AsComponent *cpt, xmlNode *root
releases = as_component_get_releases (cpt);
for (i = 0; i < releases->len; i++) {
xmlNode *subnode;
- glong unixtime;
+ guint64 unixtime;
GPtrArray *locations;
guint j;
release = (AsRelease*) g_ptr_array_index (releases, i);
diff --git a/tests/test-xmldata.c b/tests/test-xmldata.c
index 83735a7..0fa7f02 100644
--- a/tests/test-xmldata.c
+++ b/tests/test-xmldata.c
@@ -380,11 +380,11 @@ test_appstream_write_description ()
"de");
tmp = as_metadata_component_to_upstream_xml (metad);
- g_assert_cmpstr (tmp, ==, EXPECTED_XML_LOCALIZED);
+ g_assert (as_test_compare_lines (tmp, EXPECTED_XML_LOCALIZED));
g_free (tmp);
tmp = as_metadata_components_to_distro_xml (metad);
- g_assert_cmpstr (tmp, ==, EXPECTED_XML_DISTRO);
+ g_assert (as_test_compare_lines (tmp, EXPECTED_XML_DISTRO));
g_free (tmp);
}
@@ -492,7 +492,7 @@ test_xml_write_languages (void)
as_component_add_language (cpt, "en_GB", 98);
res = as_xml_test_serialize (cpt, AS_PARSER_MODE_UPSTREAM);
- g_assert_cmpstr (res, ==, expected_lang_xml);
+ g_assert (as_test_compare_lines (res, expected_lang_xml));
}
/**
--
2.7.4

View File

@ -5,7 +5,7 @@
Summary: Utilities to generate, maintain and access the AppStream Xapian database
Name: appstream
Version: 0.9.8
Release: 2%{?dist}
Release: 3%{?dist}
# lib LGPLv2+, tools GPLv2+
License: GPLv2+ and LGPLv2+
@ -14,6 +14,8 @@ URL: https://github.com/ximion/appstream
Source0: http://www.freedesktop.org/software/appstream/releases/AppStream-%{version}.tar.xz
## upstream patches
Patch5: 0005-Resolve-unit-test-failures-on-arm-and-mips.patch
Patch30: 0030-Fix-test-failures-on-32bit-architectures.patch
## upstreamable patches
@ -96,8 +98,7 @@ touch %{buildroot}/var/cache/app-info/cache.watch
%check
# FIXME: test-yaml failing on arm
make test -C %{_target_platform} ARGS="--output-on-failure --timeout 300" ||:
make test -C %{_target_platform} ARGS="--output-on-failure --timeout 300"
%post -p /sbin/ldconfig
@ -160,6 +161,9 @@ make test -C %{_target_platform} ARGS="--output-on-failure --timeout 300" ||:
%changelog
* Thu Aug 18 2016 Rex Dieter <rdieter@fedoraproject.org> - 0.9.8-3
- %%check: pull in upstream fixes
* Wed Aug 17 2016 Rex Dieter <rdieter@fedoraproject.org> - 0.9.8-2
- (re)enable vala support (#1367892)