From 01d17a3d8ca3adfe506909f132b1eca1c218c85c Mon Sep 17 00:00:00 2001 From: gammazero Date: Thu, 14 Jan 2021 17:50:23 -0800 Subject: [PATCH] Use updated IpfsDir() and CheckIpfsDir() from migrations lib - Use temporary IPFS_DIST_PATH until migrations of on dist site --- go.mod | 2 +- go.sum | 6 ++---- lib/install.go | 2 +- lib/revert.go | 4 ++-- main.go | 4 ++-- sharness/lib/test-lib.sh | 2 +- sharness/t0030-install.sh | 7 +++++-- sharness/t0040-install-many.sh | 3 +++ test-dist/testnew.go | 2 +- 9 files changed, 18 insertions(+), 14 deletions(-) diff --git a/go.mod b/go.mod index 0844a13..3dbb0aa 100644 --- a/go.mod +++ b/go.mod @@ -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 diff --git a/go.sum b/go.sum index 08d5aa6..fa2687f 100644 --- a/go.sum +++ b/go.sum @@ -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= diff --git a/lib/install.go b/lib/install.go index 00df34f..e695342 100644 --- a/lib/install.go +++ b/lib/install.go @@ -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 } diff --git a/lib/revert.go b/lib/revert.go index c39540a..4d879dd 100644 --- a/lib/revert.go +++ b/lib/revert.go @@ -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") @@ -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 } diff --git a/main.go b/main.go index a2c9729..831ec1f 100644 --- a/main.go +++ b/main.go @@ -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!") @@ -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) } diff --git a/sharness/lib/test-lib.sh b/sharness/lib/test-lib.sh index 95fd2f2..2a4d2b4 100644 --- a/sharness/lib/test-lib.sh +++ b/sharness/lib/test-lib.sh @@ -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 ' diff --git a/sharness/t0030-install.sh b/sharness/t0030-install.sh index 099134b..40afa2e 100755 --- a/sharness/t0030-install.sh +++ b/sharness/t0030-install.sh @@ -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) ' @@ -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 ' @@ -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 ' diff --git a/sharness/t0040-install-many.sh b/sharness/t0040-install-many.sh index 8216c66..c800e35 100755 --- a/sharness/t0040-install-many.sh +++ b/sharness/t0040-install-many.sh @@ -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" ' diff --git a/test-dist/testnew.go b/test-dist/testnew.go index ce48fe7..61a450a 100644 --- a/test-dist/testnew.go +++ b/test-dist/testnew.go @@ -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) }