#pragma once #include "types.hh" #include #include #include #include #include #include #include namespace nix { #define foreach(it_type, it, collection) \ for (it_type it = (collection).begin(); it != (collection).end(); ++it) #define foreach_reverse(it_type, it, collection) \ for (it_type it = (collection).rbegin(); it != (collection).rend(); ++it) /* Return an environment variable. */ string getEnv(const string & key, const string & def = ""); /* Return an absolutized path, resolving paths relative to the specified directory, or the current directory otherwise. The path is also canonicalised. */ Path absPath(Path path, Path dir = ""); /* Canonicalise a path by removing all `.' or `..' components and double or trailing slashes. Optionally resolves all symlink components such that each component of the resulting path is *not* a symbolic link. */ Path canonPath(const Path & path, bool resolveSymlinks = false); /* Return the directory part of the given canonical path, i.e., everything before the final `/'. If the path is the root or an immediate child thereof (e.g., `/foo'), this means an empty string is returned. */ Path dirOf(const Path & path); /* Return the base name of the given canonical path, i.e., everything following the final `/'. */ string baseNameOf(const Path & path); /* Check whether a given path is a descendant of the given directory. */ bool isInDir(const Path & path, const Path & dir); /* Get status of `path'. */ struct stat lstat(const Path & path); /* Return true iff the given path exists. */ bool pathExists(const Path & path); /* Read the contents (target) of a symbolic link. The result is not in any way canonicalised. */ Path readLink(const Path & path); bool isLink(const Path & path); /* Read the contents of a directory. The entries `.' and `..' are removed. */ struct DirEntry { string name; ino_t ino; unsigned char type; // one of DT_* DirEntry(const string & name, ino_t ino, unsigned char type) : name(name), ino(ino), type(type) { } }; typedef vector DirEntries; DirEntries readDirectory(const Path & path); unsigned char getFileType(const Path & path); /* Read the contents of a file into a string. */ string readFile(int fd); string readFile(const Path & path, bool drain = false); /* Write a string to a file. */ void writeFile(const Path & path, const string & s); /* Read a line from a file descriptor. */ string readLine(int fd); /* Write a line to a file descriptor. */ void writeLine(int fd, string s); /* Del2019-12-05Revert "gnu: Properly move lisp libraries to lisp-xyz, uglify-js to ↵Tobias Geerinckx-Rice javascript and stumpwm to wm." This reverts commit ac1ee30f4f7f9d0ae2a655676b0e8b9eb90a35dd, which still breaks ‘guix pull’. 2019-12-05gnu: librsvg-next: Use generate-all-checksums.Efraim Flashner * gnu/packages/gnome.scm (librsvg-next)[arguments]: Use generate-all-checksums instead of manually traversing the directories. 2019-12-05gnu: Properly move lisp libraries to lisp-xyz, uglify-js to javascript and ↵Pierre Neidhardt stumpwm to wm. * gnu/local.mk: Include lisp-xyz.scm. * gnu/packages/lisp-xyz.scm: New file. * gnu/packages/lisp.scm: Move all lisp libraries to lisp-xyz.scm, uglify-js to javascript.scm and stumpwm to wm.scm. * gnu/packages/javascript.scm: Add uglify-js. * gnu/packages/wm.scm: Add stumpwm. * gnu/packages/bioinformatics.scm: Find uglify-js in javascript.scm. * gnu/packages/machine-learning.scm: Depend on lisp-xyz.scm instead of lisp.scm. * gnu/packages/web.scm: Find uglify-js in javascript.scm. * gnu/packages/web-browsers.scm: Depend on lisp-xyz.scm instead of lisp.scm. * guix/build-system/minify.scm (default-uglify-js): Find uglify-js in javascript module instead of lisp. 2019-12-04gnu: Remove unused module import.Marius Bakke * gnu/packages/image.scm: Do not import (gnu packages gcc). 2019-12-04gnu: libjpeg-turbo: Fix CVE-2019-13960 and CVE-2019-2201.Marius Bakke * gnu/packages/patches/libjpeg-turbo-CVE-2019-2201.patch: New file. * gnu/local.mk (dist_patch_DATA): Adjust accordingly. * gnu/packages/image.scm (libjpeg-turbo/fixed): New variable. (libjpeg-turbo)[replacement]: New field. 2019-12-04gnu: pd: Update to 0.50-2.Tobias Geerinckx-Rice * gnu/packages/music.scm (pd): Update to 0.50-2. 2019-12-04gnu: libgig: Update to 4.2.0.Tobias Geerinckx-Rice * gnu/packages/music.scm (libgig): Update to 4.2.0. 2019-12-04gnu: imapfilter: Update to 2.6.16.Tobias Geerinckx-Rice * gnu/packages/mail.scm (imapfilter): Update to 2.6.16. [arguments]: Remove ‘fix-include-path’ phase. 2019-12-04gnu: mpop: Update to 1.4.6.Tobias Geerinckx-Rice * gnu/packages/mail.scm (mpop): Update to 1.4.6. 2019-12-04gnu: girara: Fetch sources from git.Tobias Geerinckx-Rice The tarball URI is having server issues. Use the upstream git repository instead until this is resolved. Reported by Marius Bakke <mbakke@fastmail.com>. * gnu/packages/gtk.scm (girara)[source]: Switch to GIT-FETCH. 2019-12-04gnu: emacs-org-contrib: Fix build.Pierre Neidhardt * gnu/packages/emacs-xyz.scm (emacs-org-contrib): Refer to the updated installation directory. 2019-12-04gnu: emacs-scel: Fix build.Pierre Neidhardt * gnu/packages/emacs-xyz.scm (emacs-scel): Refer to the updated installation directory.