
PowerTools Documentation: Index | Kickstart templates
This topic provides the template source files that help in writing a DSP.
These files assume common DSP requirements. You can copy these files into the DSP source directory and modify them to suit the DSP requirements.
Table of contents |
1 dAPI.py
import deployables_lib as dl dl.load_msgs_module("DSP_SHORTNAME-DSP_VERSION", symtab = globals()) dir_moves = [('DSP_SHORTNAME-DSP_VERSION', '')] pat = '^\s*\$(?P<key>\S+)\s*=\s*(?P<value>array\s*\(.*\))\s*;\s*$' sub = '$%(key)s = %(value)s;\r' def install(site, site_conf, instance_conf, msgs): dl.do_install_actions(site,site_conf,instance_conf,msgs, globals(), ['resolve_location', 'check_disk_quota', 'check_install_loc_owner'] {}) if msgs.get_severity() != msgs.ERROR: domain = site_conf['siteinfo']['domain'] email = instance_conf['username'] + '@' + domain conf_vars = [('domain', domain), ('email', email)] actions = ['archive_unpack', 'edit_conf_file'] args_dict = { 'archive_unpack': { 'dir_moves': dir_moves }, 'edit_conf_file': { 'file': 'config.php', 'lang': 'php', 'pat': pat, 'sub': sub, 'vars': conf_vars }, } dl.do_install_actions(site, site_conf, instance_conf, msgs, globals(), actions, args_dict)
def reconfigure(context, site, site_conf, old_site_conf, instance_conf, old_instance_conf, msgs): new_domain = site_conf['siteinfo']['domain'] new_email = instance_conf['username'] + '@' + new_domain conf_vars = [('domain', new_domain), ('email', new_email)] actions = ['handle_url_loc', 'resolve_location', 'archive_unpack', 'handle_username_change', 'edit_conf_file'] args_dict = { 'archive_unpack': { 'dir_moves': dir_moves, }, 'edit_conf_file': { 'file': 'config.php', 'lang': 'php', 'pat': pat, 'sub': sub, 'vars': conf_vars }, } dl.do_reconfigure_actions(context, site, site_conf, old_site_conf, instance_conf, old_instance_conf, msgs, globals(), actions, args_dict) def upgrade(site, site_conf, instance_conf, old_instance_conf, msgs): if old_instance_conf['shortname'] == 'DSP_SHORTNAME' and \ old_instance_conf['version'] == '0.9': instance_conf['syncfs'] = '1' instance_conf['overwritefiles'] = '1' actions = ['do_backup', 'archive_unpack','edit_conf_file'] args_dict = { 'archive_unpack': { 'dir_moves' : dir_moves }, { 'fileinfo' : {'excluded_files' : ['config.php']}} } dl.do_upgrade_actions(site, site_conf, instance_conf, old_instance_conf, msgs, globals(), actions, args_dict) def remove(site, site_conf, instance_conf, msgs): dl.install_loc_cleanup(site, site_conf, instance_conf, dir_moves) def get_instance_configuration(context, site, site_conf, new_instance_conf, old_instance_conf, locale, msgs): instance = dl.dsp_create_instance(new_instance_conf['shortname'], new_instance_conf['version']) ['username', 'url_net', 'url_path', 'domain_to_path']) return instance
2 dsp.xml
<?xml version="1.0" ?> <dsp> <dspDescription> <shortname>Foo</shortname> <longname>Foo CMS DSP</longname> <version>1.0</version> <url>http://foo-home.sourceforge.net/</url> <type>Content Management System</type> <shortDescription>Foo CMS</shortDescription> <dapiversion>1.5</dapiversion> <dapirelease>1</dapirelease> <commonOption name="domain_to_path"/> <commonOption name="url_net_required"/> <commonOption name="url_path_required"/> <commonOption name="url_loc"/> <commonOption name="install_loc"/> <commonOption name="username"/> <commonOption name="archive_name" file="foo-1.0.tar.gz"/> <commonOption name="archive_type" type="tar.gz"/> </dspDescription> </dsp>
3 default.xsl
<?xml version="1.0"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:import href="/usr/lib/ensim/deployables/lib/themes/default.xsl"/> <xsl:output method="html" omit-xml-declaration="yes"/> </xsl:stylesheet>
4 include.mk
shortname := Foo name := Foo version := 1.0 lib_files := dsp.xml msgs.list raw_lib_files := foo.gif themes := default.xsl
source_files := foo-1.0.tar.gz
-include $(addsuffix /make_utils/dsp_common.mk,$(all_source_dirs))
5 msgs.list
#include "common_msgs.list"
6 archive and logo files
These should be downloaded from the DSP site.