-
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. The package marking information is output by `dnf-json` based on what `dnf` gave as reasons during the depsolve transactions. This is stored on the `rpmmd.PackageSpec`. Note that we currently output 'user' for any 'group'-installed package. There's also a bit of complication here; as `dnf-json` does chain depsolving it marks all packages from the previous transaction for `install`. This leads to all packages from the previous transaction being marked as `user`-installed. To circumvent this we keep track of the reasons a package was selected and the oldest one wins.
- Loading branch information
Showing
9 changed files
with
243 additions
and
114 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
Large diffs are not rendered by default.
Oops, something went wrong.
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,56 @@ | ||
package osbuild | ||
|
||
import ( | ||
"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 NewDNFMarkStageFromPackageSpecs(packageSpecs []rpmmd.PackageSpec) *Stage { | ||
var packages []DNFMarkStagePackageOptions | ||
|
||
for _, ps := range packageSpecs { | ||
packages = append(packages, DNFMarkStagePackageOptions{ | ||
Name: ps.Name, | ||
Mark: ps.Reason, | ||
}) | ||
} | ||
|
||
options := NewDNFMarkStageOptions(packages) | ||
|
||
return NewDNFMarkStage(options) | ||
} |
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