Remove all the internal package that are now in the github.com/osbuild/images package and vendor it. A new function in internal/blueprint/ converts from an osbuild-composer blueprint to an images blueprint. This is necessary for keeping the blueprint implementation in both packages. In the future, the images package will change the blueprint (and most likely rename it) and it will only be part of the osbuild-composer internals and interface. The Convert() function will be responsible for converting the blueprint into the new configuration object.
60 lines
1.3 KiB
Go
60 lines
1.3 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/images/pkg/distro"
|
|
"github.com/osbuild/images/pkg/distroregistry"
|
|
"github.com/osbuild/images/pkg/ostree"
|
|
)
|
|
|
|
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()
|
|
|
|
if distroName == "" || archName == "" || imageName == "" {
|
|
flag.Usage()
|
|
os.Exit(1)
|
|
}
|
|
|
|
dr := distroregistry.NewDefault()
|
|
|
|
d := dr.GetDistro(distroName)
|
|
if d == nil {
|
|
panic(fmt.Errorf("Distro %q does not exist", distroName))
|
|
}
|
|
|
|
arch, err := d.GetArch(archName)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
image, err := arch.GetImageType(imageName)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
encoder := json.NewEncoder(os.Stdout)
|
|
encoder.SetIndent("", " ")
|
|
options := distro.ImageOptions{
|
|
OSTree: &ostree.ImageOptions{
|
|
URL: "https://example.com", // required by some image types
|
|
},
|
|
}
|
|
manifest, _, err := image.Manifest(nil, options, nil, 0)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
_ = encoder.Encode(manifest.GetPackageSetChains())
|
|
}
|