[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-dev
Subject:    Re: [gentoo-dev] gnome2-utils.eclass: updated DISABLE_DEPRECATED fix
From:       Alexandre Rostovtsev <tetromino () gentoo ! org>
Date:       2012-10-28 1:19:45
Message-ID: 1351387185.12994.24.camel () rook
[Download RAW message or body]

The previously sent patch contained two problems. First, it assumed that
the config-header to be touched is necessarily called config.h.in. This
is not the case; for example, goffice uses goffice-config.h.in. Second,
and more importantly, it touched aclocal.m4 and config.h.in even if
configure.ac was not modified.

To fix these problems in light of the fact that the config-header might
be called something different from config.h.in, and that some of
gnome2-utils.eclass's users (e.g. vte) have nested configures and
multiple aclocal files and config-headers present, we have to parse
configure.ac for A{C,M}_CONFIG_HEADERS. Fortunately, automake's
"missing" script provides a model to follow here.

Updated patch:

--- gnome2-utils.eclass	27 Oct 2012 22:24:10 -0000	1.31
+++ gnome2-utils.eclass	28 Oct 2012 01:15:36 -0000
@@ -432,16 +432,18 @@
 gnome2_disable_deprecation_warning() {
 	local retval=0
 	local fails=( )
-	local makefile
+	local makefile d h
 
 	ebegin "Disabling deprecation warnings"
-	# The sort is important to ensure .am is listed before the respective .in for
-	# maintainer mode regeneration not kicking in due to .am being newer than .in
+	# The sort is important to ensure .am is listed before the respective .in,
+	# and configure.{ac,in} before Makefile.in, to prevent maintainer mode
+	# regeneration from kicking in due to .am being newer than .in
 	while read makefile ; do
 		if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
 			continue
 		fi
 
+		debug-print "Disabling deprecation warnings in ${makefile}"
 		LC_ALL=C sed -r -i \
 			-e 's:-D[A-Z_]+_DISABLE_DEPRECATED:$(NULL):g' \
 			-e 's:-DGSEAL_ENABLE:$(NULL):g' \
@@ -451,13 +453,37 @@
 			# Add to the list of failures
 			fails+=( "${makefile}" )
 			retval=2
+		elif [[ ${makefile%%configure.ac} != ${makefile} ||
+		        ${makefile%%configure.am} != ${makefile} ]]; then
+			# To avoid maintainer mode when sedding configure.ac, aclocal.m4
+			# and config.h.in need to have mtime after configure.ac and
+			# Makefile.am, but before configure and Makefile.in
+			d="$(dirname ${makefile})"
+			pushd "${d}" > /dev/null
+			if [[ -f aclocal.m4 ]]; then
+				debug-print "Touching ${d}/aclocal.m4"
+				touch aclocal.m4
+			fi
+			# Inspired by autoheader logic from automake's "missing" script
+			# Match the argument of AC_CONFIG_HEADER (or AM_.., or  .._HEADERS)
+			# which is enclosed in () and optionally in []
+			for h in config.h $(sed -n 's/^[ ]*A[CM]_CONFIG_HEADERS\?(\[\?\([^])]*\).*/\1/p' "${makefile}"); do
+				# Argument can be of form "foo.h:bar.in" (where we want bar.in)
+				# or "foo.h" (in which case we want foo.h.in)
+				case "${h}" in
+					*:*) h=$(echo "${h}" | sed -e 's/^[^:]*://');;
+					*)   h="${h}.in";;
+				esac
+				# Ignore non-autogenerated config_headers
+				grep -q "Generated.*by autoheader" "${h}" || continue
+				debug-print "Touching ${d}/${h}"
+				touch "${h}"
+			done
+			popd > /dev/null
 		fi
-	done < <(find "${S}" -name "Makefile.in" \
-		-o -name "Makefile.am" -o -name "Makefile.decl" \
-		| sort; echo configure)
-# TODO: sedding configure.ac can trigger maintainer mode; bug #439602
-#		-o -name "configure.ac" -o -name "configure.in" \
-#		| sort; echo configure)
+	done < <(find "${S}" -name "Makefile.am" -o -name "Makefile.decl" \
+		-o -name "configure.ac" -o -name "configure.in"; \
+		find "${S}" -name "configure" -o -name "Makefile.in")
 	eend ${retval}
 
 	for makefile in "${fails[@]}" ; do


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic