Dan Streetman [Wed, 19 May 2021 14:22:21 +0000 (10:22 -0400)]
log: add log_once() and log_once_errno() macros
These macros will log a message at the specified level only the first time
they are called. On all later calls, if the specified level is debug, the
logs will be suppressed; otherwise the message will be logged at debug.
Dan Streetman [Wed, 19 May 2021 14:01:59 +0000 (10:01 -0400)]
macro: add ONCE macro that evaluates to 1 one time
Every location that this macro is used, it will be true the first
time it's checked, then false each time after that.
This can be useful for things such as one-time logging.
Lennart Poettering [Thu, 20 May 2021 19:26:56 +0000 (21:26 +0200)]
fileio: make return parameters of read_virtual_file() optional
Prompted by: #19647
Lennart Poettering [Thu, 20 May 2021 19:33:14 +0000 (21:33 +0200)]
Merge pull request #19605 from yuwata/network-fdb-outgoing-interface
network: bridge-fdb: add support to specify outgoing interface
Yu Watanabe [Thu, 20 May 2021 06:55:06 +0000 (15:55 +0900)]
man: mention that drop-in files are merged in alphanumeric order
This addresses the request in https://github.com/systemd/systemd/issues/19467#issuecomment-
829332877.
Yu Watanabe [Fri, 14 May 2021 05:52:32 +0000 (14:52 +0900)]
test-network: add a testcase for OutgoingInterface= in [BridgeFDB]
Susant Sahani [Fri, 14 May 2021 05:28:18 +0000 (14:28 +0900)]
network: bridge-fdb: add support to specify outgoing interface
Yu Watanabe [Fri, 14 May 2021 05:05:00 +0000 (14:05 +0900)]
network: use queue to configure bridge FDB
Yu Watanabe [Fri, 14 May 2021 04:24:48 +0000 (13:24 +0900)]
network: bridgeFDB: rename FdbEntry -> BridgeFDB
Luca Boccassi [Thu, 20 May 2021 09:14:30 +0000 (10:14 +0100)]
Merge pull request #19669 from mrc0mmand/ci-mkosi-arch
ci: work around #19442 to make CI happy again
Yu Watanabe [Thu, 20 May 2021 06:04:15 +0000 (15:04 +0900)]
nspawn: fix build failure
This fixes a conflict between #19555 and #19653.
Anita Zhang [Wed, 19 May 2021 07:33:59 +0000 (00:33 -0700)]
man: document default rlimits
Fixes #19645
Zbigniew Jędrzejewski-Szmek [Wed, 19 May 2021 14:44:13 +0000 (16:44 +0200)]
test: enable fuzz regression tests by default
This ensures that the fuzz test code is also built by default.
It also increases the test coverage a bit. Compiling the tests
*with* sanitizers is painfully slow, so this is not enabled. But
just compiling them sauté is hardly noticable. Running the tests
increases the test count and runtime:
622 tests, 26 s
to
922 tests, 35 s
I think this is acceptable.
Lennart Poettering [Thu, 20 May 2021 05:33:51 +0000 (07:33 +0200)]
Merge pull request #19555 from poettering/nspawn-bind-user
nspawn: add --bind-user= feature for binding host user+homedir into a container
Lennart Poettering [Thu, 20 May 2021 05:33:21 +0000 (07:33 +0200)]
Merge pull request #19591 from poettering/terminal-fixes
five terminal handling fixes
Luca Boccassi [Wed, 19 May 2021 13:45:47 +0000 (14:45 +0100)]
build tests: check that Github pages can be built successfully
Lennart Poettering [Wed, 19 May 2021 21:24:55 +0000 (23:24 +0200)]
Merge pull request #19662 from yuwata/memdup
util: make memdup() or friends safer
Lennart Poettering [Wed, 19 May 2021 21:22:44 +0000 (23:22 +0200)]
Merge pull request #19653 from poettering/greedy-realloc-more
malloc_usable_size() tweaks
Frantisek Sumsal [Wed, 19 May 2021 20:03:38 +0000 (22:03 +0200)]
ci: skip root tty login
We use the `autologin` mkosi option (see
mkosi.default.d/10-systemd.conf), so the pexpect root login throws
a (harmless) error:
```
Arch Linux (built from systemd tree)
Kernel 5.4.0-1047-azure on an x86_64 (console)
image login: root (automatic login)
root
root
[root@image ~]# systemctl poweroff
root
-bash: root: command not found
[root@image ~]# systemctl poweroff
```
Frantisek Sumsal [Wed, 19 May 2021 19:29:42 +0000 (21:29 +0200)]
ci: show image summary
Frantisek Sumsal [Wed, 19 May 2021 18:15:53 +0000 (20:15 +0200)]
ci: work around #19442 to make CI happy again
Let's introduce a somewhat ugly workaround for #19442 and retry
the systemd-nspawn image boot test up to three times in case it dies
with the dissect timeout. Since this issue occurs only in the Arch job,
limit the workaround to this job only.
Lennart Poettering [Wed, 19 May 2021 19:35:48 +0000 (21:35 +0200)]
Merge pull request #19603 from yuwata/network-link-get-by-name
network: introduce link_get_by_name() and use it in resolving interface name specifier in MultiPathRoute=
Lennart Poettering [Wed, 19 May 2021 19:34:59 +0000 (21:34 +0200)]
Merge pull request #19656 from yuwata/network-trivial-cleanups
network: several trivial cleanups
Franck Bui [Wed, 19 May 2021 08:18:21 +0000 (10:18 +0200)]
kbd-model-map: add mapping 'es-dvorak'
And update test-keymap-util accordingly.
While at it, make sure to use tabs everywhere.
Yu Watanabe [Wed, 19 May 2021 08:08:59 +0000 (17:08 +0900)]
test: reduce debugging logs in test-event
The logs mostly give no information, but fill CI results.
Lennart Poettering [Fri, 14 May 2021 16:20:32 +0000 (18:20 +0200)]
systemctl: re-align colon in status output
Lennart Poettering [Wed, 12 May 2021 14:05:40 +0000 (16:05 +0200)]
terminal: don't hardcode major number of PTYs
Hardcoding major numbers sucks. And we generally don't do it, except
when determining whether something is a PTY. Thing though is that we
don't actually need to do that here either, hence don#t.
Lennart Poettering [Fri, 7 May 2021 09:44:26 +0000 (11:44 +0200)]
man: document new nspawn --bind-user= feature
Lennart Poettering [Wed, 5 May 2021 10:45:22 +0000 (12:45 +0200)]
nspawn: add new --bind-user= option for binding a host user into the container
This new option does three things for a host user specified via
--bind-user=:
1. Bind mount the home directory from the host directory into
/run/host/home/<username>
2. Install an additional user namepace UID/GID mapping mapping the host
UID/GID of the host user to an unused one from the container in the range
60514…60577.
3. Synthesize a user/group record for the user/group under the same name
as on the host, with minimized information, and the UID/GID set to
the mapped UID/GID. This data is written to /run/host/userdb/ where
nss-system will pick it up.
This should make sharing users and home directories from host into the
container pretty seamless, under some conditions:
1. User namespacing must be used.
2. The host UID/GID of the user/group cannot be in the range assigned to
the container (kernel already refuses this, as this would mean two
host UIDs/GIDs might end up being mapped to the same continer
UID/GID.
3. There's a free UID/GID in the aforementioned range in the container,
and the name of the user/group is not used in the container.
4. Container payload is new enough to include an nss-systemd version
that picks up records from /run/host/userdb/
Lennart Poettering [Wed, 5 May 2021 10:29:01 +0000 (12:29 +0200)]
nspawn: export userns_mkdir() + userns_lchown() so that it can be used elsewhere in nspawn
Lennart Poettering [Wed, 5 May 2021 08:45:48 +0000 (10:45 +0200)]
user-record: optionally, allow parsing empty user record JSON objects
Lennart Poettering [Wed, 12 May 2021 12:00:07 +0000 (14:00 +0200)]
execute: don't chown/chmod non-TTY inodes thinking they were TTYs
Fixes: #19213
This is a safety net for invalid configurations, see the original bug
report.
Lennart Poettering [Wed, 12 May 2021 11:49:37 +0000 (13:49 +0200)]
core: use GID_INVALID instead of -1 where appropriate
Lennart Poettering [Wed, 12 May 2021 11:47:45 +0000 (13:47 +0200)]
terminal-util: use _cleanup_close_ where appropriate
Lennart Poettering [Wed, 12 May 2021 11:45:48 +0000 (13:45 +0200)]
terminal-util: add extra validity checks that we operate on a TTY before doing so
Prompted by #19213, but not fixing it.
This is mostly paranoia that we don't do stuff on inodes that aren't
actually ttys.
Lennart Poettering [Wed, 12 May 2021 11:45:01 +0000 (13:45 +0200)]
terminal-util: add debug logging for when TTY ioctls fail
Lennart Poettering [Tue, 18 May 2021 21:01:32 +0000 (23:01 +0200)]
alloc-util: simplify GREEDY_REALLOC() logic by relying on malloc_usable_size()
We recently started making more use of malloc_usable_size() and rely on
it (see the string_erase() story). Given that we don't really support
sytems where malloc_usable_size() cannot be trusted beyond statistics
anyway, let's go fully in and rework GREEDY_REALLOC() on top of it:
instead of passing around and maintaining the currenly allocated size
everywhere, let's just derive it automatically from
malloc_usable_size().
I am mostly after this for the simplicity this brings. It also brings
minor efficiency improvements I guess, but things become so much nicer
to look at if we can avoid these allocation size variables everywhere.
Note that the malloc_usable_size() man page says relying on it wasn't
"good programming practice", but I think it does this for reasons that
don't apply here: the greedy realloc logic specifically doesn't rely on
the returned extra size, beyond the fact that it is equal or larger than
what was requested.
(This commit was supposed to be a quick patch btw, but apparently we use
the greedy realloc stuff quite a bit across the codebase, so this ends
up touching *a*lot* of code.)
Lennart Poettering [Tue, 18 May 2021 20:30:10 +0000 (22:30 +0200)]
alloc-util: add MALLOC_ELEMENTSOF() helper
This is a wrapper around malloc_usable_size() but is typesafe, and
divides by the element size.
A test it is also added ensuring what it does it does correcly.
Lennart Poettering [Tue, 18 May 2021 20:27:24 +0000 (22:27 +0200)]
alloc-util: introduce MALLOC_SIZEOF_SAFE() helper
It's a wrapper around malloc_usable_size() that is supposed to be
compatible with _FORTIFY_SOURCES=1, by taking the
__builtin_object_size() data into account, the same way as the
_FORTIFY_SOURCES=1 logic does.
Fixes: #19203
Lennart Poettering [Wed, 19 May 2021 14:35:16 +0000 (16:35 +0200)]
Merge pull request #19608 from keszybz/resolved-pahole
Pahole optimization for resolved's DnsQuery
Yu Watanabe [Wed, 19 May 2021 14:08:18 +0000 (23:08 +0900)]
Merge pull request #19163 from sipraga/online-if-required
network: introduce an online state that respects RequiredForOnline=
Luca Boccassi [Wed, 19 May 2021 13:33:56 +0000 (14:33 +0100)]
Merge pull request #19659 from keszybz/mkosi-naming-adjustment
Mkosi dependency naming adjustment
Yu Watanabe [Wed, 19 May 2021 12:21:28 +0000 (21:21 +0900)]
alloc-util: use memcpy_safe() in memdup() or friends
Yu Watanabe [Wed, 19 May 2021 12:20:49 +0000 (21:20 +0900)]
memory-util: make memcpy_safe() return pointer to destination
Frantisek Sumsal [Wed, 19 May 2021 11:58:35 +0000 (13:58 +0200)]
Merge pull request #19661 from keszybz/restore-liquid-compatibility
Restore liquid compatibility
Zbigniew Jędrzejewski-Szmek [Wed, 19 May 2021 11:53:41 +0000 (13:53 +0200)]
docs: prettify two external links
Zbigniew Jędrzejewski-Szmek [Wed, 19 May 2021 11:22:25 +0000 (13:22 +0200)]
docs: use {% raw %} to wrap jinja2 tags in documentation
As reported by @mrc0mmand:
> Since https://github.com/systemd/systemd/commit/
89f52a780e54b2eb0905a6e613f6d4afcb22256b#diff-b842e6ab4a95a695d9449d106f091e6a134d9eac8d2aee1cd8b169fcb6b3a98bR109
> the GH pages fail to build, since they use the Liquid templating language,
> which coincidentally uses a very similar tags as jinja:
> https://shopify.github.io/liquid/tags/control-flow/
>
>> The tag elif on line 112 in HACKING.md is not a recognized Liquid tag.
Frantisek Sumsal [Wed, 19 May 2021 08:49:56 +0000 (10:49 +0200)]
test: reintroduce m4 dependency for TEST-06-SELINUX
m4 is required to build the test SELinux module:
```
[ 31.321789] sh[483]: /bin/sh: line 1: m4: command not found
[ 31.882668] sh[488]: Compiling targeted systemd_test module
[ 32.120862] sh[492]: /bin/sh: line 1: m4: command not found
[ 32.159897] sh[458]: make: *** [/usr/share/selinux/devel/include/Makefile:156: tmp/systemd_test.mod] Error 127
```
Zbigniew Jędrzejewski-Szmek [Wed, 19 May 2021 08:53:32 +0000 (10:53 +0200)]
mkosi: stop pulling in vi
We have 'nano' everywhere, and it's enough for a casual edit.
Zbigniew Jędrzejewski-Szmek [Wed, 19 May 2021 08:52:17 +0000 (10:52 +0200)]
mkosi/fedora: use pkgconfig virtual provides to refer to packages
... and /usr/bin/ path for a library package which provides an executable we
care about (libxslt).
This way the mkosi dependency list corresponds directly to the names which are
used in the dependency() and find_program() lines in meson.build. It also makes
the thing more resilient to package splits and renames.
Zbigniew Jędrzejewski-Szmek [Wed, 19 May 2021 08:44:45 +0000 (10:44 +0200)]
mkosi/fedora: drop python3-devel req
I think it was only used for building the python wrappers.
C.f. https://src.fedoraproject.org/rpms/systemd/c/
ec9ca01d16bf6eda50b77f64dccf1caa06d29374?branch=rawhide.
Yu Watanabe [Thu, 13 May 2021 07:47:42 +0000 (16:47 +0900)]
network: route: check validity of interface name in MultiPathRoute=
Yu Watanabe [Fri, 14 May 2021 02:58:20 +0000 (11:58 +0900)]
network: route: parse earlier if device specifier in MultiPathRoute= is ifindex
Yu Watanabe [Fri, 14 May 2021 07:00:52 +0000 (16:00 +0900)]
network: introduce link_get_by_name()
Yu Watanabe [Mon, 17 May 2021 19:52:53 +0000 (04:52 +0900)]
network: drop redundant condition
When Network::unmanaged is set, then the Network object is not assigned
to any Link object. Hence, the condition is always false.
Yu Watanabe [Wed, 19 May 2021 07:17:19 +0000 (16:17 +0900)]
network: drop unnecessary call of manager_rtnl_process_address()
The reply should be NLMSG_DONE or NLMSG_ERROR.
Moreover, calling the function for reply of address label configuration
is completely wrong.
Yu Watanabe [Mon, 17 May 2021 07:32:46 +0000 (16:32 +0900)]
network: drop unused "callback" arguments in route_remove() and address_remove()
Yu Watanabe [Mon, 17 May 2021 06:57:11 +0000 (15:57 +0900)]
network: dhcp4: re-request DHCP4 address and routes immediately
It is not necessary to wait for removal is finished, as network queue
already do the same thing.
Alvin Šipraga [Tue, 27 Apr 2021 08:58:18 +0000 (10:58 +0200)]
man: describe overall online status in networkctl(1)
Alvin Šipraga [Fri, 23 Apr 2021 12:19:56 +0000 (14:19 +0200)]
networkd-test: support online state in networkctl status output
networkctl status now outputs an online state. Fix up the tests to
account for this.
Alvin Šipraga [Tue, 6 Apr 2021 13:40:46 +0000 (15:40 +0200)]
network: show online state in networkctl status output
In case the link online state is invalid, networkctl will print
"unknown", which is sufficiently neutral. The same goes for the overall
manager online state if there are no managed links, or if
RequiredForOnline=no for all managed links.
Example output:
$ networkctl status
● State: routable
Online state: partial
Address: 172.22.0.130 on wlan0
...
$ networkctl status wlan0
● 3: wlan0
Link File: /lib/systemd/network/99-default.link
Network File: /etc/systemd/network/50-wlan0.network
Type: wlan
State: routable (configured)
Online state: online
...
Alvin Šipraga [Fri, 16 Apr 2021 13:04:24 +0000 (15:04 +0200)]
man: clarify RequiredFamilyForOnline= behaviour for online state
With new "online state" semantics in networkd, make the description of
RequiredFamilyForOnline= a little more broad. Some rewording has been
done to make the passage easier to understand.
Alvin Šipraga [Tue, 6 Apr 2021 13:56:05 +0000 (15:56 +0200)]
man: clarify RequiredForOnline= behaviour for online state
With new "online state" semantics in networkd, make the description of
RequiredForOnline= a little more broad.
Alvin Šipraga [Tue, 30 Mar 2021 21:18:08 +0000 (23:18 +0200)]
network: use the overall online state in network_is_online()
Since networkd advertises a reliable online state, use it in
network_is_online(). If for some reason networkd does not know the
online state (e.g. it does not manage any of the network interfaces),
fall back to the original best-guess logic.
Alvin Šipraga [Tue, 30 Mar 2021 19:39:18 +0000 (21:39 +0200)]
network: add an online state for links and manager
Add a new state of type LinkOnlineState which indicates whether a link
is online or not. The state is also used by networkd's manager to expose
the overall online state of the system.
The possible states are:
offline the link (or system) is offline
partial at least one required link is online (see below)
online all required links are online
For links, a link is defined to be "online" if:
- it is managed; and
- its operational state is within the range defined by
RequiredForOnline=; and
- it has an IPv4 address if RequiredFamilyForOnline=ipv4 or =both; and
- it has an IPv6 address if RequiredFamilyForOnline=ipv6 or =both.
A link is defined to be "offline" if:
- it is managed; and
- it is not online, i.e. its operational state is not within the range
defined by RequiredForOnline=, and/or it is missing an IP address in
a required address family.
Otherwise, the link online state is undefined (represented internally as
_LINK_ONLINE_STATUS_INVALID or -EINVAL). Put another way, networkd will
only offer a meaningful online state for managed links where
RequiredForOnline=yes.
For the manager, the online state is a function of the online state of
all links which are requried for online, i.e. RequiredForOnline=yes. If
all required links are online, then the manager online state is defined
to be "online". If at least one of the required links is online, then
the manager online state is defined to be "partial". If none of
the required links are online, then the manager online state is defined
to be "offline". If there are no managed links, or RequiredForOnline=no
for all managed links, then the manager online state is undefined as
above.
The purpose of the "partial" state is analogous to the --any switch in
systemd-networkd-wait-online.service(8). For example, a required link
which lacks a carrier on boot will not force the overall (manager)
online state to "offline" if there is an alternative link available.
Yu Watanabe [Wed, 19 May 2021 01:29:43 +0000 (10:29 +0900)]
Merge pull request #19611 from yuwata/network-dhcp-server-introduce-server-address
network: dhcp-server: introduce ServerAddress= setting
Yu Watanabe [Wed, 19 May 2021 01:29:16 +0000 (10:29 +0900)]
Merge pull request #19631 from yuwata/network-fix-reference-counting-issues
network: fix reference counting issues
Yu Watanabe [Wed, 19 May 2021 01:27:21 +0000 (10:27 +0900)]
Merge pull request #19630 from keszybz/jinja2
Use jinja2 for templating
Zbigniew Jędrzejewski-Szmek [Mon, 17 May 2021 19:32:49 +0000 (21:32 +0200)]
docs/HACKING: add note about template engines
Zbigniew Jędrzejewski-Szmek [Mon, 17 May 2021 10:42:34 +0000 (12:42 +0200)]
meson: add workaround for old meson
Recent meson versions include the directory name in the target name,
so there is no conflict for files with the same name in different
directories. But at least with meson-0.49.2 in buster we have conflict
with sysusers.d/systemd.conf.
Zbigniew Jędrzejewski-Szmek [Mon, 17 May 2021 08:36:30 +0000 (10:36 +0200)]
ci: drop py2 lxml, pull in jinja2
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 18:13:14 +0000 (20:13 +0200)]
units: generate ReadWritePaths= in the template
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 17:34:52 +0000 (19:34 +0200)]
meson: sort conf paths alphabetically
The order was a complete mess. Let's make it a bit more tidy.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 16:54:04 +0000 (18:54 +0200)]
man: use readable names for entities
Let's use the same names as in the jinja2 substitutions.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 16:49:04 +0000 (18:49 +0200)]
meson: drop "_YES_NO" variables
We can generate the right string in the template directly.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 16:46:59 +0000 (18:46 +0200)]
meson: use jinja2 also for custom-entities.ent
This doesn't matter too much, but makes things a bit more consistent.
A minor advantage is that the file is not a configuration file for meson
anymore, so:
a) It is not built unless pulled in by another target. Since
we don't usually build man pages by default, this saves a tiny
amount of work.
b) When the .in file is updated, meson does not reconfigure everything,
but just rebuilds the dependent targets.
Now that the conversion is finished, time for benchmarking:
a full build with default settings (and -Dstandalonebinaries=true), yields
before this pull request: 1687 targets, 148.13s user 35.17s system 317% cpu 57.697 total
with the full pull request: 1714 targets, 143.07s user 27.87s system 314% cpu 54.369 total
The difference doesn't seem significant. Partial rebuilds might be faster as
mentioned before.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 16:36:44 +0000 (18:36 +0200)]
meson: drop "substs"
We had two big 'configuration_data' objects in meson config. (There are in fact
more. On is added in this series, and there's one for efi… But those others
have a handful variables only for specific purposes and don't matter). The two
sets are 'conf' and 'substs', and were inherited from the original autotools
system. In the past there was even a third set ('m4_defines'), but @yuwata
removed it in
348b44372f36010d48d9a7dda14ef67155753a71. And those two/three
systems had very similar data, but with different variable names, because of
historical reasons. They also used subtly different quoting (.set()
vs. .set10() vs. .set_quoted()), which was required because the templating
engines were not flexible enough. This meants we had more work when changing
things, and we needed to search for different variable names, etc.
With a more flexible templating engine we can do with just one
configuration_data object.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 16:34:23 +0000 (18:34 +0200)]
meson: use jinja2 in shell-completion/
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 16:06:33 +0000 (18:06 +0200)]
efi: use meson object directly instead of going through 'substs'
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 16:03:23 +0000 (18:03 +0200)]
meson: use jinja2 in src/journal-remote
One stanza had "if install_sysconfdir_samples", while the other
"if install_sysconfdir", which looks like a mistake.
install_sysconfdir_samples is now used for both.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 15:56:15 +0000 (17:56 +0200)]
meson: use jinja2 in src/libsystemd/
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 15:52:42 +0000 (17:52 +0200)]
meson: use jinja2 for various files in src/core/
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 15:33:48 +0000 (17:33 +0200)]
meson: use jinja2 for src/libudev/
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 14:55:16 +0000 (16:55 +0200)]
meson: use jinja2 for src/resolve/
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 14:44:47 +0000 (16:44 +0200)]
meson: use jinja2 for rpm templates
The naming of variables is very inconsistent. I tried to use more
modern style naming (UNDERSCORED_TITLE_CASE), but I didn't change existing
names too much. Only SYSTEM_DATA_UNIT_PATH is renamed to SYSTEM_DATA_UNIT_DIR
to match SYSTEM_CONFIG_UNIT_DIR.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 14:45:51 +0000 (16:45 +0200)]
rpm: use %_bindir not @bindir@
We were using both in various places. To keep things simple, let
rpm do the substitution.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 14:11:04 +0000 (16:11 +0200)]
meson: use jinja2 in src/timesync/
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 14:07:19 +0000 (16:07 +0200)]
meson: use jinja2 in src/udev
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 14:04:04 +0000 (16:04 +0200)]
meson: use jinja2 in src/vconsole
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 14:01:24 +0000 (16:01 +0200)]
meson: use jinja2 in sysctl.d/
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 13:57:55 +0000 (15:57 +0200)]
meson: use conf configuration_data object to generate test-sysusers.sh
I wanted to use jinja2 templating here too, but it's hard to get right:
custom_target() strips the executable bit by default (unlike configure_file
apparently). custom_target() has install_mode setting, but it was only added
in meson-0.47, so it can't be used while we support 0.46. And without the
executable bit the test is not invoked properly. For example, "root-unittests"
in the debian package calls test-* after installation, so the executable bit
there is necessary. It would be possible to adjust the file mode after the
fact, but it would make things more complicated.
So let's use the native meson substitutions here. We don't need anything more
fancy.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 13:51:17 +0000 (15:51 +0200)]
meson: use jinja2 for rules.d templates
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 13:43:41 +0000 (15:43 +0200)]
meson: use custom configuration_data() object for man/man and man/html helpers
I want to stop using 'substs'. But in this case, configure_file() is nicer
than custom_target(), because it causes meson to immediately generate the
helpers after configuration, so it's possible to do
'meson build && build/man/man ...', without building anything first.
We only substitute one variable here, so let's use a custom configuration_data()
object.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 13:20:46 +0000 (15:20 +0200)]
Drop dependency on m4
m4 was hugely popular in the past, because autotools, automake, flex, bison and
many other things used it. But nowadays it much less popular, and might not even
be installed in the buildroot. (m4 is small, so it doesn't make a big difference.)
(FWIW, Fedora dropped make from the buildroot now,
https://fedoraproject.org/wiki/Changes/Remove_make_from_BuildRoot. I think it's
reasonable to assume that m4 will be dropped at some point too.)
The main reason to drop m4 is that the syntax is not very nice, and we should
minimize the number of different syntaxes that we use. We still have two
(configure_file() with @FOO@ and jinja2 templates with {{foo}} and the
pythonesque conditional expressions), but at least we don't need m4 (with
m4_dnl and `quotes').
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 13:05:10 +0000 (15:05 +0200)]
meson: use jinja2 for README
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 12:55:43 +0000 (14:55 +0200)]
meson: use jinja2 for the gperf template
Jinja2 inserts an empty line after the first macro body, which I don't know how
to get rid of. Only the first macro causes problems: the other ones don't have
conditional statements at the end and the issue does not occur. As a work-around
I moved ProtectHostname to the end of the first macro.
Output is identical, except for horizontal whitespace and change in position of
ProtectHostname.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 11:57:00 +0000 (13:57 +0200)]
meson: use jinja2 for src/login
{% raw %} is needed to avoid trouble with {%k, which jinja thinks
is trying to access variable 'k'.
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 11:35:51 +0000 (13:35 +0200)]
meson: use jinja2 for tmpfiles.d templates
HAVE_SMACK_RUN_LABEL was dropped back in
348b44372f36010d48d9a7dda14ef67155753a71,
so one line in etc.conf was not rendered as expected ;(
Checking if names are defined is paying for itself!
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 11:02:04 +0000 (13:02 +0200)]
meson: drop unnecessary listification
Zbigniew Jędrzejewski-Szmek [Sun, 16 May 2021 17:08:50 +0000 (19:08 +0200)]
units: strip out the developer comment in .service unit again
The comment talks about upstream development steps and doesn't make
sense for users. We used special '## ' syntax to strip it out during
build, but it got inadvertently reformatted as a normal comment
in
3982becc92197b920d86f03c3c52ae085e26ca60.