mirror of
https://github.com/restic/restic.git
synced 2026-02-28 19:56:24 +00:00
Compare commits
4 Commits
debug-chun
...
add-webdav
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0912a8db07 | ||
|
|
eefeb387d9 | ||
|
|
c7d789ab04 | ||
|
|
92918ef1b6 |
63
.github/ISSUE_TEMPLATE.md
vendored
Normal file
63
.github/ISSUE_TEMPLATE.md
vendored
Normal file
@@ -0,0 +1,63 @@
|
|||||||
|
<!--
|
||||||
|
NOTE: Not filling out the issue template needs a good reason, otherwise it may
|
||||||
|
take a lot longer to find the problem! Please take the time to help us
|
||||||
|
debugging the problem by collecting information, even if it seems irrelevant to
|
||||||
|
you. Thanks!
|
||||||
|
|
||||||
|
If you have a question, the forum at https://discourse.restic.net is a better place.
|
||||||
|
Please do not create issues for usage or documentation questions! We're using
|
||||||
|
the GitHub issue tracker mainly for tracking bugs and feature requests.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Output of `restic version`
|
||||||
|
|
||||||
|
|
||||||
|
## How did you run restic exactly?
|
||||||
|
|
||||||
|
<!--
|
||||||
|
This section should include at least:
|
||||||
|
|
||||||
|
* The complete command line and any environment variables you used to
|
||||||
|
configure restic's backend access. Make sure to replace sensitive values!
|
||||||
|
|
||||||
|
* The output of the commands, what restic prints gives may give us much
|
||||||
|
information to diagnose the problem!
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
## What backend/server/service did you use to store the repository?
|
||||||
|
|
||||||
|
|
||||||
|
## Expected behavior
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Describe what you'd like restic to do differently.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Actual behavior
|
||||||
|
|
||||||
|
<!--
|
||||||
|
In this section, please try to concentrate on observations, so only describe
|
||||||
|
what you observed directly.
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Steps to reproduce the behavior
|
||||||
|
|
||||||
|
<!--
|
||||||
|
The more time you spend describing an easy way to reproduce the behavior (if
|
||||||
|
this is possible), the easier it is for the project developers to fix it!
|
||||||
|
-->
|
||||||
|
|
||||||
|
|
||||||
|
## Do you have any idea what may have caused this?
|
||||||
|
|
||||||
|
|
||||||
|
## Do you have an idea how to solve the issue?
|
||||||
|
|
||||||
|
## Did restic help you or made you happy in any way?
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Answering this question is not required, but if you have anything positive to share, please do so here!
|
||||||
|
Sometimes we get tired of reading bug reports all day and a little positive end note does wonders.
|
||||||
|
Idea by Joey Hess, https://joeyh.name/blog/entry/two_holiday_stories/
|
||||||
|
-->
|
||||||
93
.github/ISSUE_TEMPLATE/Bug.md
vendored
93
.github/ISSUE_TEMPLATE/Bug.md
vendored
@@ -1,93 +0,0 @@
|
|||||||
---
|
|
||||||
name: Bug report
|
|
||||||
about: Report a problem with restic to help us resolve it and improve
|
|
||||||
---
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
Welcome! - We kindly ask that you:
|
|
||||||
|
|
||||||
1. Fill out the issue template below - not doing so needs a good reason.
|
|
||||||
2. Use the forum if you have a question rather than a bug or feature request.
|
|
||||||
|
|
||||||
The forum is at: https://forum.restic.net
|
|
||||||
|
|
||||||
NOTE: Not filling out the issue template needs a good reason, as otherwise it
|
|
||||||
may take a lot longer to find the problem, not to mention it can take up a lot
|
|
||||||
more time which can otherwise be spent on development. Please also take the
|
|
||||||
time to help us debug the issue by collecting relevant information, even if
|
|
||||||
it doesn't seem to be relevant to you. Thanks!
|
|
||||||
|
|
||||||
The forum is a better place for questions about restic or general suggestions
|
|
||||||
and topics, e.g. usage or documentation questions! This issue tracker is mainly
|
|
||||||
for tracking bugs and feature requests directly relating to the development of
|
|
||||||
the software itself, rather than the project.
|
|
||||||
|
|
||||||
Thanks for understanding, and for contributing to the project!
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
Output of `restic version`
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
|
|
||||||
How did you run restic exactly?
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This section should include at least:
|
|
||||||
|
|
||||||
* The complete command line and any environment variables you used to
|
|
||||||
configure restic's backend access. Make sure to replace sensitive values!
|
|
||||||
|
|
||||||
* The output of the commands, what restic prints gives may give us much
|
|
||||||
information to diagnose the problem!
|
|
||||||
-->
|
|
||||||
|
|
||||||
What backend/server/service did you use to store the repository?
|
|
||||||
----------------------------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Expected behavior
|
|
||||||
-----------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Describe what you'd like restic to do differently.
|
|
||||||
-->
|
|
||||||
|
|
||||||
Actual behavior
|
|
||||||
---------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
In this section, please try to concentrate on observations, so only describe
|
|
||||||
what you observed directly.
|
|
||||||
-->
|
|
||||||
|
|
||||||
Steps to reproduce the behavior
|
|
||||||
-------------------------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
The more time you spend describing an easy way to reproduce the behavior (if
|
|
||||||
this is possible), the easier it is for the project developers to fix it!
|
|
||||||
-->
|
|
||||||
|
|
||||||
Do you have any idea what may have caused this?
|
|
||||||
-----------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Do you have an idea how to solve the issue?
|
|
||||||
-------------------------------------------
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Did restic help you today? Did it make you happy in any way?
|
|
||||||
------------------------------------------------------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Answering this question is not required, but if you have anything positive to share, please do so here!
|
|
||||||
Sometimes we get tired of reading bug reports all day and a little positive end note does wonders.
|
|
||||||
Idea by Joey Hess, https://joeyh.name/blog/entry/two_holiday_stories/
|
|
||||||
-->
|
|
||||||
57
.github/ISSUE_TEMPLATE/Feature.md
vendored
57
.github/ISSUE_TEMPLATE/Feature.md
vendored
@@ -1,57 +0,0 @@
|
|||||||
---
|
|
||||||
name: Feature request
|
|
||||||
about: Suggest a new feature or enhancement for restic
|
|
||||||
---
|
|
||||||
|
|
||||||
<!--
|
|
||||||
|
|
||||||
Welcome! - We kindly ask that you:
|
|
||||||
|
|
||||||
1. Fill out the issue template below - not doing so needs a good reason.
|
|
||||||
2. Use the forum if you have a question rather than a bug or feature request.
|
|
||||||
|
|
||||||
The forum is at: https://forum.restic.net
|
|
||||||
|
|
||||||
The forum is a better place for questions about restic or general suggestions
|
|
||||||
and topics, e.g. usage or documentation questions! This issue tracker is mainly
|
|
||||||
for tracking bugs and feature requests directly relating to the development of
|
|
||||||
the software itself, rather than the project.
|
|
||||||
|
|
||||||
Thanks for understanding, and for contributing to the project!
|
|
||||||
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
Output of `restic version`
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Please add the version of restic you're currently using here, this helps us
|
|
||||||
later to see what has changed in restic when we revisit this issue after some
|
|
||||||
time.
|
|
||||||
-->
|
|
||||||
|
|
||||||
What should restic do differently? Which functionality do you think we should add?
|
|
||||||
----------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Please describe the feature you'd like us to add here.
|
|
||||||
-->
|
|
||||||
|
|
||||||
|
|
||||||
What are you trying to do?
|
|
||||||
--------------------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
This section should contain a brief description what you're trying to do, which
|
|
||||||
would be possible after implementing the new feature.
|
|
||||||
-->
|
|
||||||
|
|
||||||
Did restic help you today? Did it make you happy in any way?
|
|
||||||
------------------------------------------------------------
|
|
||||||
|
|
||||||
<!--
|
|
||||||
Answering this question is not required, but if you have anything positive to share, please do so here!
|
|
||||||
Sometimes we get tired of reading bug reports all day and a little positive end note does wonders.
|
|
||||||
Idea by Joey Hess, https://joeyh.name/blog/entry/two_holiday_stories/
|
|
||||||
-->
|
|
||||||
4
.github/ISSUE_TEMPLATE/config.yml
vendored
4
.github/ISSUE_TEMPLATE/config.yml
vendored
@@ -1,4 +0,0 @@
|
|||||||
contact_links:
|
|
||||||
- name: restic forum
|
|
||||||
url: https://forum.restic.net
|
|
||||||
about: Please ask questions about using restic here, do not open an issue for questions.
|
|
||||||
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
17
.github/PULL_REQUEST_TEMPLATE.md
vendored
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Thank you very much for contributing code or documentation to restic! Please
|
Thank you very much for contributing code or documentation to restic! Please
|
||||||
fill out the following questions to make it easier for us to review your
|
fill out the following questions to make it easier for us to review your
|
||||||
@@ -10,31 +8,24 @@ your time and add more commits. If you're done and ready for review, please
|
|||||||
check the last box.
|
check the last box.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
What is the purpose of this change? What does it change?
|
### What is the purpose of this change? What does it change?
|
||||||
--------------------------------------------------------
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Describe the changes here, as detailed as needed.
|
Describe the changes here, as detailed as needed.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Was the change discussed in an issue or in the forum before?
|
### Was the change discussed in an issue or in the forum before?
|
||||||
------------------------------------------------------------
|
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Link issues and relevant forum posts here.
|
Link issues and relevant forum posts here.
|
||||||
|
|
||||||
If this PR resolves an issue on GitHub, use "closes #1234" so that the issue is
|
|
||||||
closed automatically when this PR is merged.
|
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Checklist
|
### Checklist
|
||||||
---------
|
|
||||||
|
|
||||||
- [ ] I have read the [Contribution Guidelines](https://github.com/restic/restic/blob/master/CONTRIBUTING.md#providing-patches)
|
- [ ] I have read the [Contribution Guidelines](https://github.com/restic/restic/blob/master/CONTRIBUTING.md#providing-patches)
|
||||||
- [ ] I have enabled [maintainer edits for this PR](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
|
|
||||||
- [ ] I have added tests for all changes in this PR
|
- [ ] I have added tests for all changes in this PR
|
||||||
- [ ] I have added documentation for the changes (in the manual)
|
- [ ] I have added documentation for the changes (in the manual)
|
||||||
- [ ] There's a new file in `changelog/unreleased/` that describes the changes for our users (template [here](https://github.com/restic/restic/blob/master/changelog/TEMPLATE))
|
- [ ] There's a new file in a subdir of `changelog/x.y.z` that describe the changes for our users (template [here](https://github.com/restic/restic/blob/master/changelog/changelog-entry.tmpl))
|
||||||
- [ ] I have run `gofmt` on the code in all commits
|
- [ ] I have run `gofmt` on the code in all commits
|
||||||
- [ ] All commit messages are formatted in the same style as [the other commits in the repo](https://github.com/restic/restic/blob/master/CONTRIBUTING.md#git-commits)
|
- [ ] All commit messages are formatted in the same style as [the other commits in the repo](https://github.com/restic/restic/blob/master/CONTRIBUTING.md#git-commits)
|
||||||
- [ ] I'm done, this Pull Request is ready for review
|
- [ ] I'm done, this Pull Request is ready for review
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,2 +1,3 @@
|
|||||||
/restic
|
/restic
|
||||||
/.vagrant
|
/.vagrant
|
||||||
|
/doc/_build
|
||||||
|
|||||||
61
.travis.yml
61
.travis.yml
@@ -1,48 +1,30 @@
|
|||||||
language: go
|
language: go
|
||||||
sudo: false
|
sudo: false
|
||||||
|
|
||||||
|
go:
|
||||||
|
- 1.8.x
|
||||||
|
- 1.9.x
|
||||||
|
|
||||||
|
os:
|
||||||
|
- linux
|
||||||
|
- osx
|
||||||
|
|
||||||
|
env:
|
||||||
|
matrix:
|
||||||
|
RESTIC_TEST_FUSE=0
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
|
exclude:
|
||||||
|
- os: osx
|
||||||
|
go: 1.8.x
|
||||||
|
- os: linux
|
||||||
|
go: 1.9.x
|
||||||
include:
|
include:
|
||||||
- os: linux
|
- os: linux
|
||||||
go: "1.11.x"
|
go: 1.9.x
|
||||||
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.cache/go-build
|
|
||||||
- $HOME/gopath/pkg/mod
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
go: "1.12.x"
|
|
||||||
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.cache/go-build
|
|
||||||
- $HOME/gopath/pkg/mod
|
|
||||||
|
|
||||||
- os: linux
|
|
||||||
go: "1.13.x"
|
|
||||||
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/.cache/go-build
|
|
||||||
- $HOME/gopath/pkg/mod
|
|
||||||
|
|
||||||
# only run fuse and cloud backends tests on Travis for the latest Go on Linux
|
|
||||||
- os: linux
|
|
||||||
go: "1.14.x"
|
|
||||||
sudo: true
|
sudo: true
|
||||||
cache:
|
env:
|
||||||
directories:
|
RESTIC_TEST_FUSE=1
|
||||||
- $HOME/.cache/go-build
|
|
||||||
- $HOME/gopath/pkg/mod
|
|
||||||
|
|
||||||
- os: osx
|
|
||||||
go: "1.14.x"
|
|
||||||
env: RESTIC_TEST_FUSE=0 RESTIC_TEST_CLOUD_BACKENDS=0
|
|
||||||
cache:
|
|
||||||
directories:
|
|
||||||
- $HOME/Library/Caches/go-build
|
|
||||||
- $HOME/gopath/pkg/mod
|
|
||||||
|
|
||||||
branches:
|
branches:
|
||||||
only:
|
only:
|
||||||
@@ -64,3 +46,6 @@ install:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- go run run_integration_tests.go
|
- go run run_integration_tests.go
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- bash <(curl -s https://codecov.io/bash) -f all.cov
|
||||||
|
|||||||
1258
CHANGELOG.md
1258
CHANGELOG.md
File diff suppressed because it is too large
Load Diff
@@ -46,8 +46,8 @@ Remember, the easier it is for us to reproduce the bug, the earlier it will be
|
|||||||
corrected!
|
corrected!
|
||||||
|
|
||||||
In addition, you can compile restic with debug support by running
|
In addition, you can compile restic with debug support by running
|
||||||
`go run build.go -tags debug` and instructing it to create a debug
|
`go run build.go -tags debug` and instructing it to create a debug log by
|
||||||
log by setting the environment variable `DEBUG_LOG` to a file, e.g. like this:
|
setting the environment variable `DEBUG_LOG` to a file, e.g. like this:
|
||||||
|
|
||||||
$ export DEBUG_LOG=/tmp/restic-debug.log
|
$ export DEBUG_LOG=/tmp/restic-debug.log
|
||||||
$ restic backup ~/work
|
$ restic backup ~/work
|
||||||
@@ -60,37 +60,9 @@ uploading it somewhere or post only the parts that are really relevant.
|
|||||||
Development Environment
|
Development Environment
|
||||||
=======================
|
=======================
|
||||||
|
|
||||||
The repository contains several sets of directories with code: `cmd/` and
|
In order to compile restic with the `go` tool directly, it needs to be checked
|
||||||
`internal/` contain the code written for restic, whereas `vendor/` contains
|
out at the right path within a `GOPATH`. The concept of a `GOPATH` is explained
|
||||||
copies of libraries restic depends on. The libraries are managed with the
|
in ["How to write Go code"](https://golang.org/doc/code.html).
|
||||||
command `go mod vendor`.
|
|
||||||
|
|
||||||
Go >= 1.11
|
|
||||||
----------
|
|
||||||
|
|
||||||
For Go version 1.11 or later, you should clone the repo (without having
|
|
||||||
`$GOPATH` set) and `cd` into the directory:
|
|
||||||
|
|
||||||
$ unset GOPATH
|
|
||||||
$ git clone https://github.com/restic/restic
|
|
||||||
$ cd restic
|
|
||||||
|
|
||||||
Then use the `go` tool to build restic:
|
|
||||||
|
|
||||||
$ go build ./cmd/restic
|
|
||||||
$ ./restic version
|
|
||||||
restic 0.9.2-dev (compiled manually) compiled with go1.11 on linux/amd64
|
|
||||||
|
|
||||||
You can run all tests with the following command:
|
|
||||||
|
|
||||||
$ go test ./...
|
|
||||||
|
|
||||||
Go < 1.11
|
|
||||||
---------
|
|
||||||
|
|
||||||
In order to compile restic with Go before 1.11, it needs to be checked out at
|
|
||||||
the right path within a `GOPATH`. The concept of a `GOPATH` is explained in
|
|
||||||
["How to write Go code"](https://golang.org/doc/code.html).
|
|
||||||
|
|
||||||
If you do not have a directory with Go code yet, executing the following
|
If you do not have a directory with Go code yet, executing the following
|
||||||
instructions in your shell will create one for you and check out the restic
|
instructions in your shell will create one for you and check out the restic
|
||||||
@@ -111,7 +83,12 @@ You can then build restic as follows:
|
|||||||
|
|
||||||
The following commands can be used to run all the tests:
|
The following commands can be used to run all the tests:
|
||||||
|
|
||||||
$ go test ./...
|
$ go test ./cmd/... ./internal/...
|
||||||
|
|
||||||
|
The repository contains two sets of directories with code: `cmd/` and
|
||||||
|
`internal/` contain the code written for restic, whereas `vendor/` contains
|
||||||
|
copies of libraries restic depends on. The libraries are managed with the
|
||||||
|
[`dep`](https://github.com/golang/dep) tool.
|
||||||
|
|
||||||
Providing Patches
|
Providing Patches
|
||||||
=================
|
=================
|
||||||
@@ -130,7 +107,8 @@ down to the following steps:
|
|||||||
|
|
||||||
2. Clone the repository locally and create a new branch. If you are working on
|
2. Clone the repository locally and create a new branch. If you are working on
|
||||||
the code itself, please set up the development environment as described in
|
the code itself, please set up the development environment as described in
|
||||||
the previous section.
|
the previous section. Especially take care to place your forked repository
|
||||||
|
at the correct path (`src/github.com/restic/restic`) within your `GOPATH`.
|
||||||
|
|
||||||
3. Then commit your changes as fine grained as possible, as smaller patches,
|
3. Then commit your changes as fine grained as possible, as smaller patches,
|
||||||
that handle one and only one issue are easier to discuss and merge.
|
that handle one and only one issue are easier to discuss and merge.
|
||||||
@@ -138,22 +116,18 @@ down to the following steps:
|
|||||||
4. Push the new branch with your changes to your fork of the repository.
|
4. Push the new branch with your changes to your fork of the repository.
|
||||||
|
|
||||||
5. Create a pull request by visiting the GitHub website, it will guide you
|
5. Create a pull request by visiting the GitHub website, it will guide you
|
||||||
through the process. Please [allow edits from maintainers](https://help.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork).
|
through the process.
|
||||||
|
|
||||||
6. You will receive comments on your code and the feature or bug that they
|
6. You will receive comments on your code and the feature or bug that they
|
||||||
address. Maybe you need to rework some minor things, in this case push new
|
address. Maybe you need to rework some minor things, in this case push new
|
||||||
commits to the branch you created for the pull request (or amend the
|
commits to the branch you created for the pull request, they will be
|
||||||
existing commit, use common sense to decide which is better), they will be
|
|
||||||
automatically added to the pull request.
|
automatically added to the pull request.
|
||||||
|
|
||||||
7. If your pull request changes anything that users should be aware
|
7. If your pull request changes anything that users should be aware of (a
|
||||||
of (a bugfix, a new feature, ...) please add an entry as a new
|
bugfix, a new feature, ...) please add an entry to the file
|
||||||
file in `changelog/unreleased` including the issue number in the
|
['CHANGELOG.md'](CHANGELOG.md). It will be used in the announcement of the
|
||||||
filename (e.g. `issue-8756`). Use the template in
|
next stable release. While writing, ask yourself: If I were the user, what
|
||||||
`changelog/TEMPLATE` for the content. It will be used in the
|
would I need to be aware of with this change.
|
||||||
announcement of the next stable release. While writing, ask
|
|
||||||
yourself: If I were the user, what would I need to be aware of
|
|
||||||
with this change.
|
|
||||||
|
|
||||||
8. Once your code looks good and passes all the tests, we'll merge it. Thanks
|
8. Once your code looks good and passes all the tests, we'll merge it. Thanks
|
||||||
a lot for your contribution!
|
a lot for your contribution!
|
||||||
@@ -166,14 +140,13 @@ run
|
|||||||
|
|
||||||
gofmt -w **/*.go
|
gofmt -w **/*.go
|
||||||
|
|
||||||
in the project root directory before committing. For each Pull Request, the
|
in the project root directory before committing. Installing the script
|
||||||
formatting is tested with `gofmt` for the latest stable version of Go.
|
`fmt-check` from https://github.com/edsrzf/gofmt-git-hook locally as a
|
||||||
Installing the script `fmt-check` from https://github.com/edsrzf/gofmt-git-hook
|
pre-commit hook checks formatting before committing automatically, just copy
|
||||||
locally as a pre-commit hook checks formatting before committing automatically,
|
this script to `.git/hooks/pre-commit`.
|
||||||
just copy this script to `.git/hooks/pre-commit`.
|
|
||||||
|
|
||||||
For each pull request, several different systems run the integration tests on
|
For each pull request, several different systems run the integration tests on
|
||||||
Linux, macOS and Windows. We won't merge any code that does not pass all tests
|
Linux, OS X and Windows. We won't merge any code that does not pass all tests
|
||||||
for all systems, so when a tests fails, try to find out what's wrong and fix
|
for all systems, so when a tests fails, try to find out what's wrong and fix
|
||||||
it. If you need help on this, please leave a comment in the pull request, and
|
it. If you need help on this, please leave a comment in the pull request, and
|
||||||
we'll be glad to assist. Having a PR with failing integration tests is nothing
|
we'll be glad to assist. Having a PR with failing integration tests is nothing
|
||||||
@@ -190,7 +163,7 @@ history and triaging bugs much easier.
|
|||||||
Git commit messages have a very terse summary in the first line of the commit
|
Git commit messages have a very terse summary in the first line of the commit
|
||||||
message, followed by an empty line, followed by a more verbose description or a
|
message, followed by an empty line, followed by a more verbose description or a
|
||||||
List of changed things. For examples, please refer to the excellent [How to
|
List of changed things. For examples, please refer to the excellent [How to
|
||||||
Write a Git Commit Message](https://chris.beams.io/posts/git-commit/).
|
Write a Git Commit Message](http://chris.beams.io/posts/git-commit/).
|
||||||
|
|
||||||
If you change/add multiple different things that aren't related at all, try to
|
If you change/add multiple different things that aren't related at all, try to
|
||||||
make several smaller commits. This is much easier to review. Using `git add -p`
|
make several smaller commits. This is much easier to review. Using `git add -p`
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
# restic project governance
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
The restic project uses a governance model commonly described as Benevolent
|
|
||||||
Dictator For Life (BDFL). This document outlines our understanding of what this
|
|
||||||
means. It is derived from the [i3 window manager project
|
|
||||||
governance](https://raw.githubusercontent.com/i3/i3/next/.github/GOVERNANCE.md).
|
|
||||||
|
|
||||||
## Roles
|
|
||||||
|
|
||||||
* user: anyone who interacts with the restic project
|
|
||||||
* core contributor: a handful of people who have contributed significantly to
|
|
||||||
the project by any means (issue triage, support, documentation, code, etc.).
|
|
||||||
Core contributors are recognizable via GitHub’s "Member" badge.
|
|
||||||
* Benevolent Dictator For Life (BDFL): a single individual who makes decisions
|
|
||||||
when consensus cannot be reached. restic's current BDFL is [@fd0](https://github.com/fd0).
|
|
||||||
|
|
||||||
## Decision making process
|
|
||||||
|
|
||||||
In general, we try to reach consensus in discussions. In case consensus cannot
|
|
||||||
be reached, the BDFL makes a decision.
|
|
||||||
|
|
||||||
## Contribution process
|
|
||||||
|
|
||||||
The contribution process is described in a separate document called
|
|
||||||
[CONTRIBUTING](CONTRIBUTING.md).
|
|
||||||
219
Gopkg.lock
generated
Normal file
219
Gopkg.lock
generated
Normal file
@@ -0,0 +1,219 @@
|
|||||||
|
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
|
||||||
|
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "bazil.org/fuse"
|
||||||
|
packages = [".","fs","fuseutil"]
|
||||||
|
revision = "371fbbdaa8987b715bdd21d6adc4c9b20155f748"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "cloud.google.com/go"
|
||||||
|
packages = ["compute/metadata"]
|
||||||
|
revision = "2d3a6656c17a60b0815b7e06ab0be04eacb6e613"
|
||||||
|
version = "v0.16.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/Azure/azure-sdk-for-go"
|
||||||
|
packages = ["storage"]
|
||||||
|
revision = "7692b0cef22674113fcf71cc17ac3ccc1a7fef48"
|
||||||
|
version = "v11.2.2-beta"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/Azure/go-autorest"
|
||||||
|
packages = ["autorest","autorest/adal","autorest/azure","autorest/date"]
|
||||||
|
revision = "c67b24a8e30d876542a85022ebbdecf0e5a935e8"
|
||||||
|
version = "v9.4.1"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/cenkalti/backoff"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "61153c768f31ee5f130071d08fc82b85208528de"
|
||||||
|
version = "v1.1.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/cpuguy83/go-md2man"
|
||||||
|
packages = ["md2man"]
|
||||||
|
revision = "1d903dcb749992f3741d744c0f8376b4bd7eb3e1"
|
||||||
|
version = "v1.0.7"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/dgrijalva/jwt-go"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "dbeaa9332f19a944acb5736b4456cfcc02140e29"
|
||||||
|
version = "v3.1.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/dustin/go-humanize"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "bb3d318650d48840a39aa21a027c6630e198e626"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/elithrar/simple-scrypt"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "2325946f714c95de4a6088202c402fbdfa64163b"
|
||||||
|
version = "v1.2.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/go-ini/ini"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "32e4c1e6bc4e7d0d8451aa6b75200d19e37a536a"
|
||||||
|
version = "v1.32.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/golang/protobuf"
|
||||||
|
packages = ["proto"]
|
||||||
|
revision = "1e59b77b52bf8e4b449a57e6f79f21226d571845"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/inconshreveable/mousetrap"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "76626ae9c91c4f2a10f34cad8ce83ea42c93bb75"
|
||||||
|
version = "v1.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/juju/ratelimit"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "59fac5042749a5afb9af70e813da1dd5474f0167"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/kr/fs"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "2788f0dbd16903de03cb8186e5c7d97b69ad387b"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/kurin/blazer"
|
||||||
|
packages = ["b2","base","internal/b2types","internal/blog"]
|
||||||
|
revision = "e269a1a17bb6aec278c06a57cb7e8f8d0d333e04"
|
||||||
|
version = "v0.2.1"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/minio/go-homedir"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "21304a94172ae3a09dee2cd86a12fb6f842138c7"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/minio/minio-go"
|
||||||
|
packages = [".","pkg/credentials","pkg/encrypt","pkg/policy","pkg/s3signer","pkg/s3utils","pkg/set"]
|
||||||
|
revision = "57a8ae886b49af6eb0d2c27c2d007ed2f71e1da5"
|
||||||
|
version = "4.0.3"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "github.com/ncw/swift"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "c95c6e5c2d1a3d37fc44c8c6dc9e231c7500667d"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/pkg/errors"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
|
||||||
|
version = "v0.8.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/pkg/profile"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "5b67d428864e92711fcbd2f8629456121a56d91f"
|
||||||
|
version = "v1.2.1"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/pkg/sftp"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "98203f5a8333288eb3163b7c667d4260fe1333e9"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/pkg/xattr"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "23c75e3f6c1d8b13b3dd905b011a7f38a06044b7"
|
||||||
|
version = "v0.2.1"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/restic/chunker"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "db83917be3b88cc307464b7d8a221c173e34a0db"
|
||||||
|
version = "v0.2.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/russross/blackfriday"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "4048872b16cc0fc2c5fd9eacf0ed2c2fedaa0c8c"
|
||||||
|
version = "v1.5"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/satori/uuid"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "879c5887cd475cd7864858769793b2ceb0d44feb"
|
||||||
|
version = "v1.1.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/sirupsen/logrus"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "f006c2ac4710855cf0f916dd6b77acf6b048dc6e"
|
||||||
|
version = "v1.0.3"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/spf13/cobra"
|
||||||
|
packages = [".","doc"]
|
||||||
|
revision = "7b2c5ac9fc04fc5efafb60700713d4fa609b777b"
|
||||||
|
version = "v0.0.1"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "github.com/spf13/pflag"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "e57e3eeb33f795204c1ca35f56c44f83227c6e66"
|
||||||
|
version = "v1.0.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "golang.org/x/crypto"
|
||||||
|
packages = ["curve25519","ed25519","ed25519/internal/edwards25519","pbkdf2","poly1305","scrypt","ssh","ssh/terminal"]
|
||||||
|
revision = "94eea52f7b742c7cbe0b03b22f0c4c8631ece122"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "golang.org/x/net"
|
||||||
|
packages = ["context","context/ctxhttp","webdav","webdav/internal/xml"]
|
||||||
|
revision = "a8b9294777976932365dabb6640cf1468d95c70f"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "golang.org/x/oauth2"
|
||||||
|
packages = [".","google","internal","jws","jwt"]
|
||||||
|
revision = "f95fa95eaa936d9d87489b15d1d18b97c1ba9c28"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "golang.org/x/sys"
|
||||||
|
packages = ["unix","windows"]
|
||||||
|
revision = "8b4580aae2a0dd0c231a45d3ccb8434ff533b840"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "master"
|
||||||
|
name = "google.golang.org/api"
|
||||||
|
packages = ["gensupport","googleapi","googleapi/internal/uritemplates","storage/v1"]
|
||||||
|
revision = "3a1d936b7575b82197a1fea0632218dd07b1e65c"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
name = "google.golang.org/appengine"
|
||||||
|
packages = [".","internal","internal/app_identity","internal/base","internal/datastore","internal/log","internal/modules","internal/remote_api","internal/urlfetch","urlfetch"]
|
||||||
|
revision = "150dc57a1b433e64154302bdc40b6bb8aefa313a"
|
||||||
|
version = "v1.0.0"
|
||||||
|
|
||||||
|
[[projects]]
|
||||||
|
branch = "v2"
|
||||||
|
name = "gopkg.in/yaml.v2"
|
||||||
|
packages = ["."]
|
||||||
|
revision = "287cf08546ab5e7e37d55a84f7ed3fd1db036de5"
|
||||||
|
|
||||||
|
[solve-meta]
|
||||||
|
analyzer-name = "dep"
|
||||||
|
analyzer-version = 1
|
||||||
|
inputs-digest = "b01eeeb2be041c7cd11f9ee50324ef456ac1e1cd0720408c6d72f88f92f09320"
|
||||||
|
solver-name = "gps-cdcl"
|
||||||
|
solver-version = 1
|
||||||
21
Gopkg.toml
Normal file
21
Gopkg.toml
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
|
||||||
|
# Gopkg.toml example
|
||||||
|
#
|
||||||
|
# Refer to https://github.com/golang/dep/blob/master/docs/Gopkg.toml.md
|
||||||
|
# for detailed Gopkg.toml documentation.
|
||||||
|
#
|
||||||
|
# required = ["github.com/user/thing/cmd/thing"]
|
||||||
|
# ignored = ["github.com/user/project/pkgX", "bitbucket.org/user/project/pkgA/pkgY"]
|
||||||
|
#
|
||||||
|
# [[constraint]]
|
||||||
|
# name = "github.com/user/project"
|
||||||
|
# version = "1.0.0"
|
||||||
|
#
|
||||||
|
# [[constraint]]
|
||||||
|
# name = "github.com/user/project2"
|
||||||
|
# branch = "dev"
|
||||||
|
# source = "github.com/myfork/project2"
|
||||||
|
#
|
||||||
|
# [[override]]
|
||||||
|
# name = "github.com/x/y"
|
||||||
|
# version = "2.4.0"
|
||||||
25
README.rst
25
README.rst
@@ -1,9 +1,9 @@
|
|||||||
|Documentation| |Build Status| |Build status| |Report Card| |Say Thanks| |Reviewed by Hound|
|
|Documentation| |Build Status| |Build status| |Report Card| |Say Thanks| |TestCoverage|
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
------------
|
------------
|
||||||
|
|
||||||
restic is a backup program that is fast, efficient and secure. It supports the three major operating systems (Linux, macOS, Windows) and a few smaller ones (FreeBSD, OpenBSD).
|
restic is a backup program that is fast, efficient and secure.
|
||||||
|
|
||||||
For detailed usage and installation instructions check out the `documentation <https://restic.readthedocs.io/en/latest>`__.
|
For detailed usage and installation instructions check out the `documentation <https://restic.readthedocs.io/en/latest>`__.
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@ and add some data:
|
|||||||
|
|
||||||
.. code-block:: console
|
.. code-block:: console
|
||||||
|
|
||||||
$ restic --repo /tmp/backup backup ~/work
|
$ restic -r /tmp/backup backup ~/work
|
||||||
enter password for repository:
|
enter password for repository:
|
||||||
scan [/home/user/work]
|
scan [/home/user/work]
|
||||||
scanned 764 directories, 1816 files in 0:00
|
scanned 764 directories, 1816 files in 0:00
|
||||||
@@ -57,7 +57,6 @@ Therefore, restic supports the following backends for storing backups natively:
|
|||||||
- `BackBlaze B2 <https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#backblaze-b2>`__
|
- `BackBlaze B2 <https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#backblaze-b2>`__
|
||||||
- `Microsoft Azure Blob Storage <https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#microsoft-azure-blob-storage>`__
|
- `Microsoft Azure Blob Storage <https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#microsoft-azure-blob-storage>`__
|
||||||
- `Google Cloud Storage <https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#google-cloud-storage>`__
|
- `Google Cloud Storage <https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#google-cloud-storage>`__
|
||||||
- And many other services via the `rclone <https://rclone.org>`__ `Backend <https://restic.readthedocs.io/en/latest/030_preparing_a_new_repo.html#other-services-via-rclone>`__
|
|
||||||
|
|
||||||
Design Principles
|
Design Principles
|
||||||
-----------------
|
-----------------
|
||||||
@@ -111,25 +110,15 @@ License
|
|||||||
Restic is licensed under `BSD 2-Clause License <https://opensource.org/licenses/BSD-2-Clause>`__. You can find the
|
Restic is licensed under `BSD 2-Clause License <https://opensource.org/licenses/BSD-2-Clause>`__. You can find the
|
||||||
complete text in ``LICENSE``.
|
complete text in ``LICENSE``.
|
||||||
|
|
||||||
Sponsorship
|
|
||||||
-----------
|
|
||||||
|
|
||||||
Backend integration tests for Google Cloud Storage and Microsoft Azure Blob
|
|
||||||
Storage are sponsored by `AppsCode <https://appscode.com>`__!
|
|
||||||
|
|
||||||
|AppsCode|
|
|
||||||
|
|
||||||
.. |Documentation| image:: https://readthedocs.org/projects/restic/badge/?version=latest
|
.. |Documentation| image:: https://readthedocs.org/projects/restic/badge/?version=latest
|
||||||
:target: https://restic.readthedocs.io/en/latest/?badge=latest
|
:target: https://restic.readthedocs.io/en/latest/?badge=latest
|
||||||
.. |Build Status| image:: https://travis-ci.com/restic/restic.svg?branch=master
|
.. |Build Status| image:: https://travis-ci.org/restic/restic.svg?branch=master
|
||||||
:target: https://travis-ci.com/restic/restic
|
:target: https://travis-ci.org/restic/restic
|
||||||
.. |Build status| image:: https://ci.appveyor.com/api/projects/status/nuy4lfbgfbytw92q/branch/master?svg=true
|
.. |Build status| image:: https://ci.appveyor.com/api/projects/status/nuy4lfbgfbytw92q/branch/master?svg=true
|
||||||
:target: https://ci.appveyor.com/project/fd0/restic/branch/master
|
:target: https://ci.appveyor.com/project/fd0/restic/branch/master
|
||||||
.. |Report Card| image:: https://goreportcard.com/badge/github.com/restic/restic
|
.. |Report Card| image:: https://goreportcard.com/badge/github.com/restic/restic
|
||||||
:target: https://goreportcard.com/report/github.com/restic/restic
|
:target: https://goreportcard.com/report/github.com/restic/restic
|
||||||
.. |Say Thanks| image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
|
.. |Say Thanks| image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg
|
||||||
:target: https://saythanks.io/to/restic
|
:target: https://saythanks.io/to/restic
|
||||||
.. |AppsCode| image:: https://cdn.appscode.com/images/logo/appscode/ac-logo-color.png
|
.. |TestCoverage| image:: https://codecov.io/gh/restic/restic/branch/master/graph/badge.svg
|
||||||
:target: https://appscode.com
|
:target: https://codecov.io/gh/restic/restic
|
||||||
.. |Reviewed by Hound| image:: https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg
|
|
||||||
:target: https://houndci.com
|
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ branches:
|
|||||||
only:
|
only:
|
||||||
- master
|
- master
|
||||||
|
|
||||||
cache:
|
|
||||||
- '%LocalAppData%\go-build'
|
|
||||||
|
|
||||||
init:
|
init:
|
||||||
- ps: >-
|
- ps: >-
|
||||||
$app = Get-WmiObject -Class Win32_Product -Filter "Vendor = 'http://golang.org'"
|
$app = Get-WmiObject -Class Win32_Product -Filter "Vendor = 'http://golang.org'"
|
||||||
@@ -20,8 +17,8 @@ init:
|
|||||||
|
|
||||||
install:
|
install:
|
||||||
- rmdir c:\go /s /q
|
- rmdir c:\go /s /q
|
||||||
- appveyor DownloadFile https://dl.google.com/go/go1.14.windows-amd64.msi
|
- appveyor DownloadFile https://storage.googleapis.com/golang/go1.9.windows-amd64.msi
|
||||||
- msiexec /i go1.14.windows-amd64.msi /q
|
- msiexec /i go1.9.windows-amd64.msi /q
|
||||||
- go version
|
- go version
|
||||||
- go env
|
- go env
|
||||||
- appveyor DownloadFile http://sourceforge.netcologne.de/project/gnuwin32/tar/1.13-1/tar-1.13-1-bin.zip -FileName tar.zip
|
- appveyor DownloadFile http://sourceforge.netcologne.de/project/gnuwin32/tar/1.13-1/tar-1.13-1-bin.zip -FileName tar.zip
|
||||||
|
|||||||
436
build.go
436
build.go
@@ -1,41 +1,4 @@
|
|||||||
// Description
|
// +build ignore
|
||||||
//
|
|
||||||
// This program aims to make building Go programs for end users easier by just
|
|
||||||
// calling it with `go run`, without having to setup a GOPATH.
|
|
||||||
//
|
|
||||||
// This program needs Go >= 1.11. It'll use Go modules for compilation. It
|
|
||||||
// builds the package configured as Main in the Config struct.
|
|
||||||
|
|
||||||
// BSD 2-Clause License
|
|
||||||
//
|
|
||||||
// Copyright (c) 2016-2018, Alexander Neumann <alexander@bumpern.de>
|
|
||||||
// All rights reserved.
|
|
||||||
//
|
|
||||||
// This file has been derived from the repository at:
|
|
||||||
// https://github.com/fd0/build-go
|
|
||||||
//
|
|
||||||
// Redistribution and use in source and binary forms, with or without
|
|
||||||
// modification, are permitted provided that the following conditions are met:
|
|
||||||
//
|
|
||||||
// * Redistributions of source code must retain the above copyright notice, this
|
|
||||||
// list of conditions and the following disclaimer.
|
|
||||||
//
|
|
||||||
// * Redistributions in binary form must reproduce the above copyright notice,
|
|
||||||
// this list of conditions and the following disclaimer in the documentation
|
|
||||||
// and/or other materials provided with the distribution.
|
|
||||||
//
|
|
||||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
||||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
||||||
// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
||||||
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
||||||
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
||||||
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
||||||
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
||||||
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
|
|
||||||
// +build ignore_build_go
|
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
@@ -45,40 +8,172 @@ import (
|
|||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"os/exec"
|
"os/exec"
|
||||||
|
"path"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
// config contains the configuration for the program to build.
|
|
||||||
var config = Config{
|
|
||||||
Name: "restic", // name of the program executable and directory
|
|
||||||
Namespace: "github.com/restic/restic", // subdir of GOPATH, e.g. "github.com/foo/bar"
|
|
||||||
Main: "./cmd/restic", // package name for the main package
|
|
||||||
DefaultBuildTags: []string{"selfupdate"}, // specify build tags which are always used
|
|
||||||
Tests: []string{"./..."}, // tests to run
|
|
||||||
MinVersion: GoVersion{Major: 1, Minor: 11, Patch: 0}, // minimum Go version supported
|
|
||||||
}
|
|
||||||
|
|
||||||
// Config configures the build.
|
|
||||||
type Config struct {
|
|
||||||
Name string
|
|
||||||
Namespace string
|
|
||||||
Main string
|
|
||||||
DefaultBuildTags []string
|
|
||||||
Tests []string
|
|
||||||
MinVersion GoVersion
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
verbose bool
|
verbose bool
|
||||||
runTests bool
|
keepGopath bool
|
||||||
enableCGO bool
|
runTests bool
|
||||||
enablePIE bool
|
enableCGO bool
|
||||||
goVersion = ParseGoVersion(runtime.Version())
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var config = struct {
|
||||||
|
Name string
|
||||||
|
Namespace string
|
||||||
|
Main string
|
||||||
|
Tests []string
|
||||||
|
MinVersion GoVersion
|
||||||
|
}{
|
||||||
|
Name: "restic", // name of the program executable and directory
|
||||||
|
Namespace: "github.com/restic/restic", // subdir of GOPATH, e.g. "github.com/foo/bar"
|
||||||
|
Main: "github.com/restic/restic/cmd/restic", // package name for the main package
|
||||||
|
Tests: []string{ // tests to run
|
||||||
|
"github.com/restic/restic/internal/...",
|
||||||
|
"github.com/restic/restic/cmd/..."},
|
||||||
|
MinVersion: GoVersion{Major: 1, Minor: 8, Patch: 0}, // minimum Go version supported
|
||||||
|
}
|
||||||
|
|
||||||
|
// specialDir returns true if the file begins with a special character ('.' or '_').
|
||||||
|
func specialDir(name string) bool {
|
||||||
|
if name == "." {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
base := filepath.Base(name)
|
||||||
|
if base == "vendor" || base[0] == '_' || base[0] == '.' {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
// excludePath returns true if the file should not be copied to the new GOPATH.
|
||||||
|
func excludePath(name string) bool {
|
||||||
|
ext := path.Ext(name)
|
||||||
|
if ext == ".go" || ext == ".s" || ext == ".h" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
parentDir := filepath.Base(filepath.Dir(name))
|
||||||
|
if parentDir == "testdata" {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// updateGopath builds a valid GOPATH at dst, with all Go files in src/ copied
|
||||||
|
// to dst/prefix/, so calling
|
||||||
|
//
|
||||||
|
// updateGopath("/tmp/gopath", "/home/u/restic", "github.com/restic/restic")
|
||||||
|
//
|
||||||
|
// with "/home/u/restic" containing the file "foo.go" yields the following tree
|
||||||
|
// at "/tmp/gopath":
|
||||||
|
//
|
||||||
|
// /tmp/gopath
|
||||||
|
// └── src
|
||||||
|
// └── github.com
|
||||||
|
// └── restic
|
||||||
|
// └── restic
|
||||||
|
// └── foo.go
|
||||||
|
func updateGopath(dst, src, prefix string) error {
|
||||||
|
verbosePrintf("copy contents of %v to %v\n", src, filepath.Join(dst, prefix))
|
||||||
|
return filepath.Walk(src, func(name string, fi os.FileInfo, err error) error {
|
||||||
|
if name == src {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if specialDir(name) {
|
||||||
|
if fi.IsDir() {
|
||||||
|
return filepath.SkipDir
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if fi.IsDir() {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if excludePath(name) {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
intermediatePath, err := filepath.Rel(src, name)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fileSrc := filepath.Join(src, intermediatePath)
|
||||||
|
fileDst := filepath.Join(dst, "src", prefix, intermediatePath)
|
||||||
|
|
||||||
|
return copyFile(fileDst, fileSrc)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
func directoryExists(dirname string) bool {
|
||||||
|
stat, err := os.Stat(dirname)
|
||||||
|
if err != nil && os.IsNotExist(err) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
return stat.IsDir()
|
||||||
|
}
|
||||||
|
|
||||||
|
// copyFile creates dst from src, preserving file attributes and timestamps.
|
||||||
|
func copyFile(dst, src string) error {
|
||||||
|
fi, err := os.Stat(src)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fsrc, err := os.Open(src)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err = os.MkdirAll(filepath.Dir(dst), 0755); err != nil {
|
||||||
|
fmt.Printf("MkdirAll(%v)\n", filepath.Dir(dst))
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fdst, err := os.Create(dst)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err = io.Copy(fdst, fsrc); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
err = fsrc.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
err = fdst.Close()
|
||||||
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
err = os.Chmod(dst, fi.Mode())
|
||||||
|
}
|
||||||
|
|
||||||
|
if err == nil {
|
||||||
|
err = os.Chtimes(dst, fi.ModTime(), fi.ModTime())
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// die prints the message with fmt.Fprintf() to stderr and exits with an error
|
// die prints the message with fmt.Fprintf() to stderr and exits with an error
|
||||||
// code.
|
// code.
|
||||||
func die(message string, args ...interface{}) {
|
func die(message string, args ...interface{}) {
|
||||||
@@ -92,13 +187,12 @@ func showUsage(output io.Writer) {
|
|||||||
fmt.Fprintf(output, "OPTIONS:\n")
|
fmt.Fprintf(output, "OPTIONS:\n")
|
||||||
fmt.Fprintf(output, " -v --verbose output more messages\n")
|
fmt.Fprintf(output, " -v --verbose output more messages\n")
|
||||||
fmt.Fprintf(output, " -t --tags specify additional build tags\n")
|
fmt.Fprintf(output, " -t --tags specify additional build tags\n")
|
||||||
|
fmt.Fprintf(output, " -k --keep-gopath do not remove the GOPATH after build\n")
|
||||||
fmt.Fprintf(output, " -T --test run tests\n")
|
fmt.Fprintf(output, " -T --test run tests\n")
|
||||||
fmt.Fprintf(output, " -o --output set output file name\n")
|
fmt.Fprintf(output, " -o --output set output file name\n")
|
||||||
fmt.Fprintf(output, " --enable-cgo use CGO to link against libc\n")
|
fmt.Fprintf(output, " --enable-cgo use CGO to link against libc\n")
|
||||||
fmt.Fprintf(output, " --enable-pie use PIE buildmode\n")
|
|
||||||
fmt.Fprintf(output, " --goos value set GOOS for cross-compilation\n")
|
fmt.Fprintf(output, " --goos value set GOOS for cross-compilation\n")
|
||||||
fmt.Fprintf(output, " --goarch value set GOARCH for cross-compilation\n")
|
fmt.Fprintf(output, " --goarch value set GOARCH for cross-compilation\n")
|
||||||
fmt.Fprintf(output, " --goarm value set GOARM for cross-compilation\n")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func verbosePrintf(message string, args ...interface{}) {
|
func verbosePrintf(message string, args ...interface{}) {
|
||||||
@@ -109,77 +203,49 @@ func verbosePrintf(message string, args ...interface{}) {
|
|||||||
fmt.Printf("build: "+message, args...)
|
fmt.Printf("build: "+message, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// printEnv prints Go-relevant environment variables in a nice way using verbosePrintf.
|
// cleanEnv returns a clean environment with GOPATH and GOBIN removed (if
|
||||||
func printEnv(env []string) {
|
// present).
|
||||||
verbosePrintf("environment (GO*):\n")
|
func cleanEnv() (env []string) {
|
||||||
for _, v := range env {
|
for _, v := range os.Environ() {
|
||||||
// ignore environment variables which do not start with GO*.
|
if strings.HasPrefix(v, "GOPATH=") || strings.HasPrefix(v, "GOBIN=") {
|
||||||
if !strings.HasPrefix(v, "GO") {
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
verbosePrintf(" %s\n", v)
|
|
||||||
|
env = append(env, v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return env
|
||||||
}
|
}
|
||||||
|
|
||||||
// build runs "go build args..." with GOPATH set to gopath.
|
// build runs "go build args..." with GOPATH set to gopath.
|
||||||
func build(cwd string, env map[string]string, args ...string) error {
|
func build(cwd, goos, goarch, gopath string, args ...string) error {
|
||||||
a := []string{"build"}
|
a := []string{"build"}
|
||||||
|
a = append(a, "-asmflags", fmt.Sprintf("-trimpath=%s", gopath))
|
||||||
// try to remove all absolute paths from resulting binary
|
a = append(a, "-gcflags", fmt.Sprintf("-trimpath=%s", gopath))
|
||||||
if goVersion.AtLeast(GoVersion{1, 13, 0}) {
|
|
||||||
// use the new flag introduced by Go 1.13
|
|
||||||
a = append(a, "-trimpath")
|
|
||||||
} else {
|
|
||||||
// otherwise try to trim as many paths as possible
|
|
||||||
a = append(a, "-asmflags", fmt.Sprintf("all=-trimpath=%s", cwd))
|
|
||||||
a = append(a, "-gcflags", fmt.Sprintf("all=-trimpath=%s", cwd))
|
|
||||||
}
|
|
||||||
|
|
||||||
if enablePIE {
|
|
||||||
a = append(a, "-buildmode=pie")
|
|
||||||
}
|
|
||||||
|
|
||||||
a = append(a, args...)
|
a = append(a, args...)
|
||||||
cmd := exec.Command("go", a...)
|
cmd := exec.Command("go", a...)
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = append(cleanEnv(), "GOPATH="+gopath, "GOARCH="+goarch, "GOOS="+goos)
|
||||||
for k, v := range env {
|
|
||||||
cmd.Env = append(cmd.Env, k+"="+v)
|
|
||||||
}
|
|
||||||
if !enableCGO {
|
if !enableCGO {
|
||||||
cmd.Env = append(cmd.Env, "CGO_ENABLED=0")
|
cmd.Env = append(cmd.Env, "CGO_ENABLED=0")
|
||||||
}
|
}
|
||||||
|
|
||||||
printEnv(cmd.Env)
|
|
||||||
|
|
||||||
cmd.Dir = cwd
|
cmd.Dir = cwd
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
verbosePrintf("go %s\n", args)
|
||||||
verbosePrintf("chdir %q\n", cwd)
|
|
||||||
verbosePrintf("go %q\n", a)
|
|
||||||
|
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
// test runs "go test args..." with GOPATH set to gopath.
|
// test runs "go test args..." with GOPATH set to gopath.
|
||||||
func test(cwd string, env map[string]string, args ...string) error {
|
func test(cwd, gopath string, args ...string) error {
|
||||||
args = append([]string{"test", "-count", "1"}, args...)
|
args = append([]string{"test"}, args...)
|
||||||
cmd := exec.Command("go", args...)
|
cmd := exec.Command("go", args...)
|
||||||
cmd.Env = os.Environ()
|
cmd.Env = append(cleanEnv(), "GOPATH="+gopath)
|
||||||
for k, v := range env {
|
|
||||||
cmd.Env = append(cmd.Env, k+"="+v)
|
|
||||||
}
|
|
||||||
if !enableCGO {
|
|
||||||
cmd.Env = append(cmd.Env, "CGO_ENABLED=0")
|
|
||||||
}
|
|
||||||
cmd.Dir = cwd
|
cmd.Dir = cwd
|
||||||
cmd.Stdout = os.Stdout
|
cmd.Stdout = os.Stdout
|
||||||
cmd.Stderr = os.Stderr
|
cmd.Stderr = os.Stderr
|
||||||
|
verbosePrintf("go %s\n", args)
|
||||||
printEnv(cmd.Env)
|
|
||||||
|
|
||||||
verbosePrintf("chdir %q\n", cwd)
|
|
||||||
verbosePrintf("go %q\n", args)
|
|
||||||
|
|
||||||
return cmd.Run()
|
return cmd.Run()
|
||||||
}
|
}
|
||||||
@@ -262,39 +328,30 @@ func ParseGoVersion(s string) (v GoVersion) {
|
|||||||
|
|
||||||
s = s[2:]
|
s = s[2:]
|
||||||
data := strings.Split(s, ".")
|
data := strings.Split(s, ".")
|
||||||
if len(data) < 2 || len(data) > 3 {
|
if len(data) != 3 {
|
||||||
// invalid version
|
return
|
||||||
return GoVersion{}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
major, err := strconv.Atoi(data[0])
|
||||||
|
|
||||||
v.Major, err = strconv.Atoi(data[0])
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return GoVersion{}
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// try to parse the minor version while removing an eventual suffix (like
|
minor, err := strconv.Atoi(data[1])
|
||||||
// "rc2" or so)
|
if err != nil {
|
||||||
for s := data[1]; s != ""; s = s[:len(s)-1] {
|
return
|
||||||
v.Minor, err = strconv.Atoi(s)
|
|
||||||
if err == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if v.Minor == 0 {
|
patch, err := strconv.Atoi(data[2])
|
||||||
// no minor version found
|
if err != nil {
|
||||||
return GoVersion{}
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(data) >= 3 {
|
v = GoVersion{
|
||||||
v.Patch, err = strconv.Atoi(data[2])
|
Major: major,
|
||||||
if err != nil {
|
Minor: minor,
|
||||||
return GoVersion{}
|
Patch: patch,
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -327,26 +384,19 @@ func (v GoVersion) String() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if !goVersion.AtLeast(GoVersion{1, 11, 0}) {
|
ver := ParseGoVersion(runtime.Version())
|
||||||
die("Go version (%v) is too old, Go <= 1.11 does not support Go Modules\n", goVersion)
|
if !ver.AtLeast(config.MinVersion) {
|
||||||
}
|
fmt.Fprintf(os.Stderr, "%s detected, this program requires at least %s\n", ver, config.MinVersion)
|
||||||
|
|
||||||
if !goVersion.AtLeast(config.MinVersion) {
|
|
||||||
fmt.Fprintf(os.Stderr, "%s detected, this program requires at least %s\n", goVersion, config.MinVersion)
|
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTags := config.DefaultBuildTags
|
buildTags := []string{}
|
||||||
|
|
||||||
skipNext := false
|
skipNext := false
|
||||||
params := os.Args[1:]
|
params := os.Args[1:]
|
||||||
|
|
||||||
env := map[string]string{
|
targetGOOS := runtime.GOOS
|
||||||
"GO111MODULE": "on", // make sure we build in Module mode
|
targetGOARCH := runtime.GOARCH
|
||||||
"GOOS": runtime.GOOS,
|
|
||||||
"GOARCH": runtime.GOARCH,
|
|
||||||
"GOARM": "",
|
|
||||||
}
|
|
||||||
|
|
||||||
var outputFilename string
|
var outputFilename string
|
||||||
|
|
||||||
@@ -359,12 +409,14 @@ func main() {
|
|||||||
switch arg {
|
switch arg {
|
||||||
case "-v", "--verbose":
|
case "-v", "--verbose":
|
||||||
verbose = true
|
verbose = true
|
||||||
|
case "-k", "--keep-gopath":
|
||||||
|
keepGopath = true
|
||||||
case "-t", "-tags", "--tags":
|
case "-t", "-tags", "--tags":
|
||||||
if i+1 >= len(params) {
|
if i+1 >= len(params) {
|
||||||
die("-t given but no tag specified")
|
die("-t given but no tag specified")
|
||||||
}
|
}
|
||||||
skipNext = true
|
skipNext = true
|
||||||
buildTags = append(buildTags, strings.Split(params[i+1], " ")...)
|
buildTags = strings.Split(params[i+1], " ")
|
||||||
case "-o", "--output":
|
case "-o", "--output":
|
||||||
skipNext = true
|
skipNext = true
|
||||||
outputFilename = params[i+1]
|
outputFilename = params[i+1]
|
||||||
@@ -372,17 +424,12 @@ func main() {
|
|||||||
runTests = true
|
runTests = true
|
||||||
case "--enable-cgo":
|
case "--enable-cgo":
|
||||||
enableCGO = true
|
enableCGO = true
|
||||||
case "--enable-pie":
|
|
||||||
enablePIE = true
|
|
||||||
case "--goos":
|
case "--goos":
|
||||||
skipNext = true
|
skipNext = true
|
||||||
env["GOOS"] = params[i+1]
|
targetGOOS = params[i+1]
|
||||||
case "--goarch":
|
case "--goarch":
|
||||||
skipNext = true
|
skipNext = true
|
||||||
env["GOARCH"] = params[i+1]
|
targetGOARCH = params[i+1]
|
||||||
case "--goarm":
|
|
||||||
skipNext = true
|
|
||||||
env["GOARM"] = params[i+1]
|
|
||||||
case "-h":
|
case "-h":
|
||||||
showUsage(os.Stdout)
|
showUsage(os.Stdout)
|
||||||
return
|
return
|
||||||
@@ -393,14 +440,13 @@ func main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
verbosePrintf("detected Go version %v\n", goVersion)
|
if len(buildTags) == 0 {
|
||||||
|
verbosePrintf("adding build-tag release\n")
|
||||||
|
buildTags = []string{"release"}
|
||||||
|
}
|
||||||
|
|
||||||
preserveSymbols := false
|
|
||||||
for i := range buildTags {
|
for i := range buildTags {
|
||||||
buildTags[i] = strings.TrimSpace(buildTags[i])
|
buildTags[i] = strings.TrimSpace(buildTags[i])
|
||||||
if buildTags[i] == "debug" || buildTags[i] == "profile" {
|
|
||||||
preserveSymbols = true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
verbosePrintf("build tags: %s\n", buildTags)
|
verbosePrintf("build tags: %s\n", buildTags)
|
||||||
@@ -410,16 +456,48 @@ func main() {
|
|||||||
die("Getwd(): %v\n", err)
|
die("Getwd(): %v\n", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gopath, err := ioutil.TempDir("", fmt.Sprintf("%v-build-", config.Name))
|
||||||
|
if err != nil {
|
||||||
|
die("TempDir(): %v\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
verbosePrintf("create GOPATH at %v\n", gopath)
|
||||||
|
if err = updateGopath(gopath, root, config.Namespace); err != nil {
|
||||||
|
die("copying files from %v/src to %v/src failed: %v\n", root, gopath, err)
|
||||||
|
}
|
||||||
|
|
||||||
|
vendor := filepath.Join(root, "vendor")
|
||||||
|
if directoryExists(vendor) {
|
||||||
|
if err = updateGopath(gopath, vendor, filepath.Join(config.Namespace, "vendor")); err != nil {
|
||||||
|
die("copying files from %v to %v failed: %v\n", root, gopath, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defer func() {
|
||||||
|
if !keepGopath {
|
||||||
|
verbosePrintf("remove %v\n", gopath)
|
||||||
|
if err = os.RemoveAll(gopath); err != nil {
|
||||||
|
die("remove GOPATH at %s failed: %v\n", err)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
verbosePrintf("leaving temporary GOPATH at %v\n", gopath)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if outputFilename == "" {
|
if outputFilename == "" {
|
||||||
outputFilename = config.Name
|
outputFilename = config.Name
|
||||||
if env["GOOS"] == "windows" {
|
if targetGOOS == "windows" {
|
||||||
outputFilename += ".exe"
|
outputFilename += ".exe"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cwd, err := os.Getwd()
|
||||||
|
if err != nil {
|
||||||
|
die("Getwd() returned %v\n", err)
|
||||||
|
}
|
||||||
output := outputFilename
|
output := outputFilename
|
||||||
if !filepath.IsAbs(output) {
|
if !filepath.IsAbs(output) {
|
||||||
output = filepath.Join(root, output)
|
output = filepath.Join(cwd, output)
|
||||||
}
|
}
|
||||||
|
|
||||||
version := getVersion()
|
version := getVersion()
|
||||||
@@ -427,36 +505,16 @@ func main() {
|
|||||||
if version != "" {
|
if version != "" {
|
||||||
constants["main.version"] = version
|
constants["main.version"] = version
|
||||||
}
|
}
|
||||||
ldflags := constants.LDFlags()
|
ldflags := "-s -w " + constants.LDFlags()
|
||||||
if !preserveSymbols {
|
|
||||||
// Strip debug symbols.
|
|
||||||
ldflags = "-s -w " + ldflags
|
|
||||||
}
|
|
||||||
verbosePrintf("ldflags: %s\n", ldflags)
|
verbosePrintf("ldflags: %s\n", ldflags)
|
||||||
|
|
||||||
var (
|
args := []string{
|
||||||
buildArgs []string
|
|
||||||
testArgs []string
|
|
||||||
)
|
|
||||||
|
|
||||||
mainPackage := config.Main
|
|
||||||
if strings.HasPrefix(mainPackage, config.Namespace) {
|
|
||||||
mainPackage = strings.Replace(mainPackage, config.Namespace, "./", 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
buildTarget := filepath.FromSlash(mainPackage)
|
|
||||||
buildCWD, err := os.Getwd()
|
|
||||||
if err != nil {
|
|
||||||
die("unable to determine current working directory: %v\n", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
buildArgs = append(buildArgs,
|
|
||||||
"-tags", strings.Join(buildTags, " "),
|
"-tags", strings.Join(buildTags, " "),
|
||||||
"-ldflags", ldflags,
|
"-ldflags", ldflags,
|
||||||
"-o", output, buildTarget,
|
"-o", output, config.Main,
|
||||||
)
|
}
|
||||||
|
|
||||||
err = build(buildCWD, env, buildArgs...)
|
err = build(filepath.Join(gopath, "src"), targetGOOS, targetGOARCH, gopath, args...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
die("build failed: %v\n", err)
|
die("build failed: %v\n", err)
|
||||||
}
|
}
|
||||||
@@ -464,9 +522,7 @@ func main() {
|
|||||||
if runTests {
|
if runTests {
|
||||||
verbosePrintf("running tests\n")
|
verbosePrintf("running tests\n")
|
||||||
|
|
||||||
testArgs = append(testArgs, config.Tests...)
|
err = test(cwd, gopath, config.Tests...)
|
||||||
|
|
||||||
err = test(buildCWD, env, testArgs...)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
die("running tests failed: %v\n", err)
|
die("running tests failed: %v\n", err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ Enhancement: Create subdirs below `data/` for local/sftp backends
|
|||||||
|
|
||||||
The local and sftp backends now create the subdirs below `data/` on
|
The local and sftp backends now create the subdirs below `data/` on
|
||||||
open/init. This way, restic makes sure that they always exist. This is
|
open/init. This way, restic makes sure that they always exist. This is
|
||||||
connected to an issue for the sftp server.
|
connected to an issue for the sftp server:
|
||||||
|
|
||||||
https://github.com/restic/restic/issues/1055
|
|
||||||
https://github.com/restic/rest-server/pull/11#issuecomment-309879710
|
https://github.com/restic/rest-server/pull/11#issuecomment-309879710
|
||||||
|
https://github.com/restic/restic/issues/1055
|
||||||
https://github.com/restic/restic/pull/1077
|
https://github.com/restic/restic/pull/1077
|
||||||
https://github.com/restic/restic/pull/1105
|
https://github.com/restic/restic/pull/1105
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
Enhancement: Add `migrate` cmd to migrate from `s3legacy` to `default` layout
|
Enhancement: Add `migrate` cmd to migrate from `s3legacy` to `default` layout
|
||||||
|
|
||||||
The `migrate` command for changing the `s3legacy` layout to the `default` layout
|
The `migrate` command for chaning the `s3legacy` layout to the `default` layout
|
||||||
for s3 backends has been improved: It can now be restarted with `restic migrate
|
for s3 backends has been improved: It can now be restarted with `restic migrate
|
||||||
--force s3_layout` and automatically retries operations on error.
|
--force s3_layout` and automatically retries operations on error.
|
||||||
|
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
Enhancement: Properly report errors when reading files with exclude patterns
|
Enhancement: Properly report errors when reading files with exclude patterns.
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1144
|
https://github.com/restic/restic/pull/1144
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
Enhancement: Add support for TLS client certificate authentication
|
|
||||||
|
|
||||||
Support has been added for using a TLS client certificate for authentication to
|
|
||||||
HTTP based backend. A file containing the PEM encoded private key and
|
|
||||||
certificate can be set using the `--tls-client-cert` option.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/issues/1522
|
|
||||||
https://github.com/restic/restic/pull/1524
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
Enhancement: Reduce number of remote requests during repository check
|
|
||||||
|
|
||||||
This change eliminates redundant remote repository calls and significantly
|
|
||||||
improves repository check time.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/issues/1541
|
|
||||||
https://github.com/restic/restic/pull/1548
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
Enhancement: Reduce number of backend requests for rebuild-index and prune
|
|
||||||
|
|
||||||
We've found a way to reduce then number of backend requests for the
|
|
||||||
`rebuild-index` and `prune` operations. This significantly speeds up the
|
|
||||||
operations for high-latency backends.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/issues/1567
|
|
||||||
https://github.com/restic/restic/pull/1574
|
|
||||||
https://github.com/restic/restic/pull/1575
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
Bugfix: Strip spaces for lines read via --files-from
|
|
||||||
|
|
||||||
Leading and trailing spaces in lines read via `--files-from` are now stripped,
|
|
||||||
so it behaves the same as with lines read via `--exclude-file`.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/issues/1590
|
|
||||||
https://github.com/restic/restic/pull/1613
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
Enhancement: Speed up querying across indices and scanning existing files
|
|
||||||
|
|
||||||
This change increases the whenever a blob (part of a file) is searched for in a
|
|
||||||
restic repository. This will reduce cpu usage some when backing up files already
|
|
||||||
backed up by restic. Cpu usage is further decreased when scanning files.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1549
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
Enhancement: Don't terminate ssh on SIGINT
|
|
||||||
|
|
||||||
We've reworked the code which runs the `ssh` login for the sftp backend so that
|
|
||||||
it can prompt for a password (if needed) but does not exit when the user
|
|
||||||
presses CTRL+C (SIGINT) e.g. during backup. This allows restic to properly shut
|
|
||||||
down when it receives SIGINT and remove the lock file from the repo, afterwards
|
|
||||||
exiting the `ssh` process.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1564
|
|
||||||
https://github.com/restic/restic/pull/1588
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
Enhancement: Retry Backend.List() in case of errors
|
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1579
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
Enhancement: Limit index file size
|
|
||||||
|
|
||||||
Before, restic would create a single new index file on `prune` or
|
|
||||||
`rebuild-index`, this may lead to memory problems when this huge index is
|
|
||||||
created and loaded again. We're now limiting the size of the index file, and
|
|
||||||
split newly created index files into several smaller ones. This allows restic
|
|
||||||
to be more memory-efficient.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1584
|
|
||||||
https://github.com/restic/restic/issues/1412
|
|
||||||
https://github.com/restic/restic/issues/979
|
|
||||||
https://github.com/restic/restic/issues/526
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
Bugfix: Complete intermediate index upload
|
|
||||||
|
|
||||||
After a user posted a comprehensive report of what he observed, we were able to
|
|
||||||
find a bug and correct it: During backup, restic uploads so-called
|
|
||||||
"intermediate" index files. When the backup finishes during a transfer of such
|
|
||||||
an intermediate index, the upload is cancelled, but the backup is finished
|
|
||||||
without an error. This leads to an inconsistent state, where the snapshot
|
|
||||||
references data that is contained in the repo, but is not referenced in any
|
|
||||||
index.
|
|
||||||
|
|
||||||
The situation can be resolved by building a new index with `rebuild-index`, but
|
|
||||||
looks very confusing at first. Since all the data got uploaded to the repo
|
|
||||||
successfully, there was no risk of data loss, just minor inconvenience for our
|
|
||||||
users.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1589
|
|
||||||
https://forum.restic.net/t/error-loading-tree-check-prune-and-forget-gives-error-b2-backend/406
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
Bugfix: Google Cloud Storage: Use generic HTTP transport
|
|
||||||
|
|
||||||
It was discovered that the Google Cloud Storage backend did not use the generic
|
|
||||||
HTTP transport, so things such as bandwidth limiting with `--limit-upload` did
|
|
||||||
not work. This is resolved now.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1594
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
Bugfix: backup: Remove bandwidth display
|
|
||||||
|
|
||||||
This commit removes the bandwidth displayed during backup process. It is
|
|
||||||
misleading and seldomly correct, because it's neither the "read
|
|
||||||
bandwidth" (only for the very first backup) nor the "upload bandwidth".
|
|
||||||
Many users are confused about (and rightly so), c.f. #1581, #1033, #1591
|
|
||||||
|
|
||||||
We'll eventually replace this display with something more relevant when
|
|
||||||
the new archiver code is ready.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/pull/1595
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
Enhancement: Add --read-data-subset flag to check command
|
|
||||||
|
|
||||||
This change introduces ability to check integrity of a subset of repository
|
|
||||||
data packs. This can be used to spread integrity check of larger repositories
|
|
||||||
over a period of time.
|
|
||||||
|
|
||||||
https://github.com/restic/restic/issues/1497
|
|
||||||
https://github.com/restic/restic/pull/1556
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user