aboutsummaryrefslogtreecommitdiff
#pragma once

#include "config.h"

#include <string>
#include <list>
#include <set>

#include <boost/format.hpp>

/* Before 4.7, gcc's std::exception uses empty throw() specifiers for
 * its (virtual) destructor and what() in c++11 mode, in violation of spec
 */
#ifdef __GNUC__
#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
#define EXCEPTION_NEEDS_THROW_SPEC
#endif
#endif


namespace nix {


/* Inherit some names from other namespaces for convenience. */
using std::string;
using std::list;
using std::set;
using std::vector;
using boost::format;


struct FormatOrString
{
    string s;
    FormatOrString(const string & s) : s(s) { };
    FormatOrString(const format & f) : s(f.str()) { };
    FormatOrString(const char * s) : s(s) { };
};


/* BaseError should generally not be caught, as it has Interrupted as
   a subclass. Catch Error instead. */
class BaseError : public std::exception
{
protected:
    string prefix_; // used for location traces etc.
    string err;
public:
    unsigned int status; // exit status
    BaseError(const FormatOrString & fs, unsigned int status = 1);
#ifdef EXCEPTION_NEEDS_THROW_SPEC
    ~BaseError() throw () { };
    const char * what() const throw () { return err.c_str(); }
#else
    const char * what() const noexcept { return err.c_str(); }
#endif
    const string & msg() const { return err; }
    const string & prefix() const { return prefix_; }
    BaseError & addPrefix(const FormatOrString & fs);
};

#define MakeError(newClass, superClass) \
    class newClass : public superClass                  \
    {                                                   \
    public:                                             \
        newClass(const FormatOrString & fs, unsigned int status = 1) : superClass(fs, status) { }; \
    };

MakeError(Error, BaseError)

class SysError : public Error
{
public:
    int errNo;
    SysError(const FormatOrString & fs);
};


typedef list<string> Strings;
typedef set<string> StringSet;


/* Paths are just strings. */
typedef string Path;
typedef list<Path> Paths;
typedef set<Path> PathSet;


typedef enum {
    lvlError = 0,
    lvlInfo,
    lvlTalkative,
    lvlChatty,
    lvlDebug,
    lvlVomit
} Verbosity;


}
ncdu.scm (ncdu)[native-inputs]: Use zig-0.9. * gnu/packages/zig-xyz.scm (zig-zls)[inputs]: Use zig-0.9. Efraim Flashner 2022-12-11gnu: ncdu: Use upstream name....* gnu/packages/ncdu.scm (ncdu-1): New variable, renamed from… (ncdu): …this one, itself renamed from the old ncdu-2. Simple! [name]: Drop suffix. [properties]: Remove obsolete 'upstream-name. (ncdu-2): Redefine as a DEPRECATED-PACKAGE alias of ncdu. Tobias Geerinckx-Rice 2022-12-11gnu: ncdu2: Delete pregenerated man page from source....* gnu/packages/ncdu.scm (ncdu2)[source]: Add a snippet. [arguments]: Adjust 'build-manpage phase accordingly. Tobias Geerinckx-Rice 2022-12-11gnu: ncdu2: Do not use the illegal instructions....* gnu/packages/ncdu.scm (ncdu-2)[arguments]: Compile for a baseline CPU. Tobias Geerinckx-Rice 2022-12-15gnu: ncdu: Update to 1.18....* gnu/packages/ncdu.scm (ncdu): Update to 1.18. Efraim Flashner 2022-11-01gnu: ncdu-2: Update to 2.2.1....* gnu/packages/ncdu.scm (ncdu-2): Update to 2.2.1. Efraim Flashner 2022-10-18gnu: ncdu-2: Update to 2.2....* gnu/packages/ncdu.scm (ncdu-2): Update to 2.2. Efraim Flashner 2022-05-10gnu: ncdu: Update to 1.17....* gnu/packages/ncdu.scm (ncdu): Update to 1.17. Efraim Flashner 2022-05-06gnu: ncdu-2: Update to 2.1.2....* gnu/packages/ncdu.scm (ncdu-2): Update to 2.1.2. Efraim Flashner 2022-03-30gnu: ncdu-2: Update to 2.1.1....* gnu/packages/ncdu.scm (ncdu-2): Update to 2.1.1. Efraim Flashner 2022-03-30gnu: ncdu2: Set upstream name....* gnu/packages/ncdu.scm (ncdu-2)[properties]: New field. Efraim Flashner 2022-03-15gnu: ncdu2: Update to 2.1....* gnu/packages/ncdu.scm (ncdu2): Update to 2.1. Efraim Flashner 2022-03-06gnu: Add ncdu2....* gnu/packages/ncdu.scm (ncdu2): New variable. Efraim Flashner 2021-12-13gnu: Simplify package inputs....This commit was obtained by running: ./pre-inst-env guix style without any additional argument. Ludovic Courtès 2021-09-03gnu: ncdu: Update to 1.16....* gnu/packages/ncdu.scm (ncdu): Update to 1.16. Tobias Geerinckx-Rice 2020-07-01gnu: ncdu: Fix up synopsis & description....* gnu/packages/ncdu.scm (ncdu)[synopsis]: Fix typo. [description]: Start with a proper sentence. Double-space. Tobias Geerinckx-Rice 2020-07-01gnu: ncdu: Update to 1.15.1....* gnu/packages/ncdu.scm (ncdu): Update to 1.15.1. Tobias Geerinckx-Rice 2020-06-03gnu: ncdu: Update to 1.15....* gnu/packages/ncdu.scm (ncdu): Update to 1.15. Tobias Geerinckx-Rice 2020-02-17gnu: ncdu: Update to 1.14.2....* gnu/packages/ncdu.scm (ncdu): Update to 1.14.2. Tobias Geerinckx-Rice 2019-12-01gnu: ncdu: Update to 1.14.1....* gnu/packages/ncdu.scm (ncdu): Update to 1.14.1. Tobias Geerinckx-Rice