|
|
a3e2b5 |
import re, sys, os, collections
|
|
|
a3e2b5 |
|
|
|
a3e2b5 |
buildroot = sys.argv[1]
|
|
|
a3e2b5 |
known_files = sys.stdin.read().splitlines()
|
|
|
a3e2b5 |
known_files = {line.split()[-1]:line for line in known_files}
|
|
|
a3e2b5 |
|
|
|
a3e2b5 |
def files(root):
|
|
|
a3e2b5 |
os.chdir(root)
|
|
|
a3e2b5 |
todo = collections.deque(['.'])
|
|
|
a3e2b5 |
while todo:
|
|
|
a3e2b5 |
n = todo.pop()
|
|
|
a3e2b5 |
files = os.scandir(n)
|
|
|
a3e2b5 |
for file in files:
|
|
|
a3e2b5 |
yield file
|
|
|
a3e2b5 |
if file.is_dir() and not file.is_symlink():
|
|
|
a3e2b5 |
todo.append(file)
|
|
|
a3e2b5 |
|
|
|
a3e2b5 |
o_libs = open('.file-list-libs', 'w')
|
|
|
a3e2b5 |
o_udev = open('.file-list-udev', 'w')
|
|
|
a3e2b5 |
o_pam = open('.file-list-pam', 'w')
|
|
|
a3e2b5 |
o_devel = open('.file-list-devel', 'w')
|
|
|
a3e2b5 |
o_container = open('.file-list-container', 'w')
|
|
|
a3e2b5 |
o_remote = open('.file-list-remote', 'w')
|
|
|
a3e2b5 |
o_tests = open('.file-list-tests', 'w')
|
|
|
a3e2b5 |
o_rest = open('.file-list-rest', 'w')
|
|
|
a3e2b5 |
for file in files(buildroot):
|
|
|
a3e2b5 |
n = file.path[1:]
|
|
|
a3e2b5 |
if re.match(r'''/usr/(share|include)$|
|
|
|
a3e2b5 |
/usr/share/man(/man.|)$|
|
|
|
a3e2b5 |
/usr/share/zsh(/site-functions|)$|
|
|
|
a3e2b5 |
/usr/share/dbus-1$|
|
|
|
a3e2b5 |
/usr/share/dbus-1/system.d$|
|
|
|
a3e2b5 |
/usr/share/dbus-1/(system-|)services$|
|
|
|
a3e2b5 |
/usr/share/polkit-1(/actions|/rules.d|)$|
|
|
|
a3e2b5 |
/usr/share/pkgconfig$|
|
|
|
a3e2b5 |
/usr/share/bash-completion(/completions|)$|
|
|
|
a3e2b5 |
/usr(/lib|/lib64|/bin|/sbin|)$|
|
|
|
a3e2b5 |
/usr/lib.*/(security|pkgconfig)$|
|
|
|
a3e2b5 |
/usr/lib/rpm(/macros.d|)$|
|
|
|
a3e2b5 |
/usr/lib/firewalld(/services|)$|
|
|
|
a3e2b5 |
/usr/share/(locale|licenses|doc)| # no $
|
|
|
a3e2b5 |
/etc(/pam\.d|/xdg|/X11|/X11/xinit|/X11.*\.d|)$|
|
|
|
a3e2b5 |
/etc/(dnf|dnf/protected.d)$|
|
|
|
a3e2b5 |
/usr/(src|lib/debug)| # no $
|
|
|
a3e2b5 |
/var(/cache|/log|/lib|/run|)$
|
|
|
a3e2b5 |
''', n, re.X):
|
|
|
a3e2b5 |
continue
|
|
|
a3e2b5 |
if '/security/pam_' in n:
|
|
|
a3e2b5 |
o = o_pam
|
|
|
a3e2b5 |
elif re.search(r'/lib.*\.pc|/man3/|/usr/include|(?
|
|
|
a3e2b5 |
o = o_devel
|
|
|
a3e2b5 |
elif '/usr/lib/systemd/tests' in n:
|
|
|
a3e2b5 |
o = o_tests
|
|
|
a3e2b5 |
elif re.search(r'''journal-(remote|gateway|upload)|
|
|
|
a3e2b5 |
systemd-remote\.conf|
|
|
|
a3e2b5 |
/usr/share/systemd/gatewayd|
|
|
|
a3e2b5 |
/var/log/journal/remote
|
|
|
a3e2b5 |
''', n, re.X):
|
|
|
a3e2b5 |
o = o_remote
|
|
|
a3e2b5 |
elif re.search(r'''mymachines|
|
|
|
a3e2b5 |
machinectl|
|
|
|
a3e2b5 |
systemd-nspawn|
|
|
|
a3e2b5 |
import-pubring.gpg|
|
|
|
a3e2b5 |
systemd-(machined|import|pull)|
|
|
|
a3e2b5 |
/machine.slice|
|
|
|
a3e2b5 |
/machines.target|
|
|
|
a3e2b5 |
var-lib-machines.mount|
|
|
|
a3e2b5 |
network/80-container-v[ez]|
|
|
|
a3e2b5 |
org.freedesktop.(import|machine)1
|
|
|
a3e2b5 |
''', n, re.X):
|
|
|
a3e2b5 |
o = o_container
|
|
|
a3e2b5 |
elif '.so.' in n:
|
|
|
a3e2b5 |
o = o_libs
|
|
|
a3e2b5 |
elif re.search(r'''udev(?!\.pc)|
|
|
|
a3e2b5 |
hwdb|
|
|
|
a3e2b5 |
bootctl|
|
|
|
a3e2b5 |
kernel-install|
|
|
|
a3e2b5 |
vconsole|
|
|
|
a3e2b5 |
backlight|
|
|
|
a3e2b5 |
rfkill|
|
|
|
a3e2b5 |
random-seed|
|
|
|
a3e2b5 |
modules-load|
|
|
|
a3e2b5 |
timesync|
|
|
|
a3e2b5 |
cryptsetup|
|
|
|
a3e2b5 |
kmod|
|
|
|
a3e2b5 |
quota|
|
|
|
a3e2b5 |
sleep|suspend|hibernate|
|
|
|
a3e2b5 |
systemd-tmpfiles-setup-dev|
|
|
|
a3e2b5 |
network/99-default.link|
|
|
|
a3e2b5 |
growfs|makefs|makeswap|
|
|
|
a3e2b5 |
gpt-auto|
|
|
|
a3e2b5 |
/boot$|
|
|
|
a3e2b5 |
/boot/efi|
|
|
|
a3e2b5 |
remount-fs|
|
|
|
a3e2b5 |
/kernel/|
|
|
|
a3e2b5 |
/kernel$|
|
|
|
a3e2b5 |
/modprobe.d
|
|
|
a3e2b5 |
''', n, re.X):
|
|
|
a3e2b5 |
o = o_udev
|
|
|
a3e2b5 |
else:
|
|
|
a3e2b5 |
o = o_rest
|
|
|
a3e2b5 |
|
|
|
a3e2b5 |
if n in known_files:
|
|
|
a3e2b5 |
prefix = ' '.join(known_files[n].split()[:-1])
|
|
|
a3e2b5 |
if prefix:
|
|
|
a3e2b5 |
prefix += ' '
|
|
|
a3e2b5 |
elif file.is_dir() and not file.is_symlink():
|
|
|
a3e2b5 |
prefix = '%dir '
|
|
|
a3e2b5 |
elif n.startswith('/etc'):
|
|
|
a3e2b5 |
prefix = '%config(noreplace) '
|
|
|
a3e2b5 |
else:
|
|
|
a3e2b5 |
prefix = ''
|
|
|
a3e2b5 |
|
|
|
a3e2b5 |
suffix = '*' if '/man/' in n else ''
|
|
|
a3e2b5 |
|
|
|
a3e2b5 |
print(f'{prefix}{n}{suffix}', file=o)
|