This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=a0e63a6006b7a180c35f35f5cf869c4c3eebca77

commit a0e63a6006b7a180c35f35f5cf869c4c3eebca77
Author: Guillem Jover <[email protected]>
AuthorDate: Sun May 14 15:39:51 2023 +0200

    dpkg-buildpackage: Fix build hook action substitution string handling
    
    We are only running the build hook if the rules file requires root, so
    we should take that into account when setting the action boolean value
    for the hooks invocation string substitution.
---
 scripts/dpkg-buildpackage.pl | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 1532d8019..f7604980c 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -660,8 +660,6 @@ if (build_has_any(BUILD_SOURCE)) {
     run_cmd('dpkg-source', @source_opts, '-b', '.');
 }
 
-run_hook('build', build_has_any(BUILD_BINARY));
-
 my $build_types = get_build_options_from_type();
 
 if (build_has_any(BUILD_BINARY)) {
@@ -669,10 +667,18 @@ if (build_has_any(BUILD_BINARY)) {
     # targets. This is a temporary measure to not break too many packages
     # on a flag day.
     build_target_fallback($ctrl);
+}
 
-    # If we are building rootless, there is no need to call the build target
-    # independently as non-root.
-    run_cmd(@debian_rules, $buildtarget) if rules_requires_root($binarytarget);
+# If we are building rootless, there is no need to call the build target
+# independently as non-root.
+if (build_has_any(BUILD_BINARY) && rules_requires_root($binarytarget)) {
+    run_hook('build', 1);
+    run_cmd(@debian_rules, $buildtarget);
+} else {
+    run_hook('build', 0);
+}
+
+if (build_has_any(BUILD_BINARY)) {
     run_hook('binary', 1);
     run_rules_cond_root($binarytarget);
 }

-- 
Dpkg.Org's dpkg

Reply via email to