aboutsummaryrefslogtreecommitdiffstats
path: root/meta-openstack/recipes-devtools/python/python-horizon_git.bb
blob: 8ee1bedce67c0d7b012a51a24ab68433ebc15998 (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
DESCRIPTION = "The OpenStack Dashboard."
HOMEPAGE = "https://github.com/openstack/horizon/"
SECTION = "devel/python"
LICENSE = "Apache-2.0"
LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2"

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

RDEPENDS_${PN} += "python-django \
    python-django-compressor \
    python-django-nose \
    python-django-openstack-auth \
    python-netaddr \
    python-cinderclient \
    python-glanceclient \
    python-keystoneclient \
    python-nose-exclude \
    python-novaclient \
    python-neutronclient \
    python-heatclient \
    python-pytz \
    python-django-appconf \
    python-six \
    python-swiftclient \
    python-lockfile \
    python-pbr \
    python-troveclient \
    python-xstatic-angular \
    python-xstatic-angular-cookies \
    python-xstatic-angular-mock \
    python-xstatic-d3 \
    python-xstatic-hogan \
    python-xstatic-jasmine \
    python-xstatic-jquery-migrate \
    python-xstatic-jquery-quicksearch \
    python-xstatic-jquery-tablesorter \
    python-xstatic-jsencrypt \
    python-xstatic-qunit \
    python-xstatic-rickshaw \
    python-xstatic-spin \
    python-xstatic-bootstrap-datepicker \
    python-xstatic-font-awesome \
    "

PR = "r2"
SRCNAME = "horizon"

SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=master \
    file://horizon.init \
    file://fix_bindir_path.patch \
    file://openstack-dashboard-apache.conf \
    file://local_settings.py \
    file://horizon-use-full-package-path-to-test-directories.patch \
    "

SRCREV="bd998fb6094fb16d084c90de1eed619aca4c31ef"
PV="2014.2.b3+git${SRCPV}"
S = "${WORKDIR}/git"

inherit setuptools update-rc.d python-dir default_configs openstackchef monitor

# no longer required. kept as reference.
# do_install[dirs] += "${D}/usr/share/bin"

do_install_append() {
    SYSCONF_DIR=${D}${sysconfdir}
    DASHBOARD_CONF_DIR=${SYSCONF_DIR}/openstack-dashboard
    DASHBOARD_SHARE_DIR=${D}${datadir}/openstack-dashboard
    HORIZON_CONF_DIR=${D}${sysconfdir}/horizon

    install -d ${HORIZON_CONF_DIR}

    DASHBOARD_DIR=${D}${PYTHON_SITEPACKAGES_DIR}/openstack_dashboard
    sed -e "s:^LANGUAGE_CODE =.*:LANGUAGE_CODE = 'en-us':g" \
        -i ${DASHBOARD_DIR}/settings.py
    sed -e "s:^# from horizon.utils:from horizon.utils:g" \
        ${DASHBOARD_DIR}/local/local_settings.py.example > \
        ${DASHBOARD_DIR}/local/local_settings.py
    sed -e "s:^# SECRET_KEY =:SECRET_KEY =:g" \
        -i ${DASHBOARD_DIR}/local/local_settings.py
    install -m 644 ${S}/manage.py ${DASHBOARD_DIR}/manage.py

    if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)};
    then
        install -d ${D}${sysconfdir}/init.d
        sed 's:@PYTHON_SITEPACKAGES@:${PYTHON_SITEPACKAGES_DIR}:' \
            ${WORKDIR}/horizon.init >${WORKDIR}/horizon
        install -m 0755 ${WORKDIR}/horizon ${D}${sysconfdir}/init.d/horizon
    fi
    sed -i -e 's#%PYTHON_SITEPACKAGES%#${PYTHON_SITEPACKAGES_DIR}#g' \
        ${D}${PYTHON_SITEPACKAGES_DIR}/horizon/test/settings.py

    # no longer required. kept as reference.
    # mv ${D}${datadir}/bin ${DASHBOARD_DIR}/bin

    cp run_tests.sh ${HORIZON_CONF_DIR}

    # the following are setup required for horizon-apache
    install -d ${DASHBOARD_SHARE_DIR}
    cp -a ${S}/openstack_dashboard  ${DASHBOARD_SHARE_DIR}
    cp ${S}/manage.py  ${DASHBOARD_SHARE_DIR}

    install -D -m 644 ${WORKDIR}/local_settings.py \
        ${DASHBOARD_CONF_DIR}/local_settings.py
    ln -fs ${sysconfdir}/openstack-dashboard/local_settings.py \
        ${DASHBOARD_SHARE_DIR}/openstack_dashboard/local/local_settings.py

    install -D -m 644 ${WORKDIR}/openstack-dashboard-apache.conf \
      ${SYSCONF_DIR}/apache2/conf.d/openstack-dashboard-apache.conf
    sed -i -e 's#%PYTHON_SITEPACKAGES%#${PYTHON_SITEPACKAGES_DIR}#' \
        ${SYSCONF_DIR}/apache2/conf.d/openstack-dashboard-apache.conf
    sed -i -e 's#%LIBDIR%#${libdir}#' \
        ${SYSCONF_DIR}/apache2/conf.d/openstack-dashboard-apache.conf

    ln -fs openstack_dashboard/static ${DASHBOARD_SHARE_DIR}/static

    # daemon is UID 1
    chown -R 1 ${DASHBOARD_SHARE_DIR}/openstack_dashboard/static
}

PACKAGES += "${SRCNAME}-tests ${SRCNAME} ${SRCNAME}-apache ${SRCNAME}-standalone"

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

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

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

FILES_${SRCNAME}-standalone = "${sysconfdir}/init.d/horizon"

FILES_${SRCNAME}-apache = " \
    ${sysconfdir}/apache2 \
    ${sysconfdir}/openstack-dashboard/ \
    ${datadir}/openstack-dashboard/ \
    "

RDEP_ARCH_VAR = ""
RDEP_ARCH_VAR_arm = "nodejs"
RDEP_ARCH_VAR_i686 = "nodejs"
RDEP_ARCH_VAR_x86-64 = "nodejs"
RDEP_ARCH_VAR_ia32 = "nodejs"

RDEPENDS_${PN} += " python-django \
    python-django-appconf \
    python-django-compressor \
    python-django-nose \
    python-django-openstack-auth \
    python-netaddr \
    python-ceilometerclient \
    python-cinderclient \
    python-glanceclient \
    python-heatclient \
    python-keystoneclient \
    python-troveclient \
    python-saharaclient \
    python-lesscpy \
    python-novaclient \
    python-nose-exclude \
    python-neutronclient \
    python-pytz \
    python-six \
    python-swiftclient \
    python-lockfile \
    python-pyyaml \
    python-xstatic \
    python-xstatic-jquery \
    python-pyscss \
    python-django-pyscss \
    ${RDEP_ARCH_VAR} \
    "

RDEPENDS_${SRCNAME} = "${PN}"

INITSCRIPT_PACKAGES = "${SRCNAME}"
INITSCRIPT_NAME_${SRCNAME} = "horizon"
INITSCRIPT_PARAMS_${SRCNAME} = "${OS_DEFAULT_INITSCRIPT_PARAMS}"

RDEPENDS_${SRCNAME}-apache = "\
    apache2 \
    mod-wsgi \
    python-lesscpy \
    memcached \
    python-memcached \
    "

MONITOR_SERVICE_PACKAGES = "${SRCNAME}"
MONITOR_SERVICE_${SRCNAME} = "horizon"