Skip to content

Commit

Permalink
Add ability to build s3-plugin into ipfs-10-to-11 migration
Browse files Browse the repository at this point in the history
This addresses issue #122.

- Use Makefile for each migration to build and cleanup
- Update README.md to describe building with plugin
  • Loading branch information
gammazero committed Mar 15, 2021
1 parent f25639a commit 4424cc5
Show file tree
Hide file tree
Showing 13 changed files with 134 additions and 3 deletions.
8 changes: 5 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ GO111MODULE = on

MIG_DIRS = $(shell ls -d ipfs-*-to-*)

.PHONY: build clean cmd sharness test test_go
.PHONY: all build clean cmd sharness test test_go

all: build

show: $(MIG_DIRS)
@echo "$(MIG_DIRS)"
Expand All @@ -12,7 +14,7 @@ build: $(shell ls -d ipfs-*-to-* | sed -e 's/ipfs/build.ipfs/') cmd

build.%: MIGRATION=$*
build.%:
cd $(MIGRATION) && go build -mod=vendor
make -C $(MIGRATION)

cmd: cmd/fs-repo-migrations/fs-repo-migrations

Expand All @@ -31,7 +33,7 @@ clean: $(shell ls -d ipfs-*-to-* | sed -e 's/ipfs/clean.ipfs/')

clean.%: MIGRATION=$*
clean.%:
cd $(MIGRATION) && go clean
make -C $(MIGRATION) clean

test_go: $(shell ls -d ipfs-*-to-* | sed -e 's/ipfs/test_go.ipfs/')
@echo OK
Expand Down
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ These are migrations for the filesystem repository of [ipfs](https://github.com/
- [When should I migrate](#when-should-i-migrate)
- [How to Run Migrations](#how-to-run-migrations)
- [Developing Migrations](#developing-migrations)
- [Building with Plugin](#building-with-plugin)
- [Contribute](#contribute)
- [Want to hack on IPFS?](#want-to-hack-on-ipfs)
- [License](#license)
Expand Down Expand Up @@ -71,6 +72,14 @@ If the migration directory contains a subdirectory named `sharness`, tests conta

Dependencies must be vendored independently for each migration. Each migration is a separate go module with its own `vendor` directory (created with `go mod vendor` for that migration). All migrations are built using `go build -mod=vendor` to ensure dependencies come from the module's `vendor` directory.


### Building with Plugin
Migrations starting with ipfs-10-to-11 can be built with plugins. This is done by building the migration separately, using the appropriate make target. For example, to build the ipfs-10-to-11 migtation with the s3 plugin:
```
cd ipfs-10-to-11
make s3plugin
```

## Contribute

Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/fs-repo-migrations/issues)!
Expand Down
9 changes: 9 additions & 0 deletions ipfs-0-to-1/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-1-to-2/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
30 changes: 30 additions & 0 deletions ipfs-10-to-11/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
TMPDIR = /tmp/tmp.fs-repo-migration_build
TMP_GOIPFS = $(TMPDIR)/go-ipfs
BIN = ipfs-10-to-11

.PHONY: build clean s3plugin s3goipfs

all: build

build:
go build -mod=vendor

s3goipfs:
rm -rf "$(TMPDIR)"
mkdir -p "$(TMPDIR)"
#git clone -b release-v0.8.0 https://github.com/ipfs/go-ipfs "$(TMP_GOIPFS)"
git clone https://github.com/ipfs/go-ipfs "$(TMP_GOIPFS)"
cd "$(TMP_GOIPFS)" && git checkout 852dfab997f58d9c36765c2fae7e619390f44fdb
cd "$(TMP_GOIPFS)" && go get github.com/ipfs/go-ds-s3@latest
echo "s3ds github.com/ipfs/go-ds-s3/plugin 0" >> $(TMP_GOIPFS)/plugin/loader/preload_list
make -C $(TMP_GOIPFS) build
go mod edit -replace github.com/ipfs/go-ipfs=/tmp/tmp.fs-repo-migration_build/go-ipfs
go mod vendor

s3plugin: s3goipfs build
@echo "===> Build with S3 plugin"

clean:
go clean
rm -rf "$(TMPDIR)" vendor
git checkout vendor go.mod go.sum
9 changes: 9 additions & 0 deletions ipfs-2-to-3/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-3-to-4/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-4-to-5/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-5-to-6/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-6-to-7/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-7-to-8/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-8-to-9/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean
9 changes: 9 additions & 0 deletions ipfs-9-to-10/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
.PHONY: build clean

all: build

build:
go build -mod=vendor

clean:
go clean

0 comments on commit 4424cc5

Please sign in to comment.