Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

as-cache-builder: Cope with no YAML documents #25

Merged
merged 1 commit into from Feb 10, 2016

Conversation

iainlane
Copy link
Contributor

It's possible that a suite/arch will have no packages with AppStream; we
shouldn't crash in that case.

g_strstr_len will return NULL if the string we're searching for ("---")
is not found - this will be the case if there are only the headers and
no further documents. In that case we should read to the end of the
file.

While doing this, I made this bit (IMO) easier to read by renaming some variables and adding comments, hope you like that.

It's possible that a suite/arch will have no packages with AppStream; we
shouldn't crash in that case.

g_strstr_len will return NULL if the string we're searching for ("---")
is not found - this will be the case if there are only the headers and
no further documents. In that case we should read to the end of the
file.
@ximion
Copy link
Owner

ximion commented Feb 10, 2016

Looks good - the empty-DEP-11-doc case shouldn't have been missed. This is pretty much the uglies part of the code, unfortunately just scanning the first part of the doc instead of parsing the YAML correctly is also significantly faster (and we don't want to slow down people's apt update).
(For the next release, I plan to make the whole code for importing data from APT a bit smarter anyway).

ximion added a commit that referenced this pull request Feb 10, 2016
as-cache-builder: Cope with no YAML documents
@ximion ximion merged commit 7bab80c into ximion:master Feb 10, 2016
@iainlane
Copy link
Contributor Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants