blob: e93902d4578f8e322a18fba4675c9c4d26dfa568 [file] [log] [blame]
package dkms
import (
"context"
"cos.googlesource.com/cos/tools.git/src/pkg/gcs"
)
// Status returns the status of a DKMS package.
func Status(pkg *Package) PackageStatus {
if IsInstalled(pkg) {
return Installed
}
if IsBuilt(pkg) {
return Built
}
if IsAdded(pkg) {
return Added
}
return Broken
}
// CachedStatus returns the status of a DKMS package.
// If a module is built or added only in the cache, the module will have a
// status of Built or Added, respectively.
func CachedStatus(ctx context.Context, pkg *Package, cache *gcs.GCSBucket) PackageStatus {
if IsInstalled(pkg) {
return Installed
}
if IsBuilt(pkg) || IsBuiltInCache(ctx, pkg, cache) {
return Built
}
if IsAdded(pkg) || IsAddedInCache(ctx, pkg, cache) {
return Added
}
return Broken
}