From patchwork Tue Feb 4 10:53:13 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 56623 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45CC4C02194 for ; Tue, 4 Feb 2025 10:54:27 +0000 (UTC) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mx.groups.io with SMTP id smtpd.web10.113868.1738666462400525123 for ; Tue, 04 Feb 2025 02:54:22 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=fEDNFLeN; spf=pass (domain: gmail.com, ip: 209.85.128.41, mailfrom: uvv.mail@gmail.com) Received: by mail-wm1-f41.google.com with SMTP id 5b1f17b1804b1-4361815b96cso37302755e9.1 for ; Tue, 04 Feb 2025 02:54:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738666460; x=1739271260; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=/iXAawK8xXd3lwhCmz8Ortq+y5vw1ttwGvIJyy1F1Wo=; b=fEDNFLeNXqTMXoHZThG+ttnrnJ0QsouMLlCSFAHczBzOdQ3nyEtAH9tYKFniAWLsZJ d/nPwRtKDGwjLMp+tdKp3VkoH6h56inULXqMRt4fhonrvZFtpoJ4x0I5KRKaZIyqFA5Q MahUYqHnhPihwZxy5RWc6U4AExCEBihwEmNFmDs9red5AAuMK9AYqQECcjabAvkBFZYr jKVA8NMDzNwDRRt2B1GdViZIT2ePbnycl7bUBneQUZRH52tqHZuP55D+wPKdcQIbA6MP JiymboprxuxwsVqloDp/VkXMpDnatQ9Rmh4HW8ZBZ6TJweQgJm19NDYvRocgolkar1nQ mZLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738666460; x=1739271260; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/iXAawK8xXd3lwhCmz8Ortq+y5vw1ttwGvIJyy1F1Wo=; b=aEEP3f709oJ1orYgDAAW+G63+mrt1tdPi+Fe9KnX6coIBr7QmY4tqIR0zEpisGPiPi CVLKNUtmqkWMneHgfawmIRlWwRq95LcEUCDdHlydrOD+dgvzidLdtDBWR4e5mhLQz2cO GMWJyXT155SgYtP1SDVo0DO22dwYsnP522uv/nIBG2ZFNUJb/+Vfj2PWkaTLKSvrPlbw fnuTYNI25ha43hutbRUGCVxNMOQ+pRdjSjtaOrIWxWX4jxThupwGpZo5mt4GUDBB8aDa khGLxFoaI+U8mptwGI2uTNGwgmoyTmWZFWNTZl77Ix67op0sWevyL8bkxcpskqLAFW2l /6Xw== X-Gm-Message-State: AOJu0YykanM+3wlH0CzmkxM6xzvSW7JwFdkD6rdYHtMg9GyZ/pk6NuNM 4oVNm0nh6kdZch6Jcd0jBpbIcWte+165MbejBmTbeB17XOVQV618XWYSl0LJ X-Gm-Gg: ASbGncuJA2oFJe0JtAX74JmMZVmyf831DaXIQwJDkdsngZ+mHOJgeH86A5q/lKcFeXF tx6DxBdMzRzJdzhpIuVAD2HI6kBWVH1v3sQgtddY5AqJlgKmrDbe+50TLiqcR4h6mpNx4y3ZJgL thHE8Egqk4eLg2ySEwA8QyzUk1rCs9kaYYGqtWLxU0Q0e3+SvTB03vyeWmQL9ss772BDK18Mez4 l03p+iLUWd9HmC53kDzfhWXXti/hG/9KMaWktENB6BGwDwS6QoeYIYK4MFeRzyhQbYZHyfxSXJ3 Rgn44bwzNcDfgJXphsH3/mrYAKOrOM7dxqA7NX0T6/aI X-Google-Smtp-Source: AGHT+IEphkLKmu9o1McD4fpat1mXUxWZLdCn5P8BP0jJPmDDFEIFX1vIJ12vqp+81YI1XCBuO5/Stg== X-Received: by 2002:a5d:6d0c:0:b0:38a:6929:ff9e with SMTP id ffacd0b85a97d-38c51946af3mr17597431f8f.7.1738666459951; Tue, 04 Feb 2025 02:54:19 -0800 (PST) Received: from slackware.local.localdomain ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438dcc81941sm220702145e9.36.2025.02.04.02.54.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 02:54:18 -0800 (PST) From: uvv.mail@gmail.com To: Openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH v2 1/3] bitbake.conf: Add conditional host tool getent Date: Tue, 4 Feb 2025 11:53:13 +0100 Message-ID: <20250204105315.84079-1-uvv.mail@gmail.com> X-Mailer: git-send-email 2.44.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 04 Feb 2025 10:54:27 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210766 From: Vyacheslav Yurkov In case of systemd init mananger, it's required for the native build. Even though we don't build systemd natively, we might build some of its binaries, which need to run on the host system. Signed-off-by: Vyacheslav Yurkov --- meta/conf/bitbake.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meta/conf/bitbake.conf b/meta/conf/bitbake.conf index 8b607088c6..6b1bfaf64e 100644 --- a/meta/conf/bitbake.conf +++ b/meta/conf/bitbake.conf @@ -532,6 +532,9 @@ HOSTTOOLS += "${@'ip ping ps scp ssh stty' if (bb.utils.contains_any('IMAGE_CLAS # Used by archiver.bbclass when compression is xz HOSTTOOLS += "${@'xz' if (('archiver.bbclass' in (d.getVar('BBINCLUDED') or '')) and (d.getVarFlag('ARCHIVER_MODE', 'compression') == 'xz')) else ''}" +# Native build of systemd tools requires getent utility +HOSTTOOLS += "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'getent', '', d)}" + # Link to these if present HOSTTOOLS_NONFATAL += "aws gcc-ar gpg gpg-agent ld.bfd ld.gold nc pigz sftp socat ssh sudo" From patchwork Tue Feb 4 10:53:14 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 56624 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C42EC02197 for ; Tue, 4 Feb 2025 10:54:37 +0000 (UTC) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com [209.85.128.50]) by mx.groups.io with SMTP id smtpd.web10.113869.1738666463421664256 for ; Tue, 04 Feb 2025 02:54:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=V+2J3PK+; spf=pass (domain: gmail.com, ip: 209.85.128.50, mailfrom: uvv.mail@gmail.com) Received: by mail-wm1-f50.google.com with SMTP id 5b1f17b1804b1-436341f575fso63060445e9.1 for ; Tue, 04 Feb 2025 02:54:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738666461; x=1739271261; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=GqnaA+ldWalr46s3/xLZU2VNhAKovzMkLti8j72Z0FE=; b=V+2J3PK+Iu9gwTaB/ZcWWWOeti4Nu+wS7fqDy6Bbou/eD/n1z7vqpxIpKVtA5FVC2H Y4ilywCybaCfKPwnqbvqIhMgxMwoQ+fT8BXvVyC5LWdQd5wRg9H1OOV4xdHMbbMzlR93 mpoCPr62ABZAtGothcEkAGBYSyJI7dF+/PYCiYjOnEdC9tpQkk6yum/IY0qkuclzsgRe JyB0Ry2yGtFyOA/FI/H+kjC7lOreS9LkQl9jKAYM73po5HQ7WmWAGuthYAMomWEmVy6r DSTw9TbdRBwoHfjidPw8aRVtDOXAuclGgIg0IhvcG5aQ6LbW0XfxX5sFwzjtj30UNkiR u8UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738666461; x=1739271261; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=GqnaA+ldWalr46s3/xLZU2VNhAKovzMkLti8j72Z0FE=; b=kSPKqJMdIIW5a2cW+rtZhRQanM7cxdaTLyp9EXqikP/1VFDuX06JAS7FGOOkZ7Iup8 bq35xiOP1ou0mhBOWGCx+4PeaQna/GAGgijXMnlzXURWcFwXKrTSSe7b19lyVXmFPDiV if0uCSdHagHehV2UaOa+2rih3G5SsjsosHyEhiyBxWqkVsLVbWyEhLVDiEOECJq4C+Er 34icSAm2wIk/wNTnnMW2qHG7dZNqITlNZsV9wFjLxwNJ1+IpBvk/z1B8MKVM8WK/4QzS uEzA4/AbBWJ22OH+VsuHre2lTunRC9J6Z7G2xFHOBa//L9O85MLYzWjAAIK+L+CdsQ+I +1BA== X-Gm-Message-State: AOJu0YyTp6KP7JRrp0y6DcGBLpZrhkkV/jkKtDW3u5GyTP/YI7ChiU49 iK9b/RxztsdAqaiyyyXVOCEHDbMuojlzf3Q+OTNl2rsLbB07qKys5Dcw2ESD X-Gm-Gg: ASbGncsO21n1Cq4RUDJ0oBAOlKOI3w3oj8CV8q8j5G8HwmRZPG59pS6uMH9OW1eTzFm ENo+HWg1KN7eoTO0rmAtN3FR8gW3IrT1DUZhPtRldfjJCc4SaYHCWHGpPQAwBwnmYhC9u5i0p1y 0qk74VhZRbz+APQoNiWPgotkPmtnX9Q4IKfEewa6LnssqcSNXdxEhBJeOo5ROBKS+3b0fFW99Lm fudUf1UrR9lyXceAarcONevJmuHiSBEIdGOJLbkck/vqjPj3HtYkVfDHXTe/0BRyGXPAc+r8E3u sXq7ZhsJku8B1kgDOx3qWujUExXa+tE/7N9XjiW53Umf X-Google-Smtp-Source: AGHT+IET0V2LOREfoL7bwtFJZrcS/B3N93oXTou8naAVaQN7wnyic6HNhud4lxoa3MOyRSQgmP43Zg== X-Received: by 2002:a5d:64e4:0:b0:382:3959:f429 with SMTP id ffacd0b85a97d-38c519378b7mr24089628f8f.5.1738666460948; Tue, 04 Feb 2025 02:54:20 -0800 (PST) Received: from slackware.local.localdomain ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438dcc81941sm220702145e9.36.2025.02.04.02.54.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 02:54:20 -0800 (PST) From: uvv.mail@gmail.com To: Openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH v2 2/3] meson.bbclass: Add an option to specify install tags Date: Tue, 4 Feb 2025 11:53:14 +0100 Message-ID: <20250204105315.84079-2-uvv.mail@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250204105315.84079-1-uvv.mail@gmail.com> References: <20250204105315.84079-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 04 Feb 2025 10:54:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210767 From: Vyacheslav Yurkov The feature is available since meson 0.60.0. You can specify comma-separated list of install tags (not targets). Signed-off-by: Vyacheslav Yurkov --- meta/classes-recipe/meson.bbclass | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass index b343480f9a..cbfc45b94b 100644 --- a/meta/classes-recipe/meson.bbclass +++ b/meta/classes-recipe/meson.bbclass @@ -22,6 +22,9 @@ MESON_SOURCEPATH = "${S}" # The target to build in do_compile. If unset the default targets are built. MESON_TARGET ?= "" +# Since 0.60.0 you can specify custom tags to install +MESON_INSTALL_TAGS ?= "" + def noprefix(var, d): return d.getVar(var).replace(d.getVar('prefix') + '/', '', 1) @@ -182,7 +185,10 @@ meson_do_compile() { } meson_do_install() { - meson install --destdir ${D} --no-rebuild + if [ "x${MESON_INSTALL_TAGS}" != "x" ] ; then + meson_install_tags="--tags ${MESON_INSTALL_TAGS}" + fi + meson install --destdir ${D} --no-rebuild $meson_install_tags } EXPORT_FUNCTIONS do_configure do_compile do_install From patchwork Tue Feb 4 10:53:15 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vyacheslav Yurkov X-Patchwork-Id: 56625 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 33319C02194 for ; Tue, 4 Feb 2025 10:54:37 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.113432.1738666464398833212 for ; Tue, 04 Feb 2025 02:54:24 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=Y0+vqky2; spf=pass (domain: gmail.com, ip: 209.85.128.44, mailfrom: uvv.mail@gmail.com) Received: by mail-wm1-f44.google.com with SMTP id 5b1f17b1804b1-4361f796586so62988715e9.3 for ; Tue, 04 Feb 2025 02:54:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738666462; x=1739271262; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=Sr1Zi1YoQUCRndX3cNrsawrtr/Xm5loLBxgPMsGOD5k=; b=Y0+vqky2m9+NK3YA6dUVL+mkvIwIbMnH03x37yOLFqGPKG6sCMEkbYn5xqPkOd4vwf nZ4g3WUxqpzns9I82m7jwTuiOCIId8byyBlVAkDTk3t3pM5V4iuNIUWjzSCVora/28d9 r/RevP9rDIuQg0+1n2zvu/3ukkHHKDbPlSl1eMv78GqbEBgEeBTqeR+kq5O8lDbgYhpo F+H5HGP+/EYZ3ZbdY/6LByoJ4tDiibmBhWZPSLjSRhzzuQy7MIzK3PKta8X7DWfEbXBw TmtH195C10qM+XRGAtAR/B7yZUqNAVQwjwRHeoBnnjJSnRiH4LPRScAKOBJb0aMvrRTe edzw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738666462; x=1739271262; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Sr1Zi1YoQUCRndX3cNrsawrtr/Xm5loLBxgPMsGOD5k=; b=OxaGJaDLhdAL7FjhJ5Jadyu2/NjWkmjIB1ROLLQ6RkBrnJVv2tjAJgu3QJExP5fZls rXxyBUCPs11QY6BzoCTWKAOU4w4hmNeCGYgzVZDSZ4afozr4tCHyBNXDWv+HAoSxXsdu Aeo3BPuUrlX8XgcSNtomjME3QsfiddpJpgdemNZ3xseSqajg/WM1E47lo5+VxVHesBXM D2br4QmmFo7yrH2n7+4z6zyktyIVrzQLMiHKGm81CjG/aIWiCX4h+yEbCBFUKkRDCM3T ofw8NqE1iLUJyvqYFytxRTtky9vLOnKjDaiBjz5EjslzhGLHgUgkOcONHuglj8bu4ON1 l6gg== X-Gm-Message-State: AOJu0YwJRNsFypNdHyClvdzUs4cG+hxnchbsKZDB1M7CSiTshzmQXqbo cpdVLu3feQO4I50Gj+zFL4TGKoHcU7WjOXfdCVvRGcaz+q3Ppad8qE2wPmyY X-Gm-Gg: ASbGncthDO5ngBvhie/ME8VBxJvgwU74UWMrE1MSNFxlwW9Iv8bllUzJTj02BPRoElh B3bdtsT2TUXW8wFaMveHoFlBk3LxfQhAXMdySco6ILB2B7VO+qBbJ6zkZDeehtjX1VLGd7ExBs1 KXxBei2kk5mXNe54TlPUQEdZk0QzZHwjvlel6/u4YNAcH2O0uDHpk/c+gWZFFS5uTxcex2E0DOc KdFLWOZppMxvpKWobqyGMp1yAwvgMVseTrQAO1wMj4Lj8IPgZeZ5SeBKSW2XuXbw2myfSwfnnYZ W5u3Q/cVE+b8wng/RZudMslFU52kSDRyza7cQo8AX+rT X-Google-Smtp-Source: AGHT+IE/J29NV3uzV1b3pH1ONNbEcZ+CLEGd263TxQkZVXC1SaoJSCxDLuMPg8IymFy4meMBvRq6SQ== X-Received: by 2002:a05:600c:a45:b0:436:1baa:de1c with SMTP id 5b1f17b1804b1-438dc3ca7aamr249598055e9.13.1738666461944; Tue, 04 Feb 2025 02:54:21 -0800 (PST) Received: from slackware.local.localdomain ([154.47.27.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438dcc81941sm220702145e9.36.2025.02.04.02.54.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 02:54:21 -0800 (PST) From: uvv.mail@gmail.com To: Openembedded-core@lists.openembedded.org Cc: Vyacheslav Yurkov Subject: [PATCH v2 3/3] systemd: Build the systemctl executable Date: Tue, 4 Feb 2025 11:53:15 +0100 Message-ID: <20250204105315.84079-3-uvv.mail@gmail.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20250204105315.84079-1-uvv.mail@gmail.com> References: <20250204105315.84079-1-uvv.mail@gmail.com> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Tue, 04 Feb 2025 10:54:37 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/210768 From: Vyacheslav Yurkov Instead of the python re-implementation build the actual systemctl from the systemd source tree. The python script was used when systemd didn't provide an option to build individual executables. It is possible in the meantime, so instead of always adapting the script when there's a new functionality, we simply use upstream implementation. Signed-off-by: Vyacheslav Yurkov --- .../systemd/systemd-systemctl-native.bb | 20 +- ...-meson-add-install-tag-for-systemctl.patch | 25 ++ .../systemd/systemd-systemctl/systemctl | 366 ------------------ 3 files changed, 33 insertions(+), 378 deletions(-) create mode 100644 meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch delete mode 100755 meta/recipes-core/systemd/systemd-systemctl/systemctl diff --git a/meta/recipes-core/systemd/systemd-systemctl-native.bb b/meta/recipes-core/systemd/systemd-systemctl-native.bb index ffa024caef..57bb1ab830 100644 --- a/meta/recipes-core/systemd/systemd-systemctl-native.bb +++ b/meta/recipes-core/systemd/systemd-systemctl-native.bb @@ -1,17 +1,13 @@ -SUMMARY = "Wrapper for enabling systemd services" +SUMMARY = "Systemctl executable from systemd" -LICENSE = "MIT" -LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420" +require systemd.inc +DEPENDS = "gperf-native libcap-native util-linux-native python3-jinja2-native" -inherit native +inherit pkgconfig meson native -SRC_URI = "file://systemctl" +SRC_URI = "file://0001-meson-add-install-tag-for-systemctl.patch" -S = "${WORKDIR}/sources" -UNPACKDIR = "${S}" - -do_install() { - install -d ${D}${bindir} - install -m 0755 ${S}/systemctl ${D}${bindir} -} +MESON_TARGET = "systemctl:executable" +MESON_INSTALL_TAGS = "systemctl" +EXTRA_OEMESON:append = " -Dlink-systemctl-shared=false" diff --git a/meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch b/meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch new file mode 100644 index 0000000000..a9b3e62708 --- /dev/null +++ b/meta/recipes-core/systemd/systemd-systemctl/0001-meson-add-install-tag-for-systemctl.patch @@ -0,0 +1,25 @@ +From fbf1ae3b7bd074a8d3bfb741f54b8539123399f1 Mon Sep 17 00:00:00 2001 +From: Vyacheslav Yurkov +Date: Sun, 2 Feb 2025 10:13:38 +0100 +Subject: [PATCH] meson: add install tag for systemctl + +Upstream-Status: Backport +[https://github.com/systemd/systemd/commit/b1e5a7aa3f1e552c56d5adbeed6ff67d88d1e103] + +Signed-off-by: Vyacheslav Yurkov +--- + src/systemctl/meson.build | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/systemctl/meson.build b/src/systemctl/meson.build +index 88f73bf502..46218dc8ef 100644 +--- a/src/systemctl/meson.build ++++ b/src/systemctl/meson.build +@@ -61,6 +61,7 @@ executables += [ + libzstd_cflags, + threads, + ], ++ 'install_tag' : 'systemctl', + }, + fuzz_template + { + 'sources' : [ diff --git a/meta/recipes-core/systemd/systemd-systemctl/systemctl b/meta/recipes-core/systemd/systemd-systemctl/systemctl deleted file mode 100755 index 81c246a5b2..0000000000 --- a/meta/recipes-core/systemd/systemd-systemctl/systemctl +++ /dev/null @@ -1,366 +0,0 @@ -#!/usr/bin/env python3 -"""systemctl: subset of systemctl used for image construction - -Mask/preset systemd units -""" - -import argparse -import fnmatch -import os -import re -import sys - -from collections import namedtuple -from itertools import chain -from pathlib import Path - -version = 1.0 - -ROOT = Path("/") -SYSCONFDIR = Path("etc") -BASE_LIBDIR = Path("lib") -LIBDIR = Path("usr", "lib") - -locations = list() - - -class SystemdFile(): - """Class representing a single systemd configuration file""" - - _clearable_keys = ['WantedBy'] - - def __init__(self, root, path, instance_unit_name, unit_type): - self.sections = dict() - self._parse(root, path) - dirname = os.path.basename(path.name) + ".d" - for location in locations: - files = (root / location / unit_type / dirname).glob("*.conf") - if instance_unit_name: - inst_dirname = instance_unit_name + ".d" - files = chain(files, (root / location / unit_type / inst_dirname).glob("*.conf")) - for path2 in sorted(files): - self._parse(root, path2) - - def _parse(self, root, path): - """Parse a systemd syntax configuration file - - Args: - path: A pathlib.Path object pointing to the file - - """ - skip_re = re.compile(r"^\s*([#;]|$)") - section_re = re.compile(r"^\s*\[(?P
.*)\]") - kv_re = re.compile(r"^\s*(?P[^\s]+)\s*=\s*(?P.*)") - section = None - - if path.is_symlink(): - try: - path.resolve() - except FileNotFoundError: - # broken symlink, try relative to root - path = root / Path(os.readlink(str(path))).relative_to(ROOT) - - with path.open() as f: - for line in f: - if skip_re.match(line): - continue - - line = line.strip() - m = section_re.match(line) - if m: - if m.group('section') not in self.sections: - section = dict() - self.sections[m.group('section')] = section - else: - section = self.sections[m.group('section')] - continue - - while line.endswith("\\"): - line += f.readline().rstrip("\n") - - m = kv_re.match(line) - k = m.group('key') - v = m.group('value') - if k not in section: - section[k] = list() - - # If we come across a "key=" line for a "clearable key", then - # forget all preceding assignments. This works because we are - # processing files in correct parse order. - if k in self._clearable_keys and not v: - del section[k] - continue - - section[k].extend(v.split()) - - def get(self, section, prop): - """Get a property from section - - Args: - section: Section to retrieve property from - prop: Property to retrieve - - Returns: - List representing all properties of type prop in section. - - Raises: - KeyError: if ``section`` or ``prop`` not found - """ - return self.sections[section][prop] - - -class Presets(): - """Class representing all systemd presets""" - def __init__(self, scope, root): - self.directives = list() - self._collect_presets(scope, root) - - def _parse_presets(self, presets): - """Parse presets out of a set of preset files""" - skip_re = re.compile(r"^\s*([#;]|$)") - directive_re = re.compile(r"^\s*(?Penable|disable)\s+(?P(.+))") - - Directive = namedtuple("Directive", "action unit_name") - for preset in presets: - with preset.open() as f: - for line in f: - m = directive_re.match(line) - if m: - directive = Directive(action=m.group('action'), - unit_name=m.group('unit_name')) - self.directives.append(directive) - elif skip_re.match(line): - pass - else: - sys.exit("Unparsed preset line in {}".format(preset)) - - def _collect_presets(self, scope, root): - """Collect list of preset files""" - presets = dict() - for location in locations: - paths = (root / location / scope).glob("*.preset") - for path in paths: - # earlier names override later ones - if path.name not in presets: - presets[path.name] = path - - self._parse_presets([v for k, v in sorted(presets.items())]) - - def state(self, unit_name): - """Return state of preset for unit_name - - Args: - presets: set of presets - unit_name: name of the unit - - Returns: - None: no matching preset - `enable`: unit_name is enabled - `disable`: unit_name is disabled - """ - for directive in self.directives: - if fnmatch.fnmatch(unit_name, directive.unit_name): - return directive.action - - return None - - -def add_link(path, target): - try: - path.parent.mkdir(parents=True) - except FileExistsError: - pass - if not path.is_symlink(): - print("ln -s {} {}".format(target, path)) - path.symlink_to(target) - - -class SystemdUnitNotFoundError(Exception): - def __init__(self, path, unit): - self.path = path - self.unit = unit - - -class SystemdUnit(): - def __init__(self, root, unit, unit_type): - self.root = root - self.unit = unit - self.unit_type = unit_type - self.config = None - - def _path_for_unit(self, unit): - for location in locations: - path = self.root / location / self.unit_type / unit - if path.exists() or path.is_symlink(): - return path - - raise SystemdUnitNotFoundError(self.root, unit) - - def _process_deps(self, config, service, location, prop, dirstem, instance): - systemdir = self.root / SYSCONFDIR / "systemd" / self.unit_type - - target = ROOT / location.relative_to(self.root) - try: - for dependent in config.get('Install', prop): - # expand any %i to instance (ignoring escape sequence %%) - dependent = re.sub("([^%](%%)*)%i", "\\g<1>{}".format(instance), dependent) - wants = systemdir / "{}.{}".format(dependent, dirstem) / service - add_link(wants, target) - - except KeyError: - pass - - def enable(self, units_enabled=[]): - # if we're enabling an instance, first extract the actual instance - # then figure out what the template unit is - template = re.match(r"[^@]+@(?P[^\.]*)\.", self.unit) - instance_unit_name = None - if template: - instance = template.group('instance') - if instance != "": - instance_unit_name = self.unit - unit = re.sub(r"@[^\.]*\.", "@.", self.unit, 1) - else: - instance = None - unit = self.unit - - path = self._path_for_unit(unit) - - if path.is_symlink(): - # ignore aliases - return - - config = SystemdFile(self.root, path, instance_unit_name, self.unit_type) - if instance == "": - try: - default_instance = config.get('Install', 'DefaultInstance')[0] - except KeyError: - # no default instance, so nothing to enable - return - - service = self.unit.replace("@.", - "@{}.".format(default_instance)) - else: - service = self.unit - - self._process_deps(config, service, path, 'WantedBy', 'wants', instance) - self._process_deps(config, service, path, 'RequiredBy', 'requires', instance) - - try: - for also in config.get('Install', 'Also'): - try: - units_enabled.append(unit) - if also not in units_enabled: - SystemdUnit(self.root, also, self.unit_type).enable(units_enabled) - except SystemdUnitNotFoundError as e: - sys.exit("Error: Systemctl also enable issue with %s (%s)" % (service, e.unit)) - - except KeyError: - pass - - systemdir = self.root / SYSCONFDIR / "systemd" / self.unit_type - target = ROOT / path.relative_to(self.root) - try: - for dest in config.get('Install', 'Alias'): - alias = systemdir / dest - add_link(alias, target) - - except KeyError: - pass - - def mask(self): - systemdir = self.root / SYSCONFDIR / "systemd" / self.unit_type - add_link(systemdir / self.unit, "/dev/null") - - -def collect_services(root, unit_type): - """Collect list of service files""" - services = set() - for location in locations: - paths = (root / location / unit_type).glob("*") - for path in paths: - if path.is_dir(): - continue - services.add(path.name) - - return services - - -def preset_all(root, unit_type): - presets = Presets('{}-preset'.format(unit_type), root) - services = collect_services(root, unit_type) - - for service in services: - state = presets.state(service) - - if state == "enable" or state is None: - try: - SystemdUnit(root, service, unit_type).enable() - except SystemdUnitNotFoundError: - sys.exit("Error: Systemctl preset_all issue in %s" % service) - - # If we populate the systemd links we also create /etc/machine-id, which - # allows systemd to boot with the filesystem read-only before generating - # a real value and then committing it back. - # - # For the stateless configuration, where /etc is generated at runtime - # (for example on a tmpfs), this script shouldn't run at all and we - # allow systemd to completely populate /etc. - (root / SYSCONFDIR / "machine-id").touch() - - -def main(): - if sys.version_info < (3, 4, 0): - sys.exit("Python 3.4 or greater is required") - - parser = argparse.ArgumentParser() - parser.add_argument('command', nargs='?', choices=['enable', 'mask', - 'preset-all']) - parser.add_argument('service', nargs=argparse.REMAINDER) - parser.add_argument('--root') - parser.add_argument('--preset-mode', - choices=['full', 'enable-only', 'disable-only'], - default='full') - parser.add_argument('--global', dest="opt_global", action="store_true", default=False) - - args = parser.parse_args() - - root = Path(args.root) if args.root else ROOT - - locations.append(SYSCONFDIR / "systemd") - # Handle the usrmerge case by ignoring /lib when it's a symlink - if not (root / BASE_LIBDIR).is_symlink(): - locations.append(BASE_LIBDIR / "systemd") - locations.append(LIBDIR / "systemd") - - command = args.command - if not command: - parser.print_help() - return 0 - - unit_type = "user" if args.opt_global else "system" - - if command == "mask": - for service in args.service: - try: - SystemdUnit(root, service, unit_type).mask() - except SystemdUnitNotFoundError as e: - sys.exit("Error: Systemctl main mask issue in %s (%s)" % (service, e.unit)) - elif command == "enable": - for service in args.service: - try: - SystemdUnit(root, service, unit_type).enable() - except SystemdUnitNotFoundError as e: - sys.exit("Error: Systemctl main enable issue in %s (%s)" % (service, e.unit)) - elif command == "preset-all": - if len(args.service) != 0: - sys.exit("Too many arguments.") - if args.preset_mode != "enable-only": - sys.exit("Only enable-only is supported as preset-mode.") - preset_all(root, unit_type) - else: - raise RuntimeError() - - -if __name__ == '__main__': - main()