summaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-rally_git.bb
blob: 30e3283a59b1a24f9f8f0a0e0b9e899e008e2c7e (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
DESCRIPTION = "Rally - OpenStack benchmarking at a scale - is intended to provide the \
community with a benchmarking tool that is capable of performing specific, \
complicated and reproducible test cases on real deployment scenarios."
HOMEPAGE = "https://launchpad.net/rally"
SECTION = "devel/python"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=19cbd64715b51267a47bf3750cc6a8a5"

PR = "r0"
SRCNAME = "rally"

SRC_URI = "git://github.com/stackforge/${SRCNAME}.git;branch=master \
           file://rally.init \
           file://rally.conf \
           file://task-example.json \
           file://deployment-existing.json \
           file://remove-ironic-support.patch \
           file://verification-to-use-existing-tempest.patch \
           file://sqlalchemy-db-missing-name-for-ENUM.patch \
           file://verification-subunit2json-fail-to-open-result-file.patch \
"

SRCREV="b297cf00750f263b8b5bdeb71f6952f672e87f5a"
PV="git${SRCPV}"
S = "${WORKDIR}/git"

inherit setuptools update-rc.d hosts identity default_configs

do_install_append() {
    RALLY_CONF_DIR=${D}${sysconfdir}/${SRCNAME}
    RALLY_PYTHON_SITEPACKAGES_DIR=${D}${PYTHON_SITEPACKAGES_DIR}/${SRCNAME}

    install -d ${RALLY_CONF_DIR}
    install -m 600 ${WORKDIR}/rally.conf ${RALLY_CONF_DIR}/rally.conf
    sed -e "s:%DB_USER%:${DB_USER}:g" -i ${RALLY_CONF_DIR}/rally.conf
    sed -e "s:%DB_PASSWORD%:${DB_PASSWORD}:g" -i ${RALLY_CONF_DIR}/rally.conf

    if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
        install -d ${D}${sysconfdir}/init.d
        sed 's:@suffix@:api:' < ${WORKDIR}/rally.init > ${WORKDIR}/rally-api.init.sh
        install -m 0755 ${WORKDIR}/rally-api.init.sh ${D}${sysconfdir}/init.d/rally-api
    fi

    install -d ${RALLY_PYTHON_SITEPACKAGES_DIR}
    cp -r ${S}/tests* ${RALLY_PYTHON_SITEPACKAGES_DIR}
    find ${RALLY_PYTHON_SITEPACKAGES_DIR}/tests* -name "*.py" | xargs \
            sed -i 's:^from tests:from rally.tests:g'
    install -d ${RALLY_PYTHON_SITEPACKAGES_DIR}/doc/samples
    cp -r ${S}/doc/samples/* ${RALLY_PYTHON_SITEPACKAGES_DIR}/doc/samples

    install -d ${RALLY_CONF_DIR}/tasks
    install -m 600 ${WORKDIR}/task-example.json ${RALLY_CONF_DIR}/tasks/example.json

    install -d ${RALLY_CONF_DIR}/deployments
    install -m 600 ${WORKDIR}/deployment-existing.json ${RALLY_CONF_DIR}/deployments/existing.json
    sed -e "s:%ADMIN_TENANT_NAME%:admin:g" -i ${RALLY_CONF_DIR}/deployments/existing.json
    sed -e "s:%ADMIN_USER%:admin:g" -i ${RALLY_CONF_DIR}/deployments/existing.json
    sed -e "s:%ADMIN_PASSWORD%:${ADMIN_PASSWORD}:g" -i ${RALLY_CONF_DIR}/deployments/existing.json
    sed -e "s:%CONTROLLER_IP%:${CONTROLLER_IP}:g" -i ${RALLY_CONF_DIR}/deployments/existing.json

    cp ${S}/run_tests.sh ${RALLY_CONF_DIR}
    cp -r ${S}/tools ${RALLY_CONF_DIR}
}

pkg_postinst_${SRCNAME}-setup () {
    if [ "x$D" != "x" ]; then
        exit 1
    fi

    # This is to make sure postgres is configured and running
    if ! pidof postmaster > /dev/null; then
       /etc/init.d/postgresql-init
       /etc/init.d/postgresql start
    fi

    if [ ! -d /var/log/rally ]; then
       mkdir /var/log/rally
    fi

    sudo -u postgres createdb rally
    rally-manage db recreate
}

PACKAGES += "${SRCNAME}-tests ${SRCNAME}-api ${SRCNAME} ${SRCNAME}-setup"
ALLOW_EMPTY_${SRCNAME}-setup = "1"

FILES_${PN} = "${libdir}/*"

FILES_${SRCNAME}-tests = "${sysconfdir}/${SRCNAME}/run_tests.sh \
    "

FILES_${SRCNAME} = "${bindir}/* \
    ${sysconfdir}/${SRCNAME}/* \
    "

FILES_${SRCNAME}-api = "${bindir}/rally-api \
    ${sysconfdir}/init.d/rally-api \
    "

DEPENDS += " \
    python-pip \
    python-pbr \
    "

RDEPENDS_${PN} += " python-babel \
    python-decorator \
    python-fixtures \
    python-iso8601 \
    python-jsonschema \
    python-netaddr \
    python-oslo.config \
    python-paramiko \
    python-pbr \
    python-pecan \
    python-prettytable \
    python-pyyaml \
    python-glanceclient \
    python-keystoneclient \
    python-novaclient \
    python-neutronclient \
    python-cinderclient \
    python-heatclient \
    python-ceilometerclient \
    python-subunit \
    python-requests \
    python-sqlalchemy \
    python-six \
    python-wsme \
    "

RDEPENDS_${SRCNAME}-tests = "${PN} \
   python-coverage \
   python-mock \
   python-testrepository \
   python-testtools \
   python-oslotest \
   "

RDEPENDS_${SRCNAME} = "${PN} \
   postgresql \
   postgresql-client \
   "

RDEPENDS_${SRCNAME}-setup = "postgresql sudo ${SRCNAME}"
RDEPENDS_${SRCNAME}-api = "${SRCNAME}"

INITSCRIPT_PACKAGES = "${SRCNAME}-api"
INITSCRIPT_NAME_${SRCNAME}-api = "${SRCNAME}-api"
INITSCRIPT_PARAMS_${SRCNAME}-api = "${OS_DEFAULT_INITSCRIPT_PARAMS}"