mirror of
https://github.com/GayPizzaSpecifications/darwin-apk.git
synced 2025-08-03 21:41:31 +00:00
Implement dependency wrapping & version spec
This commit is contained in:
22
Sources/apk/Index/ApkIndexDependency.swift
Normal file
22
Sources/apk/Index/ApkIndexDependency.swift
Normal file
@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
import Foundation
|
||||
|
||||
struct ApkIndexDependency: ApkIndexRequirementRef {
|
||||
let name: String
|
||||
let versionSpec: ApkVersionSpecification
|
||||
|
||||
init(extract: String) throws(ApkRequirement.ParseError) {
|
||||
(self.name, self.versionSpec) = try ApkRequirement.extract(blob: extract)
|
||||
}
|
||||
}
|
||||
|
||||
extension ApkIndexDependency: CustomStringConvertible {
|
||||
var description: String {
|
||||
switch self.versionSpec {
|
||||
case .any: self.name
|
||||
case .conflict: "!\(self.name)"
|
||||
case .constraint(let op, let version): "\(self.name)\(op)\(version)"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user