Sean Whitton:
Hello,

On Thu 15 Aug 2024 at 11:07am +02, Niels Thykier wrote:

How about adding

"""
The default for Rules-Requires-Root depends on the dpkg-build-api level (the
dpkg-build-api is defined in "man 7 dpkg-build-api"). At level 0 (or when not
declared), Rules-Requires-Root defaults to binary-targets. In later versions,
it defaults to no.
"""

in 5.6.31 and then removing the `(default)` next `binary-targets` in 5.6.31?

I think that would do wonders.

Based on this I came up with the following, which I think is slightly
cleaner than adding a whole paragraph.  Would you mind checking it?


LGTM/seconded. Thanks for providing.

-- >8 --
Subject: [PATCH] Update specification of the default value for
  Rules-Requires-Root

---
  debian/changelog            |  2 ++
  policy/ch-controlfields.rst | 17 ++++++++++-------
  2 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index c1fc3c3..2d5d204 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,8 @@ debian-policy (4.7.0.1) UNRELEASED; urgency=medium
      Thanks to Paul Gevers for the report.
    * Fix markup problem in 3.9 (Closes: #1074040).
      Thanks to Ke Zhang for the report & patch.
+  * Update specification of the default value for Rules-Requires-Root.
+    See #1057238.

   -- Sean Whitton <spwhit...@spwhitton.name>  Sun, 07 Apr 2024 15:34:08 +0800

diff --git a/policy/ch-controlfields.rst b/policy/ch-controlfields.rst
index ecccbe9..530755a 100644
--- a/policy/ch-controlfields.rst
+++ b/policy/ch-controlfields.rst
@@ -1204,14 +1204,14 @@ script: debian/rules <s-debianrules>`.

  The field can consist of exactly one of the following three items:

- - ``no``: Declares that neither root nor fakeroot is required.
-   Package builders (e.g. dpkg-buildpackage) may choose to invoke any
-   target in ``debian/rules`` with an unprivileged user.
+ - ``no`` (default at dpkg-build-api level >=1): Declares that neither root
+   nor fakeroot is required.  Package builders (e.g. dpkg-buildpackage) may
+   choose to invoke any target in ``debian/rules`` with an unprivileged user.

- - ``binary-targets`` (default): Declares that the package will need
-   the root (or fakeroot) when either of the ``binary``,
-   ``binary-arch`` or ``binary-indep`` targets are called.  This is
-   how every tool behaved before this field was defined.
+ - ``binary-targets`` (default at dpkg-build-api level 0): Declares that the
+   package will need the root (or fakeroot) when either of the ``binary``,
+   ``binary-arch`` or ``binary-indep`` targets are called.  This is how every
+   tool behaved before this field was defined.

   - A space separated list of keywords described below.  These keywords
     must always contain a forward slash, which sets them apart from the
@@ -1222,6 +1222,9 @@ The field can consist of exactly one of the following 
three items:
     to ``binary-targets``, and both the builder and the package's
     ``debian/rules`` script must downgrade accordingly (see below).

+The default depends on the dpkg-build-api level (see dpkg-build-api(7)).
+If the dpkg-build-api level is undeclared, it is equivalent to level 0.
+
  If the package builder supports the ``Rules-Requires-Root`` field and
  wants to enable the feature, then it must set the environment variable
  ``DEB_RULES_REQUIRES_ROOT`` when invoking the package building script


Best regards,
Niels

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

Reply via email to