aboutsummaryrefslogtreecommitdiff
#pragma once

#include "types.hh"
#include "serialise.hh"


namespace nix {


/* dumpPath creates a Nix archive of the specified path.  The format
   is as follows:

   IF path points to a REGULAR FILE:
     dump(path) = attrs(
       [ ("type", "regular")
       , ("contents", contents(path))
       ])

   IF path points to a DIRECTORY:
     dump(path) = attrs(
       [ ("type", "directory")
       , ("entries", concat(map(f, sort(entries(path)))))
       ])
       where f(fn) = attrs(
         [ ("name", fn)
         , ("file", dump(path + "/" + fn))
         ])

   where:

     attrs(as) = concat(map(attr, as)) + encN(0)
     attrs((a, b)) = encS(a) + encS(b)

     encS(s) = encN(len(s)) + s + (padding until next 64-bit boundary)

     encN(n) = 64-bit little-endian encoding of n.

     contents(path) = the contents of a regular file.

     sort(strings) = lexicographic sort by 8-bit value (strcmp).

     entries(path) = the entries of a directory, without `.' and
     `..'.

     `+' denotes string concatenation. */

struct PathFilter
{
    virtual ~PathFilter() { }
    virtual bool operator () (const Path & path) { return true; }
};

extern PathFilter defaultPathFilter;

void dumpPath(const Path & path, Sink & sink,
    PathFilter & filter = defaultPathFilter);

struct ParseSink
{
    virtual void createDirectory(const Path & path) { };

    virtual void createRegularFile(const Path & path) { };
    virtual void isExecutable() { };
    virtual void preallocateContents(unsigned long long size) { };
    virtual void receiveContents(unsigned char * data, unsigned int len) { };

    virtual void createSymlink(const Path & path, const string & target) { };
};

void parseDump(ParseSink & sink, Source & source);

void restorePath(const Path & path, Source & source);

}
td>Julien Lepiller 2018-03-23gnu: gettext-minimal: Return #t from all phases....* gnu/packages/gettext.scm (gettext-minimal)[arguments]: Return #t from the 'patch-tests' and 'link-expat' phases. Mark H Weaver 2018-02-22gnu: po4a: Update home page....* gnu/packages/gettext.scm (po4a)[home-page]: Update. Tobias Geerinckx-Rice 2017-11-06gnu: Disable gnulib's test-lock test in packages....* gnu/packages/base.scm (findutils)[source]: Disable test-lock. * gnu/packages/gettext.scm (gettext-minimal)[source]: Ditto. * gnu/packages/libidn.scm (libidn)[source]: Ditto. * gnu/packages/libunistring.scm (libunistring)[source]: Ditto. * gnu/packages/augeas.scm (augeas)[source]: Ditto. * gnu/packages/gsasl.scm (gsasl)[source]: Ditto. * gnu/packages/patches/findutils-gnulib-multi-core.patch, gnu/packages/patches/gettext-gnulib-multi-core.patch, gnu/packages/patches/gettext-multi-core.patch, gnu/packages/patches/libunistring-gnulib-multi-core.patch: Delete patches. * gnu/local.mk (DIST_PATCH_DATA): Remove them. Eric Bavier 2017-07-27gnu: po4a: Work around "dotless @INC" build issues....* gnu/packages/gettext.scm (po4a)[arguments]: Add build phase "set-search-path". Ricardo Wurmus 2017-07-10Merge branch 'master' into core-updatesLeo Famulari 2017-06-30gnu: po4a: Use texlive-tiny....* gnu/packages/gettext.scm (po4a)[native-inputs]: Replace texlive-minimal with texlive-tiny. Ricardo Wurmus 2017-04-13gnu: gettext: Fix make check issues on multi-core machines....* gnu/packages/patches/gettext-gnulib-multi-core.patch: New file. * gnu/packages/patches/gettext-multi-core.patch: New file. * gnu/packages/gettext.scm (gettext-minimal)[patches]: Add a reference to the two previous patches. Signed-off-by: Ludovic Courtès <ludo@gnu.org> Mathieu Othacehe 2017-03-30Merge branch 'master' into core-updates...Most conflicts are from 6fd52309b8f52c9bb59fccffac53e029ce94b698. Marius Bakke 2017-03-30gnu: Use HTTPS for almost all gnu.org HOME-PAGEs....All HTTP gnu.org (and supported subdomain) HOME-PAGEs changed to HTTPS. Tobias Geerinckx-Rice 2017-03-26gnu: po4a: Make manpages writable before resetting timestamps....* gnu/packages/gettext.scm (po4a)[arguments]: Add 'make-compressed-files-writable' phase. Marius Bakke