-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: David Roman <[email protected]>
- Loading branch information
Showing
3 changed files
with
131 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
DIST fan2go-0.8.1-vendor.tar.xz 2062496 BLAKE2B 7518b55ea01f9aeb4563ade1d24d79a5a4c64b573d53c72a1fa72e9de0ee05db82daee509e5a5e2a35d0b21916136901d5104c353d538bc8ea40a2f950c9f29e SHA512 8c1ffdeb9146de3a70ae8730180ddb7766b9d8123a4e34c740902d8f65ac82a46519f3adfa79d05a408d578e2d155aee5a1a8f8c0537a69e5d01a58bd68c2cf3 | ||
DIST fan2go-0.8.1.tar.gz 200094 BLAKE2B f649ad32466a636682a4cd02d03db2b0b9e4c3692611eede5e38ee0a93dd8c2d848467bd101cfca7b1a3765045269f8f832c574023151b65e80f0060c758f56b SHA512 eab8b0ff0f45a98c086fac8530a48ed3bb892cf80bd03fce9e4f6806ed7bbd3edd0d82e715bd9330f3083a69b1afbe236a0925cc752f2dcae643f63163317354 | ||
DIST fan2go-0.9.0-vendor.tar.xz 2429896 BLAKE2B 02ac2b8d224ff214c807d168a6d096c52f808afae978c66e454cd2812deac4667bcf9a858103fcc6c5c712e5c90880461ca118b2d6f17f61c8a7514cb4d6898a SHA512 091025437685d2ad8dbb1f93aa4ddd097146b38e83d7b48058b7f01e8c1316e5a0e8f19fd1bc44953c911a61e897f9edd43d30261d6d50d831eec578b8ffaaf5 | ||
DIST fan2go-0.9.0.tar.gz 196986 BLAKE2B a8f44354ad94e4535168bd27dfd71c9661ed75b1db2b92d4e563f1a21eebf2d32ed87392aec719b27705b23fecebc9e4c72297d158a629a9e1c4cebeb034e17a SHA512 86b5658e2a4e1b20ac2b3d031c3308e62c0820d1fb0da2fcc4ce8b3bf6bf96ac5e587fe290cd82bcd99315f7561ca2e82907dcf88161729a355cca2b327b181a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Copyright 1999-2022 Gentoo Authors | ||
# Distributed under the terms of the GNU General Public License v2 | ||
|
||
EAPI=8 | ||
|
||
inherit go-module shell-completion systemd | ||
|
||
DESCRIPTION="A simple daemon providing dynamic fan speed control" | ||
HOMEPAGE="https://github.com/markusressel/fan2go" | ||
SRC_URI="https://github.com/markusressel/${PN}/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz" | ||
SRC_URI+=" https://gentoo.kropotkin.rocks/go-pkgs/${P}-vendor.tar.xz" | ||
|
||
LICENSE="AGPL-3 Apache-2.0 MIT BSD BSD-2 MIT MPL-2.0" | ||
SLOT="0" | ||
KEYWORDS="~amd64" | ||
|
||
DEPEND="sys-apps/lm-sensors" | ||
RDEPEND="${DEPEND}" | ||
|
||
PATCHES=( "${FILESDIR}/${P}-fix-tests.patch" ) | ||
|
||
src_compile() { | ||
SOURCE_DATE_EPOCH=$(date +%s || die) | ||
DATE=$(date -u -d @${SOURCE_DATE_EPOCH} +"%Y-%m-%dT%H:%M:%SZ" || die) | ||
|
||
ego \ | ||
build \ | ||
-o fan2go \ | ||
-x \ | ||
-v \ | ||
${GOFLAGS} \ | ||
-ldflags "-X fan2go/cmd.version=${PV} -X fan2go/cmd.date=${DATE}" \ | ||
-a \ | ||
-tags netgo \ | ||
. | ||
|
||
./fan2go completion fish > fan2go.fish || die | ||
./fan2go completion bash > fan2go.bash || die | ||
./fan2go completion zsh > fan2go.zsh || die | ||
} | ||
|
||
src_install() { | ||
dobin fan2go | ||
dodoc README.md | ||
systemd_dounit fan2go.service | ||
insinto /etc/fan2go | ||
doins fan2go.yaml | ||
newbashcomp "${PN}.bash" "${PN}" | ||
dofishcomp "${PN}.fish" | ||
newzshcomp "${PN}.zsh" "_${PN}" | ||
} | ||
|
||
src_test() { | ||
ego test -v ./... || die | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
diff --git a/internal/fans/cmd_test.go b/internal/fans/cmd_test.go | ||
index cb94f26..1a086e9 100644 | ||
--- a/internal/fans/cmd_test.go | ||
+++ b/internal/fans/cmd_test.go | ||
@@ -5,8 +5,15 @@ import ( | ||
"github.com/markusressel/fan2go/internal/util" | ||
"github.com/stretchr/testify/assert" | ||
"testing" | ||
+ "os/exec" | ||
) | ||
|
||
+func getEchoPath() string { | ||
+ // unlikely to fail | ||
+ p, _ := exec.LookPath("echo") | ||
+ return p | ||
+} | ||
+ | ||
func TestCmdFan_NewFan(t *testing.T) { | ||
// GIVEN | ||
config := configuration.FanConfig{ | ||
@@ -132,7 +139,7 @@ func TestCmdFan_GetRpm(t *testing.T) { | ||
config := configuration.FanConfig{ | ||
Cmd: &configuration.CmdFanConfig{ | ||
GetRpm: &configuration.ExecConfig{ | ||
- Exec: "/usr/bin/echo", | ||
+ Exec: getEchoPath(), | ||
Args: []string{"1000"}, | ||
}, | ||
}, | ||
@@ -171,7 +178,7 @@ func TestCmdFan_GetRpm_ParseError(t *testing.T) { | ||
config := configuration.FanConfig{ | ||
Cmd: &configuration.CmdFanConfig{ | ||
GetRpm: &configuration.ExecConfig{ | ||
- Exec: "/usr/bin/echo", | ||
+ Exec: getEchoPath(), | ||
Args: []string{"not_a_number"}, | ||
}, | ||
}, | ||
@@ -226,7 +233,7 @@ func TestCmdFan_GetRpmAvg(t *testing.T) { | ||
config := configuration.FanConfig{ | ||
Cmd: &configuration.CmdFanConfig{ | ||
GetRpm: &configuration.ExecConfig{ | ||
- Exec: "/usr/bin/echo", | ||
+ Exec: getEchoPath(), | ||
Args: []string{"1000"}, | ||
}, | ||
}, | ||
@@ -262,7 +269,7 @@ func TestCmdFan_GetPwm(t *testing.T) { | ||
config := configuration.FanConfig{ | ||
Cmd: &configuration.CmdFanConfig{ | ||
GetPwm: &configuration.ExecConfig{ | ||
- Exec: "/usr/bin/echo", | ||
+ Exec: getEchoPath(), | ||
Args: []string{"255"}, | ||
}, | ||
}, | ||
@@ -282,7 +289,7 @@ func TestCmdFan_SetPwm(t *testing.T) { | ||
config := configuration.FanConfig{ | ||
Cmd: &configuration.CmdFanConfig{ | ||
SetPwm: &configuration.ExecConfig{ | ||
- Exec: "/usr/bin/echo", | ||
+ Exec: getEchoPath(), | ||
Args: []string{"%pwm%"}, | ||
}, | ||
}, | ||
@@ -476,7 +483,7 @@ func TestCmdFan_Supports_RpmSensor_True(t *testing.T) { | ||
config := configuration.FanConfig{ | ||
Cmd: &configuration.CmdFanConfig{ | ||
GetRpm: &configuration.ExecConfig{ | ||
- Exec: "/usr/bin/echo", | ||
+ Exec: getEchoPath(), | ||
Args: []string{"1000"}, | ||
}, | ||
}, |