[Yum-devel] [PATCH] Mostly fix the makecache and using updateinfo/etc. with -C. BZ 815568.

James Antill james at and.org
Tue Jul 31 20:08:37 UTC 2012


---
 yumcommands.py |   29 +++++++++++++++++++++++++++++
 1 files changed, 29 insertions(+), 0 deletions(-)

diff --git a/yumcommands.py b/yumcommands.py
index 585a10b..43ff212 100644
--- a/yumcommands.py
+++ b/yumcommands.py
@@ -1128,6 +1128,35 @@ class MakeCacheCommand(YumCommand):
             # 2. Download a .xml.gz and convert to .xml.gz.sqlite
             base.repos.populateSack(mdtype='all', cacheonly=1)
 
+            # These are covered by the popSack above.
+            main_MD_types = set(['primary', 'primary_db',
+                                 'filelists', 'filelists_db',
+                                 'other', 'other_db'])
+
+            #  Ok, so if the repos. were pre-filled then group:all is a noop.
+            # so now we want to guarantee that all the data is downloaded.
+            for repo in base.repos.listEnabled():
+                MD_types = repo.repoXML.fileTypes()
+                for MD in MD_types:
+                    if MD == 'group' and 'group_gz' in MD_types:
+                        # Hacky, but ... sigh.
+                        continue
+                    if MD in main_MD_types:
+                        continue
+                    repo.retrieveMD(MD)
+
+            # Now decompress stuff, double sigh.
+            fname_map = {'group_gz'   : 'groups.xml',
+                         'pkgtags'    : 'pkgtags.sqlite',
+                         'updateinfo' : 'updateinfo.xml',
+                         }
+            for repo in base.repos.listEnabled():
+                for MD in repo.repoXML.fileTypes():
+                    if MD not in fname_map:
+                        continue
+                    misc.repo_gen_decompress(repo.retrieveMD(MD),
+                                             fname_map[MD],
+                                             cached=repo.cache)
 
         except yum.Errors.YumBaseError, e:
             return 1, [exception2msg(e)]
-- 
1.7.6.5



More information about the Yum-devel mailing list