aboutsummaryrefslogtreecommitdiff
path: root/tests/base64.scm
blob: 99c02b531e1694b12f77f50e2c73c0e58f09ef7e (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
;;; GNU Guix --- Functional package management for GNU
;;; Copyright © 2014 Nikita Karetnikov <nikita@karetnikov.org>
;;;
;;; This file is part of GNU Guix.
;;;
;;; GNU Guix is free software; you can redistribute it and/or modify it
;;; under the terms of the GNU General Public License as published by
;;; the Free Software Foundation; either version 3 of the License, or (at
;;; your option) any later version.
;;;
;;; GNU Guix is distributed in the hope that it will be useful, but
;;; WITHOUT ANY WARRANTY; without even the implied warranty of
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;;; GNU General Public License for more details.
;;;
;;; You should have received a copy of the GNU General Public License
;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.

(define-module (test-base64)
  #:use-module (guix base64)
  #:use-module (rnrs bytevectors)
  #:use-module (srfi srfi-64))

(define (string->base64 str)
  (base64-encode (string->utf8 str)))

;;; Test vectors from <https://tools.ietf.org/rfc/rfc4648.txt>.

(test-begin "base64")

(test-equal "empty string"
  (string->base64 "")
  "")

(test-equal "f"
  (string->base64 "f")
  "Zg==")

(test-equal "fo"
  (string->base64 "fo")
  "Zm8=")

(test-equal "foo"
  (string->base64 "foo")
  "Zm9v")

(test-equal "foob"
  (string->base64 "foob")
  "Zm9vYg==")

(test-equal "fooba"
  (string->base64 "fooba")
  "Zm9vYmE=")

(test-equal "foobar"
  (string->base64 "foobar")
  "Zm9vYmFy")

(test-end "base64")
d>2020-07-16guix-install.sh: Make sure /etc/profile is sourced.Tobias Geerinckx-Rice New users regularly report missing newly-installed programmes and icons. * etc/guix-install.scm (main): Tell users to log out & back in. 2020-07-16guix-install.sh: Suggest running gpg as root.Tobias Geerinckx-Rice The original example regularly prevented new users from installing Guix at all. * etc/guix-install.scm (chk_gpg_keyring): Suggest ‘sudo -i gpg’. 2020-07-14etc: Enable mount unit only if it exists.Tobias Geerinckx-Rice * etc/guix-install.sh (sys_enable_guix_daemon): Enable gnu-store.mount only if it was actually installed. Reported by peanutbutterandc on #guix. 2020-05-23guix-install.sh: Fix ‘systemctl not found’ error message at probe.Vincent Legoll * etc/guix-install.sh (chk_init_sys): Redirect systemctl errors to /dev/null. Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> 2020-05-23guix-install.sh: Add xz to requirements.Vincent Legoll * etc/guix-install.sh (REQUIRE): Add xz to requirements list. Signed-off-by: Tobias Geerinckx-Rice <me@tobias.gr> 2020-05-17etc: Install mount unit only if it exists.Tobias Geerinckx-Rice This follows up on 1a1faa78b0498fbb71f1533beb4b65817c1d3f2a, and avoids the (non-fatal) error seen in <https://issues.guix.gnu.org/41356>. /gnu/store will remain writable on new foreign distribution installations until the next release. * etc/guix-install.sh (sys_enable_guix_daemon): Check for ‘gnu-store.mount’ presence before trying to cp it. Update forgotten copyright header. 2020-05-16etc: Add a systemd unit to bind-mount @storedir@ read-only.Tobias Geerinckx-Rice * etc/gnu-store.mount.in: New file. * nix/local.mk (nodist_systemdservice_DATA): Add it. (etc/%.mount): New rule for it. * etc/guix-install.sh (sys_enable_guix_daemon): Install it. * doc/guix.texi (Binary Installation): Document it. * .gitignore: Ignore changes to it. 2020-03-22guix-install.sh: /etc/profile.d/guix.sh sources ~/.guix-profile/etc/profile.Ludovic Courtès * etc/guix-install.sh (sys_create_init_profile): Source ~/.guix-profile/etc/profile instead of running 'guix package --search-paths=prefix' 2020-03-22guix-install.sh: Add a trailing colon to 'INFOPATH'.Ludovic Courtès Fixes <https://bugs.gnu.org/39984>. Suggested by Adam Porter <adam@alphapapa.net>. * etc/guix-install.sh (sys_create_init_profile): Add a trailing colon to 'INFOPATH'. 2020-03-11guix-install.sh: Install SysV init script.Danny Milosavljevic * etc/guix-install.sh (sys_enable_guix_daemon): Install SysV init script. 2020-01-26guix-install.sh: Correctly treat empty or unset $XDG_DATA_DIRSAlexander Krotov If $XDG_DATA_DIRS is unset, default value of "/usr/local/share:/usr/share" is used according to XDG Base Directory Specification. However, /etc/profile.d/guix.sh treats this value as empty list when appending its own directory, so after installing Guix on the system, launchers such as Rofi stop searching for .desktop files in /usr/share/applications/ and can't launch applications other than those installed with Guix. This patch fixes the bug in generated /etc/profile.d/guix.sh * etc/guix-install.sh (sys_create_init_profile): Use default value of /usr/local/share:/usr/share/ before appending if $XDG_DATA_DIRS is not set. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-01-26guix-install.sh: Create /etc/profile.d if it does not existPrafulla Giri * etc/guix-install.sh (sys_create_init_profile): Add code to create /etc/profile.d if it somehow does not exist; the function still carries on because it is possible that /etc/profile is still configured to read the *.sh files from /etc/profile.d, if they exist. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-01-26guix-install.sh: Export INFOPATH to contain updated guix info-pagesPrafulla Giri * etc/guix-install.sh (sys_create_init_profile): Export INFOPATH to include the updated info-pages from ~/.config/guix/current/share/info. This also makes sure that both /usr/bin/info and $GUIX_PROFILE/bin/info can read guix info pages without throwing "no menu item 'guix' in node dir(Top)" error. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2020-01-17guix-install.sh: Create an init profile during installationPrafulla Giri Create an init profile (/etc/profile.d/guix.sh) during installation for better integration with foreign distros. This file, read by login-shells sets a few environment variables (PATH, GUIX_PROFILE, GUIX_LOCALE, along with XDG_DATA_DIRS) and makes guix-installed packages readily available for the users. Other environment variables, as listed by `guix package --search-paths=prefix`, are also exported. Checks are in place to prevent the init profile from needlessly polluting the user's environment. * etc/guix-install.sh (sys_create_init_profile): New function to create /etc/profile.d/guix.sh init profile. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2019-12-04guix-install.sh: Use a deterministic umask.Tobias Geerinckx-Rice Users with strict umasks (e.g. 0077) would end up with an unreadable /gnu (mode 0700) and no way to run guix. Reported by A. <@aaap:matrix.org> on #guix. * etc/guix-install.sh (main): Set umask before installing anything. 2019-09-05guix-install.sh: Work around locale issues in 'guix-daemon.service'.Ludovic Courtès * etc/guix-install.sh (sys_enable_guix_daemon): Modify 'guix-daemon.service' to work around locale issues not fixed in 1.0.1. 2019-07-08guix-install.sh: Don't initialise ~/.gnupg.Tobias Geerinckx-Rice * etc/guix-install.sh (chk_gpg_keyring): Call gpg with ‘--dry-run’. 2019-07-08guix-install.sh: Check for PGP key separately.Tobias Geerinckx-Rice * etc/guix-install.sh (chk_gpg_keyring): New function to handle the public key check previously stuffed into chk_require. (main): Call it. 2019-07-08guix-install.sh: Add missing ‘local’ declaration.Tobias Geerinckx-Rice * etc/guix-install.sh (chk_require): Make $c local. 2019-07-08guix-install.sh: Treat REQUIRE as the array it is.Tobias Geerinckx-Rice Don't flatten it into a string only to split it again later. * etc/guix-install.sh (chk_require): Iterate over array elements, not string tokens. (main): Pass $REQUIRE as an array of arguments. 2019-07-01etc: Do not recommend use of SKS key servers.Ricardo Wurmus * etc/guix-install.sh: Recommend downloading the GPG key from Savannah. 2019-06-29guix-install.sh: Don't authorise hydra.gnu.org.Tobias Geerinckx-Rice * etc/guix-install.sh (sys_authorize_build_farms): Authorise only ci.guix.gnu.org and make all references to it singular. 2019-05-10etc: Refer to ci.guix.gnu.org in install script.Ricardo Wurmus * etc/guix-install.sh: Replace reference to ci.guix.info with ci.guix.gnu.org. 2019-05-02guix-install.sh: Update URL.Ludovic Courtès * etc/guix-install.sh (GNU_URL): Change to ftp.gnu.org. 2019-02-05guix-install.sh: Avoid "#!/bin/bash" shebang.Ludovic Courtès Fixes <https://bugs.gnu.org/34279>. Reported by Claes Wallin (韋嘉誠) <clacke@lysator.liu.se>. * etc/guix-install.sh: Change shebang to #!/bin/sh and add 'if' statement to spawn Bash if needed. 2018-12-13guix-install.sh: Use pool.sks-keyservers.net.Ludovic Courtès "pgp.mit.edu" has been unavailable for some time. * etc/guix-install.sh (chk_require): Change key server to pool.sks-keyservers.net. 2018-12-05guix-install.sh: Use the "ci.guix.info.pub" file name for clarity.Ludovic Courtès * etc/guix-install.sh (sys_authorize_build_farms): Use the "ci.guix.info.pub" file name rather "berlin.guixsd.org.pub". 2018-11-23build: Binary tarball now populates the "current-guix" profile.Ludovic Courtès * Makefile.am (guix-binary.%.tar.xz): Pass '--profile-name=current-guix'. Remove glibc and glibc-utf8-locales. * doc/guix.texi (Binary Installation): Update accordingly. * etc/guix-install.sh * etc/guix-install.sh (sys_create_store, sys_enable_guix_daemon) (sys_authorize_build_farms): Likewise. * etc/guix-publish.conf.in, etc/guix-publish.service.in, etc/guix-daemon.conf.in, etc/guix-daemon.service.in: Update file names accordingly. 2018-10-14guix-install.sh: Recognize armhf-linux.Ludovic Courtès * etc/guix-install.sh (chk_sys_arch): Add "armv7l" case. 2018-05-19guix-install.sh: Fix chk_require exiting without warning.Maxim Cournoyer * etc/guix-install.sh (chk_require): Because of the set -e option, Bash was exiting when the command `command -v "$c" &>/dev/null' was running on its own. Instead, we now test the command and accumulate warning messages in a single statement by chaining the command with a logical OR. Signed-off-by: Ludovic Courtès <ludo@gnu.org> 2018-03-29guix-install.sh: Explicitly set root's home directory.Chris Marusich * etc/guix-install.sh (ROOT_HOME): New variable. (sys_create_store, sys_enable_guix_daemon, sys_authorize_build_farms): Use ROOT_HOME instead of ~root or the HOME environment variable. * doc/guix.texi (Binary Installation): Instead of assuming that ~ and $HOME refer to root's directory simply because commands are being run as root, explicilty refer to it via ~root. Fixes: <https://bugs.gnu.org/30728> 2018-02-21etc: guix-install.sh: Add aarch64-linux support.Efraim Flashner * etc/guix-install.sh (chk_sys_arch): Add aarch64 case. 2018-01-30etc: Add installation script.Ricardo Wurmus * etc/guix-install.sh: New file. * Makefile.am (EXTRA_DIST): Add it. * doc/guix.texi (Binary Installation): Mention it. Co-authored-by: sharlatan <sharlatanus@gmail.com>