Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 5/5] vcs-snapshot.eclass: Detect unnecessary usage and complain
Date: Thu, 25 Jul 2019 06:26:41
Message-Id: 20190725062504.30140-5-mgorny@gentoo.org
In Reply to: [gentoo-dev] [PATCH 1/5] vcs-snapshot.eclass: Allow EAPI 7 by "Michał Górny"
1 Signed-off-by: Michał Górny <mgorny@g.o>
2 ---
3 eclass/vcs-snapshot.eclass | 12 ++++++++++++
4 1 file changed, 12 insertions(+)
5
6 diff --git a/eclass/vcs-snapshot.eclass b/eclass/vcs-snapshot.eclass
7 index dbca6fd586d2..c01cf01f052c 100644
8 --- a/eclass/vcs-snapshot.eclass
9 +++ b/eclass/vcs-snapshot.eclass
10 @@ -58,6 +58,7 @@ EXPORT_FUNCTIONS src_unpack
11 vcs-snapshot_src_unpack() {
12 debug-print-function ${FUNCNAME} "${@}"
13
14 + local renamed_any=
15 local f
16
17 for f in ${A}
18 @@ -81,6 +82,7 @@ vcs-snapshot_src_unpack() {
19 done
20 die "${FUNCNAME}: Invalid directory structure in archive ${f}"
21 fi
22 + [[ ${topdirs[0]} != ${f%.tar*} ]] && renamed_any=1
23
24 mkdir "${destdir}" || die
25 # -o (--no-same-owner) to avoid restoring original owner
26 @@ -96,4 +98,14 @@ vcs-snapshot_src_unpack() {
27 ;;
28 esac
29 done
30 +
31 + if [[ ! ${renamed_any} ]]; then
32 + local w=eerror
33 + [[ ${EAPI} == [0123456] ]] && w=eqawarn
34 + "${w}" "${FUNCNAME} did not find any archives that needed renaming."
35 + "${w}" "Please verify that its usage is really necessary, and remove"
36 + "${w}" "the inherit if it is not."
37 +
38 + [[ ${w} == eerror ]] && die "${FUNCNAME}: Unnecessary usage detected"
39 + fi
40 }
41 --
42 2.22.0