mirror of
https://abf.rosa.ru/djam/repo-analyzer.git
synced 2025-02-23 10:02:54 +00:00
Update symbols resolution for links to .so files
This commit is contained in:
parent
c740f87c67
commit
558a118047
1 changed files with 31 additions and 15 deletions
|
@ -146,25 +146,40 @@ SELECT packages.id AS package_id, packages.name AS package_name, packages.nvra,
|
||||||
for file_link in package_files_links:
|
for file_link in package_files_links:
|
||||||
pkg_id = file_link[0]
|
pkg_id = file_link[0]
|
||||||
pkg_name = file_link[1]
|
pkg_name = file_link[1]
|
||||||
|
pkg_nvra = file_link[2]
|
||||||
object_id = file_link[3]
|
object_id = file_link[3]
|
||||||
target_path = os.path.normpath(file_link[5])
|
|
||||||
target_obj_id = None
|
target_obj_id = None
|
||||||
tofile = dbc.execute("""
|
target_path = os.path.normpath(file_link[5])
|
||||||
SELECT id FROM package_files WHERE path = ? AND package_id = ?
|
target_paths = {}
|
||||||
""", [target_path, pkg_id]).fetchone()
|
target_paths[target_path] = True
|
||||||
if tofile:
|
while target_path != '':
|
||||||
target_obj_id = tofile[0]
|
new_target_path = None
|
||||||
if not target_obj_id:
|
|
||||||
# Just two level of dependency recursion - TODO: Full depth recursion?
|
|
||||||
tofile = dbc.execute("""
|
tofile = dbc.execute("""
|
||||||
SELECT id FROM package_files WHERE path = ? AND package_id IN (
|
SELECT id, link_to_path FROM package_files WHERE path = ? AND package_id = ?
|
||||||
|
""", [target_path, pkg_id]).fetchone()
|
||||||
|
if tofile:
|
||||||
|
target_obj_id = tofile[0]
|
||||||
|
new_target_path = tofile[1]
|
||||||
|
if not target_obj_id:
|
||||||
|
# Just two level of dependency recursion - TODO: Full depth recursion?
|
||||||
|
tofile = dbc.execute("""
|
||||||
|
SELECT id, link_to_path FROM package_files WHERE path = ? AND package_id IN (
|
||||||
SELECT dep_package_id FROM requires WHERE package_id = ?
|
SELECT dep_package_id FROM requires WHERE package_id = ?
|
||||||
UNION
|
UNION
|
||||||
SELECT dep_package_id FROM requires WHERE package_id IN (SELECT dep_package_id FROM requires WHERE package_id = ?)
|
SELECT dep_package_id FROM requires WHERE package_id IN (SELECT dep_package_id FROM requires WHERE package_id = ?)
|
||||||
)
|
)
|
||||||
""", [target_path, pkg_id, pkg_id]).fetchone()
|
""", [target_path, pkg_id, pkg_id]).fetchone()
|
||||||
if tofile:
|
if tofile:
|
||||||
target_obj_id = tofile[0]
|
target_obj_id = tofile[0]
|
||||||
|
new_target_path = tofile[1]
|
||||||
|
if new_target_path is None:
|
||||||
|
break
|
||||||
|
target_path = os.path.normpath(new_target_path)
|
||||||
|
if target_path in target_paths:
|
||||||
|
print 'Link loop detected! %s: %s -> %s' % (pkg_nvra, file_link[5], target_path)
|
||||||
|
target_obj_id = None
|
||||||
|
break
|
||||||
|
target_paths[target_path] = True
|
||||||
|
|
||||||
if target_obj_id:
|
if target_obj_id:
|
||||||
dbc.execute("""
|
dbc.execute("""
|
||||||
|
@ -229,11 +244,12 @@ def process_repodir_obj_symbols(dbc, repodir_id, repodir_name, repodir_depends):
|
||||||
# EXPLAIN QUERY PLAN
|
# EXPLAIN QUERY PLAN
|
||||||
dbc.execute("""
|
dbc.execute("""
|
||||||
INSERT INTO obj_symbols_res(obj_sym_id, dep_obj_sym_id, res_type)
|
INSERT INTO obj_symbols_res(obj_sym_id, dep_obj_sym_id, res_type)
|
||||||
SELECT sos.id, tos.id, 1 FROM packages CROSS JOIN package_files CROSS JOIN obj_symbols sos CROSS JOIN
|
SELECT sos.id, tos.id, 1 FROM packages CROSS JOIN package_files spf CROSS JOIN obj_symbols sos CROSS JOIN
|
||||||
so_needed CROSS JOIN so_needed_res CROSS JOIN obj_symbols tos
|
so_needed CROSS JOIN so_needed_res CROSS JOIN package_files tpf CROSS JOIN obj_symbols tos
|
||||||
WHERE packages.repodir_id = ? AND packages.id = package_files.package_id AND package_files.id = sos.obj_file_id AND
|
WHERE packages.repodir_id = ? AND packages.id = spf.package_id AND spf.id = sos.obj_file_id AND
|
||||||
sos.sym_type = 0 AND sos.obj_file_id = so_needed.obj_file_id AND so_needed.id = so_needed_res.so_needed_id AND
|
sos.sym_type = 0 AND sos.obj_file_id = so_needed.obj_file_id AND so_needed.id = so_needed_res.so_needed_id AND
|
||||||
so_needed_res.res_type = 1 AND so_needed_res.dep_obj_file_id = tos.obj_file_id AND
|
so_needed_res.res_type = 1 AND so_needed_res.dep_obj_file_id = tpf.id AND
|
||||||
|
(tos.obj_file_id = tpf.id OR tos.obj_file_id = tpf.link_to_file_id) AND
|
||||||
tos.sym_type = 1 AND tos.name = sos.name
|
tos.sym_type = 1 AND tos.name = sos.name
|
||||||
""", [repodir_id])
|
""", [repodir_id])
|
||||||
print 'Searching symbols resolutions (2)...'
|
print 'Searching symbols resolutions (2)...'
|
||||||
|
|
Loading…
Add table
Reference in a new issue