diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2021-07-20 09:51:49 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2021-07-20 13:39:45 +0200 |
| commit | 1d0d9801861138705e655de691d7bb9c8b3aac4b (patch) | |
| tree | dd34c41d4d900e7aed2df6b2f90f6b3cdc612797 /pkg/build/freebsd.go | |
| parent | 2fe31df39f956886ef214b5b028362964aa07a53 (diff) | |
pkg/build: modify builder interface
Modify the `builder` interface in such a way that build method also
returns a struct containing extra information about the build process.
This allows to fetch compiler ID from individual builders. Also, this
makes the `signer` interface obsolete, as this information can also go
into that structure.
Diffstat (limited to 'pkg/build/freebsd.go')
| -rw-r--r-- | pkg/build/freebsd.go | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/pkg/build/freebsd.go b/pkg/build/freebsd.go index f8ac801ea..2d95d2415 100644 --- a/pkg/build/freebsd.go +++ b/pkg/build/freebsd.go @@ -16,7 +16,7 @@ import ( type freebsd struct{} -func (ctx freebsd) build(params Params) error { +func (ctx freebsd) build(params Params) (ImageDetails, error) { confDir := fmt.Sprintf("%v/sys/%v/conf/", params.KernelDir, params.TargetArch) confFile := "SYZKALLER" @@ -38,16 +38,16 @@ options DIAGNOSTIC `) } if err := osutil.WriteFile(filepath.Join(confDir, confFile), config); err != nil { - return err + return ImageDetails{}, err } objPrefix := filepath.Join(params.KernelDir, "obj") if err := ctx.make(params.KernelDir, objPrefix, "kernel-toolchain", "-DNO_CLEAN"); err != nil { - return err + return ImageDetails{}, err } if err := ctx.make(params.KernelDir, objPrefix, "buildkernel", "WITH_EXTRA_TCP_STACKS=", fmt.Sprintf("KERNCONF=%v", confFile)); err != nil { - return err + return ImageDetails{}, err } kernelObjDir := filepath.Join(objPrefix, params.KernelDir, @@ -60,7 +60,7 @@ options DIAGNOSTIC fullSrc := filepath.Join(s.dir, s.src) fullDst := filepath.Join(params.OutputDir, s.dst) if err := osutil.CopyFile(fullSrc, fullDst); err != nil { - return fmt.Errorf("failed to copy %v -> %v: %v", fullSrc, fullDst, err) + return ImageDetails{}, fmt.Errorf("failed to copy %v -> %v: %v", fullSrc, fullDst, err) } } @@ -105,9 +105,9 @@ sudo mdconfig -d -u ${md#md} `, objPrefix, params.KernelDir, confFile) if debugOut, err := osutil.RunCmd(10*time.Minute, params.OutputDir, "/bin/sh", "-c", script); err != nil { - return fmt.Errorf("error copying kernel: %v\n%v", err, debugOut) + return ImageDetails{}, fmt.Errorf("error copying kernel: %v\n%v", err, debugOut) } - return nil + return ImageDetails{}, nil } func (ctx freebsd) clean(kernelDir, targetArch string) error { |
