diff --git a/.delve.metadata b/.delve.metadata new file mode 100644 index 0000000..60b9ce6 --- /dev/null +++ b/.delve.metadata @@ -0,0 +1 @@ +16527e9bd43ee65b1dc9352e7a3dd171da9b5d3e SOURCES/delve-1.3.2.tar.gz diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2e080a8 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +SOURCES/delve-1.3.2.tar.gz diff --git a/SOURCES/1781-pkg-terminal-Fix-exit-status.patch b/SOURCES/1781-pkg-terminal-Fix-exit-status.patch new file mode 100644 index 0000000..4df3846 --- /dev/null +++ b/SOURCES/1781-pkg-terminal-Fix-exit-status.patch @@ -0,0 +1,58 @@ +diff --git a/pkg/terminal/command_test.go b/pkg/terminal/command_test.go +index 14fb795..350347f 100644 +--- a/pkg/terminal/command_test.go ++++ b/pkg/terminal/command_test.go +@@ -278,6 +278,19 @@ func TestIssue411(t *testing.T) { + }) + } + ++func TestExitStatus(t *testing.T) { ++ withTestTerminal("continuetestprog", t, func(term *FakeTerminal) { ++ term.Exec("continue") ++ status, err := term.handleExit() ++ if err != nil { ++ t.Fatal(err) ++ } ++ if status != 0 { ++ t.Fatalf("incorrect exit status, expected 0, got %d", status) ++ } ++ }) ++} ++ + func TestScopePrefix(t *testing.T) { + const goroutinesLinePrefix = " Goroutine " + const goroutinesCurLinePrefix = "* Goroutine " +diff --git a/pkg/terminal/terminal.go b/pkg/terminal/terminal.go +index cb59de9..b8ae4d8 100644 +--- a/pkg/terminal/terminal.go ++++ b/pkg/terminal/terminal.go +@@ -354,17 +354,20 @@ func (t *Term) handleExit() (int, error) { + + s, err := t.client.GetState() + if err != nil { +- if isErrProcessExited(err) && t.client.IsMulticlient() { +- answer, err := yesno(t.line, "Remote process has exited. Would you like to kill the headless instance? [Y/n] ") +- if err != nil { +- return 2, io.EOF +- } +- if answer { +- if err := t.client.Detach(true); err != nil { +- return 1, err ++ if isErrProcessExited(err) { ++ if t.client.IsMulticlient() { ++ answer, err := yesno(t.line, "Remote process has exited. Would you like to kill the headless instance? [Y/n] ") ++ if err != nil { ++ return 2, io.EOF ++ } ++ if answer { ++ if err := t.client.Detach(true); err != nil { ++ return 1, err ++ } + } ++ return 0, err + } +- return 0, err ++ return 0, nil + } + return 1, err + } diff --git a/SPECS/delve.spec b/SPECS/delve.spec new file mode 100644 index 0000000..71d50f6 --- /dev/null +++ b/SPECS/delve.spec @@ -0,0 +1,79 @@ +Name: delve +Version: 1.3.2 +Release: 3%{?dist} +Summary: A debugger for the Go programming language + +License: MIT +URL: https://github.com/go-delve/delve +Source0: https://github.com/go-delve/delve/archive/v%{version}.tar.gz#/%{name}-%{version}.tar.gz + +ExcludeArch: ppc64le s390x aarch64 i686 armv7hl + +BuildRequires: compiler(go-compiler) +BuildRequires: git + +Provides: dlv = %{version} + +Patch1781: ./1781-pkg-terminal-Fix-exit-status.patch + + +%description +Delve is a debugger for the Go programming language. The goal of the project +is to provide a simple, full featured debugging tool for Go. Delve should be +easy to invoke and easy to use. Chances are if you're using a debugger, things +aren't going your way. With that in mind, Delve should stay out of your way as +much as possible. + + +%prep +%setup -q +%patch1781 -p1 +rm -rf go.mod +mv vendor %{_builddir}/src +mkdir -p "%{_builddir}/src/github.com/go-delve/" +cp -r %{_builddir}/%{name}-%{version} %{_builddir}/src/github.com/go-delve/%{name} +mkdir -p %{_builddir}/%{name}-%{version}/_build +mv %{_builddir}/src %{_builddir}/%{name}-%{version}/_build/src + + +%build +export GO111MODULE=off +export GOPATH="%{_builddir}/%{name}-%{version}/_build" +%gobuild -o bin/dlv github.com/go-delve/delve/cmd/dlv + + +%install +export GO111MODULE=off +export GOPATH="%{_builddir}/%{name}-%{version}/_build" +install -Dpm 0755 bin/dlv %{buildroot}%{_bindir}/dlv + + +%check +export GO111MODULE=off +export GOPATH="%{_builddir}/%{name}-%{version}/_build" +cd "_build/src/github.com/go-delve/%{name}" +for d in $(go list ./... | grep -v cmd | grep -v scripts); do + go test ${d} +done + + +%files +%license LICENSE +%doc CONTRIBUTING.md CHANGELOG.md +%doc Documentation/* +%{_bindir}/dlv + + +%changelog +* Thu Jan 16 2020 Alejandro Sáez - 1.3.2-3 + - Resolves: rhbz#1758612 + - Resolves: rhbz#1780554 + - Add patch: 1781-pkg-terminal-Fix-exit-status.patch + +* Wed Jan 15 2020 Alejandro Sáez - 1.3.2-2 + - Added tests + - Related: rhbz#1758612 + +* Wed Nov 27 2019 Alejandro Sáez - 1.3.2-1 + - First package for RHEL + - Related: rhbz#1758612