Skip to content

Commit

Permalink
switch to images/pkg/dnfjson and remove internal copy
Browse files Browse the repository at this point in the history
COMPOSER-2068
  • Loading branch information
diaasami committed Dec 4, 2023
1 parent 7deaa29 commit 96eecda
Show file tree
Hide file tree
Showing 112 changed files with 1,666 additions and 1,542 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@ jobs:
- name: Run unit tests
run: go test -race -covermode=atomic -coverprofile=coverage.txt -coverpkg=$(go list ./... | grep -v rpmmd/test$ | tr "\n" ",") ./...

- name: Run dnfjson tests with force-dnf to make sure it's not skipped for any reason
run: go test -race ./internal/dnfjson/... -force-dnf

- name: Send coverage to codecov.io
run: bash <(curl -s https://codecov.io/bash)

Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ worker-key-pair: ca
.PHONY: unit-tests
unit-tests:
go test -race ./...
go test -race ./internal/dnfjson/... -force-dnf

#
# Building packages
Expand Down
2 changes: 1 addition & 1 deletion cmd/gen-manifests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/osbuild/images/pkg/rhsm/facts"
"github.com/osbuild/images/pkg/rpmmd"

"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/images/pkg/dnfjson"
)

type multiValue []string
Expand Down
2 changes: 1 addition & 1 deletion cmd/mock-dnf-json/dnf-json.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"os"
"strings"

"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/images/pkg/dnfjson"
)

func maybeFail(err error) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/osbuild-composer/composer.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
"github.com/osbuild/osbuild-composer/pkg/jobqueue/dbjobqueue"

"github.com/osbuild/images/pkg/distroregistry"
"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/osbuild-composer/internal/auth"
"github.com/osbuild/osbuild-composer/internal/cloudapi"
v2 "github.com/osbuild/osbuild-composer/internal/cloudapi/v2"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/jobqueue/fsjobqueue"
"github.com/osbuild/osbuild-composer/internal/weldr"
"github.com/osbuild/osbuild-composer/internal/worker"
Expand Down
18 changes: 9 additions & 9 deletions cmd/osbuild-dnf-json-tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/images/pkg/blueprint"
"github.com/osbuild/images/pkg/distro"
rhel "github.com/osbuild/images/pkg/distro/rhel8"
"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/images/pkg/ostree"
"github.com/osbuild/images/pkg/platform"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
)

// This test loads all the repositories available in /repositories directory
Expand Down Expand Up @@ -85,22 +85,22 @@ func TestDepsolvePackageSets(t *testing.T) {

// Set up temporary directory for rpm/dnf cache
dir := t.TempDir()
solver := dnfjson.NewSolver(cs9.ModulePlatformID(), cs9.Releasever(), platform.ARCH_X86_64.String(), cs9.Name(), dir)
solver := dnfjson.NewSolver(cs9.ModulePlatformID(), cs9.Releasever(), arch.ARCH_X86_64.String(), cs9.Name(), dir)

repos, err := rpmmd.LoadRepositories([]string{repoDir}, cs9.Name())
require.NoErrorf(t, err, "Failed to LoadRepositories %v", cs9.Name())
x86Repos, ok := repos[platform.ARCH_X86_64.String()]
require.Truef(t, ok, "failed to get %q repos for %q", platform.ARCH_X86_64.String(), cs9.Name())
x86Repos, ok := repos[arch.ARCH_X86_64.String()]
require.Truef(t, ok, "failed to get %q repos for %q", arch.ARCH_X86_64.String(), cs9.Name())

x86Arch, err := cs9.GetArch(platform.ARCH_X86_64.String())
require.Nilf(t, err, "failed to get %q arch of %q distro", platform.ARCH_X86_64.String(), cs9.Name())
x86Arch, err := cs9.GetArch(arch.ARCH_X86_64.String())
require.Nilf(t, err, "failed to get %q arch of %q distro", arch.ARCH_X86_64.String(), cs9.Name())

qcow2ImageTypeName := "qcow2"
qcow2Image, err := x86Arch.GetImageType(qcow2ImageTypeName)
require.Nilf(t, err, "failed to get %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), platform.ARCH_X86_64.String())
require.Nilf(t, err, "failed to get %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), arch.ARCH_X86_64.String())

manifestSource, _, err := qcow2Image.Manifest(&blueprint.Blueprint{Packages: []blueprint.Package{{Name: "bind"}}}, distro.ImageOptions{}, x86Repos, 0)
require.Nilf(t, err, "failed to initialise manifest for %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), platform.ARCH_X86_64.String())
require.Nilf(t, err, "failed to initialise manifest for %q image type of %q/%q distro/arch", qcow2ImageTypeName, cs9.Name(), arch.ARCH_X86_64.String())
imagePkgSets := manifestSource.GetPackageSetChains()

gotPackageSpecsSets := make(map[string][]rpmmd.PackageSpec, len(imagePkgSets))
Expand Down
4 changes: 2 additions & 2 deletions cmd/osbuild-image-tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"

"github.com/osbuild/images/pkg/platform"
"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/osbuild-composer/cmd/osbuild-image-tests/constants"
"github.com/osbuild/osbuild-composer/internal/boot"
"github.com/osbuild/osbuild-composer/internal/boot/azuretest"
Expand Down Expand Up @@ -410,7 +410,7 @@ func testBootUsingOpenStack(t *testing.T, imagePath string) {
currentArch := common.CurrentArch()

// skip on aarch64 because we don't have aarch64 openstack or kvm machines
if currentArch == platform.ARCH_AARCH64.String() {
if currentArch == arch.ARCH_AARCH64.String() {
t.Skip("Openstack boot test is skipped on aarch64.")
// if no credentials are given, fall back to qemu
} else if (creds == gophercloud.AuthOptions{}) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/osbuild-pipeline/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import (
"github.com/osbuild/images/pkg/container"
"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/distroregistry"
"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/images/pkg/ostree"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/dnfjson"

"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/blueprint"
Expand Down
2 changes: 1 addition & 1 deletion cmd/osbuild-playground/playground.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import (
"path"

"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/images/pkg/image"
"github.com/osbuild/images/pkg/manifest"
"github.com/osbuild/images/pkg/osbuild"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/runner"
)

Expand Down
8 changes: 4 additions & 4 deletions cmd/osbuild-store-dump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import (

"github.com/google/uuid"

"github.com/osbuild/images/pkg/arch"
"github.com/osbuild/images/pkg/distro"
"github.com/osbuild/images/pkg/distro/fedora"
"github.com/osbuild/images/pkg/distroregistry"
"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/images/pkg/manifest"
"github.com/osbuild/images/pkg/platform"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/blueprint"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/store"
"github.com/osbuild/osbuild-composer/internal/target"
)
Expand Down Expand Up @@ -127,7 +127,7 @@ func main() {
awsTarget.OsbuildArtifact.ExportFilename = "image.ami"

d := fedora.NewF37()
a, err := d.GetArch(platform.ARCH_X86_64.String())
a, err := d.GetArch(arch.ARCH_X86_64.String())
if err != nil {
panic(err)
}
Expand All @@ -143,7 +143,7 @@ func main() {
if err != nil {
panic(err)
}
repos := allRepos[platform.ARCH_X86_64.String()]
repos := allRepos[arch.ARCH_X86_64.String()]
homeDir, err := os.UserHomeDir()
if err != nil {
panic("os.UserHomeDir(): " + err.Error())
Expand Down
2 changes: 1 addition & 1 deletion cmd/osbuild-worker/jobimpl-depsolve.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (

"github.com/sirupsen/logrus"

"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/worker"
"github.com/osbuild/osbuild-composer/internal/worker/clienterrors"
)
Expand Down
2 changes: 1 addition & 1 deletion cmd/osbuild-worker/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ import (
"github.com/aws/aws-sdk-go/service/autoscaling"
"github.com/sirupsen/logrus"

"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/osbuild-composer/internal/common"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
"github.com/osbuild/osbuild-composer/internal/upload/azure"
"github.com/osbuild/osbuild-composer/internal/upload/koji"
"github.com/osbuild/osbuild-composer/internal/upload/oci"
Expand Down
28 changes: 14 additions & 14 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/Azure/go-autorest/autorest v0.11.29
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12
github.com/BurntSushi/toml v1.3.2
github.com/aws/aws-sdk-go v1.48.1
github.com/aws/aws-sdk-go v1.48.5
github.com/coreos/go-semver v0.3.1
github.com/coreos/go-systemd v0.0.0-20190719114852-fd7a80b32e1f
github.com/deepmap/oapi-codegen v1.8.2
Expand All @@ -31,7 +31,7 @@ require (
github.com/labstack/gommon v0.4.1
github.com/openshift-online/ocm-sdk-go v0.1.385
github.com/oracle/oci-go-sdk/v54 v54.0.0
github.com/osbuild/images v0.18.0
github.com/osbuild/images v0.20.0
github.com/osbuild/osbuild-composer/pkg/splunk_logger v0.0.0-20231117174845-e969a9dc3cd1
github.com/osbuild/pulp-client v0.1.0
github.com/prometheus/client_golang v1.17.0
Expand All @@ -42,16 +42,16 @@ require (
github.com/ubccr/kerby v0.0.0-20170626144437-201a958fc453
github.com/vmware/govmomi v0.33.1
golang.org/x/exp v0.0.0-20231006140011-7918f672742d
golang.org/x/oauth2 v0.14.0
golang.org/x/oauth2 v0.15.0
golang.org/x/sync v0.5.0
golang.org/x/sys v0.14.0
google.golang.org/api v0.151.0
golang.org/x/sys v0.15.0
google.golang.org/api v0.152.0
)

require (
cloud.google.com/go v0.110.8 // indirect
cloud.google.com/go v0.110.10 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v1.1.3 // indirect
cloud.google.com/go/iam v1.1.5 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.7.2 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.3.0 // indirect
github.com/Azure/go-autorest v14.2.0+incompatible // indirect
Expand Down Expand Up @@ -167,18 +167,18 @@ require (
go.mongodb.org/mongo-driver v1.11.3 // indirect
go.mozilla.org/pkcs7 v0.0.0-20210826202110-33d05740a352 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.15.0 // indirect
golang.org/x/crypto v0.16.0 // indirect
golang.org/x/mod v0.13.0 // indirect
golang.org/x/net v0.18.0 // indirect
golang.org/x/term v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.14.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231016165738-49dd2c1f3d0b // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231030173426-d783a09b4405 // indirect
google.golang.org/genproto v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231106174013-bbf56f31fb17 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect
google.golang.org/grpc v1.59.0 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/go-jose/go-jose.v2 v2.6.1 // indirect
Expand Down
Loading

0 comments on commit 96eecda

Please sign in to comment.