print full fetch url

This commit is contained in:
2024-11-17 02:52:30 +11:00
parent 8c7f0f23d5
commit 20e76918fe
2 changed files with 4 additions and 5 deletions

View File

@ -45,7 +45,7 @@ public extension ApkIndex {
} }
local = URL(filePath: repository.localName) local = URL(filePath: repository.localName)
case .update: case .update:
print("Fetching \"\(repository.name)\"") print("Fetching \"\(repository.resolved)\"")
local = try await ApkIndexDownloader.fetch(repository: repository) local = try await ApkIndexDownloader.fetch(repository: repository)
} }
let index = try ApkIndex(readFrom: local) let index = try ApkIndex(readFrom: local)

View File

@ -14,9 +14,8 @@ public struct ApkIndexRepository: Sendable {
private static func resolveApkIndex(_ repo: String, _ arch: String) private static func resolveApkIndex(_ repo: String, _ arch: String)
-> String { "\(repo)/\(arch)/APKINDEX.tar.gz" } -> String { "\(repo)/\(arch)/APKINDEX.tar.gz" }
public var url: URL { public var resolved: String { Self.resolveApkIndex(self.name, self.arch) }
URL(string: Self.resolveApkIndex(self.name, self.arch))! public var url: URL { URL(string: self.resolved)! }
}
public var localName: String { "APKINDEX.\(discriminator).tar.gz" } public var localName: String { "APKINDEX.\(discriminator).tar.gz" }
@ -25,6 +24,6 @@ public struct ApkIndexRepository: Sendable {
self.arch = arch self.arch = arch
let urlSHA1Digest = Data(Insecure.SHA1.hash(data: Data(Self.resolveApkIndex(repo, arch).utf8))) let urlSHA1Digest = Data(Insecure.SHA1.hash(data: Data(Self.resolveApkIndex(repo, arch).utf8)))
self.discriminator = urlSHA1Digest.subdata(in: 0..<3).map { String(format: "%02x", $0) }.joined() self.discriminator = urlSHA1Digest.subdata(in: 0..<4).map { String(format: "%02x", $0) }.joined()
} }
} }