Debian API

  • Tier: 基础版, 专业版, 旗舰版
  • Offering: 私有化部署
History

这是 Debian 的 API 文档。

这个 API 被 Debian 相关软件包客户端使用,例如 dput 和 apt-get,通常不适合手动使用。由于功能有限,此 API 仍在开发中,尚未准备好用于生产环境。

关于如何从极狐GitLab软件包注册表上传和安装 Debian 软件包的说明,请参阅 Debian 注册表文档

这些端点不遵循标准的 API 身份验证方法。有关支持的头和令牌类型的详细信息,请参阅 [Debian 注册表文档](../../user/packages/debian_repository/_index.md)。未记录的身份验证方法可能会在将来被删除。

启用 Debian API#

Debian API 位于默认禁用的特性标志之后。具有极狐GitLab Rails 控制台访问权限的极狐GitLab管理员 可以选择启用它。要启用它,请按照启用 Debian API中的说明进行操作。

启用 Debian 群组 API#

Debian 群组 API 位于默认禁用的特性标志之后。具有极狐GitLab Rails 控制台访问权限的极狐GitLab管理员 可以选择启用它。要启用它,请按照启用 Debian 群组 API中的说明进行操作。

认证到 Debian 软件包存储库#

请参阅 Authenticate to the Debian Package Repositories

上传软件包文件#

History
    • 使用显式分发和组件上传引入于极狐GitLab 15.9。

上传一个 Debian 软件包文件:

plaintext
PUT projects/:id/packages/debian/:file_name
属性类型必需描述
idstring项目的 ID 或完整路径。
file_namestringDebian 软件包文件的名称。
distributionstring分发代号或套件。用于显式分发和组件的上传。
componentstring软件包文件组件。用于显式分发和组件的上传。
shell
curl --request PUT \ --user "<username>:<personal_access_token>" \ --upload-file path/to/mypkg.deb \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/mypkg.deb"

使用显式分发和组件上传:

shell
curl --request PUT \ --user "<username>:<personal_access_token>" \ --upload-file /path/to/myother.deb \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/myother.deb?distribution=sid&component=main"

下载软件包#

下载一个软件包文件。

plaintext
GET projects/:id/packages/debian/pool/:distribution/:letter/:package_name/:package_version/:file_name
属性类型必需描述
distributionstringDebian 分发的代号或套件。
letterstringDebian 分类(首字母或 lib 首字母)。
package_namestring源软件包名称。
package_versionstring源软件包版本。
file_namestring文件名。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/pool/my-distro/a/my-pkg/1.0.0/example_1.0.0~alpha2_amd64.deb"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/pool/my-distro/a/my-pkg/1.0.0/example_1.0.0~alpha2_amd64.deb" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

路由前缀#

描述的其余端点是两组相同的路由,每组在不同的范围内发出请求:

  • 使用项目级别前缀在单个项目的范围内发出请求。
  • 使用群组级别前缀在单个群组的范围内发出请求。

本文档中的示例均使用项目级别前缀。

项目级别#

plaintext
/projects/:id/packages/debian
属性类型必需描述
idstring项目 ID 或完整项目路径。

群组级别#

plaintext
/groups/:id/-/packages/debian
属性类型必需描述
idstring项目 ID 或完整群组路径。

下载分发 Release 文件#

下载一个 Debian 分发文件。

plaintext
GET <route-prefix>/dists/*distribution/Release
属性类型必需描述
distributionstringDebian 分发的代号或套件。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/Release"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/Release" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

下载签名的分发 Release 文件#

下载一个签名的 Debian 分发文件。

plaintext
GET <route-prefix>/dists/*distribution/InRelease
属性类型必需描述
distributionstringDebian 分发的代号或套件。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/InRelease"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/InRelease" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

下载 Release 文件签名#

下载一个 Debian Release 文件签名。

plaintext
GET <route-prefix>/dists/*distribution/Release.gpg
属性类型必需描述
distributionstringDebian 分发的代号或套件。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/Release.gpg"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/Release.gpg" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

下载软件包索引#

下载软件包索引。

plaintext
GET <route-prefix>/dists/*distribution/:component/binary-:architecture/Packages
属性类型必需描述
distributionstringDebian 分发的代号或套件。
componentstring分发组件名称。
architecturestring分发架构类型。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/binary-amd64/Packages"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/binary-amd64/Packages" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

通过哈希下载软件包索引#

History
    • 引入于极狐GitLab 15.4。

通过哈希下载软件包索引。

plaintext
GET <route-prefix>/dists/*distribution/:component/binary-:architecture/by-hash/SHA256/:file_sha256
属性类型必需描述
distributionstringDebian 分发的代号或套件。
componentstring分发组件名称。
architecturestring分发架构类型。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/binary-amd64/by-hash/SHA256/66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/binary-amd64/by-hash/SHA256/66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

下载 Debian 安装程序软件包索引#

History
    • 引入于极狐GitLab 15.4。

下载 Debian 安装程序软件包索引。

plaintext
GET <route-prefix>/dists/*distribution/:component/debian-installer/binary-:architecture/Packages
属性类型必需描述
distributionstringDebian 分发的代号或套件。
componentstring分发组件名称。
architecturestring分发架构类型。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/debian-installer/binary-amd64/Packages"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/debian-installer/binary-amd64/Packages" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

通过哈希下载 Debian 安装程序软件包索引#

History
    • 引入于极狐GitLab 15.4。

通过哈希下载 Debian 安装程序软件包索引。

plaintext
GET <route-prefix>/dists/*distribution/:component/debian-installer/binary-:architecture/by-hash/SHA256/:file_sha256
属性类型必需描述
distributionstringDebian 分发的代号或套件。
componentstring分发组件名称。
architecturestring分发架构类型。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/debian-installer/binary-amd64/by-hash/SHA256/66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/debian-installer/binary-amd64/by-hash/SHA256/66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

下载源软件包索引#

History
    • 引入于极狐GitLab 15.4。

下载源软件包索引。

plaintext
GET <route-prefix>/dists/*distribution/:component/source/Sources
属性类型必需描述
distributionstringDebian 分发的代号或套件。
componentstring分发组件名称。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/source/Sources"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/source/Sources" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。

通过哈希下载源软件包索引#

History
    • 引入于极狐GitLab 15.4。

通过哈希下载源软件包索引。

plaintext
GET <route-prefix>/dists/*distribution/:component/source/by-hash/SHA256/:file_sha256
属性类型必需描述
distributionstringDebian 分发的代号或套件。
componentstring分发组件名称。
shell
curl --header "Private-Token: <personal_access_token>" "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/source/by-hash/SHA256/66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18"

将输出写入文件:

shell
curl --header "Private-Token: <personal_access_token>" \ "https://gitlab.example.com/api/v4/projects/1/packages/debian/dists/my-distro/main/source/by-hash/SHA256/66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18" \ --remote-name

这会将下载的文件使用远程文件名写入当前目录。