distros but rhel84: exclude packages explicitly mentioned in a blueprint
see the previous commit for further explanation
This commit is contained in:
parent
98dd7d7737
commit
9a0236eb09
5 changed files with 114 additions and 5 deletions
|
|
@ -51,6 +51,19 @@ type imageType struct {
|
|||
assembler func(uefi bool, options distro.ImageOptions, arch distro.Arch) *osbuild.Assembler
|
||||
}
|
||||
|
||||
func removePackage(packages []string, packageToRemove string) []string {
|
||||
for i, pkg := range packages {
|
||||
if pkg == packageToRemove {
|
||||
// override the package with the last one from the list
|
||||
packages[i] = packages[len(packages)-1]
|
||||
|
||||
// drop the last package from the slice
|
||||
return packages[:len(packages)-1]
|
||||
}
|
||||
}
|
||||
return packages
|
||||
}
|
||||
|
||||
func (a *architecture) Distro() distro.Distro {
|
||||
return a.distro
|
||||
}
|
||||
|
|
@ -175,7 +188,18 @@ func (t *imageType) Packages(bp blueprint.Blueprint) ([]string, []string) {
|
|||
packages = append(packages, t.arch.bootloaderPackages...)
|
||||
}
|
||||
|
||||
return packages, t.excludedPackages
|
||||
// copy the list of excluded packages from the image type
|
||||
// and subtract any packages found in the blueprint (this
|
||||
// will not handle the issue with dependencies present in
|
||||
// the list of excluded packages, but it will create a
|
||||
// possibility of a workaround at least)
|
||||
excludedPackages := append([]string(nil), t.excludedPackages...)
|
||||
for _, pkg := range bp.GetPackages() {
|
||||
// removePackage is fine if the package doesn't exist
|
||||
excludedPackages = removePackage(excludedPackages, pkg)
|
||||
}
|
||||
|
||||
return packages, excludedPackages
|
||||
}
|
||||
|
||||
func (t *imageType) BuildPackages() []string {
|
||||
|
|
|
|||
|
|
@ -51,6 +51,19 @@ type imageType struct {
|
|||
assembler func(uefi bool, options distro.ImageOptions, arch distro.Arch) *osbuild.Assembler
|
||||
}
|
||||
|
||||
func removePackage(packages []string, packageToRemove string) []string {
|
||||
for i, pkg := range packages {
|
||||
if pkg == packageToRemove {
|
||||
// override the package with the last one from the list
|
||||
packages[i] = packages[len(packages)-1]
|
||||
|
||||
// drop the last package from the slice
|
||||
return packages[:len(packages)-1]
|
||||
}
|
||||
}
|
||||
return packages
|
||||
}
|
||||
|
||||
func (a *architecture) Distro() distro.Distro {
|
||||
return a.distro
|
||||
}
|
||||
|
|
@ -175,7 +188,18 @@ func (t *imageType) Packages(bp blueprint.Blueprint) ([]string, []string) {
|
|||
packages = append(packages, t.arch.bootloaderPackages...)
|
||||
}
|
||||
|
||||
return packages, t.excludedPackages
|
||||
// copy the list of excluded packages from the image type
|
||||
// and subtract any packages found in the blueprint (this
|
||||
// will not handle the issue with dependencies present in
|
||||
// the list of excluded packages, but it will create a
|
||||
// possibility of a workaround at least)
|
||||
excludedPackages := append([]string(nil), t.excludedPackages...)
|
||||
for _, pkg := range bp.GetPackages() {
|
||||
// removePackage is fine if the package doesn't exist
|
||||
excludedPackages = removePackage(excludedPackages, pkg)
|
||||
}
|
||||
|
||||
return packages, excludedPackages
|
||||
}
|
||||
|
||||
func (t *imageType) BuildPackages() []string {
|
||||
|
|
|
|||
|
|
@ -52,6 +52,19 @@ type imageType struct {
|
|||
assembler func(uefi bool, options distro.ImageOptions, arch distro.Arch) *osbuild.Assembler
|
||||
}
|
||||
|
||||
func removePackage(packages []string, packageToRemove string) []string {
|
||||
for i, pkg := range packages {
|
||||
if pkg == packageToRemove {
|
||||
// override the package with the last one from the list
|
||||
packages[i] = packages[len(packages)-1]
|
||||
|
||||
// drop the last package from the slice
|
||||
return packages[:len(packages)-1]
|
||||
}
|
||||
}
|
||||
return packages
|
||||
}
|
||||
|
||||
func (a *architecture) Distro() distro.Distro {
|
||||
return a.distro
|
||||
}
|
||||
|
|
@ -176,7 +189,19 @@ func (t *imageType) Packages(bp blueprint.Blueprint) ([]string, []string) {
|
|||
if t.bootable {
|
||||
packages = append(packages, t.arch.bootloaderPackages...)
|
||||
}
|
||||
return packages, t.excludedPackages
|
||||
|
||||
// copy the list of excluded packages from the image type
|
||||
// and subtract any packages found in the blueprint (this
|
||||
// will not handle the issue with dependencies present in
|
||||
// the list of excluded packages, but it will create a
|
||||
// possibility of a workaround at least)
|
||||
excludedPackages := append([]string(nil), t.excludedPackages...)
|
||||
for _, pkg := range bp.GetPackages() {
|
||||
// removePackage is fine if the package doesn't exist
|
||||
excludedPackages = removePackage(excludedPackages, pkg)
|
||||
}
|
||||
|
||||
return packages, excludedPackages
|
||||
}
|
||||
|
||||
func (t *imageType) BuildPackages() []string {
|
||||
|
|
|
|||
|
|
@ -71,7 +71,19 @@ func (t *imageTypeS2) Packages(bp blueprint.Blueprint) ([]string, []string) {
|
|||
if timezone != nil {
|
||||
packages = append(packages, "chrony")
|
||||
}
|
||||
return packages, t.packageSets["packages"].Exclude
|
||||
|
||||
// copy the list of excluded packages from the image type
|
||||
// and subtract any packages found in the blueprint (this
|
||||
// will not handle the issue with dependencies present in
|
||||
// the list of excluded packages, but it will create a
|
||||
// possibility of a workaround at least)
|
||||
excludedPackages := append([]string(nil), t.packageSets["packages"].Exclude...)
|
||||
for _, pkg := range bp.GetPackages() {
|
||||
// removePackage is fine if the package doesn't exist
|
||||
excludedPackages = removePackage(excludedPackages, pkg)
|
||||
}
|
||||
|
||||
return packages, excludedPackages
|
||||
}
|
||||
|
||||
func (t *imageTypeS2) BuildPackages() []string {
|
||||
|
|
|
|||
|
|
@ -54,6 +54,19 @@ type imageType struct {
|
|||
assembler func(pt *disk.PartitionTable, options distro.ImageOptions, arch distro.Arch) *osbuild.Assembler
|
||||
}
|
||||
|
||||
func removePackage(packages []string, packageToRemove string) []string {
|
||||
for i, pkg := range packages {
|
||||
if pkg == packageToRemove {
|
||||
// override the package with the last one from the list
|
||||
packages[i] = packages[len(packages)-1]
|
||||
|
||||
// drop the last package from the slice
|
||||
return packages[:len(packages)-1]
|
||||
}
|
||||
}
|
||||
return packages
|
||||
}
|
||||
|
||||
func (a *architecture) Distro() distro.Distro {
|
||||
return a.distro
|
||||
}
|
||||
|
|
@ -195,7 +208,18 @@ func (t *imageType) Packages(bp blueprint.Blueprint) ([]string, []string) {
|
|||
packages = append(packages, t.arch.bootloaderPackages...)
|
||||
}
|
||||
|
||||
return packages, t.excludedPackages
|
||||
// copy the list of excluded packages from the image type
|
||||
// and subtract any packages found in the blueprint (this
|
||||
// will not handle the issue with dependencies present in
|
||||
// the list of excluded packages, but it will create a
|
||||
// possibility of a workaround at least)
|
||||
excludedPackages := append([]string(nil), t.excludedPackages...)
|
||||
for _, pkg := range bp.GetPackages() {
|
||||
// removePackage is fine if the package doesn't exist
|
||||
excludedPackages = removePackage(excludedPackages, pkg)
|
||||
}
|
||||
|
||||
return packages, excludedPackages
|
||||
}
|
||||
|
||||
func (t *imageType) BuildPackages() []string {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue