Add Alpine/apk local repository support
The alpine provider hosted only remote (proxy) repos; there was no way to publish first-party .apk packages the way rpm-local and deb-local already allow. This extends the existing alpine provider into a real apk repository: uploaded .apk files are parsed in pure Go and a per-arch APKINDEX.tar.gz is generated on demand, at parity with rpm repodata and deb Packages generation. - Implement LocalUploader/LocalIndexer/PostUploadHook/PostDeleteHook on the alpine provider, keeping the remote proxy methods intact. - Parse .apk (concatenated gzipped tar streams) in pure Go: read .PKGINFO from the control stream and compute the apk pull checksum C: = Q1+base64(sha1) over the raw control gzip stream (not the whole file). - Generate an unsigned per-arch APKINDEX.tar.gz (clients use --allow-untrusted), applying the same dot-segment normalization as deb for ./<arch>/... requests. - Add AlpineMetadata plus separate Alpine store/reader/deleter interfaces so the rpm/deb metadata interfaces are not widened. - Add the alpine_metadata table and its Insert/Delete/List DB methods. - Add testsupport.MinimalApk plus unit tests (parse, Q1 checksum, per-arch filtering, dot-segment handling, validate) and a dockere2e index test.
This commit is contained in:
@@ -182,6 +182,35 @@ func (db *DB) migrate() error {
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_deb_metadata_repo ON deb_metadata(repo_name);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS alpine_metadata (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
repo_name TEXT NOT NULL,
|
||||
file_path TEXT NOT NULL,
|
||||
content_hash TEXT NOT NULL,
|
||||
checksum TEXT NOT NULL,
|
||||
name TEXT NOT NULL,
|
||||
version TEXT NOT NULL,
|
||||
arch TEXT NOT NULL,
|
||||
download_size BIGINT DEFAULT 0,
|
||||
installed_size BIGINT DEFAULT 0,
|
||||
description TEXT DEFAULT '',
|
||||
url TEXT DEFAULT '',
|
||||
license TEXT DEFAULT '',
|
||||
origin TEXT DEFAULT '',
|
||||
maintainer TEXT DEFAULT '',
|
||||
build_time BIGINT DEFAULT 0,
|
||||
commit_hash TEXT DEFAULT '',
|
||||
provider_priority TEXT DEFAULT '',
|
||||
depends TEXT DEFAULT '',
|
||||
provides TEXT DEFAULT '',
|
||||
install_if TEXT DEFAULT '',
|
||||
created_at TIMESTAMPTZ DEFAULT NOW(),
|
||||
UNIQUE(repo_name, file_path)
|
||||
);
|
||||
|
||||
CREATE INDEX IF NOT EXISTS idx_alpine_metadata_repo ON alpine_metadata(repo_name);
|
||||
CREATE INDEX IF NOT EXISTS idx_alpine_metadata_repo_arch ON alpine_metadata(repo_name, arch);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS github_rpm_sync_state (
|
||||
remote_name TEXT PRIMARY KEY,
|
||||
etag TEXT DEFAULT '',
|
||||
|
||||
Reference in New Issue
Block a user