Compare commits

..

19 Commits

Author SHA1 Message Date
Lennart Poettering ed6727d40a
Merge pull request #16137 from poettering/sleep-fixlets
some log fixes in the sleep code
2020-06-11 14:12:48 +02:00
Evgeny Vereshchagin 119111645b
Merge pull request #16136 from mrc0mmand/travis-cleanup
Move the gcc/clang build check to GitHub Actions
2020-06-11 14:16:44 +03:00
Frantisek Sumsal 35cd3db4e5 ci: add homed/zstd dependencies
Also, sort the whole list when we're at it.
2020-06-11 12:15:05 +02:00
Frantisek Sumsal aab86b12dd github: move the clang/gcc build check to GH Actions
Travis CI is getting overloaded, so let's move some load over to GitHub
Actions.
2020-06-11 12:15:02 +02:00
Lennart Poettering 241616d57d
Merge pull request #16124 from ssahani/dhcpv6-duid
network: Display DHCPv6 DUID
2020-06-11 12:03:07 +02:00
Lennart Poettering 2c4702057b sleep: pass error we see to log function 2020-06-11 10:35:04 +02:00
Lennart Poettering 1326de0158 sleep-config: modernize destructors
All other destructors in the same .c file return NULL, let's make sure
the one where this so far wasn't done does it too.
2020-06-11 10:33:57 +02:00
Lennart Poettering c732e87979 sleep-config: downgrade log level in can_s2h()
As in the previous commit: can_sleep() is more a library-style function,
hence log at debug level only.
2020-06-11 10:33:56 +02:00
Lennart Poettering c02540dc9e sleep: clean up debug/error logging
half of find_hibernation_location() logged at debug level, the other
half logged at error level, and the third half didn't log at all.

Let's clean this up somewhat. Since can_sleep() is probably more
a library-style function let's downgrade everything to LOG_DEBUG and
then make sure sleep.c logs at error level, as the main program.
2020-06-11 10:33:56 +02:00
Lennart Poettering 6f9120ad61 sleep-config: return correct error code 2020-06-11 10:33:56 +02:00
Lennart Poettering c0d8fbfa34 sleep-config: add more debug logging 2020-06-11 10:33:56 +02:00
Frantisek Sumsal 48c6399ad8 github: rename CIFuzz workflow file to cifuzz.yml 2020-06-11 10:22:09 +02:00
Frantisek Sumsal b31fba440c travis: bump Ubuntu release to Bionic 2020-06-11 10:22:09 +02:00
Frantisek Sumsal 2b918da5a1 journal: drop the assert-only variable completely
Followup to dfa64b64a7.
2020-06-11 10:22:09 +02:00
Frantisek Sumsal 5a573f2b91 travis: replace set (+|-)e with travis_terminate
It looks nicer and works around
https://travis-ci.community/t/exit-0-cannot-exit-successfully-on-arm/5731/
2020-06-11 10:22:09 +02:00
Susant Sahani 639118854f networkctl: Display DHCP6 DUID 2020-06-10 19:21:24 +02:00
Susant Sahani a9deab2eec sd-network: Introduce APIs to get DHCP6 DUID 2020-06-10 19:21:21 +02:00
Susant Sahani 7e738e7b70 network: DHCP6 - save DUID to state file 2020-06-10 19:21:11 +02:00
Susant Sahani 6b7d5b6eaf network: DHCP6 - introduce DHCP6 DUID to string 2020-06-10 19:17:28 +02:00
14 changed files with 261 additions and 101 deletions

44
.github/workflows/build_test.yml vendored Normal file
View File

@ -0,0 +1,44 @@
---
# vi: ts=2 sw=2 et:
#
name: Build test
on:
pull_request:
paths:
- '**/meson.build'
- '.github/workflows/**'
- 'meson_options.txt'
- 'src/**'
- 'test/fuzz/**'
- 'travis-ci/managers/ubuntu-build-check.sh'
jobs:
build:
runs-on: ubuntu-18.04
strategy:
fail-fast: false
matrix:
env:
# As we use postfixed clang/gcc binaries, we need to override $AR
# as well, otherwise meson falls back to ar from binutils which
# doesn't work with LTO
- { CC: "clang-10", CXX: "clang++-10", AR: "llvm-ar-10" }
- { CC: "gcc-10", CXX: "g++-10", AR: "gcc-ar-10" }
env: ${{ matrix.env }}
steps:
- name: Repository checkout
uses: actions/checkout@v1
- name: Configure custom APT repositories for ${{ env.CC }}
run: |
if [[ "$CC" == clang-* ]]; then
# Latest LLVM stack deb packages provided by https://apt.llvm.org/
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
sudo apt-get install clang-10 llvm-10
else
# Latest gcc stack deb packages provided by
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install gcc-10
fi
- name: Build check (${{ env.CC }})
run: sudo -E travis-ci/managers/ubuntu-build-check.sh

View File

@ -1,5 +1,5 @@
sudo: required
dist: xenial
dist: bionic
services:
- docker
@ -11,9 +11,6 @@ env:
- REPO_ROOT="$TRAVIS_BUILD_DIR"
stages:
- name: Build check
if: type != cron
- name: Build & test
if: type != cron
@ -23,45 +20,6 @@ stages:
jobs:
include:
- stage: Build check
name: Fedora Rawhide (gcc)
language: bash
env:
- FEDORA_RELEASE="rawhide"
- CONT_NAME="systemd-fedora-$FEDORA_RELEASE"
- DOCKER_EXEC="docker exec -ti $CONT_NAME"
before_install:
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- docker --version
install:
- $CI_MANAGERS/fedora.sh SETUP
script:
- set -e
# Build systemd
- $CI_MANAGERS/fedora.sh RUN_BUILD_CHECK_GCC
- set +e
after_script:
- $CI_MANAGERS/fedora.sh CLEANUP
- name: Fedora Rawhide (clang)
language: bash
env:
- FEDORA_RELEASE="rawhide"
- CONT_NAME="systemd-fedora-$FEDORA_RELEASE"
- DOCKER_EXEC="docker exec -ti $CONT_NAME"
before_install:
- sudo apt-get -y -o Dpkg::Options::="--force-confnew" install docker-ce
- docker --version
install:
- $CI_MANAGERS/fedora.sh SETUP
script:
- set -e
# Build systemd
- $CI_MANAGERS/fedora.sh RUN_BUILD_CHECK_CLANG
- set +e
after_script:
- $CI_MANAGERS/fedora.sh CLEANUP
- stage: Build & test
name: Debian Testing
language: bash
@ -75,10 +33,7 @@ jobs:
install:
- $CI_MANAGERS/debian.sh SETUP
script:
- set -e
# Build systemd
- $CI_MANAGERS/debian.sh RUN
- set +e
- $CI_MANAGERS/debian.sh RUN || travis_terminate 1
after_script:
- $CI_MANAGERS/debian.sh CLEANUP
@ -94,9 +49,7 @@ jobs:
install:
- $CI_MANAGERS/debian.sh SETUP
script:
- set -e
- $CI_MANAGERS/debian.sh RUN_ASAN
- set +e
- $CI_MANAGERS/debian.sh RUN_ASAN || travis_terminate 1
after_script:
- $CI_MANAGERS/debian.sh CLEANUP
@ -112,9 +65,7 @@ jobs:
install:
- $CI_MANAGERS/debian.sh SETUP
script:
- set -e
- $CI_MANAGERS/debian.sh RUN_CLANG
- set +e
- $CI_MANAGERS/debian.sh RUN_CLANG || travis-travis_terminate 1
after_script:
- $CI_MANAGERS/debian.sh CLEANUP
@ -130,9 +81,7 @@ jobs:
install:
- $CI_MANAGERS/debian.sh SETUP
script:
- set -e
- $CI_MANAGERS/debian.sh RUN_CLANG_ASAN
- set +e
- $CI_MANAGERS/debian.sh RUN_CLANG_ASAN || travis_terminate 1
after_script:
- $CI_MANAGERS/debian.sh CLEANUP

View File

@ -96,11 +96,9 @@ _public_ int sd_journal_printv(int priority, const char *format, va_list ap) {
/* Allocate large buffer to accommodate big message */
if (len >= LINE_MAX) {
_unused_ int rlen;
buffer = alloca(len + 9);
memcpy(buffer, "MESSAGE=", 8);
rlen = vsnprintf(buffer + 8, len + 1, format, ap);
assert(len == rlen);
assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
}
/* Strip trailing whitespace, keep prefix whitespace. */
@ -474,11 +472,9 @@ _public_ int sd_journal_printv_with_location(int priority, const char *file, con
/* Allocate large buffer to accommodate big message */
if (len >= LINE_MAX) {
_unused_ int rlen;
buffer = alloca(len + 9);
memcpy(buffer, "MESSAGE=", 8);
rlen = vsnprintf(buffer + 8, len + 1, format, ap);
assert(len == rlen);
assert_se(vsnprintf(buffer + 8, len + 1, format, ap) == len);
}
/* Strip trailing whitespace, keep prefixing whitespace */

View File

@ -18,6 +18,7 @@
#include "dns-domain.h"
#include "event-util.h"
#include "fd-util.h"
#include "hexdecoct.h"
#include "hostname-util.h"
#include "in-addr-util.h"
#include "network-internal.h"
@ -331,6 +332,48 @@ int sd_dhcp6_client_set_duid_llt(
return dhcp6_client_set_duid_internal(client, DUID_TYPE_LLT, NULL, 0, llt_time);
}
static const char* const dhcp6_duid_type_table[_DUID_TYPE_MAX] = {
[DUID_TYPE_LLT] = "DUID-LLT",
[DUID_TYPE_EN] = "DUID-EN/Vendor",
[DUID_TYPE_LL] = "DUID-LL",
[DUID_TYPE_UUID] = "UUID",
};
DEFINE_PRIVATE_STRING_TABLE_LOOKUP_TO_STRING(dhcp6_duid_type, DUIDType);
int sd_dhcp6_client_duid_as_string(
sd_dhcp6_client *client,
char **duid) {
_cleanup_free_ char *p = NULL, *s = NULL, *t = NULL;
const char *v;
int r;
assert_return(client, -EINVAL);
assert_return(client->duid_len > 0, -ENODATA);
v = dhcp6_duid_type_to_string(be16toh(client->duid.type));
if (v) {
s = strdup(v);
if (!s)
return -ENOMEM;
} else {
r = asprintf(&s, "%0x", client->duid.type);
if (r < 0)
return -ENOMEM;
}
t = hexmem(&client->duid.raw.data, client->duid_len);
if (!t)
return -ENOMEM;
p = strjoin(s, ":", t);
if (!p)
return -ENOMEM;
*duid = TAKE_PTR(p);
return 0;
}
int sd_dhcp6_client_set_iaid(sd_dhcp6_client *client, uint32_t iaid) {
assert_return(client, -EINVAL);
assert_return(IN_SET(client->state, DHCP6_STATE_STOPPED), -EBUSY);

View File

@ -176,6 +176,10 @@ _public_ int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **ia
return network_link_get_string(ifindex, "DHCP6_CLIENT_IAID", iaid);
}
_public_ int sd_network_link_get_dhcp6_client_duid_string(int ifindex, char **duid) {
return network_link_get_string(ifindex, "DHCP6_CLIENT_DUID", duid);
}
_public_ int sd_network_link_get_required_for_online(int ifindex) {
_cleanup_free_ char *s = NULL;
int r;

View File

@ -1380,9 +1380,9 @@ static int link_status_one(
_cleanup_strv_free_ char **dns = NULL, **ntp = NULL, **sip = NULL, **search_domains = NULL, **route_domains = NULL,
**pop3_server = NULL, **smtp_server = NULL, **lpr_server = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
_cleanup_free_ char *t = NULL, *network = NULL, *client_id = NULL, *iaid = NULL;
_cleanup_free_ char *t = NULL, *network = NULL, *client_id = NULL, *iaid = NULL, *duid = NULL;
const char *driver = NULL, *path = NULL, *vendor = NULL, *model = NULL, *link = NULL;
_cleanup_free_ char *setup_state = NULL, *operational_state = NULL, *tz = NULL;
const char *on_color_operational, *off_color_operational,
*on_color_setup, *off_color_setup;
_cleanup_free_ int *carrier_bound_to = NULL, *carrier_bound_by = NULL;
@ -2093,6 +2093,16 @@ static int link_status_one(
return table_log_add_error(r);
}
r = sd_network_link_get_dhcp6_client_duid_string(info->ifindex, &duid);
if (r >= 0) {
r = table_add_many(table,
TABLE_EMPTY,
TABLE_STRING, "DHCP6 Client DUID:",
TABLE_STRING, duid);
if (r < 0)
return table_log_add_error(r);
}
r = dump_lldp_neighbors(table, "Connected To:", info->ifindex);
if (r < 0)
return r;

View File

@ -4086,7 +4086,6 @@ int link_save(Link *link) {
const char *admin_state, *oper_state, *carrier_state, *address_state;
_cleanup_free_ char *temp_path = NULL;
_cleanup_fclose_ FILE *f = NULL;
uint32_t iaid;
Route *route;
Address *a;
Iterator i;
@ -4421,9 +4420,18 @@ int link_save(Link *link) {
}
}
r = sd_dhcp6_client_get_iaid(link->dhcp6_client, &iaid);
if (r >= 0)
fprintf(f, "DHCP6_CLIENT_IAID=0x%x\n", iaid);
if (link->dhcp6_client) {
_cleanup_free_ char *duid = NULL;
uint32_t iaid;
r = sd_dhcp6_client_get_iaid(link->dhcp6_client, &iaid);
if (r >= 0)
fprintf(f, "DHCP6_CLIENT_IAID=0x%x\n", iaid);
r = sd_dhcp6_client_duid_as_string(link->dhcp6_client, &duid);
if (r >= 0)
fprintf(f, "DHCP6_CLIENT_DUID=%s\n", duid);
}
r = fflush_and_check(f);
if (r < 0)

View File

@ -108,12 +108,16 @@ int can_sleep_state(char **types) {
return true;
/* If /sys is read-only we cannot sleep */
if (access("/sys/power/state", W_OK) < 0)
if (access("/sys/power/state", W_OK) < 0) {
log_debug_errno(errno, "/sys/power/state is not writable, cannot sleep: %m");
return false;
}
r = read_one_line_file("/sys/power/state", &p);
if (r < 0)
if (r < 0) {
log_debug_errno(r, "Failed to read /sys/power/state, cannot sleep: %m");
return false;
}
STRV_FOREACH(type, types) {
const char *word, *state;
@ -129,9 +133,9 @@ int can_sleep_state(char **types) {
}
int can_sleep_disk(char **types) {
_cleanup_free_ char *p = NULL;
char **type;
int r;
_cleanup_free_ char *p = NULL;
if (strv_isempty(types))
return true;
@ -199,16 +203,17 @@ static int swap_device_to_device_id(const SwapEntry *swap, dev_t *ret_dev) {
r = stat(swap->device, &sb);
if (r < 0)
return r;
return -errno;
if (streq(swap->type, "partition")) {
if (!S_ISBLK(sb.st_mode))
return -ENOTBLK;
*ret_dev = sb.st_rdev;
return 0;
}
} else
return get_block_device(swap->device, ret_dev);
return get_block_device(swap->device, ret_dev);
}
/*
@ -227,15 +232,15 @@ static int calculate_swap_file_offset(const SwapEntry *swap, uint64_t *ret_offse
fd = open(swap->device, O_RDONLY|O_CLOEXEC|O_NOCTTY);
if (fd < 0)
return log_error_errno(errno, "Failed to open swap file %s to determine on-disk offset: %m", swap->device);
return log_debug_errno(errno, "Failed to open swap file %s to determine on-disk offset: %m", swap->device);
if (fstat(fd, &sb) < 0)
return log_error_errno(errno, "Failed to stat %s: %m", swap->device);
return log_debug_errno(errno, "Failed to stat %s: %m", swap->device);
btrfs = btrfs_is_filesystem(fd);
if (btrfs < 0)
return log_error_errno(btrfs, "Error checking %s for Btrfs filesystem: %m", swap->device);
else if (btrfs > 0) {
return log_debug_errno(btrfs, "Error checking %s for Btrfs filesystem: %m", swap->device);
if (btrfs > 0) {
log_debug("%s: detection of swap file offset on Btrfs is not supported", swap->device);
*ret_offset = UINT64_MAX;
return 0;
@ -246,14 +251,13 @@ static int calculate_swap_file_offset(const SwapEntry *swap, uint64_t *ret_offse
return log_debug_errno(r, "Unable to read extent map for '%s': %m", swap->device);
*ret_offset = fiemap->fm_extents[0].fe_physical / page_size();
return 0;
}
static int read_resume_files(dev_t *ret_resume, uint64_t *ret_resume_offset) {
_cleanup_free_ char *resume_str = NULL, *resume_offset_str = NULL;
dev_t resume;
uint64_t resume_offset = 0;
dev_t resume;
int r;
r = read_one_line_file("/sys/power/resume", &resume_str);
@ -266,13 +270,13 @@ static int read_resume_files(dev_t *ret_resume, uint64_t *ret_resume_offset) {
r = read_one_line_file("/sys/power/resume_offset", &resume_offset_str);
if (r == -ENOENT)
log_debug("Kernel does not support resume_offset; swap file offset detection will be skipped.");
log_debug_errno(r, "Kernel does not support resume_offset; swap file offset detection will be skipped.");
else if (r < 0)
return log_debug_errno(r, "Error reading /sys/power/resume_offset: %m");
else {
r = safe_atou64(resume_offset_str, &resume_offset);
if (r < 0)
return log_error_errno(r, "Failed to parse value in /sys/power/resume_offset \"%s\": %m", resume_offset_str);
return log_debug_errno(r, "Failed to parse value in /sys/power/resume_offset \"%s\": %m", resume_offset_str);
}
if (resume_offset > 0 && resume == 0)
@ -325,9 +329,8 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
f = fopen("/proc/swaps", "re");
if (!f) {
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
"Failed to open /proc/swaps: %m");
return negative_errno();
log_debug_errno(errno, "Failed to open /proc/swaps: %m");
return errno == ENOENT ? -EOPNOTSUPP : -errno; /* Convert swap not supported to a recognizable error */
}
(void) fscanf(f, "%*s %*s %*s %*s %*s\n");
@ -338,7 +341,7 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
swap = new0(SwapEntry, 1);
if (!swap)
return log_oom();
return -ENOMEM;
k = fscanf(f,
"%ms " /* device/file */
@ -350,13 +353,13 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
if (k == EOF)
break;
if (k != 5) {
log_warning("Failed to parse /proc/swaps:%u", i);
log_debug("Failed to parse /proc/swaps:%u, ignoring", i);
continue;
}
if (streq(swap->type, "file")) {
if (endswith(swap->device, "\\040(deleted)")) {
log_warning("Ignoring deleted swap file '%s'.", swap->device);
log_debug("Ignoring deleted swap file '%s'.", swap->device);
continue;
}
@ -393,12 +396,12 @@ int find_hibernate_location(HibernateLocation **ret_hibernate_location) {
dev_t swap_device;
r = swap_device_to_device_id(swap, &swap_device);
if (r < 0)
return log_error_errno(r, "%s: failed to query device number: %m", swap->device);
return log_debug_errno(r, "%s: failed to query device number: %m", swap->device);
hibernate_location = hibernate_location_free(hibernate_location);
hibernate_location = new(HibernateLocation, 1);
if (!hibernate_location)
return log_oom();
return -ENOMEM;
*hibernate_location = (HibernateLocation) {
.devno = swap_device,
@ -585,8 +588,7 @@ static bool can_s2h(const SleepConfig *sleep_config) {
int r;
if (!clock_supported(CLOCK_BOOTTIME_ALARM)) {
log_full(errno == ENOENT ? LOG_DEBUG : LOG_WARNING,
"CLOCK_BOOTTIME_ALARM is not supported");
log_debug("CLOCK_BOOTTIME_ALARM is not supported.");
return false;
}
@ -675,9 +677,9 @@ int sleep_settings(const char *verb, const SleepConfig *sleep_config, bool *ret_
return 0;
}
void free_sleep_config(SleepConfig *sc) {
SleepConfig* free_sleep_config(SleepConfig *sc) {
if (!sc)
return;
return NULL;
strv_free(sc->suspend_modes);
strv_free(sc->suspend_states);
@ -688,5 +690,5 @@ void free_sleep_config(SleepConfig *sc) {
strv_free(sc->hybrid_modes);
strv_free(sc->hybrid_states);
free(sc);
return mfree(sc);
}

View File

@ -20,7 +20,7 @@ typedef struct SleepConfig {
usec_t hibernate_delay_sec; /* HibernateDelaySec */
} SleepConfig;
void free_sleep_config(SleepConfig *sc);
SleepConfig* free_sleep_config(SleepConfig *sc);
DEFINE_TRIVIAL_CLEANUP_FUNC(SleepConfig*, free_sleep_config);
/* entry in /proc/swaps */

View File

@ -108,6 +108,9 @@ static int write_state(FILE **f, char **states) {
char **state;
int r = 0;
assert(f);
assert(*f);
STRV_FOREACH(state, states) {
int k;
@ -194,12 +197,14 @@ static int execute(char **modes, char **states) {
setvbuf(f, NULL, _IONBF, 0);
/* Configure the hibernation mode */
/* Configure hibernation settings if we are supposed to hibernate */
if (!strv_isempty(modes)) {
r = find_hibernate_location(&hibernate_location);
if (r < 0)
return r;
else if (r == 0) {
return log_error_errno(r, "Failed to find location to hibernate to: %m");
if (r == 0) { /* 0 means: no hibernation location was configured in the kernel so far, let's
* do it ourselves then. > 0 means: kernel already had a configured hibernation
* location which we shouldn't touch. */
r = write_hibernate_location_info(hibernate_location);
if (r < 0)
return log_error_errno(r, "Failed to prepare for hibernation: %m");
@ -275,11 +280,11 @@ static int execute_s2h(const SleepConfig *sleep_config) {
r = execute(sleep_config->hibernate_modes, sleep_config->hibernate_states);
if (r < 0) {
log_notice_errno(r, "Couldn't hibernate, will try to suspend again.");
log_notice_errno(r, "Couldn't hibernate, will try to suspend again: %m");
r = execute(sleep_config->suspend_modes, sleep_config->suspend_states);
if (r < 0)
return log_notice_errno(r, "Could neither hibernate nor suspend again, giving up.");
return log_error_errno(r, "Could neither hibernate nor suspend, giving up: %m");
}
return 0;

View File

@ -113,6 +113,9 @@ int sd_dhcp6_client_set_iaid(
int sd_dhcp6_client_get_iaid(
sd_dhcp6_client *client,
uint32_t *iaid);
int sd_dhcp6_client_duid_as_string(
sd_dhcp6_client *client,
char **duid);
int sd_dhcp6_client_set_fqdn(
sd_dhcp6_client *client,
const char *fqdn);

View File

@ -194,6 +194,9 @@ int sd_network_link_get_dhcp4_client_id_string(int ifindex, char **client_id);
/* Get DHCPv6 client IAID for a given link. */
int sd_network_link_get_dhcp6_client_iaid_string(int ifindex, char **iaid);
/* Get DHCPv6 client DUID for a given link. */
int sd_network_link_get_dhcp6_client_duid_string(int ifindex, char **duid);
/* Monitor object */
typedef struct sd_network_monitor sd_network_monitor;

View File

@ -0,0 +1,93 @@
#!/bin/bash
set -e
info() { echo -e "\033[33;1m$1\033[0m"; }
error() { echo >&2 -e "\033[31;1m$1\033[0m"; }
success() { echo >&2 -e "\033[32;1m$1\033[0m"; }
ARGS=(
"--optimization=0"
"--optimization=2"
"--optimization=3"
"--optimization=s"
"-Db_lto=true"
"-Db_ndebug=true"
)
PACKAGES=(
cryptsetup-bin
expect
fdisk
gettext
iptables-dev
iputils-ping
isc-dhcp-client
itstool
kbd
libblkid-dev
libcap-dev
libcurl4-gnutls-dev
libfdisk-dev
libgpg-error-dev
liblz4-dev
liblzma-dev
libmicrohttpd-dev
libmount-dev
libp11-kit-dev
libpwquality-dev
libqrencode-dev
libssl-dev
libxkbcommon-dev
libzstd-dev
mount
net-tools
ninja-build
perl
python-lxml
python3-evdev
python3-lxml
python3-pip
python3-pyparsing
python3-setuptools
quota
strace
unifont
util-linux
zstd
)
CC="${CC:?}"
CXX="${CXX:?}"
AR="${AR:-""}"
RELEASE="$(lsb_release -cs)"
bash -c "echo 'deb-src http://archive.ubuntu.com/ubuntu/ $RELEASE main restricted universe multiverse' >>/etc/apt/sources.list"
# PPA with some newer build dependencies (like zstd)
add-apt-repository -y ppa:upstream-systemd-ci/systemd-ci
apt-get update
apt-get build-dep systemd -y
apt-get install -y "${PACKAGES[@]}"
# Install latest meson from pip, as the distro-one doesn't support
# --optimization=
pip3 install meson
$CC --version
for args in "${ARGS[@]}"; do
SECONDS=0
info "Checking build with $args"
if ! AR="$AR" CC="$CC" CXX="$CXX" meson --werror $args build; then
error "meson failed with $args"
exit 1
fi
if ! ninja -C build; then
error "ninja failed with $args"
exit 1
fi
git clean -dxf
success "Build with $args passed in $SECONDS seconds"
done