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

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