const semVerDotsCount … type packageManager … // newPackageManager returns the package manager on the running machine, and an // error if no package managers is available. func newPackageManager() (packageManager, error) { … } type dpkg … // newDPKG returns a Debian package manager. It returns (nil, false) if no such // package manager exists on the running machine. func newDPKG() (packageManager, bool) { … } // getPackageVersion returns the upstream package version for the package given // the packageName, and an error if no such package exists. func (dpkg) getPackageVersion(packageName string) (string, error) { … } type packageValidator … // Name returns the name of the package validator. func (validator *packageValidator) Name() string { … } // Validate checks packages and their versions against the spec using the // package manager on the running machine, and returns an error on any // package/version mismatch. func (validator *packageValidator) Validate(spec SysSpec) ([]error, []error) { … } // Validate checks packages and their versions against the packageSpecs using // the packageManager, and returns an error on any package/version mismatch. func (validator *packageValidator) validate(packageSpecs []PackageSpec, manager packageManager) ([]error, []error) { … } // getKernelRelease returns the kernel release of the local machine. func getKernelRelease() (string, error) { … } // getOSDistro returns the OS distro of the local machine. func getOSDistro() (string, error) { … } // resolvePackageName substitutes the variables in the packageName with the // local information. // E.g., "linux-headers-${KERNEL_RELEASE}" -> "linux-headers-4.4.0-75-generic". func resolvePackageName(packageName string, kernelRelease string) string { … } // applyPackageSpecOverride applies the package spec overrides for the given // osDistro to the packageSpecs and returns the applied result. func applyPackageSpecOverride(packageSpecs []PackageSpec, overrides []PackageSpecOverride, osDistro string) []PackageSpec { … } // extractUpstreamVersion returns the upstream version of the given full // version in dpkg format. E.g., "1:1.0.6-2ubuntu2.1" -> "1.0.6". func extractUpstreamVersion(version string) string { … } // toSemVerRange converts the input to a semantic version range. // E.g., // - ">=1.0" -> ">=1.0.x" // - ">=1" -> ">=1.x" // - ">=1 <=2.3" -> ">=1.x <=2.3.x" // - ">1 || >3.1.0 !4.2" -> ">1.x || >3.1.0 !4.2.x" func toSemVerRange(input string) string { … } // toSemVer converts the input to a semantic version, and an empty string on // error. func toSemVer(version string) string { … }