projects/guix·blob python-team · refs

80 lines · 2.0 KiB

1From a0e422b11a65d63bd435c96bee3cd08f06bb8ec8 Mon Sep 17 00:00:00 2001
2From: Sharlatan Hellseher <[email protected]>
3Date: Mon, 23 Dec 2024 01:59:10 +0000
4Subject: [PATCH] Disable self-update.
5
6For exercism cli V3.5.4.
7
8Based on a Fedora patch by Elliott Sales de Andrade.
9---
10 cli/cli.go | 44 +-------------------------------------------
11 1 file changed, 1 insertion(+), 43 deletions(-)
12
13diff --git a/cli/cli.go b/cli/cli.go
14index fe113ec..3baa4b0 100644
15--- a/cli/cli.go
16+++ b/cli/cli.go
17@@ -10,13 +10,10 @@ import (
18 "io"
19 "net/http"
20 "os"
21- "runtime"
22 "strings"
23 "time"
24
25 "github.com/blang/semver"
26- "github.com/exercism/cli/debug"
27- update "github.com/inconshreveable/go-update"
28 )
29
30 var (
31@@ -95,46 +92,7 @@ func (c *CLI) IsUpToDate() (bool, error) {
32
33 // Upgrade allows the user to upgrade to the latest version of the CLI.
34 func (c *CLI) Upgrade() error {
35- var (
36- OS = osMap[runtime.GOOS]
37- ARCH = archMap[runtime.GOARCH]
38- )
39-
40- if OS == "" || ARCH == "" {
41- return fmt.Errorf("unable to upgrade: OS %s ARCH %s", OS, ARCH)
42- }
43-
44- buildName := fmt.Sprintf("%s-%s", OS, ARCH)
45- if BuildARCH == "arm" {
46- if BuildARM == "" {
47- return fmt.Errorf("unable to upgrade: arm version not found")
48- }
49- buildName = fmt.Sprintf("%s-v%s", buildName, BuildARM)
50- }
51-
52- var downloadRC *bytes.Reader
53- for _, a := range c.LatestRelease.Assets {
54- if strings.Contains(a.Name, buildName) {
55- debug.Printf("Downloading %s\n", a.Name)
56- var err error
57- downloadRC, err = a.download()
58- if err != nil {
59- return fmt.Errorf("error downloading executable: %s", err)
60- }
61- break
62- }
63- }
64- if downloadRC == nil {
65- return fmt.Errorf("no executable found for %s/%s%s", BuildOS, BuildARCH, BuildARM)
66- }
67-
68- bin, err := extractBinary(downloadRC, OS)
69- if err != nil {
70- return err
71- }
72- defer bin.Close()
73-
74- return update.Apply(bin, update.Options{})
75+ return fmt.Errorf("Please use Guix to update Exercism")
76 }
77
78 func (c *CLI) fetchLatestRelease() error {
79--
802.46.0