[Yum-devel] [PATCH] Do not add pkgtags if not available.
James Antill
james at fedoraproject.org
Tue Dec 6 17:46:33 UTC 2011
On Tue, 2011-12-06 at 10:49 -0500, Zdenek Pavlas wrote:
> > ...this is what I can't trigger.
>
> Ok, I see. This is the reproducer that works for me:
>
> 1) install yum.git/master with the following patch:
>
> --- a/yum/misc.py
> +++ b/yum/misc.py
> @@ -1092,7 +1092,7 @@ def get_uuid(savepath):
>
> return myid
>
> -def decompress(filename, dest=None, fn_only=False, check_timestamps=False):
> +def decompress(filename, dest=None, fn_only=False, check_timestamps=True):
> """take a filename and decompress it into the same relative location.
> if the file is not compressed just return the file"""
Ok, we can't change the API like that but...
> 2) sudo yum clean all
> 3) sudo yum repolist
> 4) yum search -C xxx
>
> ..
> File "./yum/__init__.py", line 989, in <lambda>
> pkgtags = property(fget=lambda self: self._getTags(),
> File "./yum/__init__.py", line 933, in _getTags
> self._tags.add(repo.id, tag_sqlite)
We call decompress() from here via. repo_gen_decompress() which does:
return decompress(filename, dest=dest, check_timestamps=True,fn_only=cached)
...so the above patch does nothing.
> File "./yum/pkgtag_db.py", line 110, in add
> dbobj = PackageTagDB(repoid, sqlite_file)
> File "./yum/pkgtag_db.py", line 54, in __init__
> self._conn = sqlite.connect(sqlite_file)
> sqlite3.OperationalError: unable to open database file
I finally found out the missing piece though, you need the pkgtags data
to be downloaded when you run via. the cache (I know, I'm a bit dumb
sometimes) ... but that doesn't happen by default. I guess you have
mdpolicy=group:all set in yum.conf ?
I think this is the bester patch:
commit 6ea12320ee0ab63a5f01bfebbe438f8c1f47e4bc
Author: James Antill <james at and.org>
Date: Tue Dec 6 12:44:28 2011 -0500
Catch the sqlite error when we can't open the DB file.
diff --git a/yum/pkgtag_db.py b/yum/pkgtag_db.py
index afcc28d..934f246 100644
--- a/yum/pkgtag_db.py
+++ b/yum/pkgtag_db.py
@@ -46,6 +46,7 @@ def catchSqliteException(func):
class PackageTagDB(object):
+ @catchSqliteException
def __init__(self, repoid, sqlite_file):
self.sqlite_file = sqlite_file
self.repoid = repoid
More information about the Yum-devel
mailing list