-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBZ-590340-move-rpmdb-from-cache.patch
93 lines (80 loc) · 3.93 KB
/
BZ-590340-move-rpmdb-from-cache.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
commit 39d852d04fd1934453d07bf9d3b9fd8ef60ca9f2
Author: James Antill <[email protected]>
Date: Wed May 5 16:00:02 2010 -0400
Move the rpmdb cache to yum persistent storage.
diff --git a/yum/__init__.py b/yum/__init__.py
index c2313a0..550e5cc 100644
--- a/yum/__init__.py
+++ b/yum/__init__.py
@@ -490,8 +490,7 @@ class YumBase(depsolve.Depsolve):
_('Reading Local RPMDB'))
self._rpmdb = rpmsack.RPMDBPackageSack(root=self.conf.installroot,
releasever=self.conf.yumvar['releasever'],
- persistdir=self.conf.persistdir,
- cachedir=self.conf.cachedir)
+ persistdir=self.conf.persistdir)
self.verbose_logger.debug('rpmdb time: %0.3f' % (time.time() - rpmdb_st))
return self._rpmdb
@@ -1923,7 +1922,7 @@ class YumBase(depsolve.Depsolve):
return self._cleanFiles(exts, 'cachedir', 'metadata')
def cleanRpmDB(self):
- cachedir = self.conf.cachedir + "/installed/"
+ cachedir = self.conf.persistdir + "/rpmdb-indexes/"
if not os.path.exists(cachedir):
filelist = []
else:
@@ -4493,7 +4492,6 @@ class YumBase(depsolve.Depsolve):
cachedir += varReplace(suffix, self.conf.yumvar)
self.repos.setCacheDir(cachedir)
- self.rpmdb.setCacheDir(cachedir)
self.conf.cachedir = cachedir
return True # We got a new cache dir
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index b457cc9..a11c6d5 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -169,7 +169,7 @@ class RPMDBPackageSack(PackageSackBase):
self._get_req_cache = {}
self._loaded_gpg_keys = False
if cachedir is None:
- cachedir = misc.getCacheDir()
+ cachedir = persistdir + "/rpmdb-indexes"
self.setCacheDir(cachedir)
if not os.path.normpath(persistdir).startswith(self.root):
self._persistdir = root + '/' + persistdir
@@ -233,11 +233,11 @@ class RPMDBPackageSack(PackageSackBase):
def setCacheDir(self, cachedir):
""" Sets the internal cachedir value for the rpmdb, to be the
- "installed" directory from this parent. """
+ "rpmdb-indexes" directory in the persisent yum storage. """
if not os.path.normpath(cachedir).startswith(self.root):
- self._cachedir = self.root + '/' + cachedir + "/installed/"
+ self._cachedir = self.root + '/' + cachedir
else:
- self._cachedir = '/' + cachedir + "/installed/"
+ self._cachedir = '/' + cachedir
def readOnlyTS(self):
if not self.ts:
commit eb7fb5fba6d0f2e21a34b10cc3a6c12003ebc299
Author: James Antill <[email protected]>
Date: Wed May 5 16:00:18 2010 -0400
Revert " Work around mock setting mtime on var/lib/Packages, for it's "caches"."
This reverts commit a079025ebb241849ba734b47607af9eb0c2ae9a3.
This is not needed anymore due to the path change.
diff --git a/yum/rpmsack.py b/yum/rpmsack.py
index a11c6d5..1c8bcd5 100644
--- a/yum/rpmsack.py
+++ b/yum/rpmsack.py
@@ -847,11 +847,9 @@ class RPMDBPackageSack(PackageSackBase):
rpmdbfname = self.root + "/var/lib/rpm/Packages"
if os.path.exists(rpmdbvfname) and os.path.exists(rpmdbfname):
- # See if rpmdb has "changed" ... NOTE that we need to use ctime
- # due to mock, because it will save and restore arbitrary rpmdb's
- # on us and will helpfully reset the mtime!
+ # See if rpmdb has "changed" ...
nmtime = os.path.getmtime(rpmdbvfname)
- omtime = os.path.getctime(rpmdbfname)
+ omtime = os.path.getmtime(rpmdbfname)
if omtime <= nmtime:
rpmdbv = open(rpmdbvfname).readline()[:-1]
self._have_cached_rpmdbv_data = rpmdbv