|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
import re, sys, os, collections
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
buildroot = sys.argv[1]
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
known_files = sys.stdin.read().splitlines()
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
known_files = {line.split()[-1]:line for line in known_files}
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
def files(root):
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
os.chdir(root)
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
todo = collections.deque(['.'])
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
while todo:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
n = todo.pop()
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
files = os.scandir(n)
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
for file in files:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
yield file
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
if file.is_dir() and not file.is_symlink():
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
todo.append(file)
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_libs = open('.file-list-libs', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_udev = open('.file-list-udev', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_pam = open('.file-list-pam', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
c9030f |
o_rpm_macros = open('.file-list-rpm-macros', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_devel = open('.file-list-devel', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_container = open('.file-list-container', 'w')
|
|
|
b50e9d |
o_networkd = open('.file-list-networkd', 'w')
|
|
|
834f04 |
o_oomd_defaults = open('.file-list-oomd-defaults', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_remote = open('.file-list-remote', 'w')
|
|
|
be0f56 |
o_resolve = open('.file-list-resolve', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_tests = open('.file-list-tests', 'w')
|
|
|
b50e9d |
o_standalone_tmpfiles = open('.file-list-standalone-tmpfiles', 'w')
|
|
|
b50e9d |
o_standalone_sysusers = open('.file-list-standalone-sysusers', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o_rest = open('.file-list-rest', 'w')
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
for file in files(buildroot):
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
n = file.path[1:]
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
if re.match(r'''/usr/(share|include)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/man(/man.|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/zsh(/site-functions|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/dbus-1$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/dbus-1/system.d$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/dbus-1/(system-|)services$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/polkit-1(/actions|/rules.d|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/pkgconfig$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/bash-completion(/completions|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr(/lib|/lib64|/bin|/sbin|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/lib.*/(security|pkgconfig)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/lib/rpm(/macros.d|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/lib/firewalld(/services|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/share/(locale|licenses|doc)| # no $
|
|
Yu Watanabe |
9653e1 |
/etc(/pam\.d|/xdg|/X11|/X11/xinit|/X11.*\.d|)$|
|
|
Zbigniew Jędrzejewski-Szmek |
184871 |
/etc/(dnf|dnf/protected.d)$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/usr/(src|lib/debug)| # no $
|
|
Zbigniew Jędrzejewski-Szmek |
be4317 |
/run$|
|
|
Yu Watanabe |
9653e1 |
/var(/cache|/log|/lib|/run|)$
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
''', n, re.X):
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
continue
|
|
Zbigniew Jędrzejewski-Szmek |
48edd5 |
if '/security/pam_' in n or '/man8/pam_' in n:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o = o_pam
|
|
Zbigniew Jędrzejewski-Szmek |
ced923 |
elif '/rpm/' in n:
|
|
Zbigniew Jędrzejewski-Szmek |
c9030f |
o = o_rpm_macros
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
elif '/usr/lib/systemd/tests' in n:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o = o_tests
|
|
Dusty Mabe |
283a99 |
elif re.search(r'/lib.*\.pc|/man3/|/usr/include|(?
|
|
Dusty Mabe |
283a99 |
o = o_devel
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
elif re.search(r'''journal-(remote|gateway|upload)|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
systemd-remote\.conf|
|
|
Yu Watanabe |
9653e1 |
/usr/share/systemd/gatewayd|
|
|
Yu Watanabe |
9653e1 |
/var/log/journal/remote
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
''', n, re.X):
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o = o_remote
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
elif re.search(r'''mymachines|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
machinectl|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
systemd-nspawn|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
import-pubring.gpg|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
systemd-(machined|import|pull)|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/machine.slice|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/machines.target|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
var-lib-machines.mount|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
org.freedesktop.(import|machine)1
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
''', n, re.X):
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o = o_container
|
|
Zbigniew Jędrzejewski-Szmek |
9bf9a3 |
elif re.search(r'''/usr/lib/systemd/network/80-|
|
|
Dusty Mabe |
283a99 |
networkd|
|
|
Dusty Mabe |
283a99 |
networkctl|
|
|
Dusty Mabe |
283a99 |
org.freedesktop.network1
|
|
Dusty Mabe |
283a99 |
''', n, re.X):
|
|
Dusty Mabe |
283a99 |
o = o_networkd
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
elif '.so.' in n:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o = o_libs
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
elif re.search(r'''udev(?!\.pc)|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
hwdb|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
bootctl|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
sd-boot|systemd-boot\.|loader.conf|
|
|
Zbigniew Jędrzejewski-Szmek |
aed571 |
bless-boot|
|
|
Zbigniew Jędrzejewski-Szmek |
aed571 |
boot-system-token|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
kernel-install|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
vconsole|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
backlight|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
rfkill|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
random-seed|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
modules-load|
|
|
Yu Watanabe |
9653e1 |
timesync|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
cryptsetup|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
kmod|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
quota|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
pstore|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
sleep|suspend|hibernate|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
systemd-tmpfiles-setup-dev|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
network/99-default.link|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
growfs|makefs|makeswap|mkswap|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
fsck|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
repart|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
gpt-auto|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
volatile-root|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
verity-setup|
|
|
Zbigniew Jędrzejewski-Szmek |
db1cfc |
remount-fs|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/boot$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/boot/efi|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/kernel/|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/kernel$|
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
/modprobe.d
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
''', n, re.X):
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o = o_udev
|
|
|
be0f56 |
elif re.search(r'''resolvectl|
|
|
|
be0f56 |
resolved|
|
|
|
be0f56 |
systemd-resolve|
|
|
|
be0f56 |
resolvconf|
|
|
|
be0f56 |
resolve1\.
|
|
|
be0f56 |
''', n, re.X):
|
|
|
be0f56 |
# keep only nss-resolve in systemd
|
|
|
be0f56 |
o = o_resolve
|
|
|
834f04 |
elif re.search(r'10-oomd-.*defaults.conf|lib/systemd/oomd.conf.d', n, re.X):
|
|
|
834f04 |
o = o_oomd_defaults
|
|
|
b50e9d |
elif n.endswith('.standalone'):
|
|
|
b50e9d |
if 'tmpfiles' in n:
|
|
|
b50e9d |
o = o_standalone_tmpfiles
|
|
|
b50e9d |
elif 'sysusers' in n:
|
|
|
b50e9d |
o = o_standalone_sysusers
|
|
|
b50e9d |
else:
|
|
|
b50e9d |
assert False, 'Found .standalone not belonging to known packages'
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
else:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
o = o_rest
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
if n in known_files:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
prefix = ' '.join(known_files[n].split()[:-1])
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
if prefix:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
prefix += ' '
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
elif file.is_dir() and not file.is_symlink():
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
prefix = '%dir '
|
|
Zbigniew Jędrzejewski-Szmek |
c6e8c3 |
elif 'README' in n:
|
|
Zbigniew Jędrzejewski-Szmek |
c6e8c3 |
prefix = '%doc '
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
elif n.startswith('/etc'):
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
prefix = '%config(noreplace) '
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
else:
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
prefix = ''
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
suffix = '*' if '/man/' in n else ''
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
|
|
Zbigniew Jędrzejewski-Szmek |
17a6f3 |
print(f'{prefix}{n}{suffix}', file=o)
|