1 |
Signed-off-by: Michał Górny <mgorny@g.o> |
2 |
--- |
3 |
eclass/vcs-snapshot.eclass | 6 +++--- |
4 |
1 file changed, 3 insertions(+), 3 deletions(-) |
5 |
|
6 |
diff --git a/eclass/vcs-snapshot.eclass b/eclass/vcs-snapshot.eclass |
7 |
index 316a37773d43..321e307b894d 100644 |
8 |
--- a/eclass/vcs-snapshot.eclass |
9 |
+++ b/eclass/vcs-snapshot.eclass |
10 |
@@ -1,83 +1,83 @@ |
11 |
-# Copyright 1999-2016 Gentoo Foundation |
12 |
+# Copyright 1999-2019 Gentoo Authors |
13 |
# Distributed under the terms of the GNU General Public License v2 |
14 |
|
15 |
# @ECLASS: vcs-snapshot.eclass |
16 |
# @MAINTAINER: |
17 |
# mgorny@g.o |
18 |
-# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 |
19 |
+# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 |
20 |
# @BLURB: support eclass for unpacking VCS snapshot tarballs |
21 |
# @DESCRIPTION: |
22 |
# This eclass provides a convenience src_unpack() which does unpack all |
23 |
# the tarballs in SRC_URI to locations matching their (local) names, |
24 |
# discarding the original parent directory. |
25 |
# |
26 |
# The typical use case are VCS snapshots, coming from bitbucket |
27 |
# and similar services. They have hash appended to the directory name |
28 |
# which makes extracting them a painful experience. But if you just use |
29 |
# a SRC_URI arrow to rename it (which you're likely have to do anyway), |
30 |
# vcs-snapshot will just extract it into a matching directory. |
31 |
# |
32 |
# Please note that this eclass handles only tarballs (.tar, .tar.gz, |
33 |
# .tar.bz2 & .tar.xz). For any other file format (or suffix) it will |
34 |
# fall back to regular unpack. Support for additional formats may be |
35 |
# added at some point so please keep your SRC_URIs clean. |
36 |
# |
37 |
# Note: this eclass is no longer needed with the new-style 'archive' |
38 |
# GitHub URLs. They have sane directory names and stable contents, |
39 |
# so you should really prefer them. |
40 |
# |
41 |
# @EXAMPLE: |
42 |
# |
43 |
# @CODE |
44 |
# EAPI=6 |
45 |
# inherit vcs-snapshot |
46 |
# |
47 |
# SRC_URI="https://github.com/example/${PN}/tarball/v${PV} -> ${P}.tar.gz |
48 |
# https://github.com/example/${PN}-otherstuff/tarball/v${PV} -> ${P}-otherstuff.tar.gz" |
49 |
# @CODE |
50 |
# |
51 |
# and however the tarballs were originally packed, all files will appear |
52 |
# in ${WORKDIR}/${P} and ${WORKDIR}/${P}-otherstuff respectively. |
53 |
|
54 |
case ${EAPI:-0} in |
55 |
- 0|1|2|3|4|5|6) ;; |
56 |
+ 0|1|2|3|4|5|6|7) ;; |
57 |
*) die "vcs-snapshot.eclass API in EAPI ${EAPI} not yet established." |
58 |
esac |
59 |
|
60 |
EXPORT_FUNCTIONS src_unpack |
61 |
|
62 |
# @FUNCTION: vcs-snapshot_src_unpack |
63 |
# @DESCRIPTION: |
64 |
# Extract all the archives from ${A}. The .tar, .tar.gz, .tar.bz2 |
65 |
# and .tar.xz archives will be unpacked to directories matching their |
66 |
# local names. Other archive types will be passed down to regular |
67 |
# unpack. |
68 |
vcs-snapshot_src_unpack() { |
69 |
debug-print-function ${FUNCNAME} "${@}" |
70 |
|
71 |
local f |
72 |
|
73 |
for f in ${A} |
74 |
do |
75 |
case "${f}" in |
76 |
*.tar|*.tar.gz|*.tar.bz2|*.tar.xz) |
77 |
local destdir=${WORKDIR}/${f%.tar*} |
78 |
|
79 |
debug-print "${FUNCNAME}: unpacking ${f} to ${destdir}" |
80 |
|
81 |
# XXX: check whether the directory structure inside is |
82 |
# fine? i.e. if the tarball has actually a parent dir. |
83 |
mkdir "${destdir}" || die |
84 |
# -o (--no-same-owner) to avoid restoring original owner |
85 |
tar -C "${destdir}" -x -o --strip-components 1 \ |
86 |
-f "${DISTDIR}/${f}" || die |
87 |
;; |
88 |
*) |
89 |
debug-print "${FUNCNAME}: falling back to unpack for ${f}" |
90 |
|
91 |
# fall back to the default method |
92 |
unpack "${f}" |
93 |
;; |
94 |
esac |
95 |
done |
96 |
} |
97 |
-- |
98 |
2.22.0 |