summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorxiaojuan.mao <xiaojuan.mao@samsung.com>2017-08-08 16:26:19 +0800
committerxiaojuan.mao <xiaojuan.mao@samsung.com>2017-08-08 16:29:13 +0800
commit33bed3aa993a9db2727f2b2044a3b43334182be8 (patch)
tree606683cecf9953373e19f7200c067024e83ce3e1
parenta5cca2b08349c596407a156379b6bf1c36b62205 (diff)
downloadmic-33bed3aa993a9db2727f2b2044a3b43334182be8.tar.gz
mic-33bed3aa993a9db2727f2b2044a3b43334182be8.tar.bz2
mic-33bed3aa993a9db2727f2b2044a3b43334182be8.zip
Locally built mic-bootstrap using gbs cannot be used in mic.
Change-Id: I9fe14df33b74670321ca302d1783f647e87c216d
-rwxr-xr-xmic/utils/misc.py14
-rwxr-xr-x[-rw-r--r--]tests/test_configmgr.py3
2 files changed, 15 insertions, 2 deletions
diff --git a/mic/utils/misc.py b/mic/utils/misc.py
index 738ac66..4716b24 100755
--- a/mic/utils/misc.py
+++ b/mic/utils/misc.py
@@ -619,7 +619,8 @@ def get_metadata_from_repos(repos, cachedir):
"proxies":proxies,
"patterns":filepaths['patterns'],
"comps":filepaths['comps'],
- "repokey":repokey})
+ "repokey":repokey,
+ "priority":repo.priority})
return my_repo_metadata
@@ -697,6 +698,7 @@ def get_arch(repometadata):
def get_package(pkg, repometadata, arch = None):
ver = ""
+ priority = 99
target_repo = None
if not arch:
arches = []
@@ -714,6 +716,16 @@ def get_package(pkg, repometadata, arch = None):
for elm in root.getiterator("%spackage" % ns):
if elm.find("%sname" % ns).text == pkg:
if elm.find("%sarch" % ns).text in arches:
+ if repo["priority"] != None:
+ tmpprior = int(repo["priority"])
+ if tmpprior < priority:
+ priority = tmpprior
+ location = elm.find("%slocation" % ns)
+ pkgpath = "%s" % location.attrib['href']
+ target_repo = repo
+ break
+ elif tmpprior > priority:
+ break
version = elm.find("%sversion" % ns)
tmpver = "%s-%s" % (version.attrib['ver'], version.attrib['rel'])
if tmpver > ver:
diff --git a/tests/test_configmgr.py b/tests/test_configmgr.py
index 2f15f10..08c3744 100644..100755
--- a/tests/test_configmgr.py
+++ b/tests/test_configmgr.py
@@ -64,7 +64,8 @@ class ConfigMgrTest(unittest.TestCase):
'primary': '%s/test/primary.sqlite' % cachedir,
'proxies': None,
'repokey': None,
- 'repomd': '%s/test/repomd.xml' % cachedir}]
+ 'repomd': '%s/test/repomd.xml' % cachedir,
+ 'priority': None}]
self.configmgr._ksconf = KSCONF
self.assertTrue(isinstance(self.configmgr.create['ks'], KickstartParser))
#self.assertEqual(self.configmgr.create['name'], 'test')