If you want to package a PHP application, you can use Conary's basic recipe class PackageRecipe and just add the recipe actions needed to install the PHP files and set modes, ownership, and permissions on those files.
Use the following template to start this basic recipe for packaging a PHP application:
# RECIPE TEMPLATE
class ExampleApp(PackageRecipe):
name = 'example'
version = '1.0'
buildRequires = []
def setup(r):
r.addArchive('http://www.example.com/%(name)s/'
'%(name)s-%(version)s.tar.bz2',
dir='%(servicedir)s/%(name)s/')
# Set modes and ownership on directories and files
r.SetModes('%(servicedir)s/%(name)s/Sources', 0755)
r.SetModes('%(servicedir)s/%(name)s/Plugins', 0755)
r.SetModes('%(servicedir)s/%(name)s/index.php', 0644)
r.Ownership('apache', 'root', '%(servicedir)s/%(name)s/Sources')
r.Ownership('apache', 'root', '%(servicedir)s/%(name)s/Plugins')
r.Ownership('apache', 'root', '%(servicedir)s/%(name)s/index.php')
# Prevent removal of empty directory placeholders
r.ExcludeDirectories(exceptions = '%(servicedir)s/%(name)s/Plugins')
Replace the class name, package name, version, and archive location as appropriate for your package. Each source or archive you add can be just a file name (if you're checking in those files with the recipe), a network-accessible location as shown in the template example, or a version control checkout action from among Conary's source actions.
You can also use the developer-contributed PHPAppPackageRecipe superclass from the contrib project at rBuilder Online. This superclass provides some recipe actions typical to installing PHP applications, and cuts down on the length of your recipe. This superclass (and other items in contrib) are not supported by rPath, but they are free and available for use in community projects. Use the following template if you want to use the PHPAppPackageRecipe superclass:
# RECIPE TEMPLATE
loadSuperClass('phpapppackage=contrib.rpath.org@rpl:devel')
class ExampleApp(PHPAppPackageRecipe):
name = 'example'
version = '1.0'
buildRequires = []
def unpack(r):
r.extractArchive('http://www.example.com/%(name)s/'
'%(name)s-%(version)s.tar.bz2')
r.CreateWriteable('%(approot)s/%(name)s.config')
r.MakeWriteableDirs('%(approot)s/uploads')
r.macros.dirconf = ' php_value memory_limit 16M'
Reference all the other actions you can add to your recipe in Conary Recipe Actions, Macros, and Variables at docs.rpath.com/conary.