Skip to content

Commit

Permalink
Use updated IpfsDir() and CheckIpfsDir() from migrations lib
Browse files Browse the repository at this point in the history
- Use temporary IPFS_DIST_PATH until migrations of on dist site
  • Loading branch information
gammazero committed Jan 15, 2021
1 parent 423f2b1 commit 01d17a3
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.14

require (
github.com/blang/semver v3.5.1+incompatible
github.com/ipfs/go-ipfs v0.7.1-0.20210112040606-bc5ef0c221e5
github.com/ipfs/go-ipfs v0.7.1-0.20210115023137-f4877d8d5ee0
github.com/urfave/cli/v2 v2.3.0
github.com/whyrusleeping/stump v0.0.0-20160611222256-206f8f13aae1
golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1
Expand Down
6 changes: 2 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,8 @@ github.com/ipfs/go-ds-measure v0.1.0/go.mod h1:1nDiFrhLlwArTME1Ees2XaBOl49OoCgd2
github.com/ipfs/go-filestore v0.0.3/go.mod h1:dvXRykFzyyXN2CdNlRGzDAkXMDPyI+D7JE066SiKLSE=
github.com/ipfs/go-fs-lock v0.0.6/go.mod h1:OTR+Rj9sHiRubJh3dRhD15Juhd/+w6VPOY28L7zESmM=
github.com/ipfs/go-graphsync v0.5.1/go.mod h1:e2ZxnClqBBYAtd901g9vXMJzS47labjAtOzsWtOzKNk=
github.com/ipfs/go-ipfs v0.7.1-0.20210106211246-dbb497bf19b0 h1:IzuBR8rHG7Mc7RmQNIZe1JvxSnRCZGxAvjlKEKEO+kI=
github.com/ipfs/go-ipfs v0.7.1-0.20210106211246-dbb497bf19b0/go.mod h1:vL6pwFgqi9/HCdS0bFI4aWzOu+uvEDo1f6AUGne3aFs=
github.com/ipfs/go-ipfs v0.7.1-0.20210112040606-bc5ef0c221e5 h1:5H67grcdepEo8O1g/BhyK9wGm4oq1uyOPU5P9pAIqcc=
github.com/ipfs/go-ipfs v0.7.1-0.20210112040606-bc5ef0c221e5/go.mod h1:vL6pwFgqi9/HCdS0bFI4aWzOu+uvEDo1f6AUGne3aFs=
github.com/ipfs/go-ipfs v0.7.1-0.20210115023137-f4877d8d5ee0 h1:ncQh85b9n0hsjrKXuap8Uz08OAv4yj/+QJQTEjoUKeo=
github.com/ipfs/go-ipfs v0.7.1-0.20210115023137-f4877d8d5ee0/go.mod h1:vL6pwFgqi9/HCdS0bFI4aWzOu+uvEDo1f6AUGne3aFs=
github.com/ipfs/go-ipfs-api v0.2.0 h1:BXRctUU8YOUOQT/jW1s56d9wLa85ntOqK6bptvCKb8c=
github.com/ipfs/go-ipfs-api v0.2.0/go.mod h1:zCTyTl+BuyvUqoSmVb8vjezCJLVTW7G/HBZbCXpTgeM=
github.com/ipfs/go-ipfs-blockstore v0.0.1/go.mod h1:d3WClOmRQKFnJ0Jz/jj/zmksX0ma1gROTlovZKBmN08=
Expand Down
2 changes: 1 addition & 1 deletion lib/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ func StashOldBinary(tag string, keep bool) (string, error) {
return "", fmt.Errorf("could not determine absolute path for old binary: %s", err)
}

ipfsdir, err := migrations.IpfsDir()
ipfsdir, err := migrations.CheckIpfsDir("")
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions lib/revert.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
)

func revertOldBinary(oldpath, version string) {
ipfsDir, err := migrations.IpfsDir()
ipfsDir, err := migrations.CheckIpfsDir("")
if err != nil {
stump.Log("Error reverting")
stump.Log("failed to replace binary after install fail")
Expand All @@ -36,7 +36,7 @@ func revertOldBinary(oldpath, version string) {
}

func SelectRevertBin() (string, error) {
ipfsDir, err := migrations.IpfsDir()
ipfsDir, err := migrations.CheckIpfsDir("")
if err != nil {
return "", err
}
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ var cmdInstall = &cli.Command{
i := lib.NewInstall(vers, c.Bool("no-check"), c.Bool("allow-downgrade"))
err := i.Run(c.Context)
if err != nil {
return err
return fmt.Errorf("install failed: %s", err)
}
stump.Log("\nInstallation complete!")

Expand Down Expand Up @@ -212,7 +212,7 @@ var cmdRevert = &cli.Command{
}

stump.Log("Reverting to %s", oldbinpath)
ipfsDir, err := migrations.IpfsDir()
ipfsDir, err := migrations.IpfsDir("")
if err != nil {
stump.Fatal("could not find ipfs directory:", err)
}
Expand Down
2 changes: 1 addition & 1 deletion sharness/lib/test-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ test_install_version() {
VERSION="$1"

test_expect_success "'ipfs-update install' works for $VERSION" '
exec_docker "$DOCID" "$GUEST_IPFS_UPDATE --verbose install --allow-downgrade $VERSION" >actual 2>&1 ||
exec_docker "$DOCID" "$GUEST_IPFS_UPDATE --distpath $IPFS_DIST_PATH --verbose install --allow-downgrade $VERSION" >actual 2>&1 ||
test_fsh cat actual
'

Expand Down
7 changes: 5 additions & 2 deletions sharness/t0030-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ test_description="ipfs-update install"

GUEST_IPFS_UPDATE="sharness/bin/ipfs-update"

# TODO: remove this when migrations are availabe one the distributions site
IPFS_DIST_PATH="/ipfs/QmXt92hFRuvQgFhgHoaMxC4wLFcvKsCywQPTNmPYCGfEV4"

test_expect_success "start a docker container" '
DOCID=$(start_docker)
'
Expand All @@ -29,7 +32,7 @@ test_expect_success "'ipfs-update version' output looks good" '
'

test_expect_success "'ipfs-update install' works when something is installed" '
exec_docker "$DOCID" "$GUEST_IPFS_UPDATE --verbose install v0.4.23" >actual 2>&1 ||
exec_docker "$DOCID" "$GUEST_IPFS_UPDATE --distpath $IPFS_DIST_PATH --verbose install v0.4.23" >actual 2>&1 ||
test_fsh cat actual
'

Expand All @@ -39,7 +42,7 @@ test_expect_success "'ipfs-update install' fails when downgrading without the d
'

test_expect_success "'ipfs-update install' works when downgrading with flag" '
exec_docker "$DOCID" "$GUEST_IPFS_UPDATE --verbose install --allow-downgrade v0.3.8" >actual 2>&1 ||
exec_docker "$DOCID" "$GUEST_IPFS_UPDATE --distpath $IPFS_DIST_PATH --verbose install --allow-downgrade v0.3.8" >actual 2>&1 ||
test_fsh cat actual
'

Expand Down
3 changes: 3 additions & 0 deletions sharness/t0040-install-many.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ test_expect_success ".ipfs/ has been created" '
exec_docker "$DOCID" "test -d /root/.ipfs/datastore && test -d /root/.ipfs/blocks"
'

# TODO: remove this when migrations are availabe one the distributions site
IPFS_DIST_PATH="/ipfs/QmXt92hFRuvQgFhgHoaMxC4wLFcvKsCywQPTNmPYCGfEV4"

test_install_version "v0.3.10"

test_expect_success "stop a docker container" '
Expand Down
2 changes: 1 addition & 1 deletion test-dist/testnew.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ func TestBinary(bin, version string) error {
return err
}

ipfsDir, err := migrations.IpfsDir()
ipfsDir, err := migrations.IpfsDir("")
if err != nil {
return fmt.Errorf("cannot find ipfs directory: %s", err)
}
Expand Down

0 comments on commit 01d17a3

Please sign in to comment.