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 eutils 1/2] Add dointo && newinto.
Date: Thu, 16 Aug 2012 20:20:59
Message-Id: 1345148385-27699-1-git-send-email-mgorny@gentoo.org
1 ---
2 eutils.eclass | 37 +++++++++++++++++++++++++++++++++++++
3 1 file changed, 37 insertions(+)
4
5 diff --git a/eutils.eclass b/eutils.eclass
6 index eb8c8f7..119fc32 100644
7 --- a/eutils.eclass
8 +++ b/eutils.eclass
9 @@ -650,6 +650,43 @@ edos2unix() {
10 sed -i 's/\r$//' -- "$@" || die
11 }
12
13 +# @FUNCTION: dointo
14 +# @USAGE: <directory> <file> [...]
15 +# @DESCRIPTION:
16 +# Install all specified <file>s into <directory>. This doesn't modify global
17 +# 'insinto' path. Alike doins, calls 'die' on failure in EAPI 4+; in earlier
18 +# EAPIs, returns false in that case.
19 +dointo() {
20 + [[ ${#} -gt 2 ]] || die 'Synopsis: dointo <directory> <file> [...]'
21 +
22 + local directory=${1}
23 + shift
24 +
25 + (
26 + insinto "${directory}"
27 + doins "${@}"
28 + )
29 +}
30 +
31 +# @FUNCTION: newinto
32 +# @USAGE: <directory> <file> <new-name>
33 +# @DESCRIPTION:
34 +# Install the specified <file> into <directory>, renaming it to <new-name>.
35 +# This doesn't modify global 'insinto' path. Alike doins, calls 'die' on failure
36 +# in EAPI 4+; in earlier EAPIs, returns false in that case.
37 +newinto() {
38 + [[ ${#} -eq 3 ]] || die 'Synopsis: newinto <directory> <file> <new-name>'
39 +
40 + local directory=${1}
41 + local f=${2}
42 + local new_name=${3}
43 +
44 + (
45 + insinto "${directory}"
46 + newins "${f}" "${new_name}"
47 + )
48 +}
49 +
50 # @FUNCTION: make_desktop_entry
51 # @USAGE: make_desktop_entry(<command>, [name], [icon], [type], [fields])
52 # @DESCRIPTION:
53 --
54 1.7.11.1

Replies