mirror of
https://github.com/awalsh128/cache-apt-pkgs-action.git
synced 2026-06-16 04:04:53 +00:00
fix: handle apt showpkg warnings
This commit is contained in:
parent
fe5b289324
commit
5513791f75
|
|
@ -11,9 +11,9 @@ EXECUTION-OBJ-END
|
|||
2025/03/15 22:29:14 EXECUTION-OBJ-START
|
||||
{
|
||||
"Cmd": "apt-cache showpkg libvips",
|
||||
"Stdout": "libvips42 8.9.1-2 (= )\n",
|
||||
"Stdout": "Package: libvips\nReverse Provides:\nlibvips42 8.9.1-2 (= )\n",
|
||||
"Stderr": "",
|
||||
"CombinedOut": "libvips42 8.9.1-2 (= )\n",
|
||||
"CombinedOut": "Package: libvips\nReverse Provides:\nlibvips42 8.9.1-2 (= )\n",
|
||||
"ExitCode": 0
|
||||
}
|
||||
EXECUTION-OBJ-END
|
||||
|
|
|
|||
|
|
@ -53,6 +53,9 @@ func getNonVirtualPackage(executor exec.Executor, name string) (pkg *AptPackage,
|
|||
if !inReverseProvides || strings.HasPrefix(trimmed, "W: ") || isErrLine(trimmed) {
|
||||
continue
|
||||
}
|
||||
if strings.HasSuffix(trimmed, ":") {
|
||||
break
|
||||
}
|
||||
splitLine := GetSplitLine(trimmed, " ", 3)
|
||||
if len(splitLine.Words) < 2 {
|
||||
continue
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ import (
|
|||
execpkg "awalsh128.com/cache-apt-pkgs-action/src/internal/exec"
|
||||
)
|
||||
|
||||
type stubExecutor struct {
|
||||
type mockExecutor struct {
|
||||
executions map[string]*execpkg.Execution
|
||||
}
|
||||
|
||||
func (s stubExecutor) Exec(name string, arg ...string) *execpkg.Execution {
|
||||
func (s mockExecutor) Exec(name string, arg ...string) *execpkg.Execution {
|
||||
cmd := name + " " + strings.Join(arg, " ")
|
||||
execution, ok := s.executions[cmd]
|
||||
if !ok {
|
||||
|
|
@ -21,8 +21,8 @@ func (s stubExecutor) Exec(name string, arg ...string) *execpkg.Execution {
|
|||
return execution
|
||||
}
|
||||
|
||||
func TestGetNonVirtualPackage_IgnoresWarningsAfterReverseProvides(t *testing.T) {
|
||||
executor := stubExecutor{
|
||||
func TestGetNonVirtualPackage_WithWarningsInReverseProvides(t *testing.T) {
|
||||
executor := mockExecutor{
|
||||
executions: map[string]*execpkg.Execution{
|
||||
"apt-cache showpkg libopenblas0-openmp": {
|
||||
Cmd: "apt-cache showpkg libopenblas0-openmp",
|
||||
|
|
|
|||
Loading…
Reference in a new issue