-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Package marking is enabled per image type and propagated down to the OS pipeline where package marking is performed. We only enable package marking for Fedora and only for version 39 and up (rawhide, at time of writing). This is due to: not wanting to deal with modularity (will be removed in f39), only wanting to deal with dnf5 (will be the default in f39).
- Loading branch information
Showing
24 changed files
with
14,296 additions
and
13,158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package osbuild | ||
|
||
import ( | ||
"sort" | ||
"strings" | ||
|
||
"github.com/osbuild/images/internal/common" | ||
"github.com/osbuild/images/pkg/rpmmd" | ||
) | ||
|
||
type DNFMarkStagePackageOptions struct { | ||
Name string `json:"name"` | ||
Mark string `json:"mark"` | ||
Group string `json:"group,omitempty"` | ||
} | ||
|
||
type DNFMarkStageOptions struct { | ||
Packages []DNFMarkStagePackageOptions `json:"packages"` | ||
} | ||
|
||
func (o DNFMarkStageOptions) isStageOptions() {} | ||
|
||
func (o DNFMarkStageOptions) validate() error { | ||
return nil | ||
} | ||
|
||
func NewDNFMarkStageOptions(packages []DNFMarkStagePackageOptions) *DNFMarkStageOptions { | ||
return &DNFMarkStageOptions{ | ||
Packages: packages, | ||
} | ||
} | ||
|
||
type DNFMarkStage struct { | ||
} | ||
|
||
func NewDNFMarkStage(options *DNFMarkStageOptions) *Stage { | ||
if err := options.validate(); err != nil { | ||
panic(err) | ||
} | ||
|
||
return &Stage{ | ||
Type: "org.osbuild.dnf.mark", | ||
Options: options, | ||
} | ||
} | ||
|
||
func NewDNFMarkStageFromPackageSetChain(packageSetChain []rpmmd.PackageSet) *Stage { | ||
var packages []DNFMarkStagePackageOptions | ||
var packageNames []string | ||
|
||
for _, ps := range packageSetChain { | ||
for _, pn := range ps.Include { | ||
// XXX dirty hack until I figure out how to do | ||
// XXX group support | ||
if strings.HasPrefix(pn, "@") { | ||
continue | ||
} | ||
|
||
// Make sure we don't mark packages multiple times | ||
if !common.IsStringInSortedSlice(packageNames, pn) { | ||
|
||
packageNames = append(packageNames, pn) | ||
sort.Strings(packageNames) | ||
|
||
packages = append(packages, DNFMarkStagePackageOptions{ | ||
Name: pn, | ||
Mark: "user", | ||
}) | ||
} | ||
} | ||
} | ||
|
||
options := NewDNFMarkStageOptions(packages) | ||
|
||
return NewDNFMarkStage(options) | ||
} |
Oops, something went wrong.