Move package set chain collation to the distro package and add repositories to the package sets while returning the package sets from their source, i.e., the ImageType.PackageSets() method. This also removes the concept of "base repositories". There are no longer repositories that are added implicitly to all package sets but instead each package set needs to specify *all* the repositories it will be depsolved against. This paves the way for the requirement we have for building RHEL 7 images with a RHEL 8 build root. The build root package set has to be depsolved against RHEL 8 repositories without any "base repos" included. This is now possible since package sets and repositories are explicitly associated from the start and there is no implicit global repository set. The change requires adding a list of PackageSet names to the core rpmmd.RepoConfig. In the cloud API, repositories that are limited to specific package sets already contain the correct package set names and these are now copied to the internal RepoConfig when converting types in genRepoConfig(). The user-specified repositories are only associated with the payload package sets like before.
46 lines
1 KiB
Go
46 lines
1 KiB
Go
// Simple tool to dump a JSON object containing all package sets for a specific
|
|
// distro x arch x image type.
|
|
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
"flag"
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/osbuild/osbuild-composer/internal/blueprint"
|
|
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
|
)
|
|
|
|
func main() {
|
|
var distroName string
|
|
var archName string
|
|
var imageName string
|
|
|
|
flag.StringVar(&distroName, "distro", "", "Distribution name")
|
|
flag.StringVar(&archName, "arch", "", "Architecture name")
|
|
flag.StringVar(&imageName, "image", "", "Image name")
|
|
flag.Parse()
|
|
|
|
dr := distroregistry.NewDefault()
|
|
|
|
distro := dr.GetDistro(distroName)
|
|
if distro == nil {
|
|
panic(fmt.Errorf("Distro %q does not exist", distro))
|
|
}
|
|
|
|
arch, err := distro.GetArch(archName)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
image, err := arch.GetImageType(imageName)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
encoder := json.NewEncoder(os.Stdout)
|
|
encoder.SetIndent("", " ")
|
|
pkgset := image.PackageSets(blueprint.Blueprint{}, nil)
|
|
_ = encoder.Encode(pkgset)
|
|
}
|