From: Isaac True <itrue@emlix.com>
To: isar-users@googlegroups.com
Cc: Isaac True <itrue@emlix.com>
Subject: [PATCH v2] debianize: allow setting Rules-Requires-Root
Date: Mon, 15 Sep 2025 16:49:26 +0200 [thread overview]
Message-ID: <20250915144925.274032-2-itrue@emlix.com> (raw)
In-Reply-To: <20250814143405.204360-2-itrue@emlix.com>
Add a new variable "DEBIAN_RULES_REQUIRES_ROOT" which can be used to
control the value of the "Rules-Requires-Root" parameter in the
debian/control file. If this variable has no value (the default
behaviour), nothing is added. Otherwise, it appends
"Rules-Requires-Root: ${DEBIAN_RULES_REQUIRES_ROOT}" to the
Source section of the debian/control file.
This can be useful when using dpkg-raw, as setting this value to "no"
skips calling `fakeroot` during the package build process, which can
provide a considerable speedup in some environments (e.g. systems with
very high open file descriptor limits and specific versions of
fakeroot).
Signed-off-by: Isaac True <itrue@emlix.com>
---
Changes in v2:
- Add information to RECIPE-API-CHANGELOG.md
- Only add Rules-Requires-Root if the DEBIAN_RULES_REQUIRES_ROOT
variable has been set
RECIPE-API-CHANGELOG.md | 8 ++++++++
meta/classes/debianize.bbclass | 17 ++++++++++++++++-
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 8468717d..f0b94c2f 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -727,3 +727,11 @@ Changes in next
This was never documented and never had practical relevance. `oci-archive` is
the useful OCI image format that can be imported, e.g., by podman.
+
+### Allow setting Rules-Requires-Root
+
+Recipes based on the `debianize` class can now set the
+`DEBIAN_RULES_REQUIRES_ROOT` variable to control the value of the
+`Rules-Requires-Root` setting in the `debian/control` file. If this variable is
+unset (the default), `Rules-Requires-Root` will not be added. Otherwise,
+`Rules-Requires-Root` will be added and set to the value of the variable.
diff --git a/meta/classes/debianize.bbclass b/meta/classes/debianize.bbclass
index 4989c601..acc5a1ba 100644
--- a/meta/classes/debianize.bbclass
+++ b/meta/classes/debianize.bbclass
@@ -16,6 +16,7 @@ DEBIAN_BREAKS ??= ""
DEBIAN_MULTI_ARCH ??= "no"
DEBIAN_COMPAT ??= "10"
DEBIAN_CHANGELOG_TIMESTAMP ??= "3600"
+DEBIAN_RULES_REQUIRES_ROOT ??= ""
DESCRIPTION ??= "must not be empty"
MAINTAINER ??= "Unknown maintainer <unknown@example.com>"
@@ -74,8 +75,10 @@ deb_create_control[vardeps] += "DEBIANIZE_BUILD_DEPENDS \
DEBIAN_PROVIDES \
DEBIAN_REPLACES \
DEBIAN_BREAKS \
- DEBIAN_CONFLICTS"
+ DEBIAN_CONFLICTS \
+ DEBIAN_RULES_REQUIRES_ROOT"
deb_create_control() {
+ # Add Source section
cat << EOF > ${S}/debian/control
Source: ${BPN}
Section: misc
@@ -83,6 +86,18 @@ Priority: optional
Standards-Version: 3.9.6
Maintainer: ${MAINTAINER}
Build-Depends: ${@ deb_list_beautify(d, 'DEBIANIZE_BUILD_DEPENDS')}
+EOF
+
+ # If a value has been set, add the value of DEBIAN_RULES_REQUIRES_ROOT to
+ # the control file.
+ if [ -n "${DEBIAN_RULES_REQUIRES_ROOT}" ]; then
+ echo "Rules-Requires-Root: ${DEBIAN_RULES_REQUIRES_ROOT}" >> \
+ ${S}/debian/control
+ fi
+
+ # Add Package section proceeded by an empty line to separate it from the
+ # previous section.
+ cat << EOF >> ${S}/debian/control
Package: ${BPN}
Architecture: ${DPKG_ARCH}
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250915144925.274032-2-itrue%40emlix.com.
prev parent reply other threads:[~2025-09-15 16:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-14 14:34 [PATCH] debianize: set Rules-Requires-Root in debian/control Isaac True
2025-08-15 13:01 ` 'Jan Kiszka' via isar-users
2025-08-15 13:09 ` Isaac True
2025-08-15 13:39 ` 'Jan Kiszka' via isar-users
2025-09-15 14:49 ` Isaac True [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250915144925.274032-2-itrue@emlix.com \
--to=itrue@emlix.com \
--cc=isar-users@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox