[Debian-ha-commits] [pacemaker] 57/69: Rewrite debian/check_header_deps

Christoph Berg myon at debian.org
Tue Jan 26 09:14:29 UTC 2016


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

myon pushed a commit to branch debian/master
in repository pacemaker.

commit 03f18e20a9bf71e8683b621d4f23a4387918be03
Author: Ferenc Wágner <wferi at niif.hu>
Date:   Wed Jan 13 12:44:29 2016 +0100

    Rewrite debian/check_header_deps
    
    * add omitted include directories
    * tolerate packages without header files
    * single make invocation
    * delete MAKEFLAGS and MAKELEVEL internally
    * add comments
---
 debian/check_header_deps | 49 ++++++++++++++++++++++++++++++++++++++----------
 debian/rules             |  2 +-
 2 files changed, 40 insertions(+), 11 deletions(-)

diff --git a/debian/check_header_deps b/debian/check_header_deps
index 299bdb9..de38560 100755
--- a/debian/check_header_deps
+++ b/debian/check_header_deps
@@ -1,22 +1,51 @@
 #!/bin/sh -e
 
+# Determine header:Depends substitutions describing the C header
+# interdependencies of the libdevel packages built from this source package.
+#
+# Arguments: package-specific include subdirectory names
+
 cd debian
 
 pkgs=$(grep-dctrl -sPackage -n -FSection libdevel control)
 DEB_HOST_MULTIARCH=$(dpkg-architecture -qDEB_HOST_MULTIARCH)
 
+# Use headers from the package directories
 for p in $pkgs; do
-    includes="$includes -I $p/usr/include/$1 -I $p/usr/include/$DEB_HOST_MULTIARCH"
+    includes="$includes -I$p/usr/include -I$p/usr/include/$DEB_HOST_MULTIARCH"
+    for dir in "$@"; do
+        includes="$includes -I$p/usr/include/$dir -I$p/usr/include/$DEB_HOST_MULTIARCH/$dir"
+    done
 done
 
-for pkg in $pkgs; do
-  {
-    for header in $(find "$pkg" -name "*.h"); do
-        gcc -MM -MT "$pkg" -E $includes $header
-    done
-    printf '\t%s\n' '$(info header:Depends= \
-$(foreach pkg,$(sort $(filter-out $@, \
+# Generate a Makefile to parse gcc -MM output and write out
+# the necessary substitutions
+{
+# For each dependency (header file) take the first path component (the
+# package name), sort them removing the duplicates, filter out the name
+# of the container package (in $@, from -MT), and append the constraint.
+# Store this expansion in a variable for easier quoting.
+echo 'headerDepLine=header:Depends=\
+$(foreach pkg,$(filter-out $@, $(sort \
 		$(foreach dep,$^,$(firstword $(subst /, ,$(dep)))))) \
-	,$(pkg) (= $${binary:Version}),))'
-  } | make -Bsf - >>"$pkg.substvars"
+	,$(pkg) (= $${binary:Version}),)'
+
+for pkg in $pkgs; do
+    found_headers=no
+    if [ -d "$pkg" ]; then
+        for header in $(find "$pkg" -name "*.h"); do
+            found_headers=yes
+            gcc -MM -MT "$pkg" -E $includes $header
+        done
+    else
+        echo ".PHONY: $pkg"
+    fi
+
+    if [ "$found_headers" = yes ]; then
+        printf "\techo '\$(headerDepLine)' >>'%s.substvars'\n" "$pkg"
+    fi
 done
+# Insulate from the outer make (usually running debian/rules) and consider
+# all targets out of date, as our targets are the package names, which exist
+# as directories
+} | MAKEFLAGS= MAKELEVEL= make --always-make --makefile=- $pkgs
diff --git a/debian/rules b/debian/rules
index d8b52ec..1d67aa7 100755
--- a/debian/rules
+++ b/debian/rules
@@ -38,7 +38,7 @@ override_dh_install:
 	dh_install --fail-missing --exclude=.la --exclude=.md5 \
 		--exclude COPYING --exclude COPYING.LIB
 	install -D -m 644 mcp/pacemaker.sysconfig debian/pacemaker/etc/default/pacemaker
-	env -u MAKELEVEL -u MAKEFLAGS -u MFLAGS debian/check_header_deps pacemaker
+	debian/check_header_deps pacemaker
 
 override_dh_installchangelogs:
 	dh_installchangelogs ChangeLog

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-ha/pacemaker.git



More information about the Debian-HA-Commits mailing list