feat!: introduce new distribution structure
BREAKING CHANGE: distro definition in the configuration files has switched from [[supported_kernels]] distro_type = "Ubuntu" distro_release = "16.04" ... to [[supported_kernels]] distro = { id = "Ubuntu", release = "16.04" } ...
This commit is contained in:
@ -118,7 +118,7 @@ func Match(km config.KernelMask) (pkgs []string, err error) {
|
||||
return
|
||||
}
|
||||
|
||||
release := releaseFromString(km.DistroRelease)
|
||||
release := releaseFromString(km.Distro.Release)
|
||||
|
||||
r := regexp.MustCompile(km.ReleaseMask)
|
||||
|
||||
@ -151,7 +151,7 @@ func Envs(km config.KernelMask) (envs []string) {
|
||||
func ContainerImage(km config.KernelMask) (image string) {
|
||||
image += "debian:"
|
||||
|
||||
switch releaseFromString(km.DistroRelease) {
|
||||
switch releaseFromString(km.Distro.Release) {
|
||||
case Wheezy:
|
||||
image += "wheezy-20190228"
|
||||
case Jessie:
|
||||
@ -159,7 +159,7 @@ func ContainerImage(km config.KernelMask) (image string) {
|
||||
case Stretch:
|
||||
image += "stretch-20220622"
|
||||
default:
|
||||
image += km.DistroRelease
|
||||
image += km.Distro.Release
|
||||
}
|
||||
|
||||
return
|
||||
@ -197,7 +197,7 @@ func repositories(release Release) (repos []string) {
|
||||
}
|
||||
|
||||
func Runs(km config.KernelMask) (commands []string) {
|
||||
release := releaseFromString(km.DistroRelease)
|
||||
release := releaseFromString(km.Distro.Release)
|
||||
|
||||
cmdf := func(f string, s ...interface{}) {
|
||||
commands = append(commands, fmt.Sprintf(f, s...))
|
||||
@ -288,8 +288,7 @@ func ContainerKernels(d container.Image, kcfg *config.KernelConfig) (err error)
|
||||
release := strings.Replace(pkgname, "linux-image-", "", -1)
|
||||
|
||||
ki := config.KernelInfo{
|
||||
DistroType: d.DistroType,
|
||||
DistroRelease: d.DistroRelease,
|
||||
Distro: d.Distro,
|
||||
KernelVersion: path.Base(modules),
|
||||
KernelRelease: release,
|
||||
ContainerName: d.Name,
|
||||
@ -332,7 +331,7 @@ func Install(km config.KernelMask, pkgname string, headers bool) (cmds []string,
|
||||
|
||||
for _, pkg := range pkgs {
|
||||
found, newurl := cache.PackageURL(
|
||||
km.DistroType,
|
||||
km.Distro.ID,
|
||||
pkg.Deb.URL,
|
||||
)
|
||||
if found {
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"code.dumpstack.io/tools/out-of-tree/config"
|
||||
"code.dumpstack.io/tools/out-of-tree/distro"
|
||||
"code.dumpstack.io/tools/out-of-tree/fs"
|
||||
)
|
||||
|
||||
@ -24,8 +25,8 @@ func TestMatch(t *testing.T) {
|
||||
config.Directory = tmp
|
||||
|
||||
km := config.KernelMask{
|
||||
ReleaseMask: "3.2.0-4",
|
||||
DistroRelease: "7",
|
||||
ReleaseMask: "3.2.0-4",
|
||||
Distro: distro.Distro{Release: "7"},
|
||||
}
|
||||
|
||||
pkgs, err := Match(km)
|
||||
|
Reference in New Issue
Block a user