public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Kent Fredric" <kentnl@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/perl-overlay:master commit in: eclass/
Date: Sun, 17 Sep 2017 00:51:57 +0000 (UTC)	[thread overview]
Message-ID: <1505608774.8d9b2b281577717bb223f50b24f57ed4eaebd56c.kentnl@gentoo> (raw)

commit:     8d9b2b281577717bb223f50b24f57ed4eaebd56c
Author:     Kent Fredric <kentfredric <AT> gmail <DOT> com>
AuthorDate: Mon Apr 11 09:58:36 2016 +0000
Commit:     Kent Fredric <kentnl <AT> gentoo <DOT> org>
CommitDate: Sun Sep 17 00:39:34 2017 +0000
URL:        https://gitweb.gentoo.org/proj/perl-overlay.git/commit/?id=8d9b2b28

perl-functions.eclass: Add a new (not in ::gentoo) perl_check_eapi function

 eclass/perl-functions.eclass | 54 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)

diff --git a/eclass/perl-functions.eclass b/eclass/perl-functions.eclass
index b189ff32c..21fe60592 100644
--- a/eclass/perl-functions.eclass
+++ b/eclass/perl-functions.eclass
@@ -686,3 +686,57 @@ perl_domodule() {
 	insinto "/${target#/}"
 	doins "${doins_opts[@]}" "${files[@]}"
 }
+
+# @FUNCTION: perl_check_eapi
+# @DESCRIPTION:
+# Checks a blacklist of known-suspect eclass variables which can be accidentally set
+# by maintainers, or may be accidentally left residual after an EAPI change.
+#
+# Dies if any of the suspect fields are found, and tell the user that the ebuild in question
+# is broken and needs a fix.
+#
+# There's a workaround, but you'll have to read the code for it.
+perl_check_eapi() {
+	local errored value;
+	local suspect_vars=();
+
+	# Secret sauce to inhibit this check
+	[[ -n "${_EAPI_PERL_MODULE_PERMISSIVE}" ]] && return;
+
+	if [[ ${EAPI:-0} == 5 ]]; then
+		suspect_vars=( DIST_TEST DIST_VERSION DIST_NAME DIST_AUTHOR DIST_A_EXT DIST_A DIST_SECTION DIST_EXAMPLES );
+	else
+		suspect_vars=( MY_PN MY_PV MODULE_VERSION MY_P MODULE_A MODULE_A_EXT MODULE_AUTHOR MODULE_NAME SRC_TEST MODULE_SECTION );
+	fi
+	for i in "${suspect_vars[@]}"; do
+		[[ -v $i ]] || continue;
+
+		# Add heading once and only once
+		if [[ ${errored:-0} == 0 ]]; then
+			if [[ -n "${I_KNOW_WHAT_I_AM_DOING}" ]]; then
+				elog "perl-module.eclass: Suspicious EAPI${EAPI:-0} eclass variables found.";
+			else
+				eerror "perl-module.eclass: Suspicious EAPI${EAPI:-0} eclass variables found.";
+			fi
+		fi
+
+		errored=1
+		# Print ENV name/value pair
+		if [[ -n "${I_KNOW_WHAT_I_AM_DOING}" ]]; then
+			elog "    ${i}=\"${!i}\"";
+		else
+			eerror "    ${i}=\"${!i}\"";
+		fi
+	done
+	# Return if there were no failures
+	[[ ${errored:-0} == 0 ]] && return;
+
+	# Return if user knows what they're doing
+	if [[ -n "${I_KNOW_WHAT_I_AM_DOING}" ]]; then
+		elog "Continuing anyway, seems you know what you're doing."
+		return
+	fi
+
+	eerror "Your ebuild/env contains eclass variables that are known invalid/legacy and indicate author oversight."
+	die "Please file a bug for this ebuild as per above details."
+}


             reply	other threads:[~2017-09-17  0:52 UTC|newest]

Thread overview: 59+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-17  0:51 Kent Fredric [this message]
  -- strict thread matches above, loose matches on Subject: below --
2017-09-17  0:51 [gentoo-commits] proj/perl-overlay:master commit in: eclass/ Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2017-09-17  0:51 Kent Fredric
2015-06-25  1:26 Kent Fredric
2015-06-21  0:39 Kent Fredric
2015-06-21  0:39 Kent Fredric
2015-06-20 22:13 Kent Fredric
2015-06-20 22:13 Kent Fredric
2015-06-20 22:13 Kent Fredric
2015-06-20 22:13 Kent Fredric
2015-03-26 12:14 Kent Fredric
2015-03-15 17:06 Kent Fredric
2015-03-15  5:10 Kent Fredric
2015-03-15  5:10 Kent Fredric
2014-12-23 18:19 Kent Fredric
2014-12-23 18:19 Kent Fredric
2014-12-23 14:43 Kent Fredric
2014-10-11 18:46 Kent Fredric
2014-10-11 18:46 Kent Fredric
2014-10-11 18:46 Kent Fredric
2014-08-26 19:06 Kent Fredric
2014-08-24 13:56 Kent Fredric
2014-08-20 13:24 Kent Fredric
2014-04-04 23:09 Kent Fredric
2013-09-17  4:35 Kent Fredric
2013-09-17  4:28 Kent Fredric
2013-04-28 16:53 Kent Fredric
2012-09-15 16:58 Torsten Veller
2012-06-07  6:06 Torsten Veller
2012-06-05 18:22 Torsten Veller
2012-06-05 18:22 Torsten Veller
2012-04-23 13:04 Torsten Veller
2012-04-23 13:04 Torsten Veller
2012-04-23 13:04 Torsten Veller
2011-08-16 17:02 Torsten Veller
2011-04-24  8:37 Torsten Veller
2011-02-04  8:15 tove

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1505608774.8d9b2b281577717bb223f50b24f57ed4eaebd56c.kentnl@gentoo \
    --to=kentnl@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox