Gentoo Archives: gentoo-dev

From: Alexandre Rostovtsev <tetromino@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] gnome2-utils.eclass: updated DISABLE_DEPRECATED fix
Date: Sun, 28 Oct 2012 01:20:44
Message-Id: 1351387185.12994.24.camel@rook
In Reply to: [gentoo-dev] gnome2-utils.eclass: updated DISABLE_DEPRECATED fix by Alexandre Rostovtsev
1 The previously sent patch contained two problems. First, it assumed that
2 the config-header to be touched is necessarily called config.h.in. This
3 is not the case; for example, goffice uses goffice-config.h.in. Second,
4 and more importantly, it touched aclocal.m4 and config.h.in even if
5 configure.ac was not modified.
6
7 To fix these problems in light of the fact that the config-header might
8 be called something different from config.h.in, and that some of
9 gnome2-utils.eclass's users (e.g. vte) have nested configures and
10 multiple aclocal files and config-headers present, we have to parse
11 configure.ac for A{C,M}_CONFIG_HEADERS. Fortunately, automake's
12 "missing" script provides a model to follow here.
13
14 Updated patch:
15
16 --- gnome2-utils.eclass 27 Oct 2012 22:24:10 -0000 1.31
17 +++ gnome2-utils.eclass 28 Oct 2012 01:15:36 -0000
18 @@ -432,16 +432,18 @@
19 gnome2_disable_deprecation_warning() {
20 local retval=0
21 local fails=( )
22 - local makefile
23 + local makefile d h
24
25 ebegin "Disabling deprecation warnings"
26 - # The sort is important to ensure .am is listed before the respective .in for
27 - # maintainer mode regeneration not kicking in due to .am being newer than .in
28 + # The sort is important to ensure .am is listed before the respective .in,
29 + # and configure.{ac,in} before Makefile.in, to prevent maintainer mode
30 + # regeneration from kicking in due to .am being newer than .in
31 while read makefile ; do
32 if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
33 continue
34 fi
35
36 + debug-print "Disabling deprecation warnings in ${makefile}"
37 LC_ALL=C sed -r -i \
38 -e 's:-D[A-Z_]+_DISABLE_DEPRECATED:$(NULL):g' \
39 -e 's:-DGSEAL_ENABLE:$(NULL):g' \
40 @@ -451,13 +453,37 @@
41 # Add to the list of failures
42 fails+=( "${makefile}" )
43 retval=2
44 + elif [[ ${makefile%%configure.ac} != ${makefile} ||
45 + ${makefile%%configure.am} != ${makefile} ]]; then
46 + # To avoid maintainer mode when sedding configure.ac, aclocal.m4
47 + # and config.h.in need to have mtime after configure.ac and
48 + # Makefile.am, but before configure and Makefile.in
49 + d="$(dirname ${makefile})"
50 + pushd "${d}" > /dev/null
51 + if [[ -f aclocal.m4 ]]; then
52 + debug-print "Touching ${d}/aclocal.m4"
53 + touch aclocal.m4
54 + fi
55 + # Inspired by autoheader logic from automake's "missing" script
56 + # Match the argument of AC_CONFIG_HEADER (or AM_.., or .._HEADERS)
57 + # which is enclosed in () and optionally in []
58 + for h in config.h $(sed -n 's/^[ ]*A[CM]_CONFIG_HEADERS\?(\[\?\([^])]*\).*/\1/p' "${makefile}"); do
59 + # Argument can be of form "foo.h:bar.in" (where we want bar.in)
60 + # or "foo.h" (in which case we want foo.h.in)
61 + case "${h}" in
62 + *:*) h=$(echo "${h}" | sed -e 's/^[^:]*://');;
63 + *) h="${h}.in";;
64 + esac
65 + # Ignore non-autogenerated config_headers
66 + grep -q "Generated.*by autoheader" "${h}" || continue
67 + debug-print "Touching ${d}/${h}"
68 + touch "${h}"
69 + done
70 + popd > /dev/null
71 fi
72 - done < <(find "${S}" -name "Makefile.in" \
73 - -o -name "Makefile.am" -o -name "Makefile.decl" \
74 - | sort; echo configure)
75 -# TODO: sedding configure.ac can trigger maintainer mode; bug #439602
76 -# -o -name "configure.ac" -o -name "configure.in" \
77 -# | sort; echo configure)
78 + done < <(find "${S}" -name "Makefile.am" -o -name "Makefile.decl" \
79 + -o -name "configure.ac" -o -name "configure.in"; \
80 + find "${S}" -name "configure" -o -name "Makefile.in")
81 eend ${retval}
82
83 for makefile in "${fails[@]}" ; do