From d2849d38269c5b850924abaed9ce13221d08462b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Mon, 9 Jul 2018 11:04:00 +0200 Subject: [PATCH] osbs: Generate unique repo names MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit And include variant in repo file name. The whole path is unique already, but not the filename itself. Signed-off-by: Lubomír Sedlář --- pungi/phases/osbs.py | 6 +++--- tests/test_osbs_phase.py | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/pungi/phases/osbs.py b/pungi/phases/osbs.py index 14db0561..4f5c6599 100644 --- a/pungi/phases/osbs.py +++ b/pungi/phases/osbs.py @@ -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) diff --git a/tests/test_osbs_phase.py b/tests/test_osbs_phase.py index e68c2ca0..5a212af1 100644 --- a/tests/test_osbs_phase.py +++ b/tests/test_osbs_phase.py @@ -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', ] }