uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,60 @@
{ lib, buildGoModule, fetchFromGitLab, fetchurl }:
let
version = "15.0.0";
in
buildGoModule rec {
inherit version;
pname = "gitlab-runner";
commonPackagePath = "gitlab.com/gitlab-org/gitlab-runner/common";
ldflags = [
"-X ${commonPackagePath}.NAME=gitlab-runner"
"-X ${commonPackagePath}.VERSION=${version}"
"-X ${commonPackagePath}.REVISION=v${version}"
];
vendorSha256 = "0ag3pmcrxksgikdcvl9rv2s3kn7l0dj41pf2m9dq0g2a1j45nydn";
src = fetchFromGitLab {
owner = "gitlab-org";
repo = "gitlab-runner";
rev = "v${version}";
sha256 = "1s7jqhrwy5wl0db37d3pms499mmy7msx4ch46w5qa25nfbxcr07c";
};
patches = [
./fix-shell-path.patch
./remove-bash-test.patch
];
prePatch = ''
# Remove some tests that can't work during a nix build
# Requires to run in a git repo
sed -i "s/func TestCacheArchiverAddingUntrackedFiles/func OFF_TestCacheArchiverAddingUntrackedFiles/" commands/helpers/file_archiver_test.go
sed -i "s/func TestCacheArchiverAddingUntrackedUnicodeFiles/func OFF_TestCacheArchiverAddingUntrackedUnicodeFiles/" commands/helpers/file_archiver_test.go
# No writable developer environment
rm common/build_test.go
rm executors/custom/custom_test.go
# No docker during build
rm executors/docker/terminal_test.go
rm executors/docker/docker_test.go
rm helpers/docker/auth/auth_test.go
'';
preCheck = ''
# Make the tests pass outside of GitLab CI
export CI=0
'';
meta = with lib; {
description = "GitLab Runner the continuous integration executor of GitLab";
license = licenses.mit;
homepage = "https://about.gitlab.com/gitlab-ci/";
platforms = platforms.unix ++ platforms.darwin;
maintainers = with maintainers; [ bachp zimbatm globin yayayayaka ];
};
}

View file

@ -0,0 +1,25 @@
diff --git a/shells/bash.go b/shells/bash.go
index 18d608445..f158ffc0b 100644
--- a/shells/bash.go
+++ b/shells/bash.go
@@ -3,6 +3,7 @@ package shells
import (
"bytes"
"fmt"
+ "os/exec"
"path"
"runtime"
"strconv"
@@ -307,7 +308,11 @@ func (b *BashShell) GetConfiguration(info common.ShellScriptInfo) (*common.Shell
script.Command = "su"
if runtime.GOOS == OSLinux {
- script.Arguments = []string{"-s", "/bin/" + b.Shell, info.User, "-c", script.CmdLine}
+ shellPath, err := exec.LookPath(b.Shell)
+ if err != nil {
+ shellPath = "/bin/" + b.Shell
+ }
+ script.Arguments = []string{"-s", shellPath, info.User, "-c", script.CmdLine}
} else {
script.Arguments = []string{info.User, "-c", script.CmdLine}
}

View file

@ -0,0 +1,80 @@
diff --git a/shells/bash_test.go b/shells/bash_test.go
index b8a48f85e..0e3173fc3 100644
--- a/shells/bash_test.go
+++ b/shells/bash_test.go
@@ -4,12 +4,9 @@
package shells
import (
- "runtime"
"testing"
"github.com/stretchr/testify/assert"
- "github.com/stretchr/testify/require"
- "gitlab.com/gitlab-org/gitlab-runner/common"
)
func TestBash_CommandShellEscapesLegacy(t *testing.T) {
@@ -84,62 +81,3 @@ func TestBash_CheckForErrors(t *testing.T) {
})
}
}
-
-func TestBash_GetConfiguration(t *testing.T) {
- tests := map[string]struct {
- info common.ShellScriptInfo
- cmd string
- args []string
- os string
- }{
- `bash`: {
- info: common.ShellScriptInfo{Shell: "bash", Type: common.NormalShell},
- cmd: "bash",
- },
- `bash -l`: {
- info: common.ShellScriptInfo{Shell: "bash", Type: common.LoginShell},
- cmd: "bash",
- args: []string{"-l"},
- },
- `su -s /bin/bash foobar -c bash`: {
- info: common.ShellScriptInfo{Shell: "bash", User: "foobar", Type: common.NormalShell},
- cmd: "su",
- args: []string{"-s", "/bin/bash", "foobar", "-c", "bash"},
- os: OSLinux,
- },
- `su -s /bin/bash foobar -c $'bash -l'`: {
- info: common.ShellScriptInfo{Shell: "bash", User: "foobar", Type: common.LoginShell},
- cmd: "su",
- args: []string{"-s", "/bin/bash", "foobar", "-c", "bash -l"},
- os: OSLinux,
- },
- `su -s /bin/sh foobar -c $'sh -l'`: {
- info: common.ShellScriptInfo{Shell: "sh", User: "foobar", Type: common.LoginShell},
- cmd: "su",
- args: []string{"-s", "/bin/sh", "foobar", "-c", "sh -l"},
- os: OSLinux,
- },
- `su foobar -c $'bash -l'`: {
- info: common.ShellScriptInfo{Shell: "bash", User: "foobar", Type: common.LoginShell},
- cmd: "su",
- args: []string{"foobar", "-c", "bash -l"},
- os: "darwin",
- },
- }
-
- for tn, tc := range tests {
- t.Run(tn, func(t *testing.T) {
- if tc.os != "" && tc.os != runtime.GOOS {
- t.Skipf("test only runs on %s", tc.os)
- }
-
- sh := BashShell{Shell: tc.info.Shell}
- config, err := sh.GetConfiguration(tc.info)
- require.NoError(t, err)
-
- assert.Equal(t, tc.cmd, config.Command)
- assert.Equal(t, tc.args, config.Arguments)
- assert.Equal(t, tn, config.CmdLine)
- })
- }
-}