Draft: add CI check for openrc services enabled in post-install and make them consistent
It's easy to make mistakes with openrc dependencies, see: https://wiki.postmarketos.org/wiki/Packaging#When_to_depend_on_-openrc_subpackages
This MR adds a CI check that lints the rc-update add
lines in post-install scripts to make them consistent and consumable by scripts, and another one that verifies that dependencies are listed properly for each rc-update add
line. The second check needs to install built packages, so it runs after the build step.
TODO:
-
fix [02:37:59] ERROR: Command failed: (native) % - b a a r c h 6 4 apk add watchdog-kick
😅 -
adjust all packages, so they pass the install-test and not just the lint test -
verify that .gitlab-ci/openrc_subpackages.py --test-pkgs --arch=...
passes for all supported arches. This runs the instlal-test on all packages with openrc-services enabled in post-install scripts.
CC: @afontain, @craftyguy (follow up to what we discussed in the chat)
Example output
Linter running on master (these linting issues are already fixed with the commits in the current version):
$ .gitlab-ci/openrc_subpackages.py
linting *.post-install regarding 'rc-update add'
modem/msm-modem/msm-modem-downstream.post-install:
1: line does not follow format 'rc-update add <service> <runlevel>'
sxmo/sxmo-utils/sxmo-utils.post-install:
2: line contains illegal character: "
2: line does not follow format 'rc-update add <service> <runlevel>'
device/testing/device-samsung-klte/device-samsung-klte-kernel-downstream.post-install:
3: line does not follow format 'rc-update add <service> <runlevel>'
3: line does not follow format 'rc-update add <service> <runlevel>'
14: line does not follow format 'rc-update add <service> <runlevel>'
device/testing/firmware-samsung-kminilte/firmware-samsung-kminilte.post-install:
3: line does not follow format 'rc-update add <service> <runlevel>'
device/testing/device-samsung-i9070/device-samsung-i9070.post-install:
3: line does not follow format 'rc-update add <service> <runlevel>'
device/testing/device-xiaomi-armani/device-xiaomi-armani.post-install:
2: line does not follow format 'rc-update add <service> <runlevel>'
device/community/device-nokia-n900/device-nokia-n900.post-install:
14: line does not follow format 'rc-update add <service> <runlevel>'
main/msm-fb-refresher/msm-fb-refresher.post-install:
2: line does not follow format 'rc-update add <service> <runlevel>'
main/watchdog-kick/watchdog-kick.post-install:
2: line does not follow format 'rc-update add <service> <runlevel>'
main/postmarketos-base/postmarketos-base.post-install:
8: line does not start with 'rc-update'
8: line contains illegal character: $
8: line does not follow format 'rc-update add <service> <runlevel>'
8: line does not start with 'rc-update'
8: line contains illegal character: $
8: line does not follow format 'rc-update add <service> <runlevel>'
11: line does not start with 'rc-update'
11: line contains illegal character: $
11: line does not follow format 'rc-update add <service> <runlevel>'
8: line does not start with 'rc-update'
8: line contains illegal character: $
8: line does not follow format 'rc-update add <service> <runlevel>'
11: line does not start with 'rc-update'
11: line contains illegal character: $
11: line does not follow format 'rc-update add <service> <runlevel>'
14: line does not start with 'rc-update'
14: line contains illegal character: $
14: line does not follow format 'rc-update add <service> <runlevel>'
8: line does not start with 'rc-update'
8: line contains illegal character: $
8: line does not follow format 'rc-update add <service> <runlevel>'
11: line does not start with 'rc-update'
11: line contains illegal character: $
11: line does not follow format 'rc-update add <service> <runlevel>'
14: line does not start with 'rc-update'
14: line contains illegal character: $
14: line does not follow format 'rc-update add <service> <runlevel>'
17: line does not start with 'rc-update'
17: line contains illegal character: $
17: line does not follow format 'rc-update add <service> <runlevel>'
42 errors found.
pmaports.git has strict rules for 'rc-update add' lines in
post-install files. Please fix the errors above.
Related: https://wiki.postmarketos.org/wiki/Packaging
Current errors and warnings found in build-x86_64:
=== 6 warning(s) ===
postmarketos-base:
* service 'devmappings' is owned by package 'postmarketos-base', which does not end in '-openrc'
* service 'syslog' is owned by package 'busybox-initscripts', which does not end in '-openrc'
* service 'sshd' is owned by package 'openssh-server-common', which does not end in '-openrc'
* service 'swapfile' is owned by package 'postmarketos-base', which does not end in '-openrc'
watchdog-kick:
* service 'watchdog-kick' is owned by package 'watchdog-kick', which does not end in '-openrc'
msm-fb-refresher:
* service 'msm-fb-refresher' is owned by package 'msm-fb-refresher', which does not end in '-openrc'
NOTE: if you add -openrc subpackages to Alpine's aports, add the -openrc dependency to the postmarketOS packages which enable the package's service in post-install right afterwards.
=== 15 error(s) ===
postmarketos-base:
* postmarketos-base must depend on 'udev-init-scripts-openrc', because it has 'rc-update add udev' in post-install
* postmarketos-base must depend on 'udev-init-scripts', because it has 'rc-update add udev' in post-install
* postmarketos-base must depend on 'udev-init-scripts-openrc', because it has 'rc-update add udev-trigger' in post-install
* postmarketos-base must depend on 'udev-init-scripts', because it has 'rc-update add udev-trigger' in post-install
* postmarketos-base must depend on 'busybox-initscripts', because it has 'rc-update add syslog' in post-install
* postmarketos-base must depend on 'chrony-openrc', because it has 'rc-update add chronyd' in post-install
* postmarketos-base must depend on 'dbus-openrc', because it has 'rc-update add dbus' in post-install
* postmarketos-base must depend on 'dbus', because it has 'rc-update add dbus' in post-install
* postmarketos-base must depend on 'haveged-openrc', because it has 'rc-update add haveged' in post-install
* postmarketos-base must depend on 'networkmanager-openrc', because it has 'rc-update add networkmanager' in post-install
* postmarketos-base must depend on 'util-linux-openrc', because it has 'rc-update add rfkill' in post-install
* postmarketos-base must depend on 'openssh-server-common', because it has 'rc-update add sshd' in post-install
* postmarketos-base must depend on 'eudev-openrc', because it has 'rc-update add udev-postmount' in post-install
* postmarketos-base must depend on 'wpa_supplicant-openrc', because it has 'rc-update add wpa_supplicant' in post-install
sxmo-utils:
* sxmo-utils must depend on 'modemmanager-openrc', because it has 'rc-update add modemmanager' in post-install
Edited by Administrator