* [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope
@ 2017-09-06 23:40 Mike Pagano
2017-09-07 1:13 ` Floyd Anderson
2017-09-07 5:42 ` [gentoo-dev] " Michał Górny
0 siblings, 2 replies; 5+ messages in thread
From: Mike Pagano @ 2017-09-06 23:40 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1.1: Type: text/plain, Size: 1978 bytes --]
This time, use bash 4.0, but limit the use of this function to ebuild that have EAPI >= 6.
Display a warning for maintainers to upgrade their ebuilds, or remove the call.
Thanks to mgorny for the suggestion.
Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
eclass/kernel-2.eclass | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
index 84909f30c..a80f3e91a 100644
--- a/eclass/kernel-2.eclass
+++ b/eclass/kernel-2.eclass
@@ -1407,11 +1407,20 @@ getfilevar() {
# This function sets ARCH_URI and ARCH_PATCH
# with the neccessary info for the arch sepecific compatibility
# patchsets.
+# To use, an ebuild could contain a line like:
+# AMD64_URI=http//linktothearchspecificpatch
+# This function requires EAPI >= 6.
detect_arch() {
- local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
+ if [[ "${EAPI}" -lt 6 ]]; then
+ eqawarn "ebuild is attempting to call detect_arch when EAPI < 6."
+ eqawarn "This function will not be executed."
+ return
+ fi
+ local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
+
# COMPAT_URI is the contents of ${ARCH}_URI
# ARCH_URI is the URI for all the ${ARCH}_URI patches
# ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
@@ -1425,18 +1434,15 @@ detect_arch() {
COMPAT_URI="${LOOP_ARCH}_URI"
COMPAT_URI="${!COMPAT_URI}"
- declare -l LOOP_ARCH_L=${LOOP_ARCH}
-
[[ -n ${COMPAT_URI} ]] && \
- ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
+ ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )"
- declare -u TC_ARCH_KERNEL=$(tc-arch-kernel)
- if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then
+ TC_ARCH_KERNEL=$(tc-arch-kernel);
+ if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then
for i in ${COMPAT_URI}; do
ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
done
fi
-
done
}
--
2.13.5
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope
2017-09-06 23:40 [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope Mike Pagano
@ 2017-09-07 1:13 ` Floyd Anderson
2017-09-07 7:01 ` [gentoo-dev] " Duncan
2017-09-07 5:42 ` [gentoo-dev] " Michał Górny
1 sibling, 1 reply; 5+ messages in thread
From: Floyd Anderson @ 2017-09-07 1:13 UTC (permalink / raw
To: gentoo-dev
Hello,
some remarks below ...
On Mi, 06 Sep 23:40:50 +0000
Mike Pagano <mpagano@gentoo.org> wrote:
>This time, use bash 4.0, but limit the use of this function to ebuild that have EAPI >= 6.
>Display a warning for maintainers to upgrade their ebuilds, or remove the call.
>Thanks to mgorny for the suggestion.
>
>Signed-off-by: Mike Pagano <mpagano@gentoo.org>
>---
> eclass/kernel-2.eclass | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
>diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
>index 84909f30c..a80f3e91a 100644
>--- a/eclass/kernel-2.eclass
>+++ b/eclass/kernel-2.eclass
>@@ -1407,11 +1407,20 @@ getfilevar() {
> # This function sets ARCH_URI and ARCH_PATCH
> # with the neccessary info for the arch sepecific compatibility
> # patchsets.
>+# To use, an ebuild could contain a line like:
>+# AMD64_URI=http//linktothearchspecificpatch
Even it’s just a comment:
# AMD64_URI="http://link-to-the-arch-specific-patch"
looks friendlier to my eyes. However at least the colon after the scheme
should be given.
>+# This function requires EAPI >= 6.
>
> detect_arch() {
>
>- local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
>+ if [[ "${EAPI}" -lt 6 ]]; then
>+ eqawarn "ebuild is attempting to call detect_arch when EAPI < 6."
>+ eqawarn "This function will not be executed."
>+ return
>+ fi
>
>+ local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
Declaration of LOOP_ARCH_L seems obsolete now.
>+
> # COMPAT_URI is the contents of ${ARCH}_URI
> # ARCH_URI is the URI for all the ${ARCH}_URI patches
> # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
>@@ -1425,18 +1434,15 @@ detect_arch() {
> COMPAT_URI="${LOOP_ARCH}_URI"
> COMPAT_URI="${!COMPAT_URI}"
>
>- declare -l LOOP_ARCH_L=${LOOP_ARCH}
>-
> [[ -n ${COMPAT_URI} ]] && \
>- ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
>+ ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )"
>
>- declare -u TC_ARCH_KERNEL=$(tc-arch-kernel)
>- if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then
>+ TC_ARCH_KERNEL=$(tc-arch-kernel);
>+ if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then
> for i in ${COMPAT_URI}; do
> ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
> done
> fi
>-
> done
> }
>
>--
>2.13.5
>
>
--
Regards,
floyd
^ permalink raw reply [flat|nested] 5+ messages in thread
* [gentoo-dev] Re: [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope
2017-09-07 1:13 ` Floyd Anderson
@ 2017-09-07 7:01 ` Duncan
0 siblings, 0 replies; 5+ messages in thread
From: Duncan @ 2017-09-07 7:01 UTC (permalink / raw
To: gentoo-dev
Floyd Anderson posted on Thu, 07 Sep 2017 03:13:45 +0200 as excerpted:
>>+# To use, an ebuild could contain a line like:
>>+# AMD64_URI=http//linktothearchspecificpatch
>
> Even it’s just a comment:
>
> # AMD64_URI="http://link-to-the-arch-specific-patch"
>
> looks friendlier to my eyes. However at least the colon after the scheme
> should be given.
... And please, even in examples, use https://, to encourage the at
least somewhat better security than plain http.
(While https may not be particularly resistant to state-level actors able
to lean on CAs, it should hopefully at least resist the trivial stuff
like insecure wifi and ISP content-insertion games.)
--
Duncan - List replies preferred. No HTML msgs.
"Every nonfree program has a lord, a master --
and if you use the program, he is your master." Richard Stallman
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope
2017-09-06 23:40 [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope Mike Pagano
2017-09-07 1:13 ` Floyd Anderson
@ 2017-09-07 5:42 ` Michał Górny
2017-09-07 7:39 ` Ciaran McCreesh
1 sibling, 1 reply; 5+ messages in thread
From: Michał Górny @ 2017-09-07 5:42 UTC (permalink / raw
To: gentoo-dev, Mike Pagano
Dnia 7 września 2017 01:40:50 CEST, Mike Pagano <mpagano@gentoo.org> napisał(a):
>This time, use bash 4.0, but limit the use of this function to ebuild
>that have EAPI >= 6.
>Display a warning for maintainers to upgrade their ebuilds, or remove
>the call.
>Thanks to mgorny for the suggestion.
>
>Signed-off-by: Mike Pagano <mpagano@gentoo.org>
>---
> eclass/kernel-2.eclass | 20 +++++++++++++-------
> 1 file changed, 13 insertions(+), 7 deletions(-)
>
>diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
>index 84909f30c..a80f3e91a 100644
>--- a/eclass/kernel-2.eclass
>+++ b/eclass/kernel-2.eclass
>@@ -1407,11 +1407,20 @@ getfilevar() {
> # This function sets ARCH_URI and ARCH_PATCH
> # with the neccessary info for the arch sepecific compatibility
> # patchsets.
>+# To use, an ebuild could contain a line like:
>+# AMD64_URI=http//linktothearchspecificpatch
>+# This function requires EAPI >= 6.
>
> detect_arch() {
>
>- local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
>+ if [[ "${EAPI}" -lt 6 ]]; then
EAPI is not a number. The next one we'll call gray-grizzly just to prove the point.
>+ eqawarn "ebuild is attempting to call detect_arch when EAPI < 6."
>+ eqawarn "This function will not be executed."
>+ return
>+ fi
>
>+ local ALL_ARCH LOOP_ARCH LOOP_ARCH_L COMPAT_URI i TC_ARCH_KERNEL
>+
> # COMPAT_URI is the contents of ${ARCH}_URI
> # ARCH_URI is the URI for all the ${ARCH}_URI patches
> # ARCH_PATCH is ARCH_URI broken into files for UNIPATCH
>@@ -1425,18 +1434,15 @@ detect_arch() {
> COMPAT_URI="${LOOP_ARCH}_URI"
> COMPAT_URI="${!COMPAT_URI}"
>
>- declare -l LOOP_ARCH_L=${LOOP_ARCH}
>-
> [[ -n ${COMPAT_URI} ]] && \
>- ARCH_URI="${ARCH_URI} ${LOOP_ARCH_L}? ( ${COMPAT_URI} )"
>+ ARCH_URI="${ARCH_URI} ${LOOP_ARCH,,}? ( ${COMPAT_URI} )"
>
>- declare -u TC_ARCH_KERNEL=$(tc-arch-kernel)
>- if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL} ]]; then
>+ TC_ARCH_KERNEL=$(tc-arch-kernel);
Strictly speaking, you aren't supposed to call this in global scope either. To do it properly, you should split the function into two parts, one for global scope, and the other for phase functions.
>+ if [[ ${LOOP_ARCH} == ${TC_ARCH_KERNEL^^} ]]; then
> for i in ${COMPAT_URI}; do
> ARCH_PATCH="${ARCH_PATCH} ${DISTDIR}/${i/*\//}"
> done
> fi
>-
> done
> }
>
--
Best regards,
Michał Górny (by phone)
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2017-09-07 7:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-06 23:40 [gentoo-dev] [PATCH v3] eclass/kernel-2.eclass: Remove use of tr in global scope Mike Pagano
2017-09-07 1:13 ` Floyd Anderson
2017-09-07 7:01 ` [gentoo-dev] " Duncan
2017-09-07 5:42 ` [gentoo-dev] " Michał Górny
2017-09-07 7:39 ` Ciaran McCreesh
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox