#!/usr/bin/env python3 """Classify every installed Qt Base file; shared directories are not payload.""" from pathlib import Path import shutil def development(path): p = Path(path).relative_to('opt/plasma') return (p.parts[0] in ('include', 'bin', 'libexec', 'mkspecs', 'doc', 'modules') or str(p).startswith(('lib/cmake/', 'lib/pkgconfig/', 'lib/metatypes/', 'lib/objects')) or (p.parent == Path('lib') and p.suffix in ('.so', '.a', '.prl'))) if __name__ == '__main__': root = Path('debian/tmp') # QDoc is outside the selected build. Do not ship unused website templates, # including their Facebook integration, as development package payload. shutil.rmtree(root / 'opt/plasma/doc', ignore_errors=True) generator = root / 'opt/plasma/libexec/qt_cyclonedx_generator.py' if generator.exists(): # Qt invokes this module through Python; upstream installs it without a shebang. generator.chmod(generator.stat().st_mode & ~0o111) groups = {'plasma-next-qtbase': [], 'plasma-next-qtbase-dev': []} for p in sorted(root.rglob('*')): if not p.is_symlink() and not p.is_file(): continue name = str(p.relative_to(root)) key = 'plasma-next-qtbase-dev' if development(name) else 'plasma-next-qtbase' groups[key].append(name) for key, names in groups.items(): Path('debian/' + key + '.install').write_text('\n'.join(names) + '\n') print('Qt Base ownership:', {key: len(names) for key, names in groups.items()})