2 # Copyright (c) 2016 Samsung Electronics Co., Ltd
4 # Licensed under the Flora License, Version 1.1 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://floralicense.org/license/
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
21 class Dependency(object):
23 RECOMMENDS='recommends'
29 default_arch = ('noarch', 'src')
32 "x86_64": ("x86_64", "i686", "i586", "i486", "i386"),
33 "i686": ("i686", "i586", "i486", "i386"),
34 "i586": ("i586", "i486", "i386"),
35 "ia64": ("ia64", "i686", "i586", "i486", "i386"),
36 "aarch64": ("aarch64"),
37 "armv7tnhl": ("armv7tnhl", "armv7thl", "armv7nhl", "armv7hl"),
38 "armv7thl": ("armv7thl", "armv7hl"),
39 "armv7nhl": ("armv7nhl", "armv7hl"),
40 "armv7hl": ("armv7hl"),
41 "armv7l": ("armv7l", "armv6l", "armv5tejl", "armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
42 "armv6l": ("armv6l", "armv5tejl", "armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
43 "armv5tejl": ("armv5tejl", "armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
44 "armv5tel": ("armv5tel", "armv5l", "armv4tl", "armv4l", "armv3l"),
45 "armv5l": ("armv5l", "armv4tl", "armv4l", "armv3l"),
48 def compare_ver(ver1, ver2):
49 return rpm.labelCompare((ver1.get('epoch'), ver1.get('ver'), ver1.get('rel')), (ver2.get('epoch'), ver2.get('ver'), ver2.get('rel')))
51 def compare_req_cap_ver(req, cap):
52 epoch = cap.get('epoch')
55 if not req.get('epoch'): epoch = None
56 if not req.get('rel'): rel = None
57 return rpm.labelCompare((req.get('epoch'), req.get('ver'), req.get('rel')), (epoch, ver, rel))
59 def meetRequireVersion(req_ver, cmp_ver):
60 cmp_ret = compare_req_cap_ver(req_ver, cmp_ver)
61 if cmp_ret == 0 and (req_ver['flags'] in ['EQ', 'GE', 'LE']):
63 elif cmp_ret == 1 and (req_ver['flags'] in ['LT', 'LE']):
65 elif cmp_ret == -1 and (req_ver['flags'] in ['GT', 'GE']):