Added obs repository as a part of obs->repo mapping
authorEd Bartosh <eduard.bartosh@intel.com>
Sat, 30 Nov 2013 14:59:25 +0000 (16:59 +0200)
committerEd Bartosh <eduard.bartosh@intel.com>
Mon, 2 Dec 2013 15:34:10 +0000 (17:34 +0200)
OBS project can be mapped to multiple repo names in repos.yaml depending
on obs repository, for example:
Tizen:Mobile OBS project currently maps to 3 repos:
  Tizen-mobile for OBS repo atom,
  Tizen-mobile-rd-pq for OBS repo arm,
  Tizen-emulator for OBS repo emulator.

so, it's not possible to find repo name by using OBS project.
OBS repository should be taken into consideration as well.

This is a serious design fault in the current code.

This change is trying to fix this by using <OBS project>:<OBS repository>
key in obs->repo mapping API.

Change-Id: Ibfb7b77b3efbbbde65d8deeff1b90e08e0695977
Signed-off-by: Ed Bartosh <eduard.bartosh@intel.com>
common/backenddb.py
tests/test_backenddb.py

index 97b8653..2bbfd0b 100644 (file)
@@ -176,7 +176,7 @@ class BackendDB():
             names.add(name)
             db_repos[name] = repo
 
-            mapkey = repo['Project']
+            mapkey = "%s:%s" % (repo['Project'], repo['Target'])
             mapkeys.add(mapkey)
             db_obsrepomap[mapkey] = name
 
index 302c98f..b2c2491 100644 (file)
@@ -160,11 +160,12 @@ class BackendDBTest(unittest.TestCase):
         repos = bdb.get_repos()
         maps = bdb.get_obs_repo_map()
         self.assertEqual(repos.keys(), set(['Repo1', 'Repo2', 'Repo3']))
-        self.assertEqual(maps.keys(), set(['Project:Repo1', 'Project:Repo2',
-                                           'Tizen:non-oss']))
-        self.assertEqual(maps['Project:Repo1'], 'Repo1')
-        self.assertEqual(maps['Project:Repo2'], 'Repo2')
-        self.assertEqual(maps['Tizen:non-oss'], 'Repo3')
+        self.assertEqual(maps.keys(), set(['Project:Repo1:standard',
+                                           'Project:Repo2:standard',
+                                           'Tizen:non-oss:standard']))
+        self.assertEqual(maps['Project:Repo1:standard'], 'Repo1')
+        self.assertEqual(maps['Project:Repo2:standard'], 'Repo2')
+        self.assertEqual(maps['Tizen:non-oss:standard'], 'Repo3')
 
     def test_repos_cleanup(self):
         """Set some repos and see if they'll be cleaned up by read_repos."""