Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions dev-tools/mage/crossbuild.go
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,8 @@ func CrossBuildImage(platform string) (string, error) {
tagSuffix = "s390x"
case strings.HasPrefix(platform, "linux"):
// Use an older version of libc to gain greater OS compatibility.
// Debian 7 uses glibc 2.13.
tagSuffix = "main-debian7"
// Debian 8 uses glibc 2.19.
tagSuffix = "main-debian8"
Comment thread
v1v marked this conversation as resolved.
}

goVersion, err := GoVersion()
Expand Down
97 changes: 0 additions & 97 deletions x-pack/auditbeat/magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ import (
"time"

"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
"github.com/pkg/errors"

auditbeat "github.com/elastic/beats/v7/auditbeat/scripts/mage"
devtools "github.com/elastic/beats/v7/dev-tools/mage"
Expand Down Expand Up @@ -45,9 +43,6 @@ func Build() error {
// GolangCrossBuild build the Beat binary inside of the golang-builder.
// Do not use directly, use crossBuild instead.
func GolangCrossBuild() error {
if d, ok := deps[devtools.Platform.Name]; ok {
mg.Deps(d)
}
return devtools.GolangCrossBuild(devtools.DefaultGolangCrossBuildArgs())
}

Expand Down Expand Up @@ -125,95 +120,3 @@ func ExportDashboard() error {
func Dashboards() error {
return devtools.KibanaDashboards(devtools.OSSBeatDir("module"), "module")
}

// -----------------------------------------------------------------------------
// - Install the librpm-dev package
var (
deps = map[string]func() error{
"linux/386": installLinux386,
"linux/amd64": installLinuxAMD64,
"linux/arm64": installLinuxARM64,
"linux/armv5": installLinuxARMEL,
"linux/armv6": installLinuxARMEL,
"linux/armv7": installLinuxARMHF,
"linux/mips": installLinuxMIPS,
"linux/mipsle": installLinuxMIPSEL,
"linux/mips64le": installLinuxMIPS64EL,
"linux/ppc64le": installLinuxPPC64EL,
"linux/s390x": installLinuxS390X,

//"linux/ppc64": installLinuxPpc64,
//"linux/mips64": installLinuxMips64,
}
)

const (
librpmDevPkgName = "librpm-dev"

// Dependency of librpm-dev in ARM architectures, that needs to be explicitly
// installed to replace other conflicting packages pre-installed in the image.
libicuDevPkgName = "libicu-dev"
)

func installLinuxAMD64() error {
return installDependencies("", librpmDevPkgName)
}

func installLinuxARM64() error {
return installDependencies("arm64", librpmDevPkgName+":arm64")
}

func installLinuxARMHF() error {
return installDependencies("armhf", librpmDevPkgName+":armhf", libicuDevPkgName+":armhf")
}

func installLinuxARMEL() error {
return installDependencies("armel", librpmDevPkgName+":armel", libicuDevPkgName+":armel")
}

func installLinux386() error {
return installDependencies("i386", librpmDevPkgName+":i386")
}

func installLinuxMIPS() error {
return installDependencies("mips", librpmDevPkgName+":mips")
}

func installLinuxMIPS64EL() error {
return installDependencies("mips64el", librpmDevPkgName+":mips64el")
}

func installLinuxMIPSEL() error {
return installDependencies("mispel", librpmDevPkgName+":mipsel")
}

func installLinuxPPC64EL() error {
return installDependencies("ppc64el", librpmDevPkgName+":ppc64el")
}

func installLinuxS390X() error {
return installDependencies("s390x", librpmDevPkgName+":s390x")
}

func installDependencies(arch string, pkgs ...string) error {
if len(pkgs) == 0 {
return nil
}
if arch != "" {
err := sh.Run("dpkg", "--add-architecture", arch)
if err != nil {
return errors.Wrap(err, "error while adding architecture")
}
}

// TODO: This is only for debian 7 and should be removed when move to a newer OS. This flag is
// going to be used unnecessary when building using non-debian7 images
// (like when making the linux/arm binaries) and we should remove it soonish.
// See https://github.com/elastic/beats/v7/issues/11750 for more details.
if err := sh.Run("apt-get", "update", "-o", "Acquire::Check-Valid-Until=false"); err != nil {
return err
}

args := append([]string{"install", "-y", "--no-install-recommends"}, pkgs...)
return sh.Run("apt-get", args...)
}