.vpkg文件(Vega的标准程序包格式)。
要开始使用VPT,请安装Vega软件开发工具包 (SDK),其中包括两个主要命令行工具:
- VPT - 管理创建和验证等程序包操作
- Vega CLI - 处理整个应用开发工作流程,包括构建和部署应用
- 检查程序包
- 验证内容
- 为您的应用添加自定义签名
命令
VPT提供以下命令类别。有关命令及其最新选项的完整列表,请使用vega exec vpt --help。
程序包信息
这些命令可用来查看程序包的详细信息和内容。info
示出程序包信息,包括ID、标题和版本详细信息。(注意:界面显示内容均为英文。此处中文译文仅供参考。)Usage: vega exec vpt info [OPTIONS] <PACKAGE>
Arguments:
<PACKAGE> Path to the vpkg
Options:
--json Output in JSON format
-h, --help Print help
vega exec vpt info /path/to/sampleapp.vpkg
// 输出
Sample App com.amazondeveloper.sampleapp v1.3.4 b53
show-contents
列出程序包中的所有文件。Usage: vega exec vpt show-contents [OPTIONS] <PACKAGE>
Arguments:
<PACKAGE> Path to the vpkg
Options:
-h, --help Print help
vega exec vpt show-contents /path/to/sampleapp.vpkg
// 输出
Package contents:
assets/ (6 files)
lib/ (2 files)
manifest.toml
meta-info/ (4 files)
程序包创建和提取
以下命令可用来创建和修改程序包。pack
从源目录创建程序包。您可以指定程序包名称、版本和内部版本号。Usage: vega exec vpt pack [OPTIONS] <SOURCE_PATHS>...
Arguments:
<SOURCE_PATHS>... Source directories
Options:
-n, --pkg-name <PKG_NAME> Name of the package
-d, --dest-path <DEST_PATH> Destination path
-b, --build-number <BUILD_NUMBER> Build number
-v, --version <VERSION> Build version
--validate Enforce validation of the manifest
--no-strict-abi-check Disable strict ABI check
-h, --help Print help
vega exec vpt pack /path/to/source --pkg-name sampleapp --dest-path /path/to/output --version 1.0.0 --build-number 42
// 输出
Creating package sampleapp...
Validating manifest...
Package created at /path/to/output/sampleapp.vpkg
unpack
将所有程序包文件提取到目标路径。Usage: vega exec vpt unpack [OPTIONS] <PACKAGE>
Arguments:
<PACKAGE> Path to the vpkg
Options:
-d, --dest-path <DEST_PATH> Destination path
-h, --help Print help
vega exec vpt unpack /path/to/sampleapp.vpkg --dest-path /path/to/output
// 输出
Extracting package contents...
Files extracted to /path/to/output
dump
从程序包中提取文件。打印到stdout,或保存到您指定的目标路径。
Usage: vega exec vpt dump [OPTIONS] <PACKAGE> <ENTRY>
Arguments:
<PACKAGE> Path to the vpkg
<ENTRY> Path to the entry inside vpkg
Options:
-d, --dest-path <DEST_PATH> Destination path
-h, --help Print help
vega exec vpt dump /path/to/sampleapp.vpkg manifest.toml
// 输出
Extracting manifest.toml from sampleapp.vpkg
Content written to stdout
extract-locales
以JSON或文本形式从程序包中提取本地化文件。Usage: vega exec vpt extract-locales [OPTIONS] <PACKAGE>
Arguments:
<PACKAGE> Path to the vpkg
Options:
-f, --format <FORMAT> Output format [default: json] [possible values: json, text]
-h, --help Print help
vega exec vpt extract-locales --format json /path/to/sampleapp.vpkg
// 输出
Extracting localization files...
Files extracted to current directory:
- en/strings.json
- es/strings.json
程序包签名和验证
这些命令用来处理安全和验证。pull
从程序包中提取摘要和签名文件。摘要文件列出了VPKG中所有文件的加密校验和,而签名文件则包含分离的加密签名,该签名用于验证摘要文件的真实性。使用--json-digest提取JSON格式的摘要文件,或使用--json-signature提取JSON格式的签名文件。
Usage: vega exec vpt pull [OPTIONS] <--signature|--digest|--json-signature|--json-digest> <PACKAGE> <DEST>
Arguments:
<PACKAGE> Path to the vpkg
<DEST> Destination path
Options:
--signature
--digest
--json-signature
--json-digest
-h, --help Print help
vega exec vpt pull --signature /path/to/sampleapp.vpkg /path/to/output/digest.sig
// 输出
Extracting signature from sampleapp.vpkg
Signature saved to /path/to/output/digest.sig
push
向程序包中添加签名文件。使用--json-signature插入与程序包摘要相对应的JSON格式签名文件。
Usage: vega exec vpt push [OPTIONS] <--signature <SIGNATURE>|--json-signature <JSON_SIGNATURE>> <PACKAGE>
Arguments:
<PACKAGE> Path to the vpkg
Options:
--signature <SIGNATURE> Legacy signature of a digest file path to push
--json-signature <JSON_SIGNATURE> Signature of a digest.json file path to push
-h, --help Print help
vega exec vpt push --signature /path/to/input/digest.sig /path/to/sampleapp.vpkg
// 输出
Adding signature to sampleapp.vpkg
Signature successfully added
sign
使用私钥和证书对消息进行签名。Usage: vega exec vpt sign [OPTIONS] <MESSAGE> <PRIVKEY> <CERTFILE> <OUTPUTFILE>
Arguments:
<MESSAGE> Message to sign
<PRIVKEY> Private key used to sign the message
<CERTFILE> X.509 certificate that corresponds to the private key
<OUTPUTFILE> Output path
Options:
-r, --resign Resign a signed message
-h, --help Print help
vega exec vpt sign --resign /path/to/input/digest.sig /path/to/developer-private.key /path/to/developer-cert.pem /path/to/output/digest.sig
// 输出
Signing digest.sig with provided key and certificate
Signature created at /path/to/output/digest.sig
verify
使用指定的证书验证消息的签名。Usage: vega exec vpt verify [OPTIONS] <MESSAGEFILE> <SIGFILE> <CERTIFICATES>...
Arguments:
<MESSAGEFILE> File to verify
<SIGFILE> Signature used to verify the message
<CERTIFICATES>... List of X.509 certificates to verify against
Options:
-p, --partial Perform a partial/non-exhaustive verification using only the provided CAs
-h, --help Print help
vega exec vpt verify /path/to/message.txt /path/to/message.sig /path/to/cert.pem
// 输出
Verifying signature...
Signature verification successful
checksum
计算程序包校验和。Usage: vega exec vpt checksum [OPTIONS] <PACKAGE>
Arguments:
<PACKAGE> Path to the vpkg
Options:
-h, --help Print help
vega exec vpt checksum /path/to/sampleapp.vpkg
// 输出
Calculating checksum...
SHA256: a1b2c3d4e5f6...
generate-csr
从配置文件创建证书签名请求 (CSR)。Usage: vega exec vpt generate-csr [OPTIONS]
Options:
-k, --key <KEY> Private key
-c, --config <CONFIG> Config file
-o, --out <OUT> Output directory
-v, --verbose Print the generated CSR path
-h, --help Print help
vega exec vpt generate-csr -k /path/to/private.key -c /path/to/config.json -o /path/to/output/dir -v
// 输出
Reading configuration from config.json
Generating CSR using private.key
CSR created at /output/dir/certificate.csr
程序包分析
以下命令用来验证程序包的结构和内容。validate
运行验证检查,检查是否满足应用商店的提交要求:- 验证程序包清单中所需的配置和语法是否正确。请参阅清单用户指南。
- 验证应用的原生代码的捆绑库或声明的依赖项是否符合Vega的ABI要求。
Usage: vega exec vpt validate [OPTIONS] <PATH>
Arguments:
<PATH> Path to the vpkg, directory, or manifest.toml
Options:
--no-strict-abi-check Disable strict ABI check
--no-color Disable colored output
-h, --help Print help
vega exec vpt validate sampleapp.vpkg
// 输出
validating 'sampleapp.vpkg' ...
analyzing manifest.toml ...
found issues in manifest.toml ...
manifest validation found 2 errors
manifest.toml:3:1 info: [package.icon] Icon isn't defined in the manifest.Using system default.
help: Define an icon to help users recognize your app
manifest.toml:15:6 error: [components.interactive.id] Component ID 'com.company.sample.badcomponentname' doesnt have package ID prefix 'com.amazondeveloper.sampleapp'
help: Component ID should follow the format: package_id.component_name
manifest.toml:9:1 error: [components.interactive.categories] No interactive component declares 'com.amazon.category.main' category.App can't launch without package-id or package ASIN.
help: One interactive component should declare 'com.amazon.category.main' category in the manifest
starting ABI validation ...
found issues in ABI validation ...
Missing dt_needed dependencies found:
- Library 'libsample-app.so.0.1.0' at path '/sampleapp/lib/arm/libsample-app.so.0.1.0' has missing dt_needed dependencies: libsample-deps.so
Missing dlopen dependencies found:
- Library 'libsample-app.so.0.1.0' at path '/sampleapp/lib/arm/libsample-app.so.0.1.0' has missing dlopen dependencies: libsample-deps.so
为您的程序包创建自定义签名
-
从程序包中拉取签名文件:
vega exec vpt pull --json-signature /path/to/sampleapp.vpkg /path/to/output/digest.json.sig // 输出 Extracting signature from sampleapp.vpkg Signature saved to /path/to/output/digest.json.sig -
使用您的私钥和证书更新签名文件::
vega exec vpt sign --resign /path/to/input/digest.json.sig /path/to/developer-private.key /path/to/developer-cert.pem /path/to/output/digest.json.sig // 输出 Signing digest.json.sig with provided key and certificate Signature created at /path/to/output/digest.json.sig -
将已更新的签名文件推送回程序包:
vega exec vpt push --json-signature /path/to/output/digest.json.sig /path/to/sampleapp.vpkg // 输出 Adding signature to sampleapp.vpkg Signature successfully added

