From 4ef4112a1203d87573a7a1ef18a69829b731a81d Mon Sep 17 00:00:00 2001 From: Martin Sehnoutka Date: Tue, 22 Oct 2019 13:50:07 +0200 Subject: [PATCH] Adjust AMI output to the Lorax one --- internal/blueprint/ami_output.go | 29 ++++++++++++++++++- internal/blueprint/blueprint_test.go | 5 +++- .../pipelines/ami_empty_blueprint.json | 12 ++++---- 3 files changed, 39 insertions(+), 7 deletions(-) diff --git a/internal/blueprint/ami_output.go b/internal/blueprint/ami_output.go index 2402079af..ace9be7d0 100644 --- a/internal/blueprint/ami_output.go +++ b/internal/blueprint/ami_output.go @@ -5,7 +5,34 @@ import "github.com/osbuild/osbuild-composer/internal/pipeline" type amiOutput struct{} func (t *amiOutput) translate(b *Blueprint) *pipeline.Pipeline { - p := getF30Pipeline() + p := &pipeline.Pipeline{ + BuildPipeline: getF30BuildPipeline(), + } + + options := &pipeline.DNFStageOptions{ + ReleaseVersion: "30", + BaseArchitecture: "x86_64", + } + options.AddRepository(getF30Repository()) + packages := [...]string{ + "@Core", + "chrony", + "kernel", + "selinux-policy-targeted", + "grub2-pc", + "langpacks-en", + "libxcrypt-compat", + "xfsprogs", + "cloud-init", + "checkpolicy", + "net-tools", + } + for _, pkg := range packages { + options.AddPackage(pkg) + } + p.AddStage(pipeline.NewDNFStage(options)) + addF30FixBlsStage(p) + addF30LocaleStage(p) addF30FSTabStage(p) addF30GRUB2Stage(p) addF30SELinuxStage(p) diff --git a/internal/blueprint/blueprint_test.go b/internal/blueprint/blueprint_test.go index 974ca14bf..652a4d6e0 100644 --- a/internal/blueprint/blueprint_test.go +++ b/internal/blueprint/blueprint_test.go @@ -149,7 +149,10 @@ func TestBlueprint_ToPipeline(t *testing.T) { } if !tt.wantErr { if !reflect.DeepEqual(got, &want) { - t.Errorf("Blueprint.ToPipeline() = %v, want %v", got, &want) + // Without this the "difference" is just a list of pointers. + gotJson, _ := json.Marshal(got) + fileJson, _ := json.Marshal(want) + t.Errorf("Blueprint.ToPipeline() =\n%v,\nwant =\n%v", string(gotJson), string(fileJson)) } } }) diff --git a/internal/blueprint/pipelines/ami_empty_blueprint.json b/internal/blueprint/pipelines/ami_empty_blueprint.json index fec552f49..40d0dd910 100644 --- a/internal/blueprint/pipelines/ami_empty_blueprint.json +++ b/internal/blueprint/pipelines/ami_empty_blueprint.json @@ -43,10 +43,12 @@ "kernel", "selinux-policy-targeted", "grub2-pc", - "spice-vdagent", - "qemu-guest-agent", - "xen-libs", - "langpacks-en" + "langpacks-en", + "libxcrypt-compat", + "xfsprogs", + "cloud-init", + "checkpolicy", + "net-tools" ], "releasever": "30", "basearch": "x86_64" @@ -102,4 +104,4 @@ "size": 3221225472 } } -} +} \ No newline at end of file