Fix segfault on errors emitting.

Function 'pkg_emit_error' calls for pkg_emit_event twice and, moreover,
the first time it is called with uninitialized buffer, hence causing
SIGSEGV while accessing this buffer further. This patch fixes it.
Add cheksums computation for manifests.

Add sha256 checksums for manifests generated. Document this change
in doxygen style comment. Generate digest file for repository in
format:
<origin>: <sha256>\n
...

Fix memory corruption during getting package files list by setting
'file' variable to NULL as it is intended.