From nobody Tue Sep  5 09:00:05 2023
X-Original-To: dev-commits-ports-all@mlmmj.nyi.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1])
	by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Rfzwk230vz4sLxW;
	Tue,  5 Sep 2023 09:00:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256
	 client-signature RSA-PSS (4096 bits) client-digest SHA256)
	(Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK))
	by mx1.freebsd.org (Postfix) with ESMTPS id 4Rfzwk0mDcz3NKd;
	Tue,  5 Sep 2023 09:00:06 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1693904406;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=oi3oC77cm3p55kZjHD5yn55ZbJVjBqITGiYRy4qWYL8=;
	b=OYuE2M/9DuHbchLYGRl9p7QUYeJEcXwijViumRP6xMjGi3O8m8go5YtagW8Fak3DBVVtOR
	zlHjiuZ+PcOzGmebV8Z5dUboQywy4SrG5Ees3yLyZTAvCqK68j22L5UFh0ITx2wbSS3i5w
	jy9UKblueJsePFUWv4w1Ru+xpesqKAcp4UZZvwYwwfsQXns862vxZ8o8IgR5T1z/RqTCF7
	kl/r+JFCW5xB4cfnfSSWlWYUsmNhC5/8yCaRD3icHqnZSmILxGnaFyy+z+rI2otofoZz0B
	Yi8al5hFgwmAiU0I0YroZABMpe/WrSmDEb3i34xZ2t0q4n8VU0SwhKrixZzgrQ==
ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1693904406; a=rsa-sha256; cv=none;
	b=rHJuRFww+Yr1q3qHilbh0oitbvzgLqA/8WWNHPuEm7/HxLVksMxA1Gz8yv+6US4cbPsl94
	i6ehPcs9usKdXt2hzV7uKXtpHX5RNQPg4imZnpikg6U+G987nBqY5x0dyinRfRecHO7Is6
	6W1Joz41Pj9UVLQiI8UMWt84emOjr8HFobmk08keTO7Mwc1l+4i5DIC6RHVXwt3/btIu66
	XpCSD1KKOpKM3tl2kwL1Y2f/nSSG23xNHs64dct++HJyhxrmH/sWnWp3nQJ3w6ytGVVIVO
	hVPV/QW3wptLWMmJPdXMXNnBaRDNvMIzG8enGejJuJ39Wf7TV8hZdXZINA1KGw==
ARC-Authentication-Results: i=1;
	mx1.freebsd.org;
	none
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org;
	s=dkim; t=1693904406;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=oi3oC77cm3p55kZjHD5yn55ZbJVjBqITGiYRy4qWYL8=;
	b=wxLxLODcWcM3K8jHT/CvJbo1t+4tYQAv4VHOzmNK9f6Ty5H13n+SRwTkqX4OZHLgZ1+msw
	t946ZY1vunLKZh6AEklhFMyfc78x3GA1irJge0uxeusT+F2Y5Kw/ubeQlXSr5xuAhxPKWv
	PgbgQ+0+n6w3BLwl9bD/N33Fo/yTd2ex7gY0DEDCHjKP9TRY1AiYY3J+tf4ShUBzf9VwhI
	UmeZqDjmumAxOG0iYVI40lMxknrLNnfnD5eUNzUIYSgFMV8caZSMKqHy3A82ootjiMS+OP
	xdYFKDKPUlPtisqan9AcjxLuQWd6E/FrmEfOLzBNlArC6jKsUxsdQvbsvoY3Nw==
Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(Client did not present a certificate)
	by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Rfzwj6S5yzBW1;
	Tue,  5 Sep 2023 09:00:05 +0000 (UTC)
	(envelope-from git@FreeBSD.org)
Received: from gitrepo.freebsd.org ([127.0.1.44])
	by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 3859050E035598;
	Tue, 5 Sep 2023 09:00:05 GMT
	(envelope-from git@gitrepo.freebsd.org)
Received: (from git@localhost)
	by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 385905sp035593;
	Tue, 5 Sep 2023 09:00:05 GMT
	(envelope-from git)
Date: Tue, 5 Sep 2023 09:00:05 GMT
Message-Id: <202309050900.385905sp035593@gitrepo.freebsd.org>
To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org,
        dev-commits-ports-main@FreeBSD.org
From: Jan Beich <jbeich@FreeBSD.org>
Subject: git: 24ffa701a8b0 - main - devel/sdbus-cpp: improve basu
  support
List-Id: Commit messages for all branches of the ports repository <dev-commits-ports-all.freebsd.org>
List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-all
List-Help: <mailto:dev-commits-ports-all+help@freebsd.org>
List-Post: <mailto:dev-commits-ports-all@freebsd.org>
List-Subscribe: <mailto:dev-commits-ports-all+subscribe@freebsd.org>
List-Unsubscribe: <mailto:dev-commits-ports-all+unsubscribe@freebsd.org>
Sender: owner-dev-commits-ports-all@freebsd.org
X-BeenThere: dev-commits-ports-all@freebsd.org
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit
X-Git-Committer: jbeich
X-Git-Repository: ports
X-Git-Refname: refs/heads/main
X-Git-Reftype: branch
X-Git-Commit: 24ffa701a8b0a7896202c33e6419af161b823434
Auto-Submitted: auto-generated

The branch main has been updated by jbeich:

URL: https://cgit.FreeBSD.org/ports/commit/?id=24ffa701a8b0a7896202c33e6419af161b823434

commit 24ffa701a8b0a7896202c33e6419af161b823434
Author:     Jan Beich <jbeich@FreeBSD.org>
AuthorDate: 2023-09-05 08:30:03 +0000
Commit:     Jan Beich <jbeich@FreeBSD.org>
CommitDate: 2023-09-05 08:58:49 +0000

    devel/sdbus-cpp: improve basu support
    
    - Enable LIBSYSTEMD_VERSION>=240 code
    - Avoid breaking libsystemd support
---
 devel/sdbus-cpp/Makefile         |   2 +-
 devel/sdbus-cpp/files/patch-basu | 228 +++++++++++++++++++++++++--------------
 2 files changed, 149 insertions(+), 81 deletions(-)

diff --git a/devel/sdbus-cpp/Makefile b/devel/sdbus-cpp/Makefile
index 623c2cd39ac0..cb594b5ae465 100644
--- a/devel/sdbus-cpp/Makefile
+++ b/devel/sdbus-cpp/Makefile
@@ -1,7 +1,7 @@
 PORTNAME=	sdbus-cpp
 DISTVERSIONPREFIX=	v
 DISTVERSION=	1.3.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	devel
 
 MAINTAINER=	jbeich@FreeBSD.org
diff --git a/devel/sdbus-cpp/files/patch-basu b/devel/sdbus-cpp/files/patch-basu
index c0fd46fa455d..79391ccc797b 100644
--- a/devel/sdbus-cpp/files/patch-basu
+++ b/devel/sdbus-cpp/files/patch-basu
@@ -2,219 +2,287 @@ libsystemd is Linux-only, so replace with basu
 
 --- CMakeLists.txt.orig	2023-08-20 09:45:44 UTC
 +++ CMakeLists.txt
-@@ -12,13 +12,13 @@ include(GNUInstallDirs) # Installation directories for
- # PERFORMING CHECKS & PREPARING THE DEPENDENCIES
- #-------------------------------
- 
--set(LIBSYSTEMD "libsystemd")
-+set(LIBSYSTEMD "basu")
- 
- option(BUILD_LIBSYSTEMD "Build libsystemd static library and incorporate it into libsdbus-c++" OFF)
- 
- if(NOT BUILD_LIBSYSTEMD)
-     find_package(PkgConfig REQUIRED)
--    pkg_check_modules(Systemd IMPORTED_TARGET GLOBAL libsystemd>=236)
-+    pkg_check_modules(Systemd IMPORTED_TARGET GLOBAL basu)
-     if(NOT TARGET PkgConfig::Systemd)
-         message(WARNING "libsystemd not found, checking for libelogind instead")
-         pkg_check_modules(Systemd IMPORTED_TARGET GLOBAL libelogind>=236)
-@@ -36,8 +36,7 @@ if(NOT BUILD_LIBSYSTEMD)
-                             "and incorporate libsystemd as embedded library within sdbus-c++)")
+@@ -26,6 +26,11 @@ if(NOT BUILD_LIBSYSTEMD)
+             set(LIBSYSTEMD "libelogind")
+             string(REPLACE "." ";" VERSION_LIST ${Systemd_VERSION})
+             list(GET VERSION_LIST 0 Systemd_VERSION)
++	else()
++            pkg_check_modules(Systemd IMPORTED_TARGET GLOBAL basu)
++            set(LIBSYSTEMD "basu")
++            # https://git.sr.ht/~emersion/basu/commit/d4d185d29a26
++            set(Systemd_VERSION "240")
+         endif()
      endif()
-     add_library(Systemd::Libsystemd ALIAS PkgConfig::Systemd)
--    string(REGEX MATCHALL "([0-9]+)" SYSTEMD_VERSION_LIST "${Systemd_VERSION}")
--    list(GET SYSTEMD_VERSION_LIST 0 LIBSYSTEMD_VERSION)
-+    set(LIBSYSTEMD_VERSION "239")
-     message(STATUS "Building with libsystemd v${LIBSYSTEMD_VERSION}")
- else()
-     # Build static libsystemd library as an external project
---- src/Connection.cpp.orig	2021-10-25 07:02:37 UTC
+     if(NOT TARGET PkgConfig::Systemd)
+--- src/Connection.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/Connection.cpp
-@@ -30,7 +30,7 @@
+@@ -31,7 +31,13 @@
  #include <sdbus-c++/Message.h>
  #include <sdbus-c++/Error.h>
  #include "ScopeGuard.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <unistd.h>
  #include <poll.h>
  #include <sys/eventfd.h>
---- src/Connection.h.orig	2021-10-25 07:02:37 UTC
+--- src/Connection.h.orig	2023-08-20 09:45:44 UTC
 +++ src/Connection.h
-@@ -32,7 +32,7 @@
+@@ -32,7 +32,13 @@
  #include "IConnection.h"
  #include "ScopeGuard.h"
  #include "ISdBus.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <memory>
  #include <thread>
  #include <string>
---- src/Error.cpp.orig	2021-10-25 07:02:37 UTC
+--- src/Error.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/Error.cpp
-@@ -25,7 +25,7 @@
+@@ -25,7 +25,13 @@
   */
  
  #include <sdbus-c++/Error.h>
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include "ScopeGuard.h"
  
  namespace sdbus
---- src/Flags.cpp.orig	2021-10-25 07:02:37 UTC
+--- src/Flags.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/Flags.cpp
-@@ -25,7 +25,7 @@
+@@ -25,7 +25,13 @@
   */
  
  #include <sdbus-c++/Flags.h>
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  
  namespace sdbus
  {
---- src/IConnection.h.orig	2022-08-09 07:50:33 UTC
+--- src/IConnection.h.orig	2023-08-20 09:45:44 UTC
 +++ src/IConnection.h
-@@ -28,7 +28,7 @@
+@@ -28,7 +28,13 @@
  #define SDBUS_CXX_INTERNAL_ICONNECTION_H_
  
  #include <sdbus-c++/IConnection.h>
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <string>
  #include <memory>
  #include <functional>
---- src/ISdBus.h.orig	2021-10-25 07:02:37 UTC
+--- src/ISdBus.h.orig	2023-08-20 09:45:44 UTC
 +++ src/ISdBus.h
-@@ -28,7 +28,7 @@
+@@ -28,7 +28,13 @@
  #ifndef SDBUS_CXX_ISDBUS_H
  #define SDBUS_CXX_ISDBUS_H
  
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  
  namespace sdbus::internal {
  
---- src/Message.cpp.orig	2021-10-25 07:02:37 UTC
+--- src/Message.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/Message.cpp
-@@ -31,7 +31,7 @@
+@@ -31,7 +31,13 @@
  #include "ISdBus.h"
  #include "IConnection.h"
  #include "ScopeGuard.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <cassert>
  
  namespace sdbus {
---- src/Object.cpp.orig	2021-10-25 07:02:37 UTC
+--- src/Object.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/Object.cpp
-@@ -34,7 +34,7 @@
- #include "ScopeGuard.h"
+@@ -35,7 +35,13 @@
  #include "IConnection.h"
+ #include "Utils.h"
  #include "VTableUtils.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <utility>
  #include <cassert>
  
---- src/Object.h.orig	2021-10-25 07:02:37 UTC
+--- src/Object.h.orig	2023-08-20 09:45:44 UTC
 +++ src/Object.h
-@@ -29,7 +29,7 @@
+@@ -29,7 +29,13 @@
  
  #include <sdbus-c++/IObject.h>
  #include "IConnection.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <string>
  #include <map>
  #include <vector>
---- src/Proxy.cpp.orig	2021-10-25 07:02:37 UTC
+--- src/Proxy.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/Proxy.cpp
-@@ -31,7 +31,7 @@
+@@ -32,7 +32,13 @@
  #include "sdbus-c++/IConnection.h"
  #include "sdbus-c++/Error.h"
  #include "ScopeGuard.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <cassert>
  #include <chrono>
  #include <utility>
---- src/Proxy.h.orig	2021-10-25 07:02:37 UTC
+--- src/Proxy.h.orig	2023-08-20 09:45:44 UTC
 +++ src/Proxy.h
-@@ -29,7 +29,7 @@
+@@ -29,7 +29,13 @@
  
  #include <sdbus-c++/IProxy.h>
  #include "IConnection.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <string>
  #include <memory>
  #include <map>
---- src/SdBus.cpp.orig	2021-10-25 07:02:37 UTC
+--- src/SdBus.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/SdBus.cpp
-@@ -178,7 +178,8 @@ int SdBus::sd_bus_open_system(sd_bus **ret)
+@@ -224,7 +224,12 @@ int SdBus::sd_bus_open_system_remote(sd_bus **ret, con
  
  int SdBus::sd_bus_open_system_remote(sd_bus **ret, const char *host)
  {
--    return ::sd_bus_open_system_remote(ret, host);
++#if __has_include(<systemd/sd-bus.h>) || __has_include(<elogind/sd-bus.h>)
+     return ::sd_bus_open_system_remote(ret, host);
++#else
 +    // Removed in https://git.sr.ht/~emersion/basu/commit/01d33b244eb6
 +    return -EOPNOTSUPP;
++#endif
  }
  
  int SdBus::sd_bus_request_name(sd_bus *bus, const char *name, uint64_t flags)
---- src/Types.cpp.orig	2021-10-25 07:02:37 UTC
+--- src/Types.cpp.orig	2023-08-20 09:45:44 UTC
 +++ src/Types.cpp
-@@ -27,7 +27,7 @@
+@@ -27,7 +27,13 @@
  #include <sdbus-c++/Types.h>
  #include <sdbus-c++/Error.h>
  #include "MessageUtils.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <cassert>
  
  namespace sdbus {
---- src/Utils.h.orig	2022-08-09 07:50:33 UTC
+--- src/Utils.h.orig	2023-08-20 09:45:44 UTC
 +++ src/Utils.h
-@@ -28,7 +28,7 @@
+@@ -28,7 +28,13 @@
  #define SDBUS_CXX_INTERNAL_UTILS_H_
  
  #include <sdbus-c++/Error.h>
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  
  #if LIBSYSTEMD_VERSION>=246
  #define SDBUS_CHECK_OBJECT_PATH(_PATH)                                                                                              \
---- src/VTableUtils.c.orig	2021-10-25 07:02:37 UTC
+--- src/VTableUtils.c.orig	2023-08-20 09:45:44 UTC
 +++ src/VTableUtils.c
-@@ -25,7 +25,7 @@
+@@ -25,7 +25,13 @@
   */
  
  #include "VTableUtils.h"
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  
  sd_bus_vtable createVTableStartItem(uint64_t flags)
  {
---- src/VTableUtils.h.orig	2021-10-25 07:02:37 UTC
+--- src/VTableUtils.h.orig	2023-08-20 09:45:44 UTC
 +++ src/VTableUtils.h
-@@ -27,7 +27,7 @@
+@@ -27,7 +27,13 @@
  #ifndef SDBUS_CXX_INTERNAL_VTABLEUTILS_H_
  #define SDBUS_CXX_INTERNAL_VTABLEUTILS_H_
  
--#include <systemd/sd-bus.h>
++#if __has_include(<systemd/sd-bus.h>)
+ #include <systemd/sd-bus.h>
++#elif __has_include(<elogind/sd-bus.h>)
++#include <elogind/sd-bus.h>
++#else
 +#include <basu/sd-bus.h>
++#endif
  #include <stdbool.h>
  
  #ifdef __cplusplus
---- tests/integrationtests/DBusStandardInterfacesTests.cpp.orig	2021-10-25 07:02:37 UTC
+--- tests/integrationtests/DBusStandardInterfacesTests.cpp.orig	2023-08-20 09:45:44 UTC
 +++ tests/integrationtests/DBusStandardInterfacesTests.cpp
-@@ -65,8 +65,8 @@ TEST_F(SdbusTestObject, AnswersMachineUuidViaPeerInter
+@@ -65,8 +65,14 @@ TEST_F(SdbusTestObject, AnswersMachineUuidViaPeerInter
      // a non-systemd Linux), org.freedesktop.DBus.Peer.GetMachineId() will not work. To solve
      // this, you can create /etc/machine-id yourself as symlink to /var/lib/dbus/machine-id,
      // and then org.freedesktop.DBus.Peer.GetMachineId() will start to work.
--    if (::access("/etc/machine-id", F_OK) == -1)
--        GTEST_SKIP() << "/etc/machine-id file does not exist, GetMachineId() will not work";
-+    if (::access("/var/lib/dbus/machine-id", F_OK) == -1)
-+        GTEST_SKIP() << "/var/lib/dbus/machine-id file does not exist, GetMachineId() will not work";
++#if __has_include(<systemd/sd-bus.h>)
+     if (::access("/etc/machine-id", F_OK) == -1)
+         GTEST_SKIP() << "/etc/machine-id file does not exist, GetMachineId() will not work";
++#else
++    if (::access("/etc/machine-id", F_OK) == -1 &&
++        ::access("/var/lib/dbus/machine-id", F_OK) == -1)
++        GTEST_SKIP() << "/etc/machine-id and /var/lib/dbus/machine-id file do not exist, GetMachineId() will not work";
++#endif
  
      ASSERT_NO_THROW(m_proxy->GetMachineId());
  }