commit: 1e0ad6d08155b666197186fa854ad468042f8249
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 25 06:24:07 2019 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sat Jul 27 09:49:51 2019 +0000
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=1e0ad6d0
vcs-snapshot.eclass: Detect unnecessary usage and complain
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
eclass/vcs-snapshot.eclass | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/eclass/vcs-snapshot.eclass b/eclass/vcs-snapshot.eclass
index d3f7025fbb3..05d963917e2 100644
--- a/eclass/vcs-snapshot.eclass
+++ b/eclass/vcs-snapshot.eclass
@@ -58,6 +58,7 @@ EXPORT_FUNCTIONS src_unpack
vcs-snapshot_src_unpack() {
debug-print-function ${FUNCNAME} "${@}"
+ local renamed_any=
local f
for f in ${A}
@@ -82,6 +83,7 @@ vcs-snapshot_src_unpack() {
done
die "${FUNCNAME}: Invalid directory
structure in archive ${f}"
fi
+ [[ ${topdirs[0]} != ${f%.tar*} ]] &&
renamed_any=1
mkdir "${destdir}" || die
# -o (--no-same-owner) to avoid restoring
original owner
@@ -97,4 +99,14 @@ vcs-snapshot_src_unpack() {
;;
esac
done
+
+ if [[ ! ${renamed_any} ]]; then
+ local w=eerror
+ [[ ${EAPI} == [0123456] ]] && w=eqawarn
+ "${w}" "${FUNCNAME} did not find any archives that needed
renaming."
+ "${w}" "Please verify that its usage is really necessary, and
remove"
+ "${w}" "the inherit if it is not."
+
+ [[ ${w} == eerror ]] && die "${FUNCNAME}: Unnecessary usage
detected"
+ fi
}