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 Jan 4, 2024
1 parent 0169b7b commit 9e30ba2
Show file tree
Hide file tree
Showing 26 changed files with 109 additions and 1,156 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
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -313,7 +313,7 @@ func resolvePipelineCommits(commitSources map[string][]ostree.SourceSpec) map[st

func depsolve(cacheDir string, packageSets map[string][]rpmmd.PackageSet, d distro.Distro, arch string) (map[string][]rpmmd.PackageSpec, error) {
solver := dnfjson.NewSolver(d.ModulePlatformID(), d.Releasever(), arch, d.Name(), cacheDir)
solver.SetDNFJSONPath("./dnf-json")
solver.SetDNFJSONPath("/usr/libexec/osbuild-depsolve-dnf")
depsolvedSets := make(map[string][]rpmmd.PackageSpec)
for name, pkgSet := range packageSets {
res, err := solver.Depsolve(pkgSet)
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
2 changes: 1 addition & 1 deletion cmd/osbuild-composer/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ func GetDefaultConfig() *ComposerConfigFile {
},
LogLevel: "info",
LogFormat: "text",
DNFJson: "/usr/libexec/osbuild-composer/dnf-json",
DNFJson: "/usr/libexec/osbuild-depsolve-dnf",
}
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/osbuild-dnf-json-tests/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"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/rpmmd"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
)

// This test loads all the repositories available in /repositories directory
Expand Down
4 changes: 2 additions & 2 deletions 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 Expand Up @@ -54,7 +54,7 @@ type composeRequest struct {
// isn't installed. This prioritises the local source version over the system
// version if run from within the source tree.
func findDnfJsonBin() string {
locations := []string{"./dnf-json", "/usr/libexec/osbuild-composer/dnf-json", "/usr/lib/osbuild-composer/dnf-json"}
locations := []string{"./dnf-json", "/usr/libexec/osbuild-depsolve-dnf", "/usr/lib/osbuild-depsolve-dnf"}
for _, djPath := range locations {
_, err := os.Stat(djPath)
if !os.IsNotExist(err) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/osbuild-playground/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func AddImageType(img image.ImageKind) {
// isn't installed. This prioritises the local source version over the system
// version if run from within the source tree.
func findDnfJsonBin() string {
locations := []string{"./dnf-json", "/usr/libexec/osbuild-composer/dnf-json", "/usr/lib/osbuild-composer/dnf-json"}
locations := []string{"./dnf-json", "/usr/libexec/osbuild-depsolve-dnf", "/usr/lib/osbuild-depsolve-dnf"}
for _, djPath := range locations {
_, err := os.Stat(djPath)
if !os.IsNotExist(err) {
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
2 changes: 1 addition & 1 deletion cmd/osbuild-store-dump/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import (
"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/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
4 changes: 2 additions & 2 deletions cmd/osbuild-worker/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func Test_parseConfig(t *testing.T) {
config: `
# comment
base_path = "/api/image-builder-worker/v1"
dnf-json = "/usr/libexec/dnf-json"
dnf-json = "/usr/libexec/osbuild-depsolve-dnf"
[composer]
proxy = "http://proxy.example.com"
Expand Down Expand Up @@ -72,7 +72,7 @@ server_address = "https://example.com/pulp"
`,
want: &workerConfig{
BasePath: "/api/image-builder-worker/v1",
DNFJson: "/usr/libexec/dnf-json",
DNFJson: "/usr/libexec/osbuild-depsolve-dnf",
Composer: &composerConfig{
Proxy: "http://proxy.example.com",
},
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
1 change: 0 additions & 1 deletion distribution/Dockerfile-ubi
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ RUN mkdir -p "/usr/share/osbuild-composer/"
RUN mkdir -p "/opt/migrate/"
COPY --from=builder /opt/app-root/src/go/bin/osbuild-composer /usr/libexec/osbuild-composer/
COPY ./containers/osbuild-composer/entrypoint.py /opt/entrypoint.py
COPY ./dnf-json /usr/libexec/osbuild-composer/

COPY ./pkg/jobqueue/dbjobqueue/schemas /opt/migrate/schemas
COPY --from=builder2 /opt/app-root/src/go/bin/tern /opt/migrate/
Expand Down
1 change: 0 additions & 1 deletion distribution/Dockerfile-worker
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,5 @@ RUN mkdir -p "/var/cache/osbuild-worker/"
RUN mkdir -p "/var/lib/osbuild-composer/"
RUN mkdir -p "/var/cache/osbuild-composer/output"
COPY --from=builder /opt/app-root/src/go/bin/osbuild-worker /usr/libexec/osbuild-composer/
COPY ./dnf-json /usr/libexec/osbuild-composer/

ENTRYPOINT ["/usr/libexec/osbuild-composer/osbuild-worker"]
2 changes: 1 addition & 1 deletion internal/client/unit_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (

"github.com/osbuild/images/pkg/distro/test_distro"
"github.com/osbuild/images/pkg/distroregistry"
"github.com/osbuild/images/pkg/dnfjson"
"github.com/osbuild/images/pkg/rpmmd"
"github.com/osbuild/osbuild-composer/internal/dnfjson"
dnfjson_mock "github.com/osbuild/osbuild-composer/internal/mocks/dnfjson"
rpmmd_mock "github.com/osbuild/osbuild-composer/internal/mocks/rpmmd"
"github.com/osbuild/osbuild-composer/internal/reporegistry"
Expand Down
Loading

0 comments on commit 9e30ba2

Please sign in to comment.