fix: scope runtime release proof and bound native file probes
This commit is contained in:
1 parent
a1b38c242f
commit
b070837acb
10 files changed
+816
-77
No files matched your search
@@ -2,6 +2,19 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def session_resource_scope(job):
|
||||
"""Persist declared targets; only fresh proof promotes them to observed scope."""
|
||||
library = Path(job['library'])
|
||||
project, pcb = job.get('project'), job.get('pcb')
|
||||
projects = [str(Path(project))] if project else []
|
||||
databases = [str(Path(p).parent/'database') for p in (project, pcb) if p]
|
||||
shared = library.parent/'SymbolLibs/__ReusableBlocksSymb'
|
||||
return {'scope_state': 'DECLARED' if project else 'RECHECK_REQUIRED',
|
||||
'library': str(library), 'operation_id': job.get('operation_id'),
|
||||
'block_name': job.get('block'), 'projects': projects,
|
||||
'databases': list(dict.fromkeys(databases)), 'shared_dependencies': [str(shared)]}
|
||||
|
||||
|
||||
def database_directories(lmc_file, project, pcb):
|
||||
return tuple(dict.fromkeys((
|
||||
Path(project).parent/'database',
|
||||
@@ -14,3 +27,20 @@ def unreleased_addresses(lmc_file, project, pcb):
|
||||
return [str(path/'cdbsvr/sAddress.adr')
|
||||
for path in database_directories(lmc_file, project, pcb)
|
||||
if (path/'cdbsvr/sAddress.adr').exists()]
|
||||
|
||||
|
||||
def inspect_release_addresses(snapshot, *, stop=None):
|
||||
"""An address is a reason for native inspection, never an occupancy verdict."""
|
||||
import tempfile
|
||||
from .native_repair import RepairTarget, run_native_repair
|
||||
from .native_occupancy import confirmed_inspection
|
||||
from .library_lock import LibraryBusy
|
||||
results = []
|
||||
for item in snapshot['inspection_targets']:
|
||||
target = RepairTarget(Path(item['project']), Path(item['database']))
|
||||
root = Path(tempfile.mkdtemp(prefix='cbb-release-inspection-'))
|
||||
result = run_native_repair(target, root, inspection_only=True, stop=stop)
|
||||
if not confirmed_inspection(target, result) or result['status'] != 'NOT_IN_USE':
|
||||
raise LibraryBusy(f'目标数据库未确认释放:{target.database};检查证据:{root}')
|
||||
results.append(result)
|
||||
return results
|
||||
Reference in new issue
Block a user