diff --git a/.gitignore b/.gitignore index ad87186..5c07976 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /cli-3.0.11.tar.gz /cli-3.0.12.tar.gz /cli-3.0.13.tar.gz +/cli-3.1.0.tar.gz diff --git a/0001-Disable-self-update.patch b/0001-Disable-self-update.patch index 5e6878c..e9daf97 100644 --- a/0001-Disable-self-update.patch +++ b/0001-Disable-self-update.patch @@ -1,7 +1,7 @@ -From 3e4643e969640dc9de10b00c7f0639f9ee066491 Mon Sep 17 00:00:00 2001 +From 6b6146ff97bd12827caae559ba495abc6efead8a Mon Sep 17 00:00:00 2001 From: Elliott Sales de Andrade Date: Sun, 10 Feb 2019 00:58:28 -0500 -Subject: [PATCH] Disable self-update. +Subject: [PATCH 1/2] Disable self-update. Signed-off-by: Elliott Sales de Andrade --- @@ -9,7 +9,7 @@ Signed-off-by: Elliott Sales de Andrade 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cli/cli.go b/cli/cli.go -index 29f6d64..2e0ff74 100644 +index 4312eb0..0e70710 100644 --- a/cli/cli.go +++ b/cli/cli.go @@ -16,7 +16,6 @@ import ( @@ -20,7 +20,7 @@ index 29f6d64..2e0ff74 100644 ) var ( -@@ -131,7 +130,7 @@ func (c *CLI) Upgrade() error { +@@ -134,7 +133,7 @@ func (c *CLI) Upgrade() error { } defer bin.Close() @@ -30,5 +30,5 @@ index 29f6d64..2e0ff74 100644 func (c *CLI) fetchLatestRelease() error { -- -2.21.0 +2.36.1 diff --git a/0002-Fix-tests-with-Go1.17.patch b/0002-Fix-tests-with-Go1.17.patch new file mode 100644 index 0000000..cab7732 --- /dev/null +++ b/0002-Fix-tests-with-Go1.17.patch @@ -0,0 +1,50 @@ +From d985a3e94c0063233e617ef3b6cd7bcc96955114 Mon Sep 17 00:00:00 2001 +From: Elliott Sales de Andrade +Date: Tue, 18 Oct 2022 00:25:38 -0400 +Subject: [PATCH 2/2] Fix tests with Go1.17 + +`Part.FileName` now applies `filepath.Base` to the return value [1]. For +compatibility with older versions, this now explicitly applies `Base` +when fetching `FileName` always. + +[1] https://go.dev/doc/go1.17#mime/multipart + +Signed-off-by: Elliott Sales de Andrade +--- + cmd/submit_test.go | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/cmd/submit_test.go b/cmd/submit_test.go +index 7286a19..f51463d 100644 +--- a/cmd/submit_test.go ++++ b/cmd/submit_test.go +@@ -272,7 +272,7 @@ func TestSubmitFiles(t *testing.T) { + if assert.NoError(t, err) { + assert.Equal(t, 3, len(submittedFiles)) + assert.Equal(t, "This is file 1.", submittedFiles["file-1.txt"]) +- assert.Equal(t, "This is file 2.", submittedFiles["subdir/file-2.txt"]) ++ assert.Equal(t, "This is file 2.", submittedFiles["file-2.txt"]) + assert.Equal(t, "This is the readme.", submittedFiles["README.md"]) + assert.Regexp(t, "submitted successfully", Err) + } +@@ -468,7 +468,7 @@ func TestSubmitFilesForTeamExercise(t *testing.T) { + assert.Equal(t, 2, len(submittedFiles)) + + assert.Equal(t, "This is file 1.", submittedFiles["file-1.txt"]) +- assert.Equal(t, "This is file 2.", submittedFiles["subdir/file-2.txt"]) ++ assert.Equal(t, "This is file 2.", submittedFiles["file-2.txt"]) + } + + func TestSubmitOnlyEmptyFile(t *testing.T) { +@@ -561,7 +561,7 @@ func fakeSubmitServer(t *testing.T, submittedFiles map[string]string) *httptest. + if err != nil { + t.Fatal(err) + } +- submittedFiles[fileHeader.Filename] = string(body) ++ submittedFiles[filepath.Base(fileHeader.Filename)] = string(body) + } + + fmt.Fprint(w, "{}") +-- +2.36.1 + diff --git a/exercism.spec b/exercism.spec index 037de29..5ddbd29 100644 --- a/exercism.spec +++ b/exercism.spec @@ -3,7 +3,7 @@ # https://github.com/exercism/cli %global goipath github.com/exercism/cli -Version: 3.0.13 +Version: 3.1.0 %gometa @@ -24,6 +24,8 @@ Source0: %{gosource} # Remove the github.com/inconshreveable/go-update dependency Patch0001: 0001-Disable-self-update.patch +# https://github.com/exercism/cli/pull/1066 +Patch0002: 0002-Fix-tests-with-Go1.17.patch BuildRequires: golang(github.com/blang/semver) BuildRequires: golang(github.com/spf13/cobra) @@ -47,7 +49,7 @@ Python or Ruby environment simply to fetch and submit exercises. %prep %goprep -%patch1 -p1 +%autopatch -p1 %build diff --git a/sources b/sources index 9826906..a322719 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (cli-3.0.13.tar.gz) = 559886abe6325295fbd2b469c6cf06321fcf04d1593870d5db7df1cd33f94d38acc846edd80c70de6e7eb4dde881102792a7a052179665468f99559bac382e24 +SHA512 (cli-3.1.0.tar.gz) = b0cb312304453b6843f722c88ceb08e749e83e9165926b3e427052a2e7f6305f90a4f9714dd2a28058948aa4e535baf90d58a97973397055ee0a82b7d75d0fe9