Creating packages with ezpm
This page is for developers and hosts who prefer a script to the browser. ezpm.php in the installation root (also
php bin/php/console ezpm) is the command line package manager; it makes the same class, content and extension
packages as the package wizard, and because it is a command, the export of
your demo content can be repeated for every release with the same options.
7x and the Exponential Foundation strongly encourage you to submit the finished site package by pull request to se7enxweb/exponential.packages.exponential.earth: see Contribute your site package.
Contents
- The commands you need
- A classes package
- A content package
- An extension package
- Setting fields
- Export, validate, check
- A release script
The commands you need
From php ezpm.php help and kernel/private/classes/commands/ezpm.php:
| Command | Usage | Does |
|---|---|---|
create | create NAME [SUMMARY [VERSION [INSTALLTYPE]]] | a new, empty package; INSTALLTYPE is install (default) or import |
add | add PACKAGE ITEM [ITEMPARAMETERS]... | adds ezcontentclass, ezcontentobject (alias ezcontentsubtree), group, and items of other handlers such as ezextension |
set | set PACKAGE ATTRIBUTE ATTRIBUTEVALUE | summary, description, vendor, priority, type, extension, source, version, licence, state |
export | export PACKAGE [-d DIRECTORY] [--format=xml|json] | writes the .ezpkg archive |
validate | validate SOURCE | checks an archive, a directory or a package name without importing |
check | check PACKAGE [--all] | what installing would meet here, by remote ID; writes nothing |
list, info | list, info PACKAGE | the packages of the repositories, one package's details |
Global options include -s/--siteaccess, -l/--login with -p/--password and -r/--repos; the full table
is on ezpm: the package manager on the command line.
Warning
Run ezpm on a test installation. install and import change the installation; create, add, set and
export only write packages, but add of content reads the whole subtree and can take a while.
A classes package
php ezpm.php create acme_classes 'Acme content classes' 1.0.0 install
php ezpm.php add acme_classes ezcontentclass article,folder,acme_product
php ezpm.php set acme_classes vendor acme
php ezpm.php set acme_classes type contentclass
php ezpm.php export acme_classes -d var/tmpadd ezcontentclass takes one argument: class IDs or identifiers, separated by commas. An unknown one stops the
command with "Content class with identifier ... does not exist".
A content package
php ezpm.php create acme_site_democontent 'Acme demo content' 1.0.0 install
php ezpm.php add acme_site_democontent ezcontentsubtree /content/demo \
--exclude-classes --exclude-templates --language=eng-US,ger-DE
php ezpm.php set acme_site_democontent vendor acme
php ezpm.php set acme_site_democontent type contentobject
php ezpm.php export acme_site_democontent -d var/tmpThe starting point is a node ID or a URL path; everything below it is included. The options of add ezcontentobject:
--include-classes/--exclude-classes, --include-templates/--exclude-templates, --node-main/--node-selected,
--siteaccess=sa,sa2, --language=loc1,loc2, --current-version/--all-versions, --minimal-template-set. Leave
the classes out when your classes package carries them, so they are defined in one place.
An extension package
bin/repack_extension.sh in the 7x source repository shows the sequence the 7x team used for an extension package:
php ezpm.php create acme_extension 'Acme extension' '1.0.0' 'install'
php ezpm.php add acme_extension ezextension acme
php ezpm.php set acme_extension vendor acme
php ezpm.php set acme_extension type extension
php ezpm.php set acme_extension state stableExporting an extension is off by default: add ezextension refuses until the extension is listed in
package.ini [ExtensionExportSettings] AllowedExtensions[] (or *), and it always refuses an extension that holds
secret values or key material (Exporting with ezpm).
Setting fields
set changes one field of the package definition and, like add and delete, "will open up a new release if no open
releases exists yet" (the command's help). create starts every package with release 1, the license GPL, the
state alpha, no vendor and the logged-in user (if any) as maintainer. Set at least:
| Attribute | Example | Why |
|---|---|---|
vendor | acme | the repository directory the package is imported into |
type | contentclass, contentobject, extension | the type the index and the policies use |
licence | GPL-2.0-or-later | the license the package page shows (License and documents) |
state | stable | one of package.ini [PackageSettings] StateList[] |
Export, validate, check
php ezpm.php export acme_classes -d var/tmp # classic format
php ezpm.php export acme_classes -d var/tmp --format=json # JSON format, .json.ezpkg
php ezpm.php validate var/tmp/acme_classes-1.0.0-1.ezpkg
php ezpm.php check acme_site_democontent --allexport names the archive <name>-<version>-<release>.ezpkg (eZPackage::exportName()). A package server and an
index.xml usually use <name>.ezpkg, the name build.sh gives: unpack the export into packages/<name>/ of your
source repository and let build.sh make the published archive, so every package of a release is built the same way
(Rebuilding with build.sh). The two formats are explained on
Classic and JSON packages.
A release script
Keep the commands in your source repository so the next release repeats them exactly:
#!/usr/bin/env bash
set -euo pipefail
cd /path/to/test-installation
php ezpm.php create acme_site_democontent 'Acme demo content' "$1" install
php ezpm.php add acme_site_democontent ezcontentsubtree /content/demo --exclude-classes
php ezpm.php set acme_site_democontent vendor acme
php ezpm.php export acme_site_democontent -d "$HOME/acme-build"Run it for a package name that is not in the test installation's repositories yet (php ezpm.php list shows them),
so each run starts from an empty package.
Related pages
- Making your own site package
- Contribute your site package
- ezpm: the package manager on the command line
- The JSON package format
- Changing classes and content
- Site packages: start here
- Free documentation: this page is free to copy, translate and improve under the GNU FDL 1.3.
Become an Exponential Partner
Partners share their information, provide funding, contribute back and develop the products with us, and that is how Exponential grows. A partner website and dashboard are planned for mid-2027: please become a partner today to speed up our growth rate and land new features faster.