public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] About disabling DISABLE_DEPRECATED
@ 2012-09-30 21:44 Gilles Dartiguelongue
  2012-10-03  2:57 ` Mike Frysinger
  0 siblings, 1 reply; 4+ messages in thread
From: Gilles Dartiguelongue @ 2012-09-30 21:44 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 900 bytes --]

Hi all,

as discussed this morning on #-desktop, I found out while reading
commits from April that we have quite a few ebuilds in tree doing this
manually.

The problem is that in those ~153 instances of the same command, some do
take care of problems such as i18n env, some don't, some delete whole
lines, some replace with $(NULL) or even other values.

I think it is high time we provide a reference solution for this, even
if the solution should be to push upstream to fix there build system as
usual.

You'll find in attachement a prototype patch from gnome2-utils eclass.

It does not take care of packages providing
--disable-deprecations{,-flags} on purpose for now since I have not
found a MACRO and hence a reliable way to make sure this works in
upstream tarballs. Some packages do have such configure switch but it
does not always work.

-- 
Gilles Dartiguelongue <eva@gentoo.org>
Gentoo

[-- Attachment #2: deprecation-warnings.patch --]
[-- Type: text/x-patch, Size: 2134 bytes --]

Index: eclass/gnome2.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2.eclass,v
retrieving revision 1.107
diff -u -B -r1.107 gnome2.eclass
--- eclass/gnome2.eclass	27 Sep 2012 16:35:41 -0000	1.107
+++ eclass/gnome2.eclass	30 Sep 2012 09:58:09 -0000
@@ -94,6 +94,9 @@
 	# Prevent scrollkeeper access violations
 	gnome2_omf_fix
 
+	# Disable all deprecation warnings
+	gnome2_disable_deprecation_warning
+
 	# Run libtoolize
 	if has ${EAPI:-0} 0 1 2 3; then
 		elibtoolize ${ELTCONF}
Index: eclass/gnome2-utils.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/gnome2-utils.eclass,v
retrieving revision 1.29
diff -u -B -r1.29 gnome2-utils.eclass
--- eclass/gnome2-utils.eclass	27 Sep 2012 16:35:41 -0000	1.29
+++ eclass/gnome2-utils.eclass	30 Sep 2012 09:59:43 -0000
@@ -424,3 +424,40 @@
 gnome2_query_immodules_gtk3() {
 	"${EPREFIX}/usr/bin/gtk-query-immodules-3.0" --update-cache
 }
+
+# @FUNCTION: gnome2_disable_deprecation_warning
+# @USAGE: gnome2_disable_deprecation_warning
+# @DESCRIPTION:
+# Disable deprecation warnings commonly found in glib based packages.
+# Should be called from src_prepare.
+gnome2_disable_deprecation_warning() {
+	local retval=0
+	local fails=( )
+
+	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
+	for makefile in $(find "${S}" -name "Makefile.in" \
+		-o -name "Makefile.am" -o -name "Makefile.decl" | sort); do
+
+		if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
+			continue
+		fi
+
+		LC_ALL=C sed -e 's:-D[A-Z_]\+_DISABLE_DEPRECATED:$(NULL):g' \
+			-e 's:-DGSEAL_ENABLE:$(NULL):g' \
+			-i "${makefile}"
+
+		if [[ $? -ne 0 ]]; then
+			# Add to the list of failures
+			fails[$(( ${#fails[@]} + 1 ))]="${makefile}"
+
+			retval=2
+		fi
+	done
+	eend ${retval}
+
+	for makefile in "${fails[@]}" ; do
+		eerror "Failed to disable deprecation warnings in $makefile"
+	done
+}

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

* Re: [gentoo-dev] About disabling DISABLE_DEPRECATED
  2012-09-30 21:44 [gentoo-dev] About disabling DISABLE_DEPRECATED Gilles Dartiguelongue
@ 2012-10-03  2:57 ` Mike Frysinger
  2012-10-08  3:37   ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 1 reply; 4+ messages in thread
From: Mike Frysinger @ 2012-10-03  2:57 UTC (permalink / raw
  To: gentoo-dev; +Cc: Gilles Dartiguelongue

[-- Attachment #1: Type: Text/Plain, Size: 1106 bytes --]

On Sunday 30 September 2012 17:44:05 Gilles Dartiguelongue wrote:
> +# @USAGE: gnome2_disable_deprecation_warning

no need for this

> +	for makefile in $(find "${S}" -name "Makefile.in" \
> +		-o -name "Makefile.am" -o -name "Makefile.decl" | sort); do

`local makefile` missing.  also, this does not preserve quoting.  you would 
have to do:
	while read makefile ; do
		...
	done < <(find ...)

> +		if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then

`grep -E` -> `egrep`

> +		LC_ALL=C sed -e 's:-D[A-Z_]\+_DISABLE_DEPRECATED:$(NULL):g' \
> +			-e 's:-DGSEAL_ENABLE:$(NULL):g' \
> +			-i "${makefile}"

use -r instead of escaping.  it's also more readable to split -e from the rest 
since that tends to be the meat of sed.
	LC_ALL=C sed -i -r \
		-e '...' \
		-e '...' \
		"${makefile}"

> +			fails[$(( ${#fails[@]} + 1 ))]="${makefile}"

fails+=( "${makefile}" )

> +		eerror "Failed to disable deprecation warnings in $makefile"

${makefile}

also, if you're using eerror, this really should end in a `die`.  or it should 
use ewarn.
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [gentoo-dev] About disabling DISABLE_DEPRECATED
  2012-10-03  2:57 ` Mike Frysinger
@ 2012-10-08  3:37   ` Arfrever Frehtes Taifersar Arahesis
  2012-10-23 20:34     ` Gilles Dartiguelongue
  0 siblings, 1 reply; 4+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2012-10-08  3:37 UTC (permalink / raw
  To: Gentoo Development

[-- Attachment #1: Type: Text/Plain, Size: 496 bytes --]

2012-10-03 04:57:10 Mike Frysinger napisał(a):
> On Sunday 30 September 2012 17:44:05 Gilles Dartiguelongue wrote:
> > +		if ! grep -qE "(DISABLE_DEPRECATED|GSEAL_ENABLE)" "${makefile}"; then
> 
> `grep -E` -> `egrep`

'man grep' says:
"egrep is the same as grep -E. fgrep is the same as grep -F. Direct invocation as either egrep or fgrep is deprecated,
but is provided to allow historical applications that rely on them to run unmodified."

-- 
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

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

* Re: [gentoo-dev] About disabling DISABLE_DEPRECATED
  2012-10-08  3:37   ` Arfrever Frehtes Taifersar Arahesis
@ 2012-10-23 20:34     ` Gilles Dartiguelongue
  0 siblings, 0 replies; 4+ messages in thread
From: Gilles Dartiguelongue @ 2012-10-23 20:34 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 197 bytes --]

I have just commited a version adapted from your comments with the
addition of fixing configure* files as well. Thanks guys for the review.

-- 
Gilles Dartiguelongue <eva@gentoo.org>
Gentoo

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

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

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

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-09-30 21:44 [gentoo-dev] About disabling DISABLE_DEPRECATED Gilles Dartiguelongue
2012-10-03  2:57 ` Mike Frysinger
2012-10-08  3:37   ` Arfrever Frehtes Taifersar Arahesis
2012-10-23 20:34     ` Gilles Dartiguelongue

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