[Rpm-metadata] createrepo/__init__.py genpkgmetadata.py

skvidal at osuosl.org skvidal at osuosl.org
Tue Jan 3 22:19:07 UTC 2012


 createrepo/__init__.py |   22 ++++++++++++++++------
 genpkgmetadata.py      |    2 +-
 2 files changed, 17 insertions(+), 7 deletions(-)

New commits:
commit 25a2dea093a3d449ab1a031e42226a7a5af0c6ec
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Tue Jan 3 17:17:58 2012 -0500

    make compress_type default to 'compat' which makes it use gz for the xml files
    and bzip2 for the sqlite files - so that rhel5 yum doesn't get pissy

diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index 2d3514e..3f55700 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -111,7 +111,7 @@ class MetaDataConfig(object):
         self.worker_cmd = '/usr/share/createrepo/worker.py'
         #self.worker_cmd = './worker.py' # helpful when testing
         self.retain_old_md = 0
-        self.compress_type = 'gz'
+        self.compress_type = 'compat'
 
         
 class SimpleMDCallBack(object):
@@ -144,10 +144,15 @@ class MetaDataGenerator:
         self.files = []
         self.rpmlib_reqs = {}
         self.read_pkgs = []
+        self.compat_compress = False
 
         if not self.conf.directory and not self.conf.directories:
             raise MDError, "No directory given on which to run."
-
+        
+        if self.conf.compress_type == 'compat':
+            self.compat_compress = True
+            self.conf.compress_type = None
+            
         if not self.conf.compress_type:
             self.conf.compress_type = 'gz'
         
@@ -982,15 +987,20 @@ class MetaDataGenerator:
                     good_name = '%s.sqlite' % ftype
                     resultpath = os.path.join(repopath, good_name)
 
+                    # compat compression for rhel5 compatibility from fedora :(
+                    compress_type = self.conf.compress_type
+                    if self.compat_compress:
+                        compress_type = 'bz2'
+                        
                     # rename from silly name to not silly name
                     os.rename(tmp_result_path, resultpath)
-                    ext = self.conf.compress_type
-                    compressed_name = '%s.%s' % (good_name, ext)
+                    compressed_name = '%s.%s' % (good_name, compress_type)
                     result_compressed = os.path.join(repopath, compressed_name)
                     db_csums[ftype] = misc.checksum(sumtype, resultpath)
 
                     # compress the files
-                    compressFile(resultpath, result_compressed, self.conf.compress_type)
+
+                    compressFile(resultpath, result_compressed, compress_type)
                     # csum the compressed file
                     db_compressed_sums[ftype] = misc.checksum(sumtype,
                                                              result_compressed)
@@ -1001,7 +1011,7 @@ class MetaDataGenerator:
 
                     if self.conf.unique_md_filenames:
                         csum_compressed_name = '%s-%s.%s' % (
-                                           db_compressed_sums[ftype], good_name, ext)
+                                           db_compressed_sums[ftype], good_name, compress_type)
                         csum_result_compressed =  os.path.join(repopath,
                                                            csum_compressed_name)
                         os.rename(result_compressed, csum_result_compressed)
diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index af0ecb4..63fb85b 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -127,7 +127,7 @@ def parse_args(args, conf):
     parser.add_option("--xz", default=False,
         action="store_true",
         help="use xz for repodata compression")
-    parser.add_option("--compress-type", default=None, dest="compress_type",
+    parser.add_option("--compress-type", default='compat', dest="compress_type",
         help="which compression type to use")
         
     


More information about the Rpm-metadata mailing list