osbuild: add RPM stage type
This is the replacement for the DNF stage, containing only GPG keys and package checksums. It is meant to be used together with the files source to actually fetch the packages. Depsolving must be done in composer and the full package list inserted into the pipeline. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
3b774e0e6d
commit
7f97401ef8
3 changed files with 51 additions and 5 deletions
21
internal/osbuild/rpm_stage.go
Normal file
21
internal/osbuild/rpm_stage.go
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package osbuild
|
||||
|
||||
// The RPMStageOptions describe the operations of the RPM stage.
|
||||
//
|
||||
// The RPM stage installs a given set of packages, identified by their
|
||||
// content hash. This ensures that given a set of RPM stage options,
|
||||
// the output is be reproducible, if the underlying tools are.
|
||||
type RPMStageOptions struct {
|
||||
GPGKeys []string `json:"gpgkeys,omitempty"`
|
||||
Packages []string `json:"packages"`
|
||||
}
|
||||
|
||||
func (RPMStageOptions) isStageOptions() {}
|
||||
|
||||
// NewRPMStage creates a new RPM stage.
|
||||
func NewRPMStage(options *RPMStageOptions) *Stage {
|
||||
return &Stage{
|
||||
Name: "org.osbuild.rpm",
|
||||
Options: options,
|
||||
}
|
||||
}
|
||||
|
|
@ -62,6 +62,8 @@ func (stage *Stage) UnmarshalJSON(data []byte) error {
|
|||
options = new(KeymapStageOptions)
|
||||
case "org.osbuild.firewall":
|
||||
options = new(FirewallStageOptions)
|
||||
case "org.osbuild.rpm":
|
||||
options = new(RPMStageOptions)
|
||||
case "org.osbuild.systemd":
|
||||
options = new(SystemdStageOptions)
|
||||
case "org.osbuild.script":
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ import (
|
|||
)
|
||||
|
||||
func TestStage_UnmarshalJSON(t *testing.T) {
|
||||
null_uuid := uuid.MustParse("00000000-0000-0000-0000-000000000000")
|
||||
nullUUID := uuid.MustParse("00000000-0000-0000-0000-000000000000")
|
||||
type fields struct {
|
||||
Name string
|
||||
Options StageOptions
|
||||
|
|
@ -117,7 +117,7 @@ func TestStage_UnmarshalJSON(t *testing.T) {
|
|||
fields: fields{
|
||||
Name: "org.osbuild.grub2",
|
||||
Options: &GRUB2StageOptions{
|
||||
RootFilesystemUUID: null_uuid,
|
||||
RootFilesystemUUID: nullUUID,
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
|
|
@ -129,7 +129,7 @@ func TestStage_UnmarshalJSON(t *testing.T) {
|
|||
fields: fields{
|
||||
Name: "org.osbuild.grub2",
|
||||
Options: &GRUB2StageOptions{
|
||||
RootFilesystemUUID: null_uuid,
|
||||
RootFilesystemUUID: nullUUID,
|
||||
UEFI: &GRUB2UEFI{
|
||||
Vendor: "vendor",
|
||||
},
|
||||
|
|
@ -144,8 +144,8 @@ func TestStage_UnmarshalJSON(t *testing.T) {
|
|||
fields: fields{
|
||||
Name: "org.osbuild.grub2",
|
||||
Options: &GRUB2StageOptions{
|
||||
RootFilesystemUUID: null_uuid,
|
||||
BootFilesystemUUID: &null_uuid,
|
||||
RootFilesystemUUID: nullUUID,
|
||||
BootFilesystemUUID: &nullUUID,
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
|
|
@ -182,6 +182,29 @@ func TestStage_UnmarshalJSON(t *testing.T) {
|
|||
data: []byte(`{"name":"org.osbuild.locale","options":{"language":""}}`),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "rpm-empty",
|
||||
fields: fields{
|
||||
Name: "org.osbuild.rpm",
|
||||
Options: &RPMStageOptions{},
|
||||
},
|
||||
args: args{
|
||||
data: []byte(`{"name":"org.osbuild.rpm","options":{"packages":null}}`),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "rpm",
|
||||
fields: fields{
|
||||
Name: "org.osbuild.rpm",
|
||||
Options: &RPMStageOptions{
|
||||
GPGKeys: []string{"key1", "key2"},
|
||||
Packages: []string{"checksum1", "checksum2"},
|
||||
},
|
||||
},
|
||||
args: args{
|
||||
data: []byte(`{"name":"org.osbuild.rpm","options":{"gpgkeys":["key1","key2"],"packages":["checksum1","checksum2"]}}`),
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "script",
|
||||
fields: fields{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue