1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-01 09:21:26 +03:00
Commit Graph

51455 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek
17a2017f69 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.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
392ed18542 ci: drop py2 lxml, pull in jinja2 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
71ae5ce544 units: generate ReadWritePaths= in the template 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
491bf10c80 meson: sort conf paths alphabetically
The order was a complete mess. Let's make it a bit more tidy.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
23b8071d47 man: use readable names for entities
Let's use the same names as in the jinja2 substitutions.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
fd3a3e31b3 meson: drop "_YES_NO" variables
We can generate the right string in the template directly.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
46c4f8dc8a 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.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
b1ac8498ac 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 348b44372f. 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.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
5908656c57 meson: use jinja2 in shell-completion/ 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
8f127e161e efi: use meson object directly instead of going through 'substs' 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
8e6c71bc19 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.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
d34593570a meson: use jinja2 in src/libsystemd/ 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
e11a25cadb meson: use jinja2 for various files in src/core/ 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
ba29ee4cc0 meson: use jinja2 for src/libudev/ 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
411d1f4c3a meson: use jinja2 for src/resolve/ 2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
835cf75aef 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.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
d0f8006993 rpm: use %_bindir not @bindir@
We were using both in various places. To keep things simple, let
rpm do the substitution.
2021-05-19 10:25:26 +09:00
Zbigniew Jędrzejewski-Szmek
54e6c7624f meson: use jinja2 in src/timesync/ 2021-05-19 10:25:12 +09:00
Zbigniew Jędrzejewski-Szmek
94e41ec098 meson: use jinja2 in src/udev 2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
1d587e04b9 meson: use jinja2 in src/vconsole 2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
2ad498fec0 meson: use jinja2 in sysctl.d/ 2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
097c072d83 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.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
8feaea5e3d meson: use jinja2 for rules.d templates 2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
195a8a9327 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.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
44ff8df777 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').
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
02fa218b24 meson: use jinja2 for README 2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
997f52a5d1 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.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
c900d89faa meson: use jinja2 for src/login
{% raw %} is needed to avoid trouble with {%k, which jinja thinks
is trying to access variable 'k'.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
d924a938fe meson: use jinja2 for tmpfiles.d templates
HAVE_SMACK_RUN_LABEL was dropped back in 348b44372f,
so one line in etc.conf was not rendered as expected ;(
Checking if names are defined is paying for itself!
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
645b2b190c meson: drop unnecessary listification 2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
fa10451686 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 3982becc92.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
059cc610b7 meson: use jinja2 for unit templates
We don't need two (and half) templating systems anymore, yay!

I'm keeping the changes minimal, to make the diff manageable. Some enhancements
due to a better templating system might be possible in the future.

For handling of '## ' — see the next commit.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
6b1aac3ccf meson: replace some m4 templates with jinja2
m4 was nice in '85, but the syntax feels a bit dated. Since we use python for
meson, let's use a popular python templating engine to replace some m4 usage.

A little nicety is that typos are caught:

FAILED: sysusers.d/systemd-remote.conf
/usr/bin/meson --internal exe --capture sysusers.d/systemd-remote.conf -- /home/zbyszek/src/systemd/tools/meson-render-jinja2.py config.h ../sysusers.d/systemd-remote.conf.j2
Traceback (most recent call last):
  File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 28, in <module>
    print(render(sys.argv[2], defines))
  File "/home/zbyszek/src/systemd/tools/meson-render-jinja2.py", line 24, in render
    return template.render(defines)
  File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 1090, in render
    self.environment.handle_exception()
  File "/usr/lib/python3.9/site-packages/jinja2/environment.py", line 832, in handle_exception
    reraise(*rewrite_traceback_stack(source=source))
  File "/usr/lib/python3.9/site-packages/jinja2/_compat.py", line 28, in reraise
    raise value.with_traceback(tb)
  File "<template>", line 8, in top-level template code
jinja2.exceptions.UndefinedError: 'HAVE_MICROHTTP' is undefined

This checking mirrors what 349cc4a507 did for C defines.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
e0698c66f4 meson, mkosi: pull in jinja2 as required
In preparation for subsequent changes.
2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
be21b60b89 modules-load: inline interator variable 2021-05-19 10:24:43 +09:00
Zbigniew Jędrzejewski-Szmek
6b908313ef test/run-unit-tests: make script compatible with python3.6
dataclasses were added in python3.7, but bionic has python3.6.
Yes, the new code is a travesty, but it does the job.

Fixes #19640.
2021-05-18 23:59:05 +02:00
Yu Watanabe
cc2d7efc5c network: fix Link reference counter issue
Previously, when link_new() fails, `link_unref()` was called, so,
`Manager::links` may become dirty.
This introduces `link_drop_or_unref()` and it will be called on
failure.
2021-05-18 20:40:56 +09:00
Yu Watanabe
56001f0233 network: also drop requests when link enters linger state
Otherwise, if link is removed, several references to the link in remain
exist in requests.
2021-05-18 20:40:56 +09:00
Yu Watanabe
63130eb36d network: merge link_drop() and link_detach_from_manager()
link_detach_from_manager() is only called by link_drop(). It is not
necessary to split such tiny function.
2021-05-18 20:40:56 +09:00
Yu Watanabe
ce9388d72a network: fix possible message counter double decrement
When after_configure() for a request fails, then the request is not
removed from the queue at that time, and the link enters to failed
state. After that, if the link is reconfigured or its carrier is lost,
then the request is dropped from the queue, and the message_counter is
decreased. However, the counter is already or will be also decreased
when the corresponding netlink reply is received.
So, the counter is decreased twice.
2021-05-18 20:40:50 +09:00
Yu Watanabe
72ffb9133d test-network: add testcases for ServerAddress= 2021-05-18 20:20:24 +09:00
Yu Watanabe
0017ba3165 network: dhcp-server: introduce ServerAddress= setting
This may be useful when the link which DHCP server running on has
multiple static addresses.
2021-05-18 20:20:24 +09:00
Yu Watanabe
998545a7d9 network: address: introduce link_get_ipv4/ipv6_address() 2021-05-18 20:20:24 +09:00
Yu Watanabe
99b5f4f7b8 network: use UINT32_C() macro 2021-05-18 20:20:24 +09:00
Yu Watanabe
473680be32 network: introduce address_set_broadcast() 2021-05-18 20:20:20 +09:00
Yu Watanabe
c9f2db2c40 network: use config_parse_in_addr_non_null() 2021-05-18 20:19:37 +09:00
Yu Watanabe
cf0747725d conf-parser: introduce config_parse_in_addr_non_null() 2021-05-18 20:19:37 +09:00
Anita Zhang
c54cfef396 man: only the system manager does not pass vars in ManagerEnvironment=
User managers always pass their environment on to their children.
Make that clear in the description of ManagerEnvironment= which
states that none of those args will get passed to child processes of
service managers.
2021-05-18 12:59:10 +02:00
Jörg Thalheim
f96bc66901 fix bash shebangs 2021-05-17 22:27:41 +01:00
Olle Lundberg
c920b86364 nspawn: bring back the word may in error text
In the change set 6c045a9998 the error
text for the old flag `--private-users-chown` was repurposed for the
new flag `--private-users-ownership=own` and while doing so the word
`may` was dropped leading to a grammatically incorrect error text.
2021-05-17 22:21:00 +01:00