osbs: Generate unique repo names

And include variant in repo file name. The whole path is unique already,
but not the filename itself.

Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
Lubomír Sedlář 2018-07-09 11:04:00 +02:00
parent 1759c1ba80
commit d2849d3826
2 changed files with 10 additions and 10 deletions

View File

@ -142,12 +142,12 @@ class OSBSThread(WorkerThread):
os_tree = compose.paths.compose.repository('$basearch', variant,
create_dir=False)
repo_file = os.path.join(compose.paths.work.tmp_dir(None, variant),
'compose-rpms-%s.repo' % self.num)
'compose-rpms-%s-%s.repo' % (variant, self.num))
gpgcheck = 1 if gpgkey else 0
with open(repo_file, 'w') as f:
f.write('[%s]\n' % compose.compose_id)
f.write('name=Compose %s (RPMs)\n' % compose.compose_id)
f.write('[%s-%s-%s]\n' % (compose.compose_id, variant, self.num))
f.write('name=Compose %s (RPMs) - %s\n' % (compose.compose_id, variant))
f.write('baseurl=%s\n' % util.translate_path(compose, os_tree))
f.write('enabled=1\n')
f.write('gpgcheck=%s\n' % gpgcheck)

View File

@ -206,7 +206,7 @@ class OSBSThreadTest(helpers.PungiTestCase):
def _assertCorrectCalls(self, opts, setupCalls=None, scratch=False):
setupCalls = setupCalls or []
options = {'yum_repourls': ['http://root/work/global/tmp-Server/compose-rpms-1.repo']}
options = {'yum_repourls': ['http://root/work/global/tmp-Server/compose-rpms-Server-1.repo']}
if scratch:
options['scratch'] = True
options.update(opts)
@ -229,7 +229,7 @@ class OSBSThreadTest(helpers.PungiTestCase):
def _assertRepoFile(self, variants=None, gpgkey=None):
variants = variants or ['Server']
for variant in variants:
with open(self.topdir + '/work/global/tmp-%s/compose-rpms-1.repo' % variant) as f:
with open(self.topdir + '/work/global/tmp-%s/compose-rpms-%s-1.repo' % (variant, variant)) as f:
lines = f.read().split('\n')
self.assertIn('baseurl=http://root/compose/%s/$basearch/os' % variant, lines)
if gpgkey:
@ -327,8 +327,8 @@ class OSBSThreadTest(helpers.PungiTestCase):
'version': '1.0',
'git_branch': 'f24-docker',
'yum_repourls': [
'http://root/work/global/tmp-Server/compose-rpms-1.repo',
'http://root/work/global/tmp-Everything/compose-rpms-1.repo',
'http://root/work/global/tmp-Server/compose-rpms-Server-1.repo',
'http://root/work/global/tmp-Everything/compose-rpms-Everything-1.repo',
'http://pkgs.example.com/my.repo',
]
}
@ -357,9 +357,9 @@ class OSBSThreadTest(helpers.PungiTestCase):
'version': '1.0',
'git_branch': 'f24-docker',
'yum_repourls': [
'http://root/work/global/tmp-Server/compose-rpms-1.repo',
'http://root/work/global/tmp-Everything/compose-rpms-1.repo',
'http://root/work/global/tmp-Client/compose-rpms-1.repo',
'http://root/work/global/tmp-Server/compose-rpms-Server-1.repo',
'http://root/work/global/tmp-Everything/compose-rpms-Everything-1.repo',
'http://root/work/global/tmp-Client/compose-rpms-Client-1.repo',
'http://pkgs.example.com/my.repo',
]
}