aboutsummaryrefslogtreecommitdiff
path: root/0.8.0/src/paludis/upgrade_TEST_setup.sh
blob: 52e6958158e35d96a1b420e84f5bcf5d4646f3ab (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
#!/bin/bash
# vim: set ft=sh sw=4 sts=4 et :

mkdir upgrade_TEST_dir || exit 1
cd upgrade_TEST_dir || exit 1

mkdir -p config/.paludis-upgrade-test
cat <<END > config/.paludis-upgrade-test/specpath
root = `pwd`/root
config-suffix =
END

mkdir -p root/${SYSCONFDIR}/paludis/repositories
cat <<END > root/${SYSCONFDIR}/paludis/use.conf
* foo
END

cat <<END > root/${SYSCONFDIR}/paludis/licenses.conf
* *
END

cat <<END > root/${SYSCONFDIR}/paludis/keywords.conf
* test
END

cat <<END > root/${SYSCONFDIR}/paludis/bashrc
export CHOST="my-chost"
export USER_BASHRC_WAS_USED=yes
END

cat <<END > root/${SYSCONFDIR}/paludis/repositories/repo1.conf
location = `pwd`/repo1
cache = /var/empty
format = portage
profiles = \${location}/profiles/testprofile
buildroot = `pwd`/build
END

cat <<END > root/${SYSCONFDIR}/paludis/repositories/installed.conf
location = \${ROOT}/var/db/pkg
format = vdb
buildroot = `pwd`/build
END

mkdir -p root/tmp
touch root/${SYSCONFDIR}/ld.so.conf
mkdir -p root/var/db/pkg

mkdir -p repo1/{eclass,distfiles,profiles/testprofile,test-category/target/files} || exit 1

mkdir -p src/target-1
cat <<"END" > src/target-1/testbin
#!/bin/bash
echo "This is testbin-1"
END
chmod +x src/target-1/testbin
cat <<"END" > src/target-1/testbin1
#!/bin/bash
echo "This is testbin1"
END
chmod +x src/target-1/testbin1
cd src
tar zcf target-1.tar.gz target-1/
mv target-1.tar.gz ../repo1/distfiles/
cd ..
rm -fr src

mkdir -p src/target-2
cat <<"END" > src/target-2/testbin
#!/bin/bash
echo "This is testbin-2"
END
chmod +x src/target-2/testbin
cat <<"END" > src/target-2/testbin2
#!/bin/bash
echo "This is testbin2"
END
chmod +x src/target-2/testbin2
cd src
tar zcf target-2.tar.gz target-2/
mv target-2.tar.gz ../repo1/distfiles/
cd ..
rm -fr src

cd repo1 || exit 1
echo "test-repo-1" > profiles/repo_name || exit 1
cat <<END > profiles/categories || exit 1
test-category
END
cat <<END > profiles/testprofile/make.defaults
ARCH=test
USERLAND=test
KERNEL=test
END

cat <<"END" > eclass/myeclass.eclass || exit 1
the_eclass_works()
{
    true
}
END

cat <<"END" > test-category/target/target-1.ebuild || exit 1
inherit myeclass

DESCRIPTION="Test target"
HOMEPAGE="http://paludis.berlios.de/"
SRC_URI="http://invalid.domain/${P}.tar.gz"
SLOT="0"
IUSE=""
LICENSE="GPL-2"
KEYWORDS="test"

pkg_setup() {
    export VAR1=yes
    VAR2=yes
    local VAR3=yes
}

src_install() {
    [[ "${VAR1}" == yes ]] || die
    [[ "${VAR2}" == yes ]] || die
    [[ "${VAR3}" == yes ]] && die

    dobin testbin
    dobin testbin${PV}
}

pkg_prerm() {
    [[ "${VAR1}" == yes ]] || die
    [[ "${VAR2}" == yes ]] || die
    [[ "${VAR3}" == yes ]] && die

    the_eclass_works || die
}
END

cat <<"END" > test-category/target/target-2.ebuild || exit 1
DESCRIPTION="Test target"
HOMEPAGE="http://paludis.berlios.de/"
SRC_URI="http://invalid.domain/${P}.tar.gz"
SLOT="0"
IUSE=""
LICENSE="GPL-2"
KEYWORDS="test"

src_install() {
    dobin testbin
    dobin testbin${PV}
}
END
cd ..