Skip to content

Commit

Permalink
Merge pull request #5271 from slonopotamus/cleanup-linuxisms
Browse files Browse the repository at this point in the history
Cleanup Linux-isms in code
  • Loading branch information
tonistiigi authored Aug 27, 2024
2 parents 11a4a07 + c8c5024 commit b9a3e7b
Show file tree
Hide file tree
Showing 11 changed files with 23 additions and 45 deletions.
8 changes: 0 additions & 8 deletions cmd/buildkitd/constants_unix.go

This file was deleted.

5 changes: 0 additions & 5 deletions cmd/buildkitd/constants_windows.go

This file was deleted.

4 changes: 2 additions & 2 deletions cmd/buildkitd/main_containerd_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func init() {
}

if defaultConf.Workers.Containerd.Address == "" {
defaultConf.Workers.Containerd.Address = defaultContainerdAddress
defaultConf.Workers.Containerd.Address = defaults.DefaultAddress
}

if defaultConf.Workers.Containerd.Namespace == "" {
Expand Down Expand Up @@ -178,7 +178,7 @@ func init() {

func applyContainerdFlags(c *cli.Context, cfg *config.Config) error {
if cfg.Workers.Containerd.Address == "" {
cfg.Workers.Containerd.Address = defaultContainerdAddress
cfg.Workers.Containerd.Address = defaults.DefaultAddress
}

if c.GlobalIsSet("containerd-worker") {
Expand Down
2 changes: 1 addition & 1 deletion hack/Vagrantfile.freebsd13
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Vagrant.configure("2") do |config|
#!/usr/bin/env bash
set -eux -o pipefail
mkdir -p /run/buildkit
daemon -o /vagrant/.tmp/logs/buildkitd /usr/local/bin/buildkitd --addr=unix:///run/buildkit/buildkitd.sock
daemon -o /vagrant/.tmp/logs/buildkitd /usr/local/bin/buildkitd
sleep 3
SHELL
end
Expand Down
17 changes: 0 additions & 17 deletions snapshot/diffapply_freebsd.go

This file was deleted.

3 changes: 0 additions & 3 deletions snapshot/diffapply_unix.go → snapshot/diffapply_linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !windows && !freebsd
// +build !windows,!freebsd

package snapshot

import (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
//go:build windows
// +build windows
//go:build !linux
// +build !linux

package snapshot

import (
"context"
"runtime"

"github.com/containerd/containerd/leases"
"github.com/containerd/containerd/snapshots"
"github.com/pkg/errors"
)

func (sn *mergeSnapshotter) diffApply(_ context.Context, _ Mountable, _ ...Diff) (_ snapshots.Usage, rerr error) {
return snapshots.Usage{}, errors.New("diffApply not yet supported on windows")
return snapshots.Usage{}, errors.New("diffApply not yet supported on " + runtime.GOOS)
}

func needsUserXAttr(_ context.Context, _ Snapshotter, _ leases.Manager) (bool, error) {
return false, errors.New("needs userxattr not supported on windows")
return false, errors.New("needs userxattr not supported on " + runtime.GOOS)
}
3 changes: 0 additions & 3 deletions source/git/source_unix.go → source/git/source_linux.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !windows && !freebsd
// +build !windows,!freebsd

package git

import (
Expand Down
6 changes: 6 additions & 0 deletions util/appdefaults/appdefaults_linux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package appdefaults

const (
Address = "unix:///run/buildkit/buildkitd.sock"
traceSocketPath = "/run/buildkit/otel-grpc.sock"
)
3 changes: 1 addition & 2 deletions util/appdefaults/appdefaults_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import (
)

const (
Address = "unix:///run/buildkit/buildkitd.sock"
Root = "/var/lib/buildkit"
ConfigDir = "/etc/buildkit"
DefaultCNIBinDir = "/opt/cni/bin"
Expand Down Expand Up @@ -82,5 +81,5 @@ func TraceSocketPath(inUserNS bool) string {
return filepath.Join(dirs[0], "buildkit", "otel-grpc.sock")
}
}
return "/run/buildkit/otel-grpc.sock"
return traceSocketPath
}
8 changes: 8 additions & 0 deletions util/appdefaults/appdefaults_unix_nolinux.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//go:build unix && !linux

package appdefaults

const (
Address = "unix:///var/run/buildkit/buildkitd.sock"
traceSocketPath = "/var/run/buildkit/otel-grpc.sock"
)

0 comments on commit b9a3e7b

Please sign in to comment.