2 # Copyright (c) 2000 - 2016 Samsung Electronics Co., Ltd. All rights reserved.
5 # @author Chulwoo Shin <cw1.shin@samsung.com>
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
24 class Dependency(object):
26 RECOMMENDS='recommends'
32 default_arch = ('noarch', 'src')
35 "x86_64": ("x86_64", "i686", "i586", "i486", "i386"),
36 "i686": ("i686", "i586", "i486", "i386"),
37 "i586": ("i586", "i486", "i386"),
38 "ia64": ("ia64", "i686", "i586", "i486", "i386"),
39 "aarch64": ("aarch64"),
40 "armv7tnhl": ("armv7tnhl", "armv7thl", "armv7nhl", "armv7hl"),
41 "armv7thl": ("armv7thl", "armv7hl"),
42 "armv7nhl": ("armv7nhl", "armv7hl"),
43 "armv7hl": ("armv7hl"),
44 "armv7l": ("armv7l", "armv6l", "armv5tejl", "armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
45 "armv6l": ("armv6l", "armv5tejl", "armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
46 "armv5tejl": ("armv5tejl", "armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
47 "armv5tel": ("armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
48 "armv5l": ("armv5l", "armv4tl", "armv4l", "armv3l"),
51 def compare_ver(ver1, ver2):
52 return rpm.labelCompare((ver1.get('epoch'), ver1.get('ver'), ver1.get('rel')), (ver2.get('epoch'), ver2.get('ver'), ver2.get('rel')))
54 def compare_req_cap_ver(req, cap):
55 epoch = cap.get('epoch')
58 if not req.get('epoch'): epoch = None
59 if not req.get('rel'): rel = None
60 return rpm.labelCompare((req.get('epoch'), req.get('ver'), req.get('rel')), (epoch, ver, rel))
62 def meetRequireVersion(req_ver, cmp_ver):
63 cmp_ret = compare_req_cap_ver(req_ver, cmp_ver)
64 if cmp_ret == 0 and (req_ver['flags'] in ['EQ', 'GE', 'LE']):
66 elif cmp_ret == 1 and (req_ver['flags'] in ['LT', 'LE']):
68 elif cmp_ret == -1 and (req_ver['flags'] in ['GT', 'GE']):