[yum-commits] Branch 'yum-3_2_X' - 2 commits - yum/packages.py

skvidal at osuosl.org skvidal at osuosl.org
Sun Jul 17 05:12:32 UTC 2011


 yum/packages.py |   24 ++++++++++++++----------
 1 file changed, 14 insertions(+), 10 deletions(-)

New commits:
commit cf07a046ba2969f25fa16801cc86940dd0ceafa7
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Jul 15 17:44:25 2011 -0400

    sort the files output too - it takes a bit more time but it makes things easier to read :)

diff --git a/yum/packages.py b/yum/packages.py
index db365c5..79c15db 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1161,11 +1161,11 @@ class YumAvailablePackage(PackageObject, RpmBase):
             dirs = self.returnFileEntries('dir', primary_only=True)
             ghosts = self.returnFileEntries('ghost', primary_only=True)
                 
-        for fn in files:
+        for fn in sorted(files):
             msg += """    <file>%s</file>\n""" % misc.to_xml(fn)
-        for fn in dirs:
+        for fn in sorted(dirs):
             msg += """    <file type="dir">%s</file>\n""" % misc.to_xml(fn)
-        for fn in ghosts:
+        for fn in sorted(ghosts):
             msg += """    <file type="ghost">%s</file>\n""" % misc.to_xml(fn)
         
         return msg
commit b6431c11672f9f0cfb09fc384c7f249c66f3c78a
Author: Seth Vidal <skvidal at fedoraproject.org>
Date:   Fri Jul 15 17:37:12 2011 -0400

    - make the pre check look for 0 or "0" b/c 0 comes from the pkgs and "0" comes from the sqlite :)
    - if we have nothing we've used in the requires output, then don't output anything - this makes it match
      the behavior of dumping to xml from the sqlite dbs
    - set installedsize properly for header/local pkg objects
    - use installedsize properly in the xml generation :)
    - sort the requires and provides lists so if nothing has changed nothing in the repodata will change :)

diff --git a/yum/packages.py b/yum/packages.py
index e055edf..db365c5 100644
--- a/yum/packages.py
+++ b/yum/packages.py
@@ -1083,7 +1083,7 @@ class YumAvailablePackage(PackageObject, RpmBase):
          misc.to_unicode(misc.to_xml(self.summary)), 
          misc.to_unicode(misc.to_xml(self.description)), 
          packager, url, self.filetime, 
-         self.buildtime, self.packagesize, self.size, self.archivesize)
+         self.buildtime, self.packagesize, self.installedsize, self.archivesize)
         
         msg += self._return_remote_location()
         return msg
@@ -1133,7 +1133,7 @@ class YumAvailablePackage(PackageObject, RpmBase):
         msg = ""
         mylist = getattr(self, pcotype)
         if mylist: msg = "\n    <rpm:%s>\n" % pcotype
-        for (name, flags, (e,v,r)) in mylist:
+        for (name, flags, (e,v,r)) in sorted(mylist):
             pcostring = '''      <rpm:entry name="%s"''' % misc.to_xml(name, attrib=True)
             if flags:
                 pcostring += ''' flags="%s"''' % misc.to_xml(flags, attrib=True)
@@ -1194,8 +1194,8 @@ class YumAvailablePackage(PackageObject, RpmBase):
                         continue
                     newlist.append(i)
                 mylist = newlist
-        
-        for (name, flags, (e,v,r),pre) in mylist:
+        used = 0
+        for (name, flags, (e,v,r),pre) in sorted(mylist):
             if name.startswith('rpmlib('):
                 continue
             # this drops out requires that the pkg provides for itself.
@@ -1217,13 +1217,16 @@ class YumAvailablePackage(PackageObject, RpmBase):
                     prcostring += ''' ver="%s"''' % misc.to_xml(v, attrib=True)
                 if r:
                     prcostring += ''' rel="%s"''' % misc.to_xml(r, attrib=True)
-            if pre != "0":
+            if pre not in ("0", 0):
                 prcostring += ''' pre="%s"''' % pre
-                    
+
             prcostring += "/>\n"
             msg += prcostring
+            used += 1
             
         if mylist: msg += "    </rpm:requires>"
+        if used == 0:
+            return ""
         return msg
 
     def _dump_changelog(self, clog_limit):
@@ -1299,7 +1302,8 @@ class YumHeaderPackage(YumAvailablePackage):
         self.pkgid = self.hdr[rpm.RPMTAG_SHA1HEADER]
         if not self.pkgid:
             self.pkgid = "%s.%s" %(self.hdr['name'], self.hdr['buildtime'])
-        self.packagesize = self.hdr['size']
+        self.packagesize = self.hdr['archivesize']
+        self.installedsize = self.hdr['size']
         self.__mode_cache = {}
         self.__prcoPopulated = False
 


More information about the Yum-commits mailing list