Prefix repoclosure cache dir with compose id
JIRA: COMPOSE-3922 Signed-off-by: Haibo Lin <hlin@redhat.com>
This commit is contained in:
parent
c87d299a20
commit
e0dd20dffe
@ -51,7 +51,7 @@ def run_repoclosure(compose):
|
|||||||
if conf and conf[-1] == 'off':
|
if conf and conf[-1] == 'off':
|
||||||
continue
|
continue
|
||||||
|
|
||||||
prefix = "repoclosure-%s" % compose.compose_id
|
prefix = "%s-repoclosure" % compose.compose_id
|
||||||
lookaside = {}
|
lookaside = {}
|
||||||
if variant.parent:
|
if variant.parent:
|
||||||
repo_id = "%s-%s.%s" % (prefix, variant.parent.uid, arch)
|
repo_id = "%s-%s.%s" % (prefix, variant.parent.uid, arch)
|
||||||
@ -87,12 +87,12 @@ def run_repoclosure(compose):
|
|||||||
% (variant.uid, arch, exc))
|
% (variant.uid, arch, exc))
|
||||||
finally:
|
finally:
|
||||||
if methods != "hybrid":
|
if methods != "hybrid":
|
||||||
_delete_repoclosure_cache_dirs(compose, prefix)
|
_delete_repoclosure_cache_dirs(compose)
|
||||||
|
|
||||||
compose.log_info("[DONE ] %s" % msg)
|
compose.log_info("[DONE ] %s" % msg)
|
||||||
|
|
||||||
|
|
||||||
def _delete_repoclosure_cache_dirs(compose, prefix):
|
def _delete_repoclosure_cache_dirs(compose):
|
||||||
if 'dnf' == compose.conf["repoclosure_backend"]:
|
if 'dnf' == compose.conf["repoclosure_backend"]:
|
||||||
from dnf.yum.misc import getCacheDir
|
from dnf.yum.misc import getCacheDir
|
||||||
else:
|
else:
|
||||||
@ -100,7 +100,7 @@ def _delete_repoclosure_cache_dirs(compose, prefix):
|
|||||||
|
|
||||||
top_cache_dir = getCacheDir()
|
top_cache_dir = getCacheDir()
|
||||||
for name in os.listdir(top_cache_dir):
|
for name in os.listdir(top_cache_dir):
|
||||||
if name.startswith(prefix):
|
if name.startswith(compose.compose_id):
|
||||||
cache_path = os.path.join(top_cache_dir, name)
|
cache_path = os.path.join(top_cache_dir, name)
|
||||||
if os.path.isdir(cache_path):
|
if os.path.isdir(cache_path):
|
||||||
shutil.rmtree(cache_path)
|
shutil.rmtree(cache_path)
|
||||||
|
@ -304,7 +304,7 @@ class TestRepoclosure(PungiTestCase):
|
|||||||
def _get_repo(self, compose_id, variant, arch, path=None):
|
def _get_repo(self, compose_id, variant, arch, path=None):
|
||||||
path = path or arch + '/os'
|
path = path or arch + '/os'
|
||||||
return {
|
return {
|
||||||
'repoclosure-%s-%s.%s' % (compose_id, variant, arch): self.topdir + '/compose/%s/%s' % (variant, path)
|
'%s-repoclosure-%s.%s' % (compose_id, variant, arch): self.topdir + '/compose/%s/%s' % (variant, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
@mock.patch('pungi.wrappers.repoclosure.get_repoclosure_cmd')
|
@mock.patch('pungi.wrappers.repoclosure.get_repoclosure_cmd')
|
||||||
|
Loading…
Reference in New Issue
Block a user