From 442780f214f72cdec20120e1771928c3f10f96a7 Mon Sep 17 00:00:00 2001 From: Fabian Wickborn Date: Mon, 22 Feb 2016 09:29:22 +0100 Subject: [PATCH 1/3] Move commands to src/cmds --- src/{restic/cmd => cmds}/restic-server/.gitignore | 0 src/{restic/cmd => cmds}/restic-server/LICENSE | 0 src/{restic/cmd => cmds}/restic-server/README.md | 0 src/{restic/cmd => cmds}/restic-server/handlers.go | 0 src/{restic/cmd => cmds}/restic-server/htpasswd.go | 0 src/{restic/cmd => cmds}/restic-server/router.go | 0 .../cmd => cmds}/restic-server/router_test.go | 0 src/{restic/cmd => cmds}/restic-server/server.go | 0 src/{restic/cmd => cmds}/restic/.gitignore | 0 src/{restic/cmd => cmds}/restic/cleanup.go | 0 src/{restic/cmd => cmds}/restic/cmd_backup.go | 0 src/{restic/cmd => cmds}/restic/cmd_cache.go | 0 src/{restic/cmd => cmds}/restic/cmd_cat.go | 0 src/{restic/cmd => cmds}/restic/cmd_check.go | 0 src/{restic/cmd => cmds}/restic/cmd_dump.go | 0 src/{restic/cmd => cmds}/restic/cmd_find.go | 0 src/{restic/cmd => cmds}/restic/cmd_init.go | 0 src/{restic/cmd => cmds}/restic/cmd_key.go | 0 src/{restic/cmd => cmds}/restic/cmd_list.go | 0 src/{restic/cmd => cmds}/restic/cmd_ls.go | 0 src/{restic/cmd => cmds}/restic/cmd_mount.go | 0 src/{restic/cmd => cmds}/restic/cmd_optimize.go | 0 .../cmd => cmds}/restic/cmd_rebuild_index.go | 0 src/{restic/cmd => cmds}/restic/cmd_restore.go | 0 src/{restic/cmd => cmds}/restic/cmd_snapshots.go | 0 src/{restic/cmd => cmds}/restic/cmd_unlock.go | 0 src/{restic/cmd => cmds}/restic/cmd_version.go | 0 src/{restic/cmd => cmds}/restic/doc.go | 0 src/{restic/cmd => cmds}/restic/global.go | 0 .../cmd => cmds}/restic/integration_fuse_test.go | 0 .../cmd => cmds}/restic/integration_helpers_test.go | 0 .../restic/integration_helpers_unix_test.go | 0 .../restic/integration_helpers_windows_test.go | 0 src/{restic/cmd => cmds}/restic/integration_test.go | 0 src/{restic/cmd => cmds}/restic/lock.go | 0 src/{restic/cmd => cmds}/restic/main.go | 0 .../cmd => cmds}/restic/testdata/backup-data.tar.gz | Bin .../restic/testdata/old-index-repo.tar.gz | Bin .../testdata/repo-restore-permissions-test.tar.gz | Bin .../cmd => cmds}/restic/testdata/small-repo.tar.gz | Bin 40 files changed, 0 insertions(+), 0 deletions(-) rename src/{restic/cmd => cmds}/restic-server/.gitignore (100%) rename src/{restic/cmd => cmds}/restic-server/LICENSE (100%) rename src/{restic/cmd => cmds}/restic-server/README.md (100%) rename src/{restic/cmd => cmds}/restic-server/handlers.go (100%) rename src/{restic/cmd => cmds}/restic-server/htpasswd.go (100%) rename src/{restic/cmd => cmds}/restic-server/router.go (100%) rename src/{restic/cmd => cmds}/restic-server/router_test.go (100%) rename src/{restic/cmd => cmds}/restic-server/server.go (100%) rename src/{restic/cmd => cmds}/restic/.gitignore (100%) rename src/{restic/cmd => cmds}/restic/cleanup.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_backup.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_cache.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_cat.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_check.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_dump.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_find.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_init.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_key.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_list.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_ls.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_mount.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_optimize.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_rebuild_index.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_restore.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_snapshots.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_unlock.go (100%) rename src/{restic/cmd => cmds}/restic/cmd_version.go (100%) rename src/{restic/cmd => cmds}/restic/doc.go (100%) rename src/{restic/cmd => cmds}/restic/global.go (100%) rename src/{restic/cmd => cmds}/restic/integration_fuse_test.go (100%) rename src/{restic/cmd => cmds}/restic/integration_helpers_test.go (100%) rename src/{restic/cmd => cmds}/restic/integration_helpers_unix_test.go (100%) rename src/{restic/cmd => cmds}/restic/integration_helpers_windows_test.go (100%) rename src/{restic/cmd => cmds}/restic/integration_test.go (100%) rename src/{restic/cmd => cmds}/restic/lock.go (100%) rename src/{restic/cmd => cmds}/restic/main.go (100%) rename src/{restic/cmd => cmds}/restic/testdata/backup-data.tar.gz (100%) rename src/{restic/cmd => cmds}/restic/testdata/old-index-repo.tar.gz (100%) rename src/{restic/cmd => cmds}/restic/testdata/repo-restore-permissions-test.tar.gz (100%) rename src/{restic/cmd => cmds}/restic/testdata/small-repo.tar.gz (100%) diff --git a/src/restic/cmd/restic-server/.gitignore b/src/cmds/restic-server/.gitignore similarity index 100% rename from src/restic/cmd/restic-server/.gitignore rename to src/cmds/restic-server/.gitignore diff --git a/src/restic/cmd/restic-server/LICENSE b/src/cmds/restic-server/LICENSE similarity index 100% rename from src/restic/cmd/restic-server/LICENSE rename to src/cmds/restic-server/LICENSE diff --git a/src/restic/cmd/restic-server/README.md b/src/cmds/restic-server/README.md similarity index 100% rename from src/restic/cmd/restic-server/README.md rename to src/cmds/restic-server/README.md diff --git a/src/restic/cmd/restic-server/handlers.go b/src/cmds/restic-server/handlers.go similarity index 100% rename from src/restic/cmd/restic-server/handlers.go rename to src/cmds/restic-server/handlers.go diff --git a/src/restic/cmd/restic-server/htpasswd.go b/src/cmds/restic-server/htpasswd.go similarity index 100% rename from src/restic/cmd/restic-server/htpasswd.go rename to src/cmds/restic-server/htpasswd.go diff --git a/src/restic/cmd/restic-server/router.go b/src/cmds/restic-server/router.go similarity index 100% rename from src/restic/cmd/restic-server/router.go rename to src/cmds/restic-server/router.go diff --git a/src/restic/cmd/restic-server/router_test.go b/src/cmds/restic-server/router_test.go similarity index 100% rename from src/restic/cmd/restic-server/router_test.go rename to src/cmds/restic-server/router_test.go diff --git a/src/restic/cmd/restic-server/server.go b/src/cmds/restic-server/server.go similarity index 100% rename from src/restic/cmd/restic-server/server.go rename to src/cmds/restic-server/server.go diff --git a/src/restic/cmd/restic/.gitignore b/src/cmds/restic/.gitignore similarity index 100% rename from src/restic/cmd/restic/.gitignore rename to src/cmds/restic/.gitignore diff --git a/src/restic/cmd/restic/cleanup.go b/src/cmds/restic/cleanup.go similarity index 100% rename from src/restic/cmd/restic/cleanup.go rename to src/cmds/restic/cleanup.go diff --git a/src/restic/cmd/restic/cmd_backup.go b/src/cmds/restic/cmd_backup.go similarity index 100% rename from src/restic/cmd/restic/cmd_backup.go rename to src/cmds/restic/cmd_backup.go diff --git a/src/restic/cmd/restic/cmd_cache.go b/src/cmds/restic/cmd_cache.go similarity index 100% rename from src/restic/cmd/restic/cmd_cache.go rename to src/cmds/restic/cmd_cache.go diff --git a/src/restic/cmd/restic/cmd_cat.go b/src/cmds/restic/cmd_cat.go similarity index 100% rename from src/restic/cmd/restic/cmd_cat.go rename to src/cmds/restic/cmd_cat.go diff --git a/src/restic/cmd/restic/cmd_check.go b/src/cmds/restic/cmd_check.go similarity index 100% rename from src/restic/cmd/restic/cmd_check.go rename to src/cmds/restic/cmd_check.go diff --git a/src/restic/cmd/restic/cmd_dump.go b/src/cmds/restic/cmd_dump.go similarity index 100% rename from src/restic/cmd/restic/cmd_dump.go rename to src/cmds/restic/cmd_dump.go diff --git a/src/restic/cmd/restic/cmd_find.go b/src/cmds/restic/cmd_find.go similarity index 100% rename from src/restic/cmd/restic/cmd_find.go rename to src/cmds/restic/cmd_find.go diff --git a/src/restic/cmd/restic/cmd_init.go b/src/cmds/restic/cmd_init.go similarity index 100% rename from src/restic/cmd/restic/cmd_init.go rename to src/cmds/restic/cmd_init.go diff --git a/src/restic/cmd/restic/cmd_key.go b/src/cmds/restic/cmd_key.go similarity index 100% rename from src/restic/cmd/restic/cmd_key.go rename to src/cmds/restic/cmd_key.go diff --git a/src/restic/cmd/restic/cmd_list.go b/src/cmds/restic/cmd_list.go similarity index 100% rename from src/restic/cmd/restic/cmd_list.go rename to src/cmds/restic/cmd_list.go diff --git a/src/restic/cmd/restic/cmd_ls.go b/src/cmds/restic/cmd_ls.go similarity index 100% rename from src/restic/cmd/restic/cmd_ls.go rename to src/cmds/restic/cmd_ls.go diff --git a/src/restic/cmd/restic/cmd_mount.go b/src/cmds/restic/cmd_mount.go similarity index 100% rename from src/restic/cmd/restic/cmd_mount.go rename to src/cmds/restic/cmd_mount.go diff --git a/src/restic/cmd/restic/cmd_optimize.go b/src/cmds/restic/cmd_optimize.go similarity index 100% rename from src/restic/cmd/restic/cmd_optimize.go rename to src/cmds/restic/cmd_optimize.go diff --git a/src/restic/cmd/restic/cmd_rebuild_index.go b/src/cmds/restic/cmd_rebuild_index.go similarity index 100% rename from src/restic/cmd/restic/cmd_rebuild_index.go rename to src/cmds/restic/cmd_rebuild_index.go diff --git a/src/restic/cmd/restic/cmd_restore.go b/src/cmds/restic/cmd_restore.go similarity index 100% rename from src/restic/cmd/restic/cmd_restore.go rename to src/cmds/restic/cmd_restore.go diff --git a/src/restic/cmd/restic/cmd_snapshots.go b/src/cmds/restic/cmd_snapshots.go similarity index 100% rename from src/restic/cmd/restic/cmd_snapshots.go rename to src/cmds/restic/cmd_snapshots.go diff --git a/src/restic/cmd/restic/cmd_unlock.go b/src/cmds/restic/cmd_unlock.go similarity index 100% rename from src/restic/cmd/restic/cmd_unlock.go rename to src/cmds/restic/cmd_unlock.go diff --git a/src/restic/cmd/restic/cmd_version.go b/src/cmds/restic/cmd_version.go similarity index 100% rename from src/restic/cmd/restic/cmd_version.go rename to src/cmds/restic/cmd_version.go diff --git a/src/restic/cmd/restic/doc.go b/src/cmds/restic/doc.go similarity index 100% rename from src/restic/cmd/restic/doc.go rename to src/cmds/restic/doc.go diff --git a/src/restic/cmd/restic/global.go b/src/cmds/restic/global.go similarity index 100% rename from src/restic/cmd/restic/global.go rename to src/cmds/restic/global.go diff --git a/src/restic/cmd/restic/integration_fuse_test.go b/src/cmds/restic/integration_fuse_test.go similarity index 100% rename from src/restic/cmd/restic/integration_fuse_test.go rename to src/cmds/restic/integration_fuse_test.go diff --git a/src/restic/cmd/restic/integration_helpers_test.go b/src/cmds/restic/integration_helpers_test.go similarity index 100% rename from src/restic/cmd/restic/integration_helpers_test.go rename to src/cmds/restic/integration_helpers_test.go diff --git a/src/restic/cmd/restic/integration_helpers_unix_test.go b/src/cmds/restic/integration_helpers_unix_test.go similarity index 100% rename from src/restic/cmd/restic/integration_helpers_unix_test.go rename to src/cmds/restic/integration_helpers_unix_test.go diff --git a/src/restic/cmd/restic/integration_helpers_windows_test.go b/src/cmds/restic/integration_helpers_windows_test.go similarity index 100% rename from src/restic/cmd/restic/integration_helpers_windows_test.go rename to src/cmds/restic/integration_helpers_windows_test.go diff --git a/src/restic/cmd/restic/integration_test.go b/src/cmds/restic/integration_test.go similarity index 100% rename from src/restic/cmd/restic/integration_test.go rename to src/cmds/restic/integration_test.go diff --git a/src/restic/cmd/restic/lock.go b/src/cmds/restic/lock.go similarity index 100% rename from src/restic/cmd/restic/lock.go rename to src/cmds/restic/lock.go diff --git a/src/restic/cmd/restic/main.go b/src/cmds/restic/main.go similarity index 100% rename from src/restic/cmd/restic/main.go rename to src/cmds/restic/main.go diff --git a/src/restic/cmd/restic/testdata/backup-data.tar.gz b/src/cmds/restic/testdata/backup-data.tar.gz similarity index 100% rename from src/restic/cmd/restic/testdata/backup-data.tar.gz rename to src/cmds/restic/testdata/backup-data.tar.gz diff --git a/src/restic/cmd/restic/testdata/old-index-repo.tar.gz b/src/cmds/restic/testdata/old-index-repo.tar.gz similarity index 100% rename from src/restic/cmd/restic/testdata/old-index-repo.tar.gz rename to src/cmds/restic/testdata/old-index-repo.tar.gz diff --git a/src/restic/cmd/restic/testdata/repo-restore-permissions-test.tar.gz b/src/cmds/restic/testdata/repo-restore-permissions-test.tar.gz similarity index 100% rename from src/restic/cmd/restic/testdata/repo-restore-permissions-test.tar.gz rename to src/cmds/restic/testdata/repo-restore-permissions-test.tar.gz diff --git a/src/restic/cmd/restic/testdata/small-repo.tar.gz b/src/cmds/restic/testdata/small-repo.tar.gz similarity index 100% rename from src/restic/cmd/restic/testdata/small-repo.tar.gz rename to src/cmds/restic/testdata/small-repo.tar.gz From ee494ab9395cc42d0b05fa01ee6ae72649e0b1a0 Mon Sep 17 00:00:00 2001 From: Fabian Wickborn Date: Mon, 22 Feb 2016 21:03:07 +0100 Subject: [PATCH 2/3] Use relocated command folders in build.go and run_integration_tests.go The resulting command structure is almost compatible to that of that gb reference project (example-gsftp), as the subfolder for commands is 'cmds' instead of 'cmd'. --- build.go | 12 ++++++++---- run_integration_tests.go | 4 ++-- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/build.go b/build.go index 2f3f3e5f0..d81b57dc7 100644 --- a/build.go +++ b/build.go @@ -329,13 +329,17 @@ func main() { } verbosePrintf("create GOPATH at %v\n", gopath) - if err = updateGopath(gopath, filepath.Join(root, "src"), ""); err != nil { - die("copying files from %v to %v failed: %v\n", root, gopath, err) + if err = updateGopath(gopath, filepath.Join(root, "src", "restic"), "restic"); err != nil { + die("copying files from %v/src/restic to %v/src/restic failed: %v\n", root, gopath, err) + } + + if err = updateGopath(gopath, filepath.Join(root, "src", "cmds"), "cmds"); err != nil { + die("copying files from %v/src/cmds to %v/src/restic/cmds failed: %v\n", root, gopath, err) } vendor := filepath.Join(root, "vendor", "src") if err = updateGopath(gopath, vendor, ""); err != nil { - die("copying files from %v to %v failed: %v\n", root, gopath, err) + die("copying files from %v to %v/src failed: %v\n", vendor, gopath, err) } defer func() { @@ -372,7 +376,7 @@ func main() { args := []string{ "-tags", strings.Join(buildTags, " "), "-ldflags", ldflags, - "-o", output, "restic/cmd/restic", + "-o", output, "cmds/restic", } err = build(filepath.Join(gopath, "src"), gopath, args...) diff --git a/run_integration_tests.go b/run_integration_tests.go index e9ab7cda2..519a6cd1f 100644 --- a/run_integration_tests.go +++ b/run_integration_tests.go @@ -171,7 +171,7 @@ func (env *TravisEnvironment) RunTests() { "-arch", strings.Join(env.goxArch, " "), "-tags", tags, "-output", "/tmp/{{.Dir}}_{{.OS}}_{{.Arch}}", - "restic/cmd/restic") + "cmds/restic") } } @@ -192,7 +192,7 @@ func (env *TravisEnvironment) RunTests() { } // run the tests and gather coverage information - runWithEnv(envWithGOPATH, "gotestcover", "-coverprofile", "all.cov", "restic/...") + runWithEnv(envWithGOPATH, "gotestcover", "-coverprofile", "all.cov", "cmds/...", "restic/...") runGofmt() From 6005bd983316ec05c18139b065180d65771e25a9 Mon Sep 17 00:00:00 2001 From: Fabian Wickborn Date: Tue, 23 Feb 2016 09:21:50 +0100 Subject: [PATCH 3/3] Fix relative paths in integrations tests --- src/cmds/restic/integration_test.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/cmds/restic/integration_test.go b/src/cmds/restic/integration_test.go index aa0408c20..c8be04c5a 100644 --- a/src/cmds/restic/integration_test.go +++ b/src/cmds/restic/integration_test.go @@ -724,7 +724,7 @@ func TestFind(t *testing.T) { func TestRebuildIndex(t *testing.T) { withTestEnvironment(t, func(env *testEnvironment, global GlobalOptions) { - datafile := filepath.Join("..", "..", "checker", "testdata", "duplicate-packs-in-index-test-repo.tar.gz") + datafile := filepath.Join("..", "..", "restic", "checker", "testdata", "duplicate-packs-in-index-test-repo.tar.gz") SetupTarTestFixture(t, env.base, datafile) out := cmdCheckOutput(t, global) @@ -755,7 +755,7 @@ var optimizeTests = []struct { snapshots backend.IDSet }{ { - filepath.Join("..", "..", "checker", "testdata", "checker-test-repo.tar.gz"), + filepath.Join("..", "..", "restic", "checker", "testdata", "checker-test-repo.tar.gz"), backend.NewIDSet(ParseID("a13c11e582b77a693dd75ab4e3a3ba96538a056594a4b9076e4cacebe6e06d43")), }, {