aboutsummaryrefslogtreecommitdiff
path: root/paludis/repositories/e/exndbam_repository_TEST_setup.sh
blob: 1636f26db925c89bfe6d3160acef439d576d76d8 (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
#!/usr/bin/env bash
# vim: set ft=sh sw=4 sts=4 et :

mkdir -p exndbam_repository_TEST_dir || exit 1
cd exndbam_repository_TEST_dir || exit 1

mkdir -p distdir
mkdir -p build
mkdir -p root/etc

mkdir -p repo1/ || exit 1

mkdir -p installed || exit 1
mkdir -p parts/{metadata,profiles/profile,packages/category/partitioned} || exit 1
mkdir -p postinsttest postinsttest_src1/{eclass,profiles/profile,cat/pkg} || exit 1

cat <<END > postinsttest_src1/profiles/profile/make.defaults
ARCH=test
USERLAND="GNU"
KERNEL="linux"
CHOST="i286-badger-linux-gnu"
END
echo postinsttest >postinsttest_src1/profiles/repo_name
echo cat >postinsttest_src1/profiles/categories

cat <<END >postinsttest_src1/cat/pkg/pkg-0.ebuild
EAPI=1
KEYWORDS="test"
if [[ \${PV} == 2* ]]; then
    SLOT="2"
else
    SLOT="1"
fi
pkg_preinst() {
    OTHER=\$(best_version "\${CATEGORY}/\${PN}:\${SLOT}")
    if [[ -n \${OTHER} ]]; then
        if [[ \${EAPI} == paludis-1 ]] || has_version "=\${CATEGORY}/\${PF}:\${SLOT}"; then
            COMMAND=rmdir
        else
            COMMAND=mkdir
        fi
    else
        COMMAND=:
    fi
}
pkg_postinst() {
    \${COMMAND} "\${ROOT}"/\${OTHER##*/} || die
}
pkg_postrm() {
    if has_version "\${CATEGORY}/\${PN}:\${SLOT}[<\${PVR}&=0*]" || has_version "\${CATEGORY}/\${PN}:\${SLOT}[>\${PVR}&=0*]"; then
        rmdir "\${ROOT}"/\${PF} || die
    else
        mkdir "\${ROOT}"/\${PF} || die
    fi
}
END
cp postinsttest_src1/cat/pkg/pkg-{0,0.1}.ebuild
cp postinsttest_src1/cat/pkg/pkg-{0,1}.ebuild
sed -i -e 's/EAPI=1/EAPI=paludis-1/' postinsttest_src1/cat/pkg/pkg-1.ebuild
cp postinsttest_src1/cat/pkg/pkg-{1,1.1}.ebuild
cp postinsttest_src1/cat/pkg/pkg-{1,2}.ebuild

echo '*/* PLATFORM: (test)' > parts/profiles/profile/options.conf
cat <<- EOF > parts/profiles/profile/make.defaults
CHOST="i686-pc-linux-gnu"
EOF
echo parts > parts/profiles/repo_name
echo category > parts/metadata/categories.conf

cat <<- EOF > parts/packages/category/partitioned/partitioned-0.exheres-0
PLATFORMS="test"
MYOPTIONS="parts: binaries"

SLOT="0"

src_unpack() {
    edo mkdir -p "\${WORK}"
}

src_install() {
    edo mkdir -p "\${IMAGE}"/usr/{bin,lib,share/man/man1}
    edo touch "\${IMAGE}"/usr/{bin/binary,lib/library.{so,a},share/man/man1/expart.1}

    expart binaries /usr/bin
    expart libraries /usr/lib
}
EOF

cat <<- EOF > parts/packages/category/partitioned/partitioned-1.exheres-0
PLATFORMS="test"
MYOPTIONS="parts: binaries libraries"

SLOT="0"

src_unpack() {
    edo mkdir -p "\${WORK}"
}

src_install() {
    edo mkdir -p "\${IMAGE}"/usr/{bin,lib,share/man/man1}
    edo touch "\${IMAGE}"/usr/{bin/binary,lib/library.{so,a},share/man/man1/expart.1}

    expart binaries /usr/bin
    expart libraries /usr/lib
}
EOF