Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# registries

Go library for fetching package metadata from registry APIs. Supports 27 ecosystems with a unified interface. Also provides sub-packages for HTTP client usage (`client/`) and streaming artifact downloads (`fetch/`).
Go library for fetching package metadata from registry APIs. Supports 28 ecosystems with a unified interface. Also provides sub-packages for HTTP client usage (`client/`) and streaming artifact downloads (`fetch/`).

## Installation

Expand Down Expand Up @@ -134,6 +134,7 @@ packages = registries.BulkFetchPackagesWithConcurrency(ctx, purls, nil, 5)
| Maven | `pkg:maven/org.apache.commons/commons-lang3@3.12.0` |
| RubyGems | `pkg:gem/rails@7.1.0` |
| Terraform | `pkg:terraform/hashicorp/consul/aws@0.11.0` |
| Alpine | `pkg:apk/alpine/curl@8.22.0-r0?arch=x86_64&repository_url=https://dl-cdn.alpinelinux.org/alpine/v3.23/main/x86_64` |

## Direct Registry Usage

Expand Down Expand Up @@ -193,6 +194,9 @@ import _ "github.com/git-pkgs/registries/all"
| Deno | `deno` | https://apiland.deno.dev |
| Terraform | `terraform` | https://registry.terraform.io |
| Swift | `swift` | URL required |
| Alpine | `apk` | URL required |

The Alpine URL is one repository architecture directory, such as `https://dl-cdn.alpinelinux.org/alpine/v3.23/main/x86_64`, or the `APKINDEX.tar.gz` inside it. The client doesn't pick a release, component or architecture from a mirror root. It reads v2 `APKINDEX.tar.gz` indexes. When a directory serves a v3 `Packages.adb`, the client returns an error rather than reading the v2 index.

### Swift registries

Expand Down
3 changes: 2 additions & 1 deletion all/all.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
//
// // Now all ecosystems are available
// ecosystems := registries.SupportedEcosystems()
// // ["brew", "cargo", "clojars", "cocoapods", "composer", "conda", "cpan", "cran", "deno", "dub", "elm", "gem", "golang", "hackage", "haxelib", "helm", "hex", "julia", "luarocks", "maven", "nimble", "npm", "nuget", "pub", "pypi", "swift", "terraform"]
// // ["apk", "brew", "cargo", "clojars", "cocoapods", "composer", "conda", "cpan", "cran", "deno", "dub", "elm", "gem", "golang", "hackage", "haxelib", "helm", "hex", "julia", "luarocks", "maven", "nimble", "npm", "nuget", "pub", "pypi", "swift", "terraform"]
package all

import (
_ "github.com/git-pkgs/registries/internal/apk"
_ "github.com/git-pkgs/registries/internal/cargo"
_ "github.com/git-pkgs/registries/internal/clojars"
_ "github.com/git-pkgs/registries/internal/cocoapods"
Expand Down
29 changes: 29 additions & 0 deletions fetch/apk_resolver_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package fetch

import (
"context"
"testing"

"github.com/git-pkgs/registries"
_ "github.com/git-pkgs/registries/internal/apk"
)

func TestResolveAPK(t *testing.T) {
reg, err := registries.New("apk", "https://dl-cdn.alpinelinux.org/alpine/v3.23/main/x86_64", nil)
if err != nil {
t.Fatal(err)
}
r := NewResolver()
r.RegisterRegistry(reg)

info, err := r.Resolve(context.Background(), "apk", "alpine/curl", "8.22.0-r0")
if err != nil {
t.Fatalf("Resolve failed: %v", err)
}
if want := "https://dl-cdn.alpinelinux.org/alpine/v3.23/main/x86_64/curl-8.22.0-r0.apk"; info.URL != want {
t.Errorf("URL = %q, want %q", info.URL, want)
}
if info.Filename != "curl-8.22.0-r0.apk" {
t.Errorf("Filename = %q", info.Filename)
}
}
Loading
Loading