|
|
aa0848 |
import re, sys, os, collections
|
|
|
aa0848 |
|
|
|
aa0848 |
buildroot = sys.argv[1]
|
|
|
aa0848 |
known_files = sys.stdin.read().splitlines()
|
|
|
aa0848 |
known_files = {line.split()[-1]:line for line in known_files}
|
|
|
aa0848 |
|
|
|
aa0848 |
def files(root):
|
|
|
aa0848 |
os.chdir(root)
|
|
|
aa0848 |
todo = collections.deque(['.'])
|
|
|
aa0848 |
while todo:
|
|
|
aa0848 |
n = todo.pop()
|
|
|
aa0848 |
files = os.scandir(n)
|
|
|
aa0848 |
for file in files:
|
|
|
aa0848 |
yield file
|
|
|
aa0848 |
if file.is_dir() and not file.is_symlink():
|
|
|
aa0848 |
todo.append(file)
|
|
|
aa0848 |
|
|
|
aa0848 |
o_libs = open('.file-list-libs', 'w')
|
|
|
aa0848 |
o_udev = open('.file-list-udev', 'w')
|
|
|
2aacef |
o_boot = open('.file-list-boot', 'w')
|
|
|
aa0848 |
o_pam = open('.file-list-pam', 'w')
|
|
|
aa0848 |
o_rpm_macros = open('.file-list-rpm-macros', 'w')
|
|
|
aa0848 |
o_devel = open('.file-list-devel', 'w')
|
|
|
aa0848 |
o_container = open('.file-list-container', 'w')
|
|
|
aa0848 |
o_networkd = open('.file-list-networkd', 'w')
|
|
|
aa0848 |
o_oomd = open('.file-list-oomd', 'w')
|
|
|
aa0848 |
o_remote = open('.file-list-remote', 'w')
|
|
|
2aacef |
o_resolve = open('.file-list-resolve', 'w')
|
|
|
aa0848 |
o_tests = open('.file-list-tests', 'w')
|
|
|
aa0848 |
o_standalone_tmpfiles = open('.file-list-standalone-tmpfiles', 'w')
|
|
|
aa0848 |
o_standalone_sysusers = open('.file-list-standalone-sysusers', 'w')
|
|
|
2aacef |
o_main = open('.file-list-main', 'w')
|
|
|
aa0848 |
for file in files(buildroot):
|
|
|
aa0848 |
n = file.path[1:]
|
|
|
aa0848 |
if re.match(r'''/usr/(share|include)$|
|
|
|
aa0848 |
/usr/share/man(/man.|)$|
|
|
|
aa0848 |
/usr/share/zsh(/site-functions|)$|
|
|
|
aa0848 |
/usr/share/dbus-1$|
|
|
|
aa0848 |
/usr/share/dbus-1/system.d$|
|
|
|
aa0848 |
/usr/share/dbus-1/(system-|)services$|
|
|
|
aa0848 |
/usr/share/polkit-1(/actions|/rules.d|)$|
|
|
|
aa0848 |
/usr/share/pkgconfig$|
|
|
|
aa0848 |
/usr/share/bash-completion(/completions|)$|
|
|
|
aa0848 |
/usr(/lib|/lib64|/bin|/sbin|)$|
|
|
|
aa0848 |
/usr/lib.*/(security|pkgconfig)$|
|
|
|
aa0848 |
/usr/lib/rpm(/macros.d|)$|
|
|
|
aa0848 |
/usr/lib/firewalld(/services|)$|
|
|
|
aa0848 |
/usr/share/(locale|licenses|doc)| # no $
|
|
|
aa0848 |
/etc(/pam\.d|/xdg|/X11|/X11/xinit|/X11.*\.d|)$|
|
|
|
aa0848 |
/etc/(dnf|dnf/protected.d)$|
|
|
|
aa0848 |
/usr/(src|lib/debug)| # no $
|
|
|
aa0848 |
/run$|
|
|
|
aa0848 |
/var(/cache|/log|/lib|/run|)$
|
|
|
aa0848 |
''', n, re.X):
|
|
|
aa0848 |
continue
|
|
|
aa0848 |
if '/security/pam_' in n or '/man8/pam_' in n:
|
|
|
aa0848 |
o = o_pam
|
|
|
aa0848 |
elif '/rpm/' in n:
|
|
|
aa0848 |
o = o_rpm_macros
|
|
|
aa0848 |
elif '/usr/lib/systemd/tests' in n:
|
|
|
aa0848 |
o = o_tests
|
|
|
2aacef |
elif re.search(r'/libsystemd-(shared|core)-.*\.so$', n):
|
|
|
2aacef |
o = o_main
|
|
|
2aacef |
elif re.search(r'/libcryptsetup-token-systemd-.*\.so$', n):
|
|
|
2aacef |
o = o_udev
|
|
|
2aacef |
elif re.search(r'/lib.*\.pc|/man3/|/usr/include|\.so$', n):
|
|
|
aa0848 |
o = o_devel
|
|
|
aa0848 |
elif re.search(r'''journal-(remote|gateway|upload)|
|
|
|
aa0848 |
systemd-remote\.conf|
|
|
|
aa0848 |
/usr/share/systemd/gatewayd|
|
|
|
aa0848 |
/var/log/journal/remote
|
|
|
aa0848 |
''', n, re.X):
|
|
|
aa0848 |
o = o_remote
|
|
|
2aacef |
|
|
|
aa0848 |
elif re.search(r'''mymachines|
|
|
|
aa0848 |
machinectl|
|
|
|
aa0848 |
systemd-nspawn|
|
|
|
aa0848 |
import-pubring.gpg|
|
|
|
aa0848 |
systemd-(machined|import|pull)|
|
|
|
aa0848 |
/machine.slice|
|
|
|
aa0848 |
/machines.target|
|
|
|
aa0848 |
var-lib-machines.mount|
|
|
|
aa0848 |
org.freedesktop.(import|machine)1
|
|
|
aa0848 |
''', n, re.X):
|
|
|
aa0848 |
o = o_container
|
|
|
2aacef |
|
|
|
aa0848 |
elif re.search(r'''/usr/lib/systemd/network/80-|
|
|
|
aa0848 |
networkd|
|
|
|
aa0848 |
networkctl|
|
|
|
2aacef |
org.freedesktop.network1|
|
|
|
2aacef |
sysusers\.d/systemd-network.conf|
|
|
|
2aacef |
tmpfiles\.d/systemd-network.conf|
|
|
|
2aacef |
systemd\.network|
|
|
|
2aacef |
systemd\.netdev
|
|
|
aa0848 |
''', n, re.X):
|
|
|
aa0848 |
o = o_networkd
|
|
|
2aacef |
|
|
|
aa0848 |
elif '.so.' in n:
|
|
|
aa0848 |
o = o_libs
|
|
|
2aacef |
|
|
|
aa0848 |
elif re.search(r'''udev(?!\.pc)|
|
|
|
aa0848 |
hwdb|
|
|
|
aa0848 |
bootctl|
|
|
|
2aacef |
boot-update|
|
|
|
aa0848 |
bless-boot|
|
|
|
aa0848 |
boot-system-token|
|
|
|
aa0848 |
kernel-install|
|
|
|
aa0848 |
vconsole|
|
|
|
aa0848 |
backlight|
|
|
|
aa0848 |
rfkill|
|
|
|
aa0848 |
random-seed|
|
|
|
aa0848 |
modules-load|
|
|
|
aa0848 |
timesync|
|
|
|
2aacef |
crypttab|
|
|
|
aa0848 |
cryptenroll|
|
|
|
aa0848 |
cryptsetup|
|
|
|
aa0848 |
kmod|
|
|
|
aa0848 |
quota|
|
|
|
aa0848 |
pstore|
|
|
|
aa0848 |
sleep|suspend|hibernate|
|
|
|
aa0848 |
systemd-tmpfiles-setup-dev|
|
|
|
aa0848 |
network/99-default.link|
|
|
|
aa0848 |
growfs|makefs|makeswap|mkswap|
|
|
|
aa0848 |
fsck|
|
|
|
aa0848 |
repart|
|
|
|
aa0848 |
gpt-auto|
|
|
|
aa0848 |
volatile-root|
|
|
|
2aacef |
veritysetup|
|
|
|
2aacef |
integritysetup|
|
|
|
2aacef |
integritytab|
|
|
|
aa0848 |
remount-fs|
|
|
|
2aacef |
/initrd|
|
|
|
2aacef |
systemd-pcrphase|
|
|
|
2aacef |
systemd-measure|
|
|
|
aa0848 |
/boot$|
|
|
|
aa0848 |
/kernel/|
|
|
|
aa0848 |
/kernel$|
|
|
|
2aacef |
/modprobe.d|
|
|
|
2aacef |
binfmt|
|
|
|
2aacef |
sysctl|
|
|
|
2aacef |
coredump|
|
|
|
2aacef |
homed|home1|
|
|
|
2aacef |
portabled|portable1
|
|
|
2aacef |
''', n, re.X): # coredumpctl, homectl, portablectl are included in the main package because
|
|
|
2aacef |
# they can be used to interact with remote daemons. Also, the user could be
|
|
|
2aacef |
# confused if those user-facing binaries are not available.
|
|
|
aa0848 |
o = o_udev
|
|
|
2aacef |
|
|
|
2aacef |
elif re.search(r'''/boot/efi|
|
|
|
2aacef |
/usr/lib/systemd/boot|
|
|
|
2aacef |
sd-boot|systemd-boot\.|loader.conf
|
|
|
2aacef |
''', n, re.X):
|
|
|
2aacef |
o = o_boot
|
|
|
2aacef |
|
|
|
2aacef |
elif re.search(r'''resolved|resolve1|
|
|
|
2aacef |
resolvectl|
|
|
|
2aacef |
systemd-resolve|
|
|
|
2aacef |
resolvconf|
|
|
|
2aacef |
systemd\.(positive|negative)|
|
|
|
2aacef |
nss-resolve
|
|
|
2aacef |
''', n, re.X): # resolvectl and nss-resolve are in the main package.
|
|
|
2aacef |
o = o_resolve
|
|
|
2aacef |
|
|
|
aa0848 |
elif re.search(r'''10-oomd-.*defaults\.conf|
|
|
|
aa0848 |
oomd\.conf|
|
|
|
aa0848 |
oomctl|
|
|
|
aa0848 |
org.freedesktop.oom1|
|
|
|
aa0848 |
systemd-oomd
|
|
|
aa0848 |
''', n, re.X):
|
|
|
aa0848 |
o = o_oomd
|
|
|
2aacef |
|
|
|
aa0848 |
elif n.endswith('.standalone'):
|
|
|
aa0848 |
if 'tmpfiles' in n:
|
|
|
aa0848 |
o = o_standalone_tmpfiles
|
|
|
aa0848 |
elif 'sysusers' in n:
|
|
|
aa0848 |
o = o_standalone_sysusers
|
|
|
aa0848 |
else:
|
|
|
aa0848 |
assert False, 'Found .standalone not belonging to known packages'
|
|
|
2aacef |
|
|
|
aa0848 |
else:
|
|
|
2aacef |
o = o_main
|
|
|
aa0848 |
|
|
|
aa0848 |
if n in known_files:
|
|
|
aa0848 |
prefix = ' '.join(known_files[n].split()[:-1])
|
|
|
aa0848 |
if prefix:
|
|
|
aa0848 |
prefix += ' '
|
|
|
aa0848 |
elif file.is_dir() and not file.is_symlink():
|
|
|
aa0848 |
prefix = '%dir '
|
|
|
aa0848 |
elif 'README' in n:
|
|
|
aa0848 |
prefix = '%doc '
|
|
|
aa0848 |
elif n.startswith('/etc'):
|
|
|
aa0848 |
prefix = '%config(noreplace) '
|
|
|
aa0848 |
else:
|
|
|
aa0848 |
prefix = ''
|
|
|
aa0848 |
|
|
|
aa0848 |
suffix = '*' if '/man/' in n else ''
|
|
|
aa0848 |
|
|
|
aa0848 |
print(f'{prefix}{n}{suffix}', file=o)
|