File manager - Edit - /usr/share/doc/restic/html/developer_information.html
Back
<!DOCTYPE html> <html class="writer-html5" lang="en" > <head> <meta charset="utf-8" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Developer Information — restic 0.12.1 documentation</title> <link rel="stylesheet" href="_static/pygments.css" type="text/css" /> <link rel="stylesheet" href="_static/css/restic.css" type="text/css" /> <link rel="shortcut icon" href="_static/favicon.ico"/> <script data-url_root="./" id="documentation_options" src="_static/documentation_options.js"></script> <script src="_static/jquery.js"></script> <script src="_static/underscore.js"></script> <script src="_static/doctools.js"></script> <script src="_static/js/theme.js"></script> <link rel="index" title="Index" href="genindex.html" /> <link rel="search" title="Search" href="search.html" /> <link rel="prev" title="Manual" href="manual_rest.html" /> </head> <body class="wy-body-for-nav"> <div class="wy-grid-for-nav"> <nav data-toggle="wy-nav-shift" class="wy-nav-side"> <div class="wy-side-scroll"> <div class="wy-side-nav-search" > <a href="index.html" class="icon icon-home"> restic <img src="_static/logo.png" class="logo" alt="Logo"/> </a> <div class="version"> 0.12.1 </div> <div role="search"> <form id="rtd-search-form" class="wy-form" action="search.html" method="get"> <input type="text" name="q" placeholder="Search docs" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> </div> </div><div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="Navigation menu"> <ul class="current"> <li class="toctree-l1"><a class="reference internal" href="010_introduction.html">Introduction</a></li> <li class="toctree-l1"><a class="reference internal" href="020_installation.html">Installation</a></li> <li class="toctree-l1"><a class="reference internal" href="030_preparing_a_new_repo.html">Preparing a new repository</a></li> <li class="toctree-l1"><a class="reference internal" href="040_backup.html">Backing up</a></li> <li class="toctree-l1"><a class="reference internal" href="045_working_with_repos.html">Working with repositories</a></li> <li class="toctree-l1"><a class="reference internal" href="050_restore.html">Restoring from backup</a></li> <li class="toctree-l1"><a class="reference internal" href="060_forget.html">Removing backup snapshots</a></li> <li class="toctree-l1"><a class="reference internal" href="070_encryption.html">Encryption</a></li> <li class="toctree-l1"><a class="reference internal" href="075_scripting.html">Scripting</a></li> <li class="toctree-l1"><a class="reference internal" href="080_examples.html">Examples</a></li> <li class="toctree-l1"><a class="reference internal" href="090_participating.html">Participating</a></li> <li class="toctree-l1"><a class="reference internal" href="100_references.html">References</a></li> <li class="toctree-l1"><a class="reference internal" href="110_talks.html">Talks</a></li> <li class="toctree-l1"><a class="reference internal" href="faq.html">FAQ</a></li> <li class="toctree-l1"><a class="reference internal" href="manual_rest.html">Manual</a></li> <li class="toctree-l1 current"><a class="current reference internal" href="#">Developer Information</a><ul> <li class="toctree-l2"><a class="reference internal" href="#reproducible-builds">Reproducible Builds</a></li> <li class="toctree-l2"><a class="reference internal" href="#building-the-official-binaries">Building the Official Binaries</a></li> <li class="toctree-l2"><a class="reference internal" href="#prepare-a-new-release">Prepare a New Release</a></li> </ul> </li> </ul> </div> </div> </nav> <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap"><nav class="wy-nav-top" aria-label="Mobile navigation menu" > <i data-toggle="wy-nav-top" class="fa fa-bars"></i> <a href="index.html">restic</a> </nav> <div class="wy-nav-content"> <div class="rst-content"> <div role="navigation" aria-label="Page navigation"> <ul class="wy-breadcrumbs"> <li><a href="index.html" class="icon icon-home"></a> »</li> <li>Developer Information</li> <li class="wy-breadcrumbs-aside"> <a href="_sources/developer_information.rst.txt" rel="nofollow"> View page source</a> </li> </ul> <hr/> </div> <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article"> <div itemprop="articleBody"> <section id="developer-information"> <h1>Developer Information<a class="headerlink" href="#developer-information" title="Permalink to this headline">¶</a></h1> <section id="reproducible-builds"> <h2>Reproducible Builds<a class="headerlink" href="#reproducible-builds" title="Permalink to this headline">¶</a></h2> <p>This section describes how to reproduce the official released binaries for restic for version 0.10.0 and later. For restic versions down to 0.9.3 please refer to the documentation for the respective version. The binary produced depends on the following things:</p> <blockquote> <div><ul class="simple"> <li><p>The source code for the release</p></li> <li><p>The exact version of the official <a class="reference external" href="https://golang.org">Go compiler</a> used to produce the binaries (running <code class="docutils literal notranslate"><span class="pre">restic</span> <span class="pre">version</span></code> will print this)</p></li> <li><p>The architecture and operating system the Go compiler runs on (Linux, <code class="docutils literal notranslate"><span class="pre">amd64</span></code>)</p></li> <li><p>The path where the source code is extracted to (<code class="docutils literal notranslate"><span class="pre">/restic</span></code>)</p></li> <li><p>The path to the Go compiler (<code class="docutils literal notranslate"><span class="pre">/usr/local/go</span></code>)</p></li> <li><p>The build tags (for official binaries, it’s the tag <code class="docutils literal notranslate"><span class="pre">selfupdate</span></code>)</p></li> <li><p>The environment variables (mostly <code class="docutils literal notranslate"><span class="pre">$GOOS</span></code>, <code class="docutils literal notranslate"><span class="pre">$GOARCH</span></code>, <code class="docutils literal notranslate"><span class="pre">$CGO_ENABLED</span></code>)</p></li> </ul> </div></blockquote> <p>In addition, The compressed ZIP files for Windows depends on the modification timestamp and filename of the binary contained in it. In order to reproduce the exact same ZIP file every time, we update the timestamp of the file <code class="docutils literal notranslate"><span class="pre">VERSION</span></code> in the source code archive and set the timezone to Europe/Berlin.</p> <p>In the following example, we’ll use the file <code class="docutils literal notranslate"><span class="pre">restic-0.10.0.tar.gz</span></code> and Go 1.15.2 to reproduce the released binaries.</p> <ol class="arabic simple"> <li><p>Determine the Go compiler version used to build the released binaries, then download and extract the Go compiler into <code class="docutils literal notranslate"><span class="pre">/usr/local/go</span></code>:</p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ restic version restic 0.10.0 compiled with go1.15.2 on linux/amd64 $ cd /usr/local $ curl -L https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz | tar xz </pre></div> </div> <ol class="arabic simple" start="2"> <li><p>Extract the restic source code into <code class="docutils literal notranslate"><span class="pre">/restic</span></code></p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ mkdir /restic $ cd /restic $ TZ=Europe/Berlin curl -L https://github.com/restic/restic/releases/download/v0.10.0/restic-0.10.0.tar.gz | tar xz --strip-components=1 </pre></div> </div> <ol class="arabic simple" start="3"> <li><p>Build the binaries for Windows and Linux:</p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span>$ export PATH=/usr/local/go/bin:$PATH $ go version go version go1.15.2 linux/amd64 $ GOOS=linux GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -tags selfupdate -o restic_linux_amd64 ./cmd/restic $ bzip2 restic_linux_amd64 $ GOOS=windows GOARCH=amd64 CGO_ENABLED=0 go build -ldflags "-s -w" -tags selfupdate -o restic_0.10.0_windows_amd64.exe ./cmd/restic $ touch --reference VERSION restic_0.10.0_windows_amd64.exe $ TZ=Europe/Berlin zip -q -X restic_0.10.0_windows_amd64.zip restic_0.10.0_windows_amd64.exe </pre></div> </div> </section> <section id="building-the-official-binaries"> <h2>Building the Official Binaries<a class="headerlink" href="#building-the-official-binaries" title="Permalink to this headline">¶</a></h2> <p>The released binaries for restic are built using a Docker container. You can find it on <a class="reference external" href="https://hub.docker.com/r/restic/builder">Docker Hub</a> as <code class="docutils literal notranslate"><span class="pre">restic/builder</span></code>, the <code class="docutils literal notranslate"><span class="pre">Dockerfile</span></code> and instructions on how to build the container can be found in the <a class="reference external" href="https://github.com/restic/builder">GitHub repository</a></p> <dl class="simple"> <dt>The container serves the following goals:</dt><dd><ul class="simple"> <li><p>Have a very controlled environment which is independent from the local system</p></li> <li><p>Make it easy to have the correct version of the Go compiler at the right path</p></li> <li><p>Make it easy to pass in the source code to build at a well-defined path</p></li> </ul> </dd> </dl> <p>The following steps are necessary to build the binaries:</p> <ol class="arabic simple"> <li><p>Either build the container (see the instructions in the <a class="reference external" href="https://github.com/restic/builder">repository’s README</a>). Alternatively, download the container from the hub:</p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">pull</span> <span class="n">restic</span><span class="o">/</span><span class="n">builder</span> </pre></div> </div> <ol class="arabic simple" start="2"> <li><p>Extract the source code somewhere:</p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">tar</span> <span class="n">xvzf</span> <span class="n">restic</span><span class="o">-</span><span class="mf">0.10.0</span><span class="o">.</span><span class="n">tar</span><span class="o">.</span><span class="n">gz</span> </pre></div> </div> <ol class="arabic simple" start="3"> <li><p>Create a directory to place the resulting binaries in:</p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mkdir</span> <span class="n">output</span> </pre></div> </div> <ol class="arabic simple" start="3"> <li><p>Mount the source code and the output directory in the container and run the default command, which starts <code class="docutils literal notranslate"><span class="pre">helpers/build-release-binaries/main.go</span></code>:</p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">run</span> <span class="o">--</span><span class="n">rm</span> \ <span class="o">--</span><span class="n">volume</span> <span class="s2">"$PWD/restic-0.10.0:/restic"</span> \ <span class="o">--</span><span class="n">volume</span> <span class="s2">"$PWD/output:/output"</span> \ <span class="n">restic</span><span class="o">/</span><span class="n">builder</span> \ <span class="n">go</span> <span class="n">run</span> <span class="n">helpers</span><span class="o">/</span><span class="n">build</span><span class="o">-</span><span class="n">release</span><span class="o">-</span><span class="n">binaries</span><span class="o">/</span><span class="n">main</span><span class="o">.</span><span class="n">go</span> <span class="o">--</span><span class="n">version</span> <span class="mf">0.10.0</span> </pre></div> </div> <ol class="arabic simple" start="4"> <li><p>If anything goes wrong, you can enable debug output like this:</p></li> </ol> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">docker</span> <span class="n">run</span> <span class="o">--</span><span class="n">rm</span> \ <span class="o">--</span><span class="n">volume</span> <span class="s2">"$PWD/restic-0.10.0:/restic"</span> \ <span class="o">--</span><span class="n">volume</span> <span class="s2">"$PWD/output:/output"</span> \ <span class="n">restic</span><span class="o">/</span><span class="n">builder</span> \ <span class="n">go</span> <span class="n">run</span> <span class="n">helpers</span><span class="o">/</span><span class="n">build</span><span class="o">-</span><span class="n">release</span><span class="o">-</span><span class="n">binaries</span><span class="o">/</span><span class="n">main</span><span class="o">.</span><span class="n">go</span> <span class="o">--</span><span class="n">version</span> <span class="mf">0.10.0</span> <span class="o">--</span><span class="n">verbose</span> </pre></div> </div> </section> <section id="prepare-a-new-release"> <h2>Prepare a New Release<a class="headerlink" href="#prepare-a-new-release" title="Permalink to this headline">¶</a></h2> <p>Publishing a new release of restic requires many different steps. We’ve automated this in the Go program <code class="docutils literal notranslate"><span class="pre">helpers/prepare-release/main.go</span></code> which also includes checking that e.g. the changelog is correctly generated. The only required argument is the new version number (in <a class="reference external" href="https://semver.org/">Semantic Versioning</a> format <code class="docutils literal notranslate"><span class="pre">MAJOR.MINOR.PATCH</span></code>):</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">go</span> <span class="n">run</span> <span class="n">helpers</span><span class="o">/</span><span class="n">prepare</span><span class="o">-</span><span class="n">release</span><span class="o">/</span><span class="n">main</span><span class="o">.</span><span class="n">go</span> <span class="mf">0.10.0</span> </pre></div> </div> <p>Checks can be skipped on demand via flags, please see <code class="docutils literal notranslate"><span class="pre">--help</span></code> for details.</p> </section> </section> </div> </div> <footer><div class="rst-footer-buttons" role="navigation" aria-label="Footer"> <a href="manual_rest.html" class="btn btn-neutral float-left" title="Manual" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left" aria-hidden="true"></span> Previous</a> </div> <hr/> <div role="contentinfo"> <p>© Copyright 2024, restic authors.</p> </div> Built with <a href="https://www.sphinx-doc.org/">Sphinx</a> using a <a href="https://github.com/readthedocs/sphinx_rtd_theme">theme</a> provided by <a href="https://readthedocs.org">Read the Docs</a>. </footer> </div> </div> </section> </div> <script> jQuery(function () { SphinxRtdTheme.Navigation.enable(true); }); </script> </body> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.2.28 | Generation time: 0.02 |
proxy
|
phpinfo
|
Settings