summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2019-07-25 08:24:07 +0200
committerMichał Górny <mgorny@gentoo.org>2019-07-27 11:49:51 +0200
commit1e0ad6d08155b666197186fa854ad468042f8249 (patch)
tree8694c4f2a0c788c9129aa7156bb5e28135deb2da /eclass/vcs-snapshot.eclass
parentvcs-snapshot.eclass: Detect and report invalid directory structure (diff)
downloadgentoo-1e0ad6d08155b666197186fa854ad468042f8249.tar.gz
gentoo-1e0ad6d08155b666197186fa854ad468042f8249.tar.bz2
gentoo-1e0ad6d08155b666197186fa854ad468042f8249.zip
vcs-snapshot.eclass: Detect unnecessary usage and complain
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/vcs-snapshot.eclass')
-rw-r--r--eclass/vcs-snapshot.eclass12
1 files changed, 12 insertions, 0 deletions
diff --git a/eclass/vcs-snapshot.eclass b/eclass/vcs-snapshot.eclass
index d3f7025fbb35..05d963917e25 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
}