summaryrefslogtreecommitdiff
path: root/libappstream-builder/asb-self-test.c
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2015-08-10 13:54:49 +0100
committerRichard Hughes <richard@hughsie.com>2015-08-10 18:04:19 +0100
commit93f1a4b5ab2e6d80d66027cd80edef4dabe45b24 (patch)
tree3bcd724792e600fb629fc605ed166b0f9eb08e74 /libappstream-builder/asb-self-test.c
parent4695568085f77599355804fa79dfb9ae7e12a182 (diff)
downloadappstream-glib-93f1a4b5ab2e6d80d66027cd80edef4dabe45b24.tar.gz
Add support for the flashed firmware provide kind
This allows us to have an ID that isn't tied to the GUID, and also allows us to have one component that targets more than one ESRT GUID. This requires changing the matching logic better, but should match what makes it into AppStream 0.9
Diffstat (limited to 'libappstream-builder/asb-self-test.c')
-rw-r--r--libappstream-builder/asb-self-test.c66
1 files changed, 36 insertions, 30 deletions
diff --git a/libappstream-builder/asb-self-test.c b/libappstream-builder/asb-self-test.c
index e48dd83..45e7092 100644
--- a/libappstream-builder/asb-self-test.c
+++ b/libappstream-builder/asb-self-test.c
@@ -416,30 +416,6 @@ asb_test_context_test_func (AsbTestContextMode mode)
xml = as_store_to_xml (store, AS_NODE_TO_XML_FLAG_FORMAT_MULTILINE);
expected_xml =
"<components version=\"0.9\" builder_id=\"appstream-glib:4\" origin=\"asb-self-test\">\n"
- "<component type=\"firmware\">\n"
- "<id>84f40464-9272-4ef7-9399-cd95f12da696</id>\n"
- "<name>ColorHug Firmware</name>\n"
- "<summary>Firmware for the ColorHug Colorimeter</summary>\n"
- "<developer_name>Hughski</developer_name>\n"
- "<description><p>Updating the firmware on your ColorHug device "
- "improves performance and adds new features.</p></description>\n"
- "<icon type=\"stock\">application-x-executable</icon>\n"
- "<url type=\"homepage\">http://www.hughski.com/</url>\n"
- "<releases>\n"
- "<release version=\"2.0.2\" timestamp=\"1424116753\">\n"
- "<location>http://www.hughski.com/downloads/colorhug2/firmware/colorhug-2.0.2.cab</location>\n"
- "<checksum filename=\"colorhug-als-2.0.2.cab\" target=\"container\" type=\"sha1\">522aeefdcc7f27658d73de76107fe62550c61868</checksum>\n"
- "<checksum filename=\"firmware.bin\" target=\"content\" type=\"sha1\">767a8a7b8a7b350b513f57761204b4aaa657aa44</checksum>\n"
- "<description><p>This unstable release adds the following features:</p>"
- "<ul><li>Add TakeReadingArray to enable panel latency measurements</li>"
- "<li>Speed up the auto-scaled measurements considerably, using 256ms "
- "as the smallest sample duration</li></ul></description>\n"
- "</release>\n"
- "</releases>\n"
- "<metadata>\n"
- "<value key=\"X-CacheID\">colorhug-als-2.0.2.cab</value>\n"
- "</metadata>\n"
- "</component>\n"
"<component type=\"font\">\n"
"<id>Liberation</id>\n"
"<pkgname>font</pkgname>\n"
@@ -541,6 +517,33 @@ asb_test_context_test_func (AsbTestContextMode mode)
"<value key=\"X-CacheID\">app-1-1.fc21.x86_64.rpm</value>\n"
"</metadata>\n"
"</component>\n"
+ "<component type=\"firmware\">\n"
+ "<id>com.hughski.ColorHug2.firmware</id>\n"
+ "<name>ColorHug Firmware</name>\n"
+ "<summary>Firmware for the ColorHug Colorimeter</summary>\n"
+ "<developer_name>Hughski Limited</developer_name>\n"
+ "<description><p>Updating the firmware on your ColorHug device "
+ "improves performance and adds new features.</p></description>\n"
+ "<icon type=\"stock\">application-x-executable</icon>\n"
+ "<url type=\"homepage\">http://www.hughski.com/</url>\n"
+ "<releases>\n"
+ "<release version=\"2.0.2\" timestamp=\"1424116753\">\n"
+ "<location>http://www.hughski.com/downloads/colorhug2/firmware/colorhug-2.0.2.cab</location>\n"
+ "<checksum filename=\"colorhug-als-2.0.2.cab\" target=\"container\" type=\"sha1\">6301e24ae5fb2aa73c336fd40a5d2f1835afe088</checksum>\n"
+ "<checksum filename=\"firmware.bin\" target=\"content\" type=\"sha1\">767a8a7b8a7b350b513f57761204b4aaa657aa44</checksum>\n"
+ "<description><p>This unstable release adds the following features:</p>"
+ "<ul><li>Add TakeReadingArray to enable panel latency measurements</li>"
+ "<li>Speed up the auto-scaled measurements considerably, using 256ms "
+ "as the smallest sample duration</li></ul></description>\n"
+ "</release>\n"
+ "</releases>\n"
+ "<provides>\n"
+ "<firmware type=\"flashed\">84f40464-9272-4ef7-9399-cd95f12da696</firmware>\n"
+ "</provides>\n"
+ "<metadata>\n"
+ "<value key=\"X-CacheID\">colorhug-als-2.0.2.cab</value>\n"
+ "</metadata>\n"
+ "</component>\n"
"<component type=\"desktop\">\n"
"<id>valid1.desktop</id>\n"
"<pkgname>composite</pkgname>\n"
@@ -912,7 +915,7 @@ asb_test_firmware_func (void)
g_assert_no_error (error);
g_assert (ret);
g_assert_cmpint (as_store_get_size (store), ==, 1);
- app = as_store_get_app_by_id (store, "84f40464-9272-4ef7-9399-cd95f12da696");
+ app = as_store_get_app_by_id (store, "com.hughski.ColorHug2.firmware");
g_assert (app != NULL);
/* check it matches what we expect */
@@ -920,10 +923,10 @@ asb_test_firmware_func (void)
expected_xml =
"<components version=\"0.9\" origin=\"asb-self-test\">\n"
"<component type=\"firmware\">\n"
- "<id>84f40464-9272-4ef7-9399-cd95f12da696</id>\n"
+ "<id>com.hughski.ColorHug2.firmware</id>\n"
"<name>ColorHug Firmware</name>\n"
"<summary>Firmware for the ColorHug Colorimeter</summary>\n"
- "<developer_name>Hughski</developer_name>\n"
+ "<developer_name>Hughski Limited</developer_name>\n"
"<description><p>Updating the firmware on your ColorHug device "
"improves performance and adds new features.</p></description>\n"
"<icon type=\"stock\">application-x-executable</icon>\n"
@@ -931,7 +934,7 @@ asb_test_firmware_func (void)
"<releases>\n"
"<release version=\"2.0.2\" timestamp=\"1424116753\">\n"
"<location>http://www.hughski.com/downloads/colorhug2/firmware/colorhug-2.0.2.cab</location>\n"
- "<checksum filename=\"colorhug-als-2.0.2.cab\" target=\"container\" type=\"sha1\">522aeefdcc7f27658d73de76107fe62550c61868</checksum>\n"
+ "<checksum filename=\"colorhug-als-2.0.2.cab\" target=\"container\" type=\"sha1\">6301e24ae5fb2aa73c336fd40a5d2f1835afe088</checksum>\n"
"<checksum filename=\"firmware.bin\" target=\"content\" type=\"sha1\">767a8a7b8a7b350b513f57761204b4aaa657aa44</checksum>\n"
"<description><p>This unstable release adds the following features:</p>"
"<ul><li>Add TakeReadingArray to enable panel latency measurements</li>"
@@ -940,7 +943,7 @@ asb_test_firmware_func (void)
"</release>\n"
"<release version=\"2.0.1\" timestamp=\"1424116753\">\n"
"<location>http://www.hughski.com/downloads/colorhug2/firmware/colorhug-2.0.1.cab</location>\n"
- "<checksum filename=\"colorhug-als-2.0.1.cab\" target=\"container\" type=\"sha1\">c61e55ccb2ce8de401550a731b0f364a18cb2639</checksum>\n"
+ "<checksum filename=\"colorhug-als-2.0.1.cab\" target=\"container\" type=\"sha1\">7d4cab8775213cbd223a4a3b236618ced0af9447</checksum>\n"
"<checksum filename=\"firmware.bin\" target=\"content\" type=\"sha1\">767a8a7b8a7b350b513f57761204b4aaa657aa44</checksum>\n"
"<description><p>This unstable release adds the following features:</p>"
"<ul><li>Use TakeReadings() to do a quick non-adaptive measurement</li>"
@@ -948,10 +951,13 @@ asb_test_firmware_func (void)
"sane</li></ul></description>\n"
"</release>\n"
"<release version=\"2.0.0\" timestamp=\"1425168000\">\n"
- "<checksum filename=\"colorhug-als-2.0.0.cab\" target=\"container\" type=\"sha1\">186ad37fe3e63acc843b8727ac1add4ac15f0bf8</checksum>\n"
+ "<checksum filename=\"colorhug-als-2.0.0.cab\" target=\"container\" type=\"sha1\">d7b9ae5b36029de606c9b047c229d9c8f5e3807c</checksum>\n"
"<checksum filename=\"firmware.bin\" target=\"content\" type=\"sha1\">767a8a7b8a7b350b513f57761204b4aaa657aa44</checksum>\n"
"</release>\n"
"</releases>\n"
+ "<provides>\n"
+ "<firmware type=\"flashed\">84f40464-9272-4ef7-9399-cd95f12da696</firmware>\n"
+ "</provides>\n"
"</component>\n"
"</components>\n";
ret = asb_test_compare_lines (xml->str, expected_xml, &error);