[createrepo/f16] make deltas be generated correctly and with the right name - fix mashing - I hope

Seth Vidal skvidal at fedoraproject.org
Fri Oct 28 17:35:05 UTC 2011


commit 047a740735a33837ce5e57cf68ae9a4d096e11f0
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Oct 28 13:35:03 2011 -0400

    make deltas be generated correctly and with the right name - fix mashing - I hope

 createrepo-head.patch |   61 +++++++++++++++++++++++++++++++++++++------------
 createrepo.spec       |    6 ++++-
 2 files changed, 51 insertions(+), 16 deletions(-)
---
diff --git a/createrepo-head.patch b/createrepo-head.patch
index f230f3a..ee14d25 100644
--- a/createrepo-head.patch
+++ b/createrepo-head.patch
@@ -124,7 +124,7 @@ index 1e491cd..eea7092 100644
  - bump to 0.9.9
  - add worker.py
 diff --git a/createrepo/__init__.py b/createrepo/__init__.py
-index 8f2538e..61694f9 100644
+index 8f2538e..014765a 100644
 --- a/createrepo/__init__.py
 +++ b/createrepo/__init__.py
 @@ -27,14 +27,14 @@ import stat
@@ -382,7 +382,7 @@ index 8f2538e..61694f9 100644
              if not self.conf.quiet:
                  self.callback.log("Workers Finished")
              # finished with workers
-@@ -671,7 +679,7 @@ class MetaDataGenerator:
+@@ -671,15 +679,19 @@ class MetaDataGenerator:
                  for (fn, fo) in (('primary.xml', self.primaryfile), 
                             ('filelists.xml', self.flfile),
                             ('other.xml', self.otherfile)):
@@ -391,7 +391,21 @@ index 8f2538e..61694f9 100644
                      if os.path.exists(fnpath):
                          fo.write(open(fnpath, 'r').read())
  
-@@ -784,7 +792,6 @@ 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
+@@ -784,7 +796,6 @@ class MetaDataGenerator:
              return self._old_package_dict
  
          self._old_package_dict = {}
@@ -399,7 +413,7 @@ index 8f2538e..61694f9 100644
          for d in self.conf.oldpackage_paths:
              for f in self.getFileList(d, '.rpm'):
                  fp = d + '/' + f
-@@ -833,7 +840,7 @@ class MetaDataGenerator:
+@@ -833,7 +844,7 @@ class MetaDataGenerator:
          return ' '.join(results)
  
      def _createRepoDataObject(self, mdfile, mdtype, compress=True, 
@@ -408,7 +422,7 @@ index 8f2538e..61694f9 100644
          """return random metadata as RepoData object to be  added to RepoMD
             mdfile = complete path to file
             mdtype = the metadata type to use
-@@ -843,15 +850,13 @@ class MetaDataGenerator:
+@@ -843,15 +854,13 @@ class MetaDataGenerator:
          sfile = os.path.basename(mdfile)
          fo = open(mdfile, 'r')
          outdir = os.path.join(self.conf.outputdir, self.conf.tempdir)
@@ -430,7 +444,7 @@ index 8f2538e..61694f9 100644
          else:
              outfn  = os.path.join(outdir, sfile)
              output = open(outfn, 'w')
-@@ -874,7 +879,6 @@ class MetaDataGenerator:
+@@ -874,7 +883,6 @@ class MetaDataGenerator:
  
          thisdata = RepoData()
          thisdata.type = mdtype
@@ -438,7 +452,7 @@ index 8f2538e..61694f9 100644
          thisdata.location = (self.conf.baseurl, os.path.join(self.conf.finaldir, sfile))
          thisdata.checksum = (self.conf.sumtype, csum)
          if compress:
-@@ -925,9 +929,13 @@ class MetaDataGenerator:
+@@ -925,9 +933,14 @@ class MetaDataGenerator:
              rp = sqlitecachec.RepodataParserSqlite(repopath, repomd.repoid, None)
  
          for (rpm_file, ftype) in workfiles:
@@ -446,14 +460,16 @@ index 8f2538e..61694f9 100644
 +            # 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 = _gzipOpen(complete_path)
 +            zfo = compressOpen(complete_path)
              # This is misc.checksum() done locally so we can get the size too.
              data = misc.Checksums([sumtype])
              while data.read(zfo, 2**16):
-@@ -968,12 +976,13 @@ class MetaDataGenerator:
+@@ -968,12 +981,13 @@ class MetaDataGenerator:
  
                      # rename from silly name to not silly name
                      os.rename(tmp_result_path, resultpath)
@@ -469,7 +485,7 @@ index 8f2538e..61694f9 100644
                      # csum the compressed file
                      db_compressed_sums[ftype] = misc.checksum(sumtype,
                                                               result_compressed)
-@@ -983,8 +992,8 @@ class MetaDataGenerator:
+@@ -983,8 +997,8 @@ class MetaDataGenerator:
                      os.unlink(resultpath)
  
                      if self.conf.unique_md_filenames:
@@ -480,7 +496,22 @@ index 8f2538e..61694f9 100644
                          csum_result_compressed =  os.path.join(repopath,
                                                             csum_compressed_name)
                          os.rename(result_compressed, csum_result_compressed)
-@@ -1046,7 +1055,7 @@ class MetaDataGenerator:
+@@ -1020,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)
+@@ -1046,7 +1066,7 @@ class MetaDataGenerator:
              
  
          if self.conf.additional_metadata:
@@ -489,7 +520,7 @@ index 8f2538e..61694f9 100644
                  mdcontent = self._createRepoDataObject(md_file, md_type)
                  repomd.repoData[mdcontent.type] = mdcontent
                  
-@@ -1110,23 +1119,43 @@ class MetaDataGenerator:
+@@ -1110,23 +1130,43 @@ class MetaDataGenerator:
                      raise MDError, _(
                      'Could not remove old metadata file: %s: %s') % (oldfile, e)
  
@@ -547,7 +578,7 @@ index 8f2538e..61694f9 100644
                  continue
  
              if os.path.exists(finalfile):
-@@ -1147,14 +1176,19 @@ class MetaDataGenerator:
+@@ -1147,14 +1187,19 @@ class MetaDataGenerator:
                      msg += _('Error was %s') % e
                      raise MDError, msg
  
@@ -574,7 +605,7 @@ index 8f2538e..61694f9 100644
          # write out the read_pkgs_list file with self.read_pkgs
          if self.conf.read_pkgs_list:
              try:
-@@ -1167,6 +1201,23 @@ class MetaDataGenerator:
+@@ -1167,6 +1212,23 @@ class MetaDataGenerator:
                                % self.conf.read_pkgs_list)
                  self.errorlog(_('Error was %s') % e)
  
@@ -598,7 +629,7 @@ index 8f2538e..61694f9 100644
      def setup_sqlite_dbs(self, initdb=True):
          """sets up the sqlite dbs w/table schemas and db_infos"""
          destdir = os.path.join(self.conf.outputdir, self.conf.tempdir)
-@@ -1240,7 +1291,6 @@ class SplitMetaDataGenerator(MetaDataGenerator):
+@@ -1240,7 +1302,6 @@ class SplitMetaDataGenerator(MetaDataGenerator):
          self.conf.baseurl = self._getFragmentUrl(self.conf.baseurl, mediano)
          try:
              self.openMetadataDocs()
diff --git a/createrepo.spec b/createrepo.spec
index 18c24e4..52a3a4c 100644
--- a/createrepo.spec
+++ b/createrepo.spec
@@ -3,7 +3,7 @@
 Summary: Creates a common metadata repository
 Name: createrepo
 Version: 0.9.9
-Release: 8%{?dist}
+Release: 9%{?dist}
 License: GPLv2
 Group: System Environment/Base
 Source: %{name}-%{version}.tar.gz
@@ -47,6 +47,10 @@ rm -rf $RPM_BUILD_ROOT
 %{python_sitelib}/createrepo
 
 %changelog
+* Fri Oct 28 2011 Seth Vidal <skvidal at fedoraproject.org> - 0.9.9-9
+- 3rd time is the charm
+- fix it so prestodelta's get made with the right name and don't traceback
+
 * Wed Oct 26 2011 Seth Vidal <skvidal at fedoraproject.org> - 0.9.9-8
 - change how compressOpen() defaults so mash doesn't break
 - add requires for pyliblzma


More information about the scm-commits mailing list