[yum-commits] 5 commits - cli.py yum/__init__.py yum/misc.py yum/parser.py yum/yumRepo.py

James Antill james at osuosl.org
Wed May 9 14:06:01 UTC 2012


 cli.py          |    2 ++
 yum/__init__.py |    2 +-
 yum/misc.py     |    2 ++
 yum/parser.py   |    6 +++++-
 yum/yumRepo.py  |   40 +++++++++++++++++++++++++++++++++++++---
 5 files changed, 47 insertions(+), 5 deletions(-)

New commits:
commit f3058fc6deafe0a7660f8a03a792f3d5d8470f83
Merge: 0559fc6 02528bc
Author: James Antill <james at and.org>
Date:   Wed May 9 10:04:57 2012 -0400

    Fix merge with _async changes etc. in ._commonRetrieveDataMD_done.

commit 0559fc6834961865d4abc85fea44f1920247a2f9
Author: James Antill <james at and.org>
Date:   Mon May 7 11:17:04 2012 -0400

    Ignore getcwd() failures for relative config. file paths. BZ 819534

diff --git a/yum/parser.py b/yum/parser.py
index fccf528..f443ce7 100644
--- a/yum/parser.py
+++ b/yum/parser.py
@@ -73,7 +73,11 @@ class ConfigPreProcessor:
         if scheme == '':
             # check it to make sure it's not a relative file url
             if configfile[0] != '/':
-                configfile = os.getcwd() + '/' + configfile
+                try:
+                    rootdir = os.getcwd() + "/"
+                except:
+                    rootdir = "/"
+                configfile = rootdir + configfile
             url = 'file://' + configfile
         else:
             url = configfile
commit e0ede5225deda96838faa58118dad5443a3748bd
Author: James Antill <james at and.org>
Date:   Tue May 1 14:37:17 2012 -0400

    Don't die on arg='', provides searches. Or search for paths. BZ 817491.

diff --git a/cli.py b/cli.py
index a0d8886..597efd6 100755
--- a/cli.py
+++ b/cli.py
@@ -1403,6 +1403,8 @@ class YumBaseCli(yum.YumBase, output.YumOutput):
             paths = set(sys.path + os.environ['PATH'].split(':'))
             nargs = []
             for arg in args:
+                if not arg:
+                    continue
                 if yum.misc.re_filename(arg) or yum.misc.re_glob(arg):
                     continue
                 for path in paths:
diff --git a/yum/__init__.py b/yum/__init__.py
index 33d4d4c..02559b0 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -3039,7 +3039,7 @@ class YumBase(depsolve.Depsolve):
         def _arg_data(arg):
             if not misc.re_glob(arg):
                 isglob = False
-                if arg[0] != '/':
+                if not arg or arg[0] != '/':
                     canBeFile = False
                 else:
                     canBeFile = True
commit bc93f95ace2221ead8b3ad616869e3309ee0edab
Author: James Antill <james at and.org>
Date:   Tue May 1 14:34:00 2012 -0400

    Also catch EOFError on decompressions.

diff --git a/yum/misc.py b/yum/misc.py
index e3952b5..55c433a 100644
--- a/yum/misc.py
+++ b/yum/misc.py
@@ -758,6 +758,8 @@ def _decompress_chunked(source, dest, ztype):
             data = s_fn.read(1024000)
         except IOError:
             break
+        except EOFError:
+            break
         
         if not data: break
 
commit 4daf54b30ab3c0150fa87258af7c667e042b0a6b
Author: James Antill <james at and.org>
Date:   Fri Apr 27 14:29:07 2012 -0400

    Use repo_gen_decompress() for primary/filelists/other.

diff --git a/yum/yumRepo.py b/yum/yumRepo.py
index 655bbaa..cd14a75 100644
--- a/yum/yumRepo.py
+++ b/yum/yumRepo.py
@@ -165,6 +165,19 @@ class YumPackageSack(packageSack.PackageSack):
                 continue
 
             if self._check_db_version(repo, mydbtype):
+                #  Use gen decompression on DB files. Keeps exactly what we
+                # downloaded in the download dir.
+
+                db_un_fn = self._check_uncompressed_db_gen(repo, mydbtype)
+                if not db_un_fn:
+                    db_fn = repo._retrieveMD(mydbtype)
+                    if db_fn:
+                        db_un_fn = self._check_uncompressed_db_gen(repo,
+                                                                   mydbtype)
+
+                dobj = repo.cacheHandler.open_database(db_un_fn)
+
+            elif self._check_db_version(repo, mydbtype):
                 # see if we have the uncompressed db and check it's checksum vs the openchecksum
                 # if not download the compressed file
                 # decompress it
@@ -196,6 +209,25 @@ class YumPackageSack(packageSack.PackageSack):
         # get rid of all this stuff we don't need now
         del repo.cacheHandler
 
+    def _check_uncompressed_db_gen(self, repo, mdtype):
+        """return file name of db in gen/ dir if good, None if not"""
+
+        ret = self._check_uncompressed_db(repo, mdtype)
+        if ret: # Backwards compat.
+            return ret
+
+        mydbdata         = repo.repoXML.getData(mdtype)
+        (r_base, remote) = mydbdata.location
+        fname            = os.path.basename(remote)
+        compressed_fn    = repo.cachedir + '/' + fname
+        db_un_fn         = mdtype + '.sqlite'
+
+        ret = misc.repo_gen_decompress(compressed_fn, db_un_fn,
+                                       cached=repo.cache)
+        if ret:
+            return self._check_uncompressed_db_fn(repo, mdtype, ret)
+        return None
+
     def _check_uncompressed_db(self, repo, mdtype):
         """return file name of uncompressed db is good, None if not"""
         mydbdata = repo.repoXML.getData(mdtype)
@@ -204,6 +236,9 @@ class YumPackageSack(packageSack.PackageSack):
         compressed_fn = repo.cachedir + '/' + fname
         db_un_fn = misc.decompress(compressed_fn, fn_only=True)
 
+        return self._check_uncompressed_db_fn(repo, mdtype, db_un_fn)
+
+    def _check_uncompressed_db_fn(self, repo, mdtype, db_un_fn):
         result = None
 
         repo._preload_md_from_system_cache(os.path.basename(db_un_fn))
@@ -1287,11 +1322,10 @@ Insufficient space in download directory %s
             return None
 
         if not file_check:
-            compressed = dbmdtype.endswith("_db")
-            local = self._get_mdtype_fname(data, compressed)
+            local = self._get_mdtype_fname(data)
         else:
             compressed = False
-            local = self._get_mdtype_fname(data, False)
+            local = self._get_mdtype_fname(data)
             if not os.path.exists(local):
                 local = misc.decompress(local, fn_only=True)
                 compressed = True
@@ -1409,11 +1443,7 @@ Insufficient space in download directory %s
                 return False
 
         for (ndata, nmdtype) in downloading_with_size + downloading_no_size:
-            local = self._get_mdtype_fname(ndata, False)
-            if nmdtype.endswith("_db"): # Uncompress any compressed files
-                dl_local = local
-                local = misc.decompress(dl_local)
-                misc.unlink_f(dl_local)
+            local = self._get_mdtype_fname(ndata)
             self._oldRepoMDData['new_MD_files'].append(local)
 
         self._doneOldRepoXML()


More information about the Yum-commits mailing list