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