"""OMEGA AB-007: read-only, targeted public source comparison (Python 3.9+).""" import argparse, base64, csv, datetime as dt, hashlib, json, re, urllib.request from concurrent.futures import ThreadPoolExecutor from pathlib import Path from urllib.error import HTTPError BASE = 'drivers/net/wireless/intel/iwlwifi/' GOOG = 'https://kernel.googlesource.com/pub/scm/linux/kernel/git/iwlwifi/backport-iwlwifi' CORE = 'refs/heads/release/core46' FILES = ['fw/api/location.h','fw/file.h','fw/api/tx.h','mvm/ops.c','mvm/vendor-cmd.c', 'mvm/vendor-cmd.h','mvm/mvm.h','mvm/rx.c','mvm/rxmq.c','mvm/debugfs.c', 'mvm/Makefile','Kconfig','Kconfig.noupstream','cfg/9000.c'] PAT = re.compile(r'\b(?:\w*(?:CSI|csi|MCSI|mcsi)\w*|cfg80211_vendor_event\w*|IWL_VENDOR_CMDS)\b') def fetch(url): req = urllib.request.Request(url, headers={'User-Agent':'OMEGA-AB007/1.0'}) with urllib.request.urlopen(req, timeout=25) as response: data = response.read(5_000_001) if len(data) > 5_000_000: raise ValueError('response exceeds size limit') return data def core_revision(): try: raw = fetch(f'{GOOG}/+/{CORE}?format=JSON').decode() obj = json.loads(raw.split('\n',1)[1] if raw.startswith(")]}'") else raw) revision = obj['commit'] if not re.fullmatch('[a-f0-9]{40}',revision): raise ValueError('invalid commit') return revision, 'resolved commit' except Exception as e: return CORE, 'branch only; commit resolution failed: '+str(e) def category(path, line): if line.lstrip().startswith(('*','//','/*')): return 'comment' if 'cfg80211_vendor_event' in line: return 'vendor event API reference (inspect context)' if path.endswith('.h'): return 'header declaration/reference' if path.endswith('ops.c') and re.search('CSI_|csi',line): return 'possible dispatch/handler registration' if path.endswith('vendor-cmd.c'): return 'vendor implementation reference' return 'implementation/configuration reference' def main(): ap = argparse.ArgumentParser(); ap.add_argument('--root',type=Path,default=Path.home()/'Documents'/'OMEGA'/'OMICRON'); args=ap.parse_args() root=args.root if not (root/'Index'/'Current-Checkpoint.txt').is_file(): raise SystemExit('OMEGA checkpoint not found; pass --root with the correct OMICRON directory.') stamp=dt.datetime.now().strftime('%Y%m%d-%H%M%S-%f') out=root/'Analysis'/('AB-007-'+stamp); out.mkdir(parents=True) ref, refnote=core_revision() print('Core46:',ref,refnote,flush=True) jobs=[(src,p) for src in ('linux-v6.14','intel-core46') for p in FILES] def collect(job): src,p=job url=(f'https://raw.githubusercontent.com/torvalds/linux/v6.14/{BASE}{p}' if src=='linux-v6.14' else f'{GOOG}/+/{ref}/{BASE}{p}?format=TEXT') info={'source':src,'file':p,'url':url,'status':'','sha256':'','detail':''}; hits=[] try: data=fetch(url) if src=='intel-core46': data=base64.b64decode(b''.join(data.split()),validate=True) text=data.decode('utf-8'); if text.lstrip().lower().startswith(('