diff options
Diffstat (limited to 'meta-openstack/recipes-devtools/python/python-glance_git.bb')
| -rw-r--r-- | meta-openstack/recipes-devtools/python/python-glance_git.bb | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/meta-openstack/recipes-devtools/python/python-glance_git.bb b/meta-openstack/recipes-devtools/python/python-glance_git.bb new file mode 100644 index 0000000..284399e --- /dev/null +++ b/meta-openstack/recipes-devtools/python/python-glance_git.bb | |||
| @@ -0,0 +1,123 @@ | |||
| 1 | DESCRIPTION = "Services for discovering, registering and retrieving virtual machine images" | ||
| 2 | HOMEPAGE = "http://glance.openstack.org/" | ||
| 3 | SECTION = "devel/python" | ||
| 4 | LICENSE = "Apache-2.0" | ||
| 5 | LIC_FILES_CHKSUM = "file://LICENSE;md5=1dece7821bf3fd70fe1309eaa37d52a2" | ||
| 6 | |||
| 7 | PR = "r0" | ||
| 8 | SRCNAME = "glance" | ||
| 9 | |||
| 10 | SRC_URI = "git://github.com/openstack/${SRCNAME}.git;branch=stable/havana \ | ||
| 11 | file://glance.init \ | ||
| 12 | " | ||
| 13 | |||
| 14 | SRCREV="252fe8572400c25c35e1973b2622e479947c6135" | ||
| 15 | PV="2013.2+git${SRCPV}" | ||
| 16 | |||
| 17 | S = "${WORKDIR}/git" | ||
| 18 | |||
| 19 | inherit setuptools update-rc.d identity | ||
| 20 | |||
| 21 | do_install_append() { | ||
| 22 | TEMPLATE_CONF_DIR=${S}${sysconfdir} | ||
| 23 | GLANCE_CONF_DIR=${D}${sysconfdir}/glance | ||
| 24 | |||
| 25 | for file in api registry cache | ||
| 26 | do | ||
| 27 | sed -e "s:%SERVICE_TENANT_NAME%:${SERVICE_TENANT_NAME}:g" \ | ||
| 28 | ${TEMPLATE_CONF_DIR}/glance-$file.conf > ${WORKDIR}/glance-$file.conf | ||
| 29 | sed -e "s:%SERVICE_USER%:${SRCNAME}:g" -i ${WORKDIR}/glance-$file.conf | ||
| 30 | sed -e "s:%SERVICE_PASSWORD%:${SERVICE_PASSWORD}:g" \ | ||
| 31 | -i ${WORKDIR}/glance-$file.conf | ||
| 32 | sed -e "s#^sql_conn.*#sql_connection = postgresql://${DB_USER}:${DB_PASSWORD}@localhost/glance#g" \ | ||
| 33 | -i ${WORKDIR}/glance-$file.conf | ||
| 34 | done | ||
| 35 | sed -e "s:^filesystem_store_datadir =.*:filesystem_store_datadir = ${sysconfdir}/${SRCNAME}/images/:g" \ | ||
| 36 | -i ${WORKDIR}/glance-api.conf | ||
| 37 | |||
| 38 | install -d ${GLANCE_CONF_DIR} | ||
| 39 | install -m 600 ${WORKDIR}/glance-registry.conf ${GLANCE_CONF_DIR}/ | ||
| 40 | install -m 600 ${WORKDIR}/glance-api.conf ${GLANCE_CONF_DIR}/ | ||
| 41 | install -m 600 ${WORKDIR}/glance-cache.conf ${GLANCE_CONF_DIR}/ | ||
| 42 | |||
| 43 | install -m 600 ${S}/etc/glance-registry-paste.ini ${GLANCE_CONF_DIR}/ | ||
| 44 | install -m 600 ${S}/etc/glance-api-paste.ini ${GLANCE_CONF_DIR}/ | ||
| 45 | install -m 600 ${S}/etc/policy.json ${GLANCE_CONF_DIR}/ | ||
| 46 | |||
| 47 | install -d ${GLANCE_CONF_DIR}/images | ||
| 48 | install -d ${D}${localstatedir}/lib/glance/image_cache | ||
| 49 | |||
| 50 | install -d ${D}${localstatedir}/log/${SRCNAME} | ||
| 51 | |||
| 52 | if ${@base_contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
| 53 | install -d ${D}${sysconfdir}/init.d | ||
| 54 | sed 's:@suffix@:api:' < ${WORKDIR}/glance.init >${WORKDIR}/glance-api.init.sh | ||
| 55 | install -m 0755 ${WORKDIR}/glance-api.init.sh ${D}${sysconfdir}/init.d/glance-api | ||
| 56 | sed 's:@suffix@:registry:' < ${WORKDIR}/glance.init >${WORKDIR}/glance-registry.init.sh | ||
| 57 | install -m 0755 ${WORKDIR}/glance-registry.init.sh ${D}${sysconfdir}/init.d/glance-registry | ||
| 58 | fi | ||
| 59 | } | ||
| 60 | |||
| 61 | pkg_postinst_${SRCNAME} () { | ||
| 62 | if [ "x$D" != "x" ]; then | ||
| 63 | exit 1 | ||
| 64 | fi | ||
| 65 | |||
| 66 | # This is to make sure postgres is configured and running | ||
| 67 | if ! pidof postmaster > /dev/null; then | ||
| 68 | /etc/init.d/postgresql-init | ||
| 69 | /etc/init.d/postgresql start | ||
| 70 | sleep 5 | ||
| 71 | fi | ||
| 72 | |||
| 73 | mkdir /var/log/glance | ||
| 74 | sudo -u postgres createdb glance | ||
| 75 | glance-manage db_sync | ||
| 76 | } | ||
| 77 | |||
| 78 | PACKAGES += " ${SRCNAME} ${SRCNAME}-api ${SRCNAME}-registry" | ||
| 79 | |||
| 80 | FILES_${PN} = "${libdir}/*" | ||
| 81 | |||
| 82 | FILES_${SRCNAME} = "${bindir}/* \ | ||
| 83 | ${sysconfdir}/${SRCNAME}/* \ | ||
| 84 | ${localstatedir}/* \ | ||
| 85 | " | ||
| 86 | |||
| 87 | FILES_${SRCNAME}-api = "${bindir}/glance-api \ | ||
| 88 | ${sysconfdir}/init.d/glance-api \ | ||
| 89 | " | ||
| 90 | |||
| 91 | FILES_${SRCNAME}-registry = "${bindir}/glance-registry \ | ||
| 92 | ${sysconfdir}/init.d/glance-registry \ | ||
| 93 | " | ||
| 94 | |||
| 95 | RDEPENDS_${PN} += "python-greenlet \ | ||
| 96 | python-sqlalchemy \ | ||
| 97 | python-anyjson \ | ||
| 98 | python-eventlet \ | ||
| 99 | python-pastedeploy \ | ||
| 100 | python-routes \ | ||
| 101 | python-webob \ | ||
| 102 | python-boto \ | ||
| 103 | python-sqlalchemy-migrate \ | ||
| 104 | python-httplib2 \ | ||
| 105 | python-kombu \ | ||
| 106 | python-iso8601 \ | ||
| 107 | python-oslo.config \ | ||
| 108 | python-lxml \ | ||
| 109 | python-paste \ | ||
| 110 | python-pycrypto \ | ||
| 111 | python-jsonschema \ | ||
| 112 | python-keystoneclient \ | ||
| 113 | python-swiftclient \ | ||
| 114 | " | ||
| 115 | |||
| 116 | RDEPENDS_${SRCNAME} = "${PN} \ | ||
| 117 | postgresql postgresql-client python-psycopg2" | ||
| 118 | RDEPENDS_${SRCNAME}-api = "${SRCNAME}" | ||
| 119 | RDEPENDS_${SRCNAME}-registry = "${SRCNAME}" | ||
| 120 | |||
| 121 | INITSCRIPT_PACKAGES = "${SRCNAME}-api ${SRCNAME}-registry" | ||
| 122 | INITSCRIPT_NAME_${SRCNAME}-api = "glance-api" | ||
| 123 | INITSCRIPT_NAME_${SRCNAME}-registry = "glance-registry" | ||
