createrepo/__init__.py

[email protected] Fri, 28 Oct 2011 17:24:28 +0000 (UTC)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 createrepo/__init__.py |   19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

New commits:
commit c42fc5a12315ee2abc60b0fdc1c8292e11b3a48e
Author: Seth Vidal <[email protected]>
Date:   Fri Oct 28 13:23:21 2011 -0400

    - when we read deltarpms - if a pkg is unreadable -just skip it and report the error on stderr
    - when we make the repodata:
     1. we need to append the right compression string to delta (and other) metadata files
     2. make sure the files get renamed properly with unique-md-names.

diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index 61694f9..014765a 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -686,8 +686,12 @@ class MetaDataGenerator:
                     
             for pkgfile in pkgfiles:
                 if self.conf.deltas:
-                    po = self.read_in_package(pkgfile, pkgpath=pkgpath, reldir=reldir)
-                    self._do_delta_rpm_package(po)
+                    try:
+                        po = self.read_in_package(pkgfile, pkgpath=pkgpath, reldir=reldir)
+                        self._do_delta_rpm_package(po)
+                    except MDError, e:
+                        errorprint(e)
+                        continue
                 self.read_pkgs.append(pkgfile)
 
         return self.current_pkg
@@ -933,8 +937,9 @@ class MetaDataGenerator:
             # self.conf.compress_type
             if ftype in ('other', 'filelists', 'primary'):
                 rpm_file = rpm_file + '.' + 'gz'
+            elif rpm_file.find('.') != -1 and rpm_file.split('.')[-1] not in _available_compression:
+                rpm_file = rpm_file + '.' + self.conf.compress_type
             complete_path = os.path.join(repopath, rpm_file)
-
             zfo = compressOpen(complete_path)
             # This is misc.checksum() done locally so we can get the size too.
             data = misc.Checksums([sumtype])
@@ -1029,7 +1034,13 @@ class MetaDataGenerator:
             data.openchecksum = (sumtype, uncsum)
 
             if self.conf.unique_md_filenames:
-                res_file = '%s-%s.xml.gz' % (csum, ftype)
+                if ftype in ('primary', 'filelists', 'other'):
+                    compress = 'gz'
+                else:
+                    compress = self.conf.compress_type
+                
+                main_name = '.'.join(rpm_file.split('.')[:-1])
+                res_file = '%s-%s.%s' % (csum, main_name, compress)
                 orig_file = os.path.join(repopath, rpm_file)
                 dest_file = os.path.join(repopath, res_file)
                 os.rename(orig_file, dest_file)