75
gchar * manifestfile = g_strdup_printf("%s.manifest", package);
76
gchar * manifestpath = g_build_filename(app_dir, ".click", "info", manifestfile, NULL);
76
gchar * cmdline = g_strdup_printf("click info \"%s\"", package);
77
g_spawn_command_line_sync(cmdline, &output, NULL, NULL, &error);
79
if (!g_file_test(manifestpath, G_FILE_TEST_EXISTS)) {
80
g_warning("Unable to find manifest file: %s", manifestpath);
81
g_warning("Unable to get manifest for '%s': %s", package, error->message);
84
86
parser = json_parser_new();
86
json_parser_load_from_file(parser, manifestpath, &error);
88
json_parser_load_from_data(parser, output, -1, &error);
87
91
if (error != NULL) {
88
g_warning("Unable to load manifest file '%s': %s", manifestpath, error->message);
92
g_warning("Unable to load manifest data '%s': %s", package, error->message);
89
93
g_error_free(error);
93
97
JsonNode * root = json_parser_get_root(parser);
94
98
if (json_node_get_node_type(root) != JSON_NODE_OBJECT) {
95
g_warning("Manifest '%s' doesn't start with an object", manifestpath);
99
g_warning("Manifest '%s' doesn't start with an object", package);
96
100
goto manifest_out;
99
103
JsonObject * rootobj = json_node_get_object(root);
100
104
if (!json_object_has_member(rootobj, "version")) {
101
g_warning("Manifest '%s' doesn't have a version", manifestpath);
105
g_warning("Manifest '%s' doesn't have a version", package);
102
106
goto manifest_out;
105
109
if (g_strcmp0(json_object_get_string_member(rootobj, "version"), version) != 0) {
106
g_warning("Manifest '%s' version '%s' doesn't match AppID version '%s'", manifestpath, json_object_get_string_member(rootobj, "version"), version);
110
g_warning("Manifest '%s' version '%s' doesn't match AppID version '%s'", package, json_object_get_string_member(rootobj, "version"), version);
107
111
goto manifest_out;
110
114
if (!json_object_has_member(rootobj, "hooks")) {
111
g_warning("Manifest '%s' doesn't have an hooks section", manifestpath);
115
g_warning("Manifest '%s' doesn't have an hooks section", package);
112
116
goto manifest_out;
115
119
JsonObject * appsobj = json_object_get_object_member(rootobj, "hooks");
116
120
if (appsobj == NULL) {
117
g_warning("Manifest '%s' has an hooks section that is not a JSON object", manifestpath);
121
g_warning("Manifest '%s' has an hooks section that is not a JSON object", package);
118
122
goto manifest_out;
121
125
if (!json_object_has_member(appsobj, application)) {
122
g_warning("Manifest '%s' doesn't have the application '%s' defined", manifestpath, application);
126
g_warning("Manifest '%s' doesn't have the application '%s' defined", package, application);
123
127
goto manifest_out;
126
130
JsonObject * appobj = json_object_get_object_member(appsobj, application);
127
131
if (appobj == NULL) {
128
g_warning("Manifest '%s' has a definition for application '%s' that is not an object", manifestpath, application);
132
g_warning("Manifest '%s' has a definition for application '%s' that is not an object", package, application);
129
133
goto manifest_out;