aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/e_repository_TEST_5_setup.sh
blob: 50439a9e8cd06308509b3eb9eaed6bf45d07fe08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
#!/usr/bin/env bash
# vim: set ft=sh sw=4 sts=4 et :

mkdir e_repository_TEST_5_dir || exit 1
cd e_repository_TEST_5_dir || exit 1

mkdir -p root/etc

mkdir -p vdb
touch vdb/THISISTHEVDB

mkdir -p build
ln -s build symlinked_build

mkdir -p distdir

mkdir -p repo/{profiles/profile,metadata,eclass} || exit 1
cd repo || exit 1
echo "test-repo" >> profiles/repo_name || exit 1
echo "cat" >> profiles/categories || exit 1
cat <<END > profiles/profile/make.defaults
ARCH="cheese"
USERLAND="GNU"
KERNEL="linux"
LIBC="glibc"
CHOST="i286-badger-linux-gnu"
LINGUAS="enabled_en enabled_en_GB enabled_en_GB@UTF-8"
USE_EXPAND="LINGUAS USERLAND"
USE_EXPAND_UNPREFIXED="ARCH"
USE_EXPAND_IMPLICIT="USERLAND ARCH"
USE_EXPAND_VALUES_USERLAND="GNU"
USE_EXPAND_VALUES_ARCH="cheese otherarch"
IUSE_IMPLICIT="build"
END

mkdir -p "cat/required-use-at-most-one-none" || exit 1
cat << 'END' > cat/required-use-at-most-one-none/required-use-at-most-one-none-5.ebuild || exit 1
EAPI="5"
DESCRIPTION="The Description"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="test"
IUSE="disabled1 disabled2 disabled3 enabled1 enabled2 enabled3"
REQUIRED_USE="?? ( disabled1 disabled2 disabled3 )"
S="${WORKDIR}"
END

mkdir -p "cat/required-use-at-most-one-one" || exit 1
cat << 'END' > cat/required-use-at-most-one-one/required-use-at-most-one-one-5.ebuild || exit 1
EAPI="5"
DESCRIPTION="The Description"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="test"
IUSE="disabled1 disabled2 disabled3 enabled1 enabled2 enabled3"
REQUIRED_USE="?? ( disabled1 enabled2 disabled3 )"
S="${WORKDIR}"
END

mkdir -p "cat/required-use-at-most-one-two" || exit 1
cat << 'END' > cat/required-use-at-most-one-two/required-use-at-most-one-two-5.ebuild || exit 1
EAPI="5"
DESCRIPTION="The Description"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
LICENSE="GPL-2"
KEYWORDS="test"
IUSE="disabled1 disabled2 disabled3 enabled1 enabled2 enabled3"
REQUIRED_USE="?? ( disabled1 enabled2 enabled3 )"
S="${WORKDIR}"
END

mkdir -p "cat/econf-disable-silent-rules" || exit 1
cat << 'END' > cat/econf-disable-silent-rules/econf-disable-silent-rules-5.ebuild || exit 1
EAPI="5"
DESCRIPTION="The Description"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
IUSE="spork"
LICENSE="GPL-2"
KEYWORDS="test"

S="${WORKDIR}"

src_unpack() {
    mkdir -p ${WORKDIR}
    cd "${WORKDIR}"

    cat <<'EOF' > configure
#!/bin/sh

if echo "$@" | grep -q 'help' ; then
    echo disable-silent-rules
    exit 0
fi

if ! echo "$@" | grep -q 'disable-silent-rules' ; then
    exit 1
fi

exit 0
EOF

    chmod +x configure
}
END

mkdir -p "cat/usex" || exit 1
cat << 'END' > cat/usex/usex-5.ebuild || exit 1
EAPI="5"
DESCRIPTION="The Description"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
IUSE="enabled disabled"
LICENSE="GPL-2"
KEYWORDS="test"

S="${WORKDIR}"

pkg_pretend() {
    usex enabled                      >>"${T}"/usex.out || die
    usex disabled                     >>"${T}"/usex.out || die
    usex enabled  foo                 >>"${T}"/usex.out || die
    usex disabled foo                 >>"${T}"/usex.out || die
    usex enabled  foo bar             >>"${T}"/usex.out || die
    usex disabled foo bar             >>"${T}"/usex.out || die
    usex enabled  foo bar xyzzy       >>"${T}"/usex.out || die
    usex disabled foo bar xyzzy       >>"${T}"/usex.out || die
    usex enabled  foo bar xyzzy plugh >>"${T}"/usex.out || die
    usex disabled foo bar xyzzy plugh >>"${T}"/usex.out || die
    usex enabled  ""  bar xyzzy plugh >>"${T}"/usex.out || die
    usex disabled ""  bar xyzzy plugh >>"${T}"/usex.out || die
    usex enabled  foo ""  xyzzy plugh >>"${T}"/usex.out || die
    usex disabled foo ""  xyzzy plugh >>"${T}"/usex.out || die
    usex enabled  foo bar ""    plugh >>"${T}"/usex.out || die
    usex disabled foo bar ""    plugh >>"${T}"/usex.out || die
    usex enabled  foo bar xyzzy ""    >>"${T}"/usex.out || die
    usex disabled foo bar xyzzy ""    >>"${T}"/usex.out || die

    cat >"${T}"/usex.expected <<EOF
yes
no
foo
no
foo
bar
fooxyzzy
bar
fooxyzzy
barplugh
xyzzy
barplugh
fooxyzzy
plugh
foo
barplugh
fooxyzzy
bar
EOF

    diff "${T}"/usex.{expected,out} || die
}
END

mkdir -p "cat/new-stdin" || exit 1
cat << 'END' > cat/new-stdin/new-stdin-5.ebuild || exit 1
EAPI="5"
DESCRIPTION="The Description"
HOMEPAGE="http://example.com/"
SRC_URI=""
SLOT="0"
IUSE=""
LICENSE="GPL-2"
KEYWORDS="test"

S="${WORKDIR}"

src_install() {
    echo testbin    | newbin    - testbin
    echo testconfd  | newconfd  - testconfd
    echo testdoc    | newdoc    - testdoc
    echo testenvd   | newenvd   - testenvd
    exeinto /usr/libexec
    echo testexe    | newexe    - testexe
    echo testinitd  | newinitd  - testinitd
    insinto /usr/share/test
    echo testins    | newins    - testins
    echo testlib.a  | newlib.a  - testlib.a
    echo testlib.so | newlib.so - testlib.so
    echo testman.1  | newman    - testman.1
    echo testsbin   | newsbin   - testsbin

    cat "${D}"/{usr/bin/testbin,etc/conf.d/testconfd,usr/share/doc/${PF}/testdoc,etc/env.d/testenvd,usr/libexec/testexe,etc/init.d/testinitd,usr/share/test/testins,usr/lib*/testlib.a,usr/lib*/testlib.so,usr/share/man/man1/testman.1,usr/sbin/testsbin} > "${T}"/new.out
    cat >"${T}"/new.expected <<EOF
testbin
testconfd
testdoc
testenvd
testexe
testinitd
testins
testlib.a
testlib.so
testman.1
testsbin
EOF

    diff "${T}"/new.{expected,out} || die
}
END

cd ..
cd ..