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);

}
cm?id=221a922746f1548d9a3c21d2fdb9b5c738187091'>teams: Remove myself from the documentation team....* etc/teams.scm (Florian Pelz): Remove from the documentation team. Change-Id: I12be73998b18c3767f6d07753285bf1e70401054 Florian Pelz 2024-10-05teams: Register (gnu packages emulators) to games team....* etc/teams.scm (games) <scope>: Register "gnu/packages/emulators.scm". Change-Id: I269f83073ff7bb9dcfc23767d853050ce07bfcb5 Maxim Cournoyer 2024-09-06Add file to core-packages team....* etc/teams.scm (core-packages): Add multiprecision.scm, which contains inputs for gcc. Change-Id: I36bf34450942c55529a471838fcfca29ceb9ae45 Andreas Enge 2024-09-06Add myself to teams....* etc/teams.scm: Add teams to myself. Change-Id: I4d8c5bc5144cdd094063960c079527628ace4bbc Andreas Enge 2024-09-04Add André Batista to team mozilla....* etc/teams.scm: Define new member. Change-Id: I34114c8fdbcaa40380e032353945d5e74a369064 Signed-off-by: jgart <jgart@dismail.de> André Batista 2024-09-04etc: teams: Add gnu/packages/librewolf.scm to mozilla team....* etc/teams.scm (mozilla): Register gnu/packages/librewolf.scm file. Update team description in order to reflect its broadened scope. Change-Id: I75dac5d5e76e611aba7e9e55ef99e8279f1e6d9b Signed-off-by: jgart <jgart@dismail.de> André Batista 2024-08-31etc: teams: Add gnu/packages/ld-wrapper.in to core-packages team....* etc/teams.scm (core-packages): Register gnu/packages/ld-wrapper.in file. Change-Id: Iab401eac38e7fef2b92788fa30e9546e985641c3 Maxim Cournoyer 2024-08-26teams: Remove Matt from their team due to inactivity....* etc/teams.scm (Matthew Trzcinski): Remove from the DOCUMENTATION team. Change-Id: I6ab1f35086a2a1abc7c0436013efe223b44c7867 Florian Pelz 2024-07-04Add Nicolas Goaziou to team tex....* etc/teams.scm: Define new member. Change-Id: Ia7a52c5057a6e1b6b92c6079641bb354f1ecfd64 Nicolas Goaziou 2024-07-04Add Laurent Gatto to team r....Welcome to the R Team! * etc/teams.scm: Define new member. Change-Id: I947b54fef154d39a0630d0f0c7c11aecda492db9 Laurent Gatto 2024-06-16Remove Ricardo from all teams but R and Sugar....Change-Id: I609d9ae18be81b512641f28452e01da7e1c63db7 Ricardo Wurmus 2024-06-16teams: Remove Tobias Geerinckx-Rice from the kernel team due to inactivity....* etc/teams.scm (Tobias Geerinckx-Rice): Remove from the KERNEL team. Change-Id: I48875486a1420c3a0459570d1dafe54c4f700802 Leo Famulari 2024-06-04teams: Add Simon to r team....* etc/teams.scm (Simon Tournier): Subscribe to the 'r' team. Change-Id: I6f183ac10a854ae6f42396abed7436a9cefe26b4 Simon Tournier 2024-05-15teams: Add Maxim to documentation team....* etc/teams.scm (Maxim Cournoyer): Subscribe to the 'documentation' team. Change-Id: I4a9d0a329fb66eb2dc798da5dbb5231255676033 Maxim Cournoyer 2024-05-11teams: Add Matt to the documentation team....* etc/teams.scm (Matthew Trzcinski): New member. Signed-off-by: Florian Pelz <pelzflorian@pelzflorian.de> Change-Id: I5f75d8e74d972c60760b8fb57bcef0b76a971962 Matthew Trzcinski 2024-05-02teams: Add myself to the documentation team....* etc/teams.scm (Florian Pelz): Add to documentation team. Change-Id: I904097dbaf32ed0ae80caff5ef966bed287a2a05 Florian Pelz 2024-05-01teams: Add myself to the documentation team....* etc/teams.scm (Ludovic Courtès): Add to documentation team. Change-Id: Icf71ad8e2ebbe2b65ab3b6c0cf8cd8fe60cf2d0a Ludovic Courtès 2024-05-01teams: Add documentation team....* etc/teams.scm (documentation): New team. Change-Id: I34d4ed9029f369ebf0d1f510cc0810baca2ced89 Ludovic Courtès 2024-04-09teams: Remove Björn Höfling from their team due to inactivity....* etc/teams.scm (Björn Höfling): Remove from the JAVA team. Change-Id: I384e4aebff18485ea5c5bf444a46dc88a64af72d Leo Famulari 2024-04-09teams: Remove Raghav Gururajan from their teams due to inactivity....* etc/teams.scm (Raghav Gururajan): Remove from the GNOME and MENTORS teams. Change-Id: Ic1a583f08636f4cfd34635ab04091844b9957e08 Leo Famulari 2024-03-14teams: Add Tanguy Le Carrour....* etc/teams.scm.in ("Tanguy Le Carrour"): New member. Change-Id: Ic1b1588a5a8bc67ee8e135c3069966f139374529 Signed-off-by: Christopher Baines <mail@cbaines.net> Tanguy Le Carrour 2024-03-08teams: Add 宋文武 to the qt team....* etc/teams.scm (宋文武): Add qt team. Change-Id: Ib1b50b109ded4dbbcfd0649d3e0c1e6884585c5e 宋文武 2024-03-08teams: lxqt: Remove qt.scm from scope....* etc/teams.scm (lxqt)[#:scope]: Remove "gnu/packages/qt.scm". Change-Id: If05ea534a827eba5a2acf6526d906cea43f72442 宋文武 2024-03-08teams: Add entry for Adam Faiz....* etc/teams.scm ("Adam Faiz"): New member. Signed-off-by: Andreas Enge <andreas@enge.fr> Change-Id: Idb913da5e4f622b8efdbadc87d2cf3e5aec118eb AwesomeAdam54321 2024-02-13teams: Add Sugar team....* etc/teams.scm (sugar): New team; add Ricardo to it. Change-Id: I4d7af2a8f4077fa60ff8400b0b8b1b6127a77448 Ricardo Wurmus 2024-02-13teams: go: Add all related files to the scope....* etc/teams.scm (go): Add regex search for any golang files. Change-Id: Ia6c95d8d49863de0381a907ca6309fa22d22927e Sharlatan Hellseher 2024-02-05teams: mozilla: Add tor-browsers.scm....* etc/teams.scm (mozilla): Add "gnu/packages/tor-browsers.scm". Change-Id: Id3aa1fe641c612000319a4ea4b236285f8d3b599 Clément Lassieur 2024-02-03teams: Add Mark H Weaver to the ‘mozilla’ team....* etc/teams.scm (Mark H Weaver): Add to the ‘mozilla’ team. Mark H Weaver