public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] gnome2-utils.eclass: updated DISABLE_DEPRECATED fix
@ 2012-10-27 22:44 Alexandre Rostovtsev
  2012-10-28  1:19 ` Alexandre Rostovtsev
  0 siblings, 1 reply; 2+ messages in thread
From: Alexandre Rostovtsev @ 2012-10-27 22:44 UTC (permalink / raw
  To: Gentoo Dev

The recently added gnome2_disable_deprecation_warning() unfortunately
triggered maintainer mode and undesirable autoreconf for some packages
like file-roller, leading to build failure (see bug #439602); the
problem had been caused by configure.ac having a higher mtime than
aclocal.m4 and config.h.in.

To prevent the bug, gnome2_disable_deprecation_warning() currently no
longer modifies configure.ac, but it would be desirable to bring back
that functionality. The patch below does so.

People who are well-versed in autotools internals, please review whether
this approach is sane and sufficient.

--- gnome2-utils.eclass	27 Oct 2012 22:24:10 -0000	1.31
+++ gnome2-utils.eclass	27 Oct 2012 22:29:20 -0000
@@ -435,13 +435,22 @@
 	local makefile
 
 	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
+		if [[ ${makefile%%aclocal.m4} != ${makefile} ||
+		      ${makefile%%config.h.in} != ${makefile} ]]; then
+			# To avoid maintainer mode, aclocal.m4/config.h.in need to have
+			# mtime after configure.ac and Makefile.am, but before configure
+			# and Makefile.in
+			debug-print "Touching ${makefile}"
+			touch "${makefile}" && continue
+		elif ! 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' \
@@ -452,12 +461,10 @@
 			fails+=( "${makefile}" )
 			retval=2
 		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 "aclocal.m4" -o -name "config.h.in"; \
+		find "${S}" -name "configure" -o -name "Makefile.in")
 	eend ${retval}
 
 	for makefile in "${fails[@]}" ; do



^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [gentoo-dev] gnome2-utils.eclass: updated DISABLE_DEPRECATED fix
  2012-10-27 22:44 [gentoo-dev] gnome2-utils.eclass: updated DISABLE_DEPRECATED fix Alexandre Rostovtsev
@ 2012-10-28  1:19 ` Alexandre Rostovtsev
  0 siblings, 0 replies; 2+ messages in thread
From: Alexandre Rostovtsev @ 2012-10-28  1:19 UTC (permalink / raw
  To: gentoo-dev

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



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-28  1:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-27 22:44 [gentoo-dev] gnome2-utils.eclass: updated DISABLE_DEPRECATED fix Alexandre Rostovtsev
2012-10-28  1:19 ` Alexandre Rostovtsev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox