Dependencies and install order
This page is for developers who write the <requires> of a site package, and for administrators who wonder why an
install fetched, replaced or refused a package. It answers: how a requirement is written, how it is checked, and in
which order packages are fetched and installed.
Contents
- How a requirement is written
- How min-version is compared
- Fetching: what the wizard downloads
- Installing: the order on the site
- Requirements of requirements
- The other dependency sections
- Checklist for your own requirements
- Related pages
How a requirement is written
<dependencies>
<requires>
<require type="ezpackage" name="sevenx_classes" min-version="5.1" />
<require type="ezpackage" name="sevenx_multisite_democontent" min-version="5.1" />
</requires>
</dependencies>| Attribute | Meaning |
|---|---|
type | ezpackage for another package. The Create sites step ignores any other type |
name | The <name> of the required package, which is also its file name on the package server |
min-version | The lowest <number>-<release> that satisfies the requirement; without it, any version does |
The order of the <require> elements is the order of installation. Put content classes before the content that
uses them, as sevenx_multisite does.
How min-version is compared
A package's version is eZPackage::getVersion(): <version><number> and <version><release> joined by -. It is
compared with min-version by eZPackageVersion::compareFull() (kernel/classes/ezpackageversion.php):
- The part after the last
-is the release number only when it is all digits; the rest is the version number. - Version numbers compare by Semantic Versioning 2.0.0 precedence. Older forms are read too:
1and1.0read as1.0.0, a fourth part compares after PATCH,3.4.0beta1reads as the prereleasebeta1. - When the version numbers are equal, the release numbers compare as numbers (a missing one counts as 0).
| Installed | min-version | Result |
|---|---|---|
6.0-10-stable (sevenx_classes in 6.0.15) | 5.1 | satisfied: 6 is greater than 5 |
1.0-1 | 1.0-2 | not satisfied |
1.0-1 | 1.0.0-1 | satisfied: equal |
Note
The version attribute of an index.xml entry is not compared with min-version. Only the version inside an
imported package counts.
Fetching: what the wizard downloads
eZStepSiteTypes::downloadDependantPackages() (kernel/setup/steps/ezstep_site_types.php) runs after the site
package is imported. For every <require> of the site package, in order:
- Look for a package of that name in the local repository.
- If it exists and
compareFull( installed, min-version ) >= 0: keep it, download nothing. - If it exists but is older: remove it from the repository and download the new one.
- If it does not exist: download it.
- To download, look the name up in the index; the URL is the entry's
url. A name the index does not list stops the step with "Download of package '...' failed. You may upload the package manually."
Each download is imported with eZPackage::import() into the repository its vendor names. In a kickstarter dry run
everything is downloaded into the temporary repository var/storage/packages/dryrun instead, so the whole chain is
checked without touching the real repository.
Installing: the order on the site
The Create sites step (kernel/setup/steps/ezstep_create_sites.php) then:
- Fetches the site package; error
EZSW-041when it cannot. - Includes its install scripts and calls
eZSitePreInstall()(see Install scripts in a site package). - Walks the site package's
<require>list in order. For eachtype="ezpackage"item:- fetches the package; error
EZSW-050"Could not fetch required package" when it is missing; - when its
install_typeisinstall, installs it; errorEZSW-051"Unable to install package" when that fails; - when its
install_typeisimport, leaves it as it is (a site style, for example, whose files the installer scripts use).
- fetches the package; error
- Writes the settings, roles and preferences, and calls
eZSitePostInstall().
For sevenx_multisite this means: sevenx_classes is installed first, then sevenx_multisite_democontent, then the
installer runs.
Requirements of requirements
eZPackage::install() handles requirements too, like a package manager: before it installs a package's own items,
it installs every package that package requires, one level after another
(eZPackage::installUnaudited(), "apt-like: pre-install all required packages"). A package already being installed
higher up the chain is skipped, so a loop does not run for ever. A required package that is not in the repository
only logs a warning there.
Note
From 6.0.15 on the setup wizard downloads the whole chain: the site package's requirements, theirs, and so on,
each package once (eZStepSiteTypes::downloadDependantPackages()), from any package server it reads. Before, it
downloaded only the direct requirements, and a requirement's own requirements had to be in the local repository
already, or they were only logged as missing when it was installed. Listing every package a site needs in the
site package itself, as every site package of the 6.0.15 index does, still works with older releases.
eZPackage::install() does not check whether a package is installed already: when two requirements require the
same package, its items run twice. The kernel only drops repeated items inside one package.
The other dependency sections
<provides>, <obsoletes> and <conflicts> are read and kept, and shown by the package pages and ezpm info, but
neither the setup steps nor eZPackage::install() act on them. The 7x design packages declare
<provide type="ezfile" name="collection" value="default"/> for information.
Checklist for your own requirements
- To do: Every package the site needs is listed in the site package itself, with
type="ezpackage". - To do: Classes come before content, extensions before content that uses their datatypes.
- To do: Every
nameis listed in theindex.xmlthe installation reads. - To do:
min-versionis at most the version inside the archive on the server. - To do: The required packages that must change the site have
install_type="install".
Related pages
- Site package basics
- Site packages: start here
- Declaring dependencies
- How the setup wizard uses packages
- Import versus install
- The index.xml format
- Contribute your site package
- 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.