Blame SOURCES/BZ-1287685-modifyrepo-handle-empty-file-lzma.patch

0222c2
commit c626c54074b36edb090254fe6f4985bc20893436
0222c2
Author: Michal Domonkos <mdomonko@redhat.com>
0222c2
Date:   Thu Mar 23 16:05:16 2017 +0100
0222c2
0222c2
    modifyrepo: handle empty file with LZMA. BZ 1287685
0222c2
    
0222c2
    When trying to compress an empty string with LZMA, we will get the
0222c2
    unfriendly "LZMA.error: unknown error!".  Let's handle this case
0222c2
    ourselves and raise a more user-friendly error instead.
0222c2
0222c2
diff --git a/modifyrepo.py b/modifyrepo.py
0222c2
index 34b0902..ade5607 100755
0222c2
--- a/modifyrepo.py
0222c2
+++ b/modifyrepo.py
0222c2
@@ -125,6 +125,9 @@ class RepoMetadata:
0222c2
         else:
0222c2
             raise MDError, 'invalid metadata type'
0222c2
 
0222c2
+        if not md and self.compress_type == 'xz':
0222c2
+            raise MDError, 'LZMA does not support compressing empty files'
0222c2
+
0222c2
         ## Compress the metadata and move it into the repodata
0222c2
         mdtype = self._get_mdtype(mdname, mdtype)
0222c2
         destmd = os.path.join(self.repodir, mdname)