27 lines
1.5 KiB
Python
27 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Assign each private Frameworks/provider file to one runtime or dev package."""
|
|
import json
|
|
from pathlib import Path
|
|
|
|
def development(path,policy):
|
|
if policy.get('development_only'):return True
|
|
p=Path(path).relative_to('opt/plasma')
|
|
return (p.parts[0]=='include'
|
|
or str(p).startswith(('lib/cmake/','lib/pkgconfig/','share/pkgconfig/','share/ECM/'))
|
|
or (p.parent==Path('lib') and p.suffix in ('.so','.a','.prl'))
|
|
or (policy['module']=='wayland-runtime' and str(p) in ('bin/wayland-scanner','share/wayland/wayland.dtd','share/wayland/wayland.xml')))
|
|
|
|
if __name__=='__main__':
|
|
policy=json.loads(Path('debian/package-policy.json').read_text());root=Path('debian/tmp')
|
|
groups={name:[] for name in policy['packages']};base='plasma-next-'+policy['module']
|
|
for p in sorted(root.rglob('*')):
|
|
if not p.is_symlink() and not p.is_file():continue
|
|
path=str(p.relative_to(root));key=base+'-dev' if development(path,policy) else base
|
|
if key not in groups:raise ValueError('Unexpected package category: '+path)
|
|
groups[key].append(path)
|
|
for key,files in groups.items():
|
|
if not files:raise ValueError('Empty package: '+key)
|
|
# Compat 13 substitutes these after splitting fields on whitespace.
|
|
escaped=[p.replace('$','${Dollar}').replace(' ','${Space}').replace('\t','${Tab}') for p in files]
|
|
Path('debian/'+key+'.install').write_text('\n'.join(escaped)+'\n')
|