Skip to content

Commit

Permalink
validator: Don't fail validation if a snapshot release is missing a time
Browse files Browse the repository at this point in the history
Resolves: #570, #650

Thanks to James Addison for the initial work!
  • Loading branch information
ximion committed Dec 8, 2024
1 parent f8be161 commit 13a94d5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/as-validator-issue-tag.h
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,13 @@ AsValidatorIssueTag as_validator_issue_tag_list[] = {
{ "release-time-missing",
AS_ISSUE_SEVERITY_ERROR,
/* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */
N_("The release is missing either the `date` (preferred) or the `timestamp` property."),
N_("The release entry is missing either the `date` (preferred) or the `timestamp` property."),
},

{ "release-time-missing-for-snapshot",
AS_ISSUE_SEVERITY_INFO,
/* TRANSLATORS: Please do not translate AppStream tag and property names (in backticks). */
N_("The release entry is missing the `date` property. Ensure to add it before publishing the snapshot release."),
},

{ "release-timestamp-invalid",
Expand Down
5 changes: 4 additions & 1 deletion src/as-validator.c
Original file line number Diff line number Diff line change
Expand Up @@ -2453,7 +2453,10 @@ as_validator_check_release (AsValidator *validator, xmlNode *node, AsFormatStyle
g_autofree gchar *timestamp = as_xml_get_prop_value (node, "timestamp");
if (timestamp == NULL) {
/* Neither timestamp, nor date property exists */
as_validator_add_issue (validator, node, "release-time-missing", "date");
if (rel_kind == AS_RELEASE_KIND_SNAPSHOT)
as_validator_add_issue (validator, node, "release-time-missing-for-snapshot", "date");
else
as_validator_add_issue (validator, node, "release-time-missing", "date");
} else {
/* check if the timestamp is both a number and higher than 3000. The 3000 is used to check that it is not a year */
if (!as_str_verify_integer (timestamp, 3000, G_MAXINT64))
Expand Down

0 comments on commit 13a94d5

Please sign in to comment.