[PATCH 2/3] modifyrepo: use the selected compression
Zdenek Pavlas <[email protected]> Mon, 30 Sep 2013 17:23:34 +0200
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Message-ID | <[email protected]> |
When Seth added the code that decompresses already compressed
metadata, this should have been done as well.
---
modifyrepo.py | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/modifyrepo.py b/modifyrepo.py
index 6614ebd..412b657 100755
--- a/modifyrepo.py
+++ b/modifyrepo.py
@@ -118,15 +118,11 @@ class RepoMetadata:
else:
raise MDError, 'invalid metadata type'
- do_compress = False
## Compress the metadata and move it into the repodata
- if self.compress and mdname.split('.')[-1] not in ('gz', 'bz2', 'xz'):
- do_compress = True
- mdname += '.' + self.compress_type
mdtype = self._get_mdtype(mdname, mdtype)
-
destmd = os.path.join(self.repodir, mdname)
- if do_compress:
+ if self.compress:
+ destmd += '.' + self.compress_type
newmd = compressOpen(destmd, mode='wb', compress_type=self.compress_type)
else:
newmd = open(destmd, 'wb')
@@ -150,7 +146,7 @@ class RepoMetadata:
new_rd.location = (None, 'repodata/' + base_destmd)
new_rd.checksum = (self.checksum_type, csum)
new_rd.size = str(os.stat(destmd).st_size)
- if do_compress:
+ if self.compress:
new_rd.openchecksum = (self.checksum_type, open_csum)
new_rd.opensize = str(os.stat(metadata).st_size)
new_rd.timestamp = str(int(os.stat(destmd).st_mtime))
--
1.7.11.7