winget 源存储库的结构
Structure of winget source repositories
Microsoft 宣布并开源 winget,一个用于 Windows 的包管理器。
输入winget source
时(安装后)可以看到支持添加源
winget source
提供以下子命令:
add Add a new source
list list current sources
update updates current sources
remove removes current sources
reset resets sources
通过输入 winget source list
,将显示默认来源(只要来源未更改):
C:\Windows\System32>winget source list
Name Arg
-----------------------------------------
winget https://winget.azureedge.net/cache
由于可以使用 winget source add
添加源,如何创建源存储库?
存储库必须如何构建或没有足够的文档来回答这个问题?
我认为这个问题是 Stack Overflow 的主题,因为添加源的主要原因(在我看来)是为节目或类似节目创建 alpha/beta 频道。
截至 2020 年 7 月,How to Update Winget Source List 澄清:
Winget is a really young application in terms of software age and currently, only has a single source/repo available for it, Microsoft's official Winget repository.
Thus sub-commands such as add
and remove
aren't of use yet.
REST API 实施后可能是您的最佳选择:https://github.com/microsoft/winget-cli/issues/118
winget 1.0 introduced a new REST API for custom repositories. The API and a reference implementation are provided by Microsoft at github.com/microsoft/winget-cli-restsource/. The reference implementation uses C# and allows self-hosting on Azure. Hosted offerings are also becoming available, such as https://winget.pro.
在winget 1.0之前,winget仓库的结构大致如下:
远程存储库应该有一个 source.msix
文件。您可以参考默认存储库中的示例:https://winget.azureedge.net/cache/source.msix
- 上找到有关 MSIX 本身的详细信息
实际上 source.msix
是一个 zip 包,其内容以 pre-defined 方式构建(只需将其重命名为 source.zip
并解压):
Assets/
Public/
AppxBlockMap.xml
AppxManifest.xml
AppcSignature.p7x
[Content_Typex.xml]
主数据文件好像是Public/index.db
。它是一个 SQLite 数据库,包含来自 Community Repo Manifests 的信息。它的结构非常简单易懂。
另一个问题是 MSIX 应该由开发人员签名。应该更改 Windows 设置以便 winget
接受第三方签名的包。详情见下文。
请注意 winget
不接受 HTTP 存储库,它只需要具有受信任证书的 HTTPS 存储库。
index.db
中最有趣的 table 是 manifest
和 pathparts
。第一个将应用程序的名称、版本等匹配到 pathparts,后者指向 manifest YAML-file.
例如:https://winget.azureedge.net/cache/manifests/RubyInstallerTeam/Ruby/e70d-2.7.2.yaml (a cache of github/winget-pkgs/manifests/RubyInstallerTeam/Ruby/2.7.2.yaml).
winget
使用此缓存清单进行应用程序安装。
为了 winget
可以添加 third-party 源存储库(当 source.msix
由 third-party 证书签名时)应该允许安装侧载应用程序.
综上所述,总体顺序如下:
- 从
winget
的默认存储库下载 source.msix
:https://winget.azureedge.net/cache/source.msix
- 将其解压缩为 ZIP-package 或使用 MSIX Packaging Tool 从
Public
目录中获取 index.db
文件。
- 编辑此 SQLite 数据库(为此我使用了 DB Browser for SQLite)只留下您的应用程序(tables
ids
、monikers
、names
, versions
).
- 在
pathparts
table 中将路径设置为 YAML-manifest(每个路径元素一条记录)。例如。对于 /manifests/MyCompany/MyProduct/1.0.0.yaml
,table 应该是这样的:
- 通过添加合并所有相关记录的记录来编辑
manifest
table。
- 保存编辑的
index.db
,使用 MSIX 打包工具在 source.msix
中覆盖它,用您自己的 code-signing 证书签署 MSIX。
- 将清单(请参阅 Manifest Specification 以了解有关清单本身的详细信息)和
source.msix
到您的服务器(例如 myserver.net/repo/source.msix
和 myserver.net/repo/manifests/MyCompany/MyProduct/1.0.0.yaml
)。
- 使用:
winget source add myrepo https://myserver.net/repo
winget install MyProduct
WinGet 1.0 有 just been released,Microsoft 还发布了 REST API 源的参考实现,因此可以托管您自己的私有存储库。
叫做WinGet.RestSource,可以是cloned from here;因为它是一个 Azure 解决方案,所以在 Visual Studio 2019 之后您还需要一个 Azure 订阅。
我发现 WinGet.RestSource 和 运行 并将包推送到它(目前)并不 容易,但对于任何感兴趣的人来说,我已经写了 2 篇关于这个的博客文章:
Microsoft 宣布并开源 winget,一个用于 Windows 的包管理器。
输入winget source
时(安装后)可以看到支持添加源
winget source
提供以下子命令:
add Add a new source
list list current sources
update updates current sources
remove removes current sources
reset resets sources
通过输入 winget source list
,将显示默认来源(只要来源未更改):
C:\Windows\System32>winget source list
Name Arg
-----------------------------------------
winget https://winget.azureedge.net/cache
由于可以使用 winget source add
添加源,如何创建源存储库?
存储库必须如何构建或没有足够的文档来回答这个问题?
我认为这个问题是 Stack Overflow 的主题,因为添加源的主要原因(在我看来)是为节目或类似节目创建 alpha/beta 频道。
截至 2020 年 7 月,How to Update Winget Source List 澄清:
Winget is a really young application in terms of software age and currently, only has a single source/repo available for it, Microsoft's official Winget repository.
Thus sub-commands such as
add
andremove
aren't of use yet.
REST API 实施后可能是您的最佳选择:https://github.com/microsoft/winget-cli/issues/118
winget 1.0 introduced a new REST API for custom repositories. The API and a reference implementation are provided by Microsoft at github.com/microsoft/winget-cli-restsource/. The reference implementation uses C# and allows self-hosting on Azure. Hosted offerings are also becoming available, such as https://winget.pro.
在winget 1.0之前,winget仓库的结构大致如下:
远程存储库应该有一个
source.msix
文件。您可以参考默认存储库中的示例:https://winget.azureedge.net/cache/source.msix- 上找到有关 MSIX 本身的详细信息
实际上
source.msix
是一个 zip 包,其内容以 pre-defined 方式构建(只需将其重命名为source.zip
并解压):Assets/
Public/
AppxBlockMap.xml
AppxManifest.xml
AppcSignature.p7x
[Content_Typex.xml]
主数据文件好像是
Public/index.db
。它是一个 SQLite 数据库,包含来自 Community Repo Manifests 的信息。它的结构非常简单易懂。另一个问题是 MSIX 应该由开发人员签名。应该更改 Windows 设置以便
winget
接受第三方签名的包。详情见下文。请注意
winget
不接受 HTTP 存储库,它只需要具有受信任证书的 HTTPS 存储库。index.db
中最有趣的 table 是manifest
和pathparts
。第一个将应用程序的名称、版本等匹配到 pathparts,后者指向 manifest YAML-file.例如:https://winget.azureedge.net/cache/manifests/RubyInstallerTeam/Ruby/e70d-2.7.2.yaml (a cache of github/winget-pkgs/manifests/RubyInstallerTeam/Ruby/2.7.2.yaml).
winget
使用此缓存清单进行应用程序安装。为了
winget
可以添加 third-party 源存储库(当source.msix
由 third-party 证书签名时)应该允许安装侧载应用程序.
综上所述,总体顺序如下:
- 从
winget
的默认存储库下载source.msix
:https://winget.azureedge.net/cache/source.msix - 将其解压缩为 ZIP-package 或使用 MSIX Packaging Tool 从
Public
目录中获取index.db
文件。 - 编辑此 SQLite 数据库(为此我使用了 DB Browser for SQLite)只留下您的应用程序(tables
ids
、monikers
、names
,versions
). - 在
pathparts
table 中将路径设置为 YAML-manifest(每个路径元素一条记录)。例如。对于/manifests/MyCompany/MyProduct/1.0.0.yaml
,table 应该是这样的: - 通过添加合并所有相关记录的记录来编辑
manifest
table。 - 保存编辑的
index.db
,使用 MSIX 打包工具在source.msix
中覆盖它,用您自己的 code-signing 证书签署 MSIX。 - 将清单(请参阅 Manifest Specification 以了解有关清单本身的详细信息)和
source.msix
到您的服务器(例如myserver.net/repo/source.msix
和myserver.net/repo/manifests/MyCompany/MyProduct/1.0.0.yaml
)。 - 使用:
winget source add myrepo https://myserver.net/repo winget install MyProduct
- 从
WinGet 1.0 有 just been released,Microsoft 还发布了 REST API 源的参考实现,因此可以托管您自己的私有存储库。 叫做WinGet.RestSource,可以是cloned from here;因为它是一个 Azure 解决方案,所以在 Visual Studio 2019 之后您还需要一个 Azure 订阅。
我发现 WinGet.RestSource 和 运行 并将包推送到它(目前)并不 容易,但对于任何感兴趣的人来说,我已经写了 2 篇关于这个的博客文章: