Package Directory
包目录
Installers contain components that are either embedded to the installer or loaded from a remote repository. In both cases, you need to use a file format and structure for the components that the installer can read.
安装程序包含嵌入安装程序或从远程存储库加载的组件。在这两种情况下,都需要为安装程序可以读取的组件使用文件格式和结构。
Package Directory Structure
包目录结构
Place all components in the same root directory, which is called the package directory. The directory name acts as a domain-like identifier, which identifies all components. For example, com.vendor.root
. The directory name must not contain :
or -
characters as those are reserved for separating the version number from the identifier.
将所有组件放在同一个根目录中,该目录称为包目录。目录名充当类域标识符,用于标识所有组件。例如,com.vendor.root。目录名不得包含:或-字符,因为这些字符是为分隔版本号和标识符而保留的。
Within the root directory, create subdirectories called data
and meta
.
在根目录中,创建名为data和meta的子目录。
A package directory can look as follows:
包目录可以如下所示:
-packages - com.vendor.root - data - meta - com.vendor.root.component1 - data - meta - com.vendor.root.component1.subcomponent1 - data - meta - com.vendor.root.component2 - data - meta
Meta Directory
Meta目录
The meta
directory contains files that specify settings for deployment and the installation process. The files are not extracted by the installer. The directory must contain at least a package information file and all files that you refer to in the package information file, such as scripts, user interface files, and translations.
meta目录包含指定部署和安装过程设置的文件。安装程序不会提取这些文件。目录必须至少包含一个包信息文件以及在包信息文件中引用的所有文件,如脚本、用户界面文件和翻译。
Package Information File Syntax
包信息文件语法
The package.xml file is the main source of information about a component. The following is an example of a package file:
package.xml文件是组件信息的主要来源。以下是一个包文件的示例:
<?xml version="1.0"?>
<Package>
<DisplayName>QtGui</DisplayName>
<Description>Qt gui libraries</Description>
<Description xml:lang="de_de">Qt GUI Bibliotheken</Description>
<Version>1.2.3</Version>
<ReleaseDate>2009-04-23</ReleaseDate>
<Name>com.vendor.root.component2</Name>
<Dependencies>com.vendor.root.component1</Dependencies>
<Virtual>false</Virtual>
<Licenses>
<License name="License Agreement" file="license.txt" />
</Licenses>
<Script>installscript.qs</Script>
<UserInterfaces>
<UserInterface>specialpage.ui</UserInterface>
<UserInterface>errorpage.ui</UserInterface>
</UserInterfaces>
<Translations>
<Translation>sv_se.qm</Translation>
<Translation>de_de.qm</Translation>
</Translations>
<DownloadableArchives>component2.7z, component2a.7z</DownloadableArchives>
<AutoDependOn>com.vendor.root.component3</AutoDependOn>
<SortingPriority>123</SortingPriority>
<UpdateText>This changed compared to the last release</UpdateText>
<Default>false</Default>
<ForcedInstallation>false</ForcedInstallation>
<ForcedUpdate>false</ForcedUpdate>
<Essential>false</Essential>
<Replaces>com.vendor.root.component2old</Replaces>
<Operations>
<Operation name="AppendFile">
<Argument>@TargetDir@/A.txt</Argument>
<Argument>lorem ipsum</Argument>
</Operation>
<Operation name="Extract">
<Argument>@TargetDir@/Folder1</Argument>
<Argument>content.7z</Argument>
</Operation>
<Operation name="Extract">
<Argument>@TargetDir@/Folder2</Argument>
</Operation>
</Operations>
<TreeName moveChildren="true">com.vendor.subcomponent</TreeName>
</Package>
Summary of Package Information File Elements
包信息文件元素摘要
Element | Description |
---|---|
DisplayName | Human-readable name of the component. Required. Specify translations for the name of the component as values of additional DisplayName tags, with the xml:lang attribute set to the correct locale. 组件的可读名称。必要的。将组件名称的翻译指定为其他DisplayName标记的值,并将xml:lang属性设置为正确的区域设置。 |
Description | Human-readable description of the component. Required. Translations may be specified similarly to DisplayName tag. If a localization that matches the locale is not found and an untranslated version exists, that one will be used. Otherwise no Description will be shown for that locale. User clickable external links, for example a component's homepage, can be included in component description by specifying a URL address like this: {external-link}='https://www.qt.io/'. The URL must be valid and contain a full path to the desired resource. 组件的人类可读描述。必要的。翻译可以类似于DisplayName标签进行指定。如果找不到与区域设置匹配的本地化,并且存在未翻译的版本,则将使用该版本。否则,将不会显示该区域设置的描述。用户可点击的外部链接,例如组件的主页,可以通过指定这样的URL地址包含在组件描述中:{external link}='https://www.qt.io/'. URL必须有效,并包含所需资源的完整路径。 |
Version | Version number of the component in the following format: [0-9]+((\.|-)[0-9]+)* such as 1-1; 1.2-2; 3.4.7. Required. If a package needs to show the version number from a child rather than it's own (due to grouping of child packages) one can specify the attribute inheritVersionFrom with the package name the version needs to be inherited from. 组件的版本号格式如下:[0-9]+((\.|-)[0-9]+)*,如1-1;1.2-2; 3.4.7. 必要的。如果一个包需要显示子包的版本号,而不是它自己的版本号(由于子包的分组),可以使用需要继承版本的包名指定属性hericVersionFrom。 |
ReleaseDate | Date when this component version was released. Required. 此组件版本发布的日期。必要的。 |
Name | Domain-like identification for this component. Required. 此组件的类域标识。必要的 |
Dependencies | Comma-separated list of identifiers of components that this component depends on. Optionally, you can specify version numbers, separated by a dash (-). You can prefix version numbers with a comparison operator (=, >, <, >= or <=). Keep in mind that you have to use the character reference "<" to escape the left angle bracket (use "<" instead of "<" and "<=" instead of "<="). Optional. For more information, see Component Dependencies. 此组件所依赖的组件标识符的逗号分隔列表。也可以指定版本号,用破折号(-)分隔。可以在版本号前添加比较运算符(=、>、<、>=或<=)。请记住,必须使用字符引用“<;”来转义左尖括号(使用“<”代替“<”,使用“<;=”代替“<=”)。可选。有关更多信息,请参见组件依赖关系。 |
AutoDependOn | Comma-separated list of identifiers of components that this component has an automatic dependency on. The component is installed if and only if all of the specified dependencies are fulfilled. If a component has an automatic dependency on other components, the check box will not be visible next to the component in the component tree, but this does not change the visibility of the check box in the updater view where the end user may still manually select the component for update. 此组件具有自动依赖关系的组件标识符的逗号分隔列表。仅当满足所有指定的依赖关系时,才会安装该组件。如果一个组件自动依赖于其他组件,则组件树中该组件旁边的复选框将不可见,但这不会改变更新器视图中复选框的可见性,最终用户仍可以手动选择要更新的组件。 When running an installer or a maintenance tool in package manager mode, the selection will be performed automatically. If the component was not installed before, it will be selected for installation only when all components from this list are also selected for installation. If the component was already installed, it will be selected for uninstallation or for update when at least one of the components from this list is also selected for uninstallation or for update. For more information, see Component Dependencies. 在包管理器模式下运行安装程序或维护工具时,将自动执行选择。如果该组件以前未安装,则只有当此列表中的所有组件都已选择安装时,才会选择安装该组件。如果该组件已安装,当此列表中的至少一个组件也被选择卸载或更新时,它将被选择进行卸载或更新。有关更多信息,请参见组件依赖关系。 |
Virtual | Set to 设置为true可在安装程序中隐藏组件。这也隐藏了此组件可能具有的任何子组件,包括它们的后代。请注意,在根组件上设置此项不起作用。 |
SortingPriority | Priority of the component in the tree. The tree is sorted from highest to lowest priority, with the highest priority on the top. 树中组件的优先级。树从最高优先级到最低优先级排序,最高优先级在顶部。 |
Licenses | List of license agreements to be accepted by the installing user. To add several licenses, add several 安装用户接受的许可协议列表。要添加多个许可证,请添加多个<License>子元素,每个子元素指定许可证 If there are translations listed for this component, the installer will also look for translated licenses. These need to have the same name as the original license file but with an added locale identifier. If for example the license file is called license.txt and there is German translation specified, the installer will also include a license_de_de.txt file (and show that when installing on a German system). 如果列出了此组件的翻译,安装程序还将查找翻译后的许可证。这些需要与原始许可证文件同名,但添加了区域设置标识符。例如,如果许可证文件名为license.txt,并且指定了德语翻译,则安装程序还将包含license_de_de.txt文件(并在德语系统上安装时显示)。 |
Script | File name of a script being loaded. Optional. Specifying the 正在加载的脚本的文件名。可选。指定postLoad=“true”属性将导致脚本仅加载到选择进行更新或安装的组件。使用该属性,脚本将在组件安装开始之前加载。如果存储库中有大量带有安装脚本的组件,这将加快安装程序的速度。确保脚本中不包含在显示安装树视图之前需要评估的任何内容。有关更多信息,请参阅在组件脚本中添加操作和使用postLoad。 |
UserInterfaces | List of pages to load. To add several pages, add several 要加载的页面列表。要添加多个页面,请添加几个<UserInterface>子元素,每个子元素指定页面的文件名。可选。有关详细信息,请参阅添加页面。 |
Translations | List of translation files to load. To add several language variants, specify several 要加载的翻译文件列表。要添加多个语言版本,请指定几个<Translation>子元素,每个子元素指定一个语言版本的文件名。安装程序加载与当前系统区域设置匹配的翻译文件。例如,如果系统区域设置为德语,则加载de.qm文件。可选。有关更多信息,请参阅翻译页面。 |
UpdateText | Description added to the component description if this is an update to the component. Optional. 如果这是对组件的更新,则将描述添加到组件描述中。可选。 |
Default | Possible values are: 可能的值有:true、false和script。设置为true可在安装程序中预选组件。这仅对没有可见子组件的组件生效。布尔值直接计算,而脚本在运行时解析。将脚本的名称作为此文件中<script>元素的值添加。有关示例脚本,请参见选择默认内容。 |
Essential | Marks the package as essential to force a restart of the 将包装标记为强制重新启动MaintenanceTool所必需的。如果某个基本组件有可用的更新,则包管理器将保持禁用状态,直到该组件更新为止。运行更新程序时,会自动安装新引入的基本组件。 |
ForcedInstallation | Determines that the package must always be installed. End users cannot deselect it in the installer. When updating components, the component can still be deselected from an update. 确定必须始终安装该包。最终用户无法在安装程序中取消选择它。更新组件时,仍然可以从更新中取消选择该组件。 |
ForcedUpdate | Marks the package as 将包标记为ForcedUpdate,以强制重新启动MaintenanceTool。如果ForcedUpdate组件有可用的更新,则包管理器将保持禁用状态,直到该组件更新为止。 |
Replaces | Comma-separated list of components to replace. Optional. 用逗号分隔的要替换的组件列表。可选。 |
DownloadableArchives | Lists the data files (separated by commas) for an online installer to download. If there is some data inside the component and the package.xml and/or the script has no DownloadableArchives value, the repogen tool registers the found data automatically. 列出在线安装程序要下载的数据文件(用逗号分隔)。如果组件中有一些数据,并且package.xml或脚本没有DownloadableArchives值,则重新生成工具会自动注册找到的数据。 |
RequiresAdminRights | Set to 如果需要使用提升的权限安装包,请设置为true。可选。 |
Checkable | Set to 如果要隐藏项目的复选框,请设置为false。当只应选择少数子组件而不是所有子组件时,这很有用。更新组件时,复选框仍然可见,以允许切换组件进行更新。可选。 |
ExpandedByDefault | Set to 如果希望默认展开此项目,请设置为true。可选。 |
Operations | List of operations that are performed when component is installed. To add several operations, specify several 安装组件时执行的操作列表。要添加多个操作,请指定多个<Operation>子元素,每个子元素都指定操作 |
TreeName | Specifies the component location in the install tree view. Overwrites the original location which is calculated from component name. Component names and tree names must be unique. Optional. 指定安装树视图中的组件位置。覆盖根据组件名称计算的原始位置。组件名称和树名称必须唯一。可选。 Specifying 指定moveChildren=“true”属性也将更改此组件所具有的任何子组件的位置。子节点将移动到覆盖的树名称,保持与父组件的相对位置。 One component branch in the install tree view can have multiple components specifying a tree name. The order in which the location of components is changed is from leaf to root components. 安装树视图中的一个组件分支可以有多个指定树名称的组件。组件位置更改的顺序是从叶组件到根组件。 |
Component Dependencies
组件依赖
Components can depend on one or several real or virtual components. Dependencies are defined by using the component identifier and, optionally, component version. Use a dash (-) to separate version numbers from identifiers.
组件可以依赖于一个或多个真实或虚拟组件。依赖关系是通过使用组件标识符和组件版本(可选)来定义的。使用破折号(-)将版本号与标识符分开。
You can prefix version numbers with a comparison operator (=, >, < (<), >= or <= (<=)) to indicate that the version number of the package is compared to the required version and has to be equal to, greater than, less than, greater than or equal to, or less than or equal to the version number specified in the dependency. If no comparison operator is given, it defaults to =.
可以在版本号前添加比较运算符(=、>、< (<)、>=或<= (<=))表示将包的版本号与所需版本进行比较,并且必须等于、大于、小于、大于或等于或小于或等于依赖关系中指定的版本号。如果没有给出比较运算符,则默认为=。
Data Directory
数据目录
The data
directory contains the content that the installer extracts during the installation. The data must be packaged into archive files. This is either done automatically by binarycreator and repogen when creating an installer or a repository, respectively, or you can do this beforehand for more control.
data
目录包含安装程序在安装过程中提取的内容。数据必须打包到归档文件中。这要么是由binarycreator和repogen分别在创建安装程序或存储库时自动完成的,要么可以提前这样做以获得更多控制。
For manual archive creation you can use either the archivegen tool that is delivered with the Qt Installer Framework or some other tool that generates archives in any of the file formats: 7z
, zip
, tar.gz
, tar.bz2
and tar.xz
.
对于手动创建存档,您可以使用Qt Installer Framework附带的archivegen工具,也可以使用其他工具生成任何文件格式的存档:7z、zip、tar.gz、tar.bz2和tar.xz。
Note: If the Installer Framework tools were built without libarchive support, only
7z
format is supported.注意:如果安装程序框架工具是在没有libarchive支持的情况下构建的,则只支持7z格式。
Configuration FileAlias Definition File
© 2021 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. The Qt Company, Qt and their respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.