mirror of
https://abf.rosa.ru/djam/repo-analyzer.git
synced 2025-02-23 18:12:54 +00:00
Make the same package preferred for a requirement resolution
This commit is contained in:
parent
183ad8fef6
commit
6e1cc15160
1 changed files with 59 additions and 58 deletions
|
@ -230,16 +230,11 @@ SELECT packages.id AS package_id, packages.name AS package_name, packages.nvra,
|
|||
in_repodirs = ','.join(str(id) for id in search_repodirs)
|
||||
# print 'package requires count: ', len(package_requires)
|
||||
broken_dep = 0
|
||||
requires_cache = {}
|
||||
# TODO: Reuse the cache for dependent repositories???
|
||||
|
||||
for packreq in package_requires:
|
||||
(cpackage_id, package_nvra, requires_id, requires_name, requires_flags, requires_version) = \
|
||||
(packreq[0], packreq[2], packreq[3], packreq[4], packreq[5], packreq[6])
|
||||
|
||||
requirement_uid = requires_name + '\x00' + str(requires_flags) + '\x00' + requires_version
|
||||
req_res = requires_cache.get(requirement_uid, None)
|
||||
if req_res is None:
|
||||
req_res = []
|
||||
if (re.match(r'\A(rpmlib|executable)\(.+\)\Z', requires_name)):
|
||||
# see if($N=~/\A(rpmlib|executable)\(.+\)\Z/) in urpm_repoclosure.pl
|
||||
|
@ -254,9 +249,10 @@ SELECT packages.id AS package_id, packages.name AS package_name, packages.nvra,
|
|||
""" % in_repodirs, [requires_name]).fetchall()
|
||||
preferred_version = None
|
||||
for dep_cand in depend_candidates:
|
||||
(provides_flags, provides_version) = \
|
||||
(dep_cand[5], dep_cand[6])
|
||||
#print 'provides_version: ', provides_flags, ' ', provides_version
|
||||
(pkg_id, provides_id,
|
||||
provides_flags, provides_version) = \
|
||||
(dep_cand[0], dep_cand[3],
|
||||
dep_cand[5], dep_cand[6])
|
||||
if provides_flags & RPMSENSE_SENSEMASK == 0:
|
||||
if not provides_version:
|
||||
provides_version = '*'
|
||||
|
@ -267,6 +263,12 @@ SELECT packages.id AS package_id, packages.name AS package_name, packages.nvra,
|
|||
if version_ok(requires_version,
|
||||
requires_flags & RPMSENSE_SENSEMASK,
|
||||
provides_version):
|
||||
if pkg_id == cpackage_id:
|
||||
# the same package is preferred over any other
|
||||
req_res.append({'prov_id': provides_id,
|
||||
'pkg_id': pkg_id})
|
||||
preferred_version = None
|
||||
break
|
||||
better_version = preferred_version is None or \
|
||||
provides_version == '*'
|
||||
if not better_version:
|
||||
|
@ -319,7 +321,6 @@ VALUES (?, ?, ?, ?)
|
|||
else:
|
||||
print requires_name, ' ', requires_version, ' (required by %s)' % package_nvra, ' not found!!!'
|
||||
broken_dep += 1
|
||||
requires_cache[requirement_uid] = req_res
|
||||
n = n + 1
|
||||
#print "n = ", n
|
||||
# if n == 60000:
|
||||
|
|
Loading…
Add table
Reference in a new issue