3
5
Fork 0
mirror of git://git.savannah.gnu.org/guix.git synced 2023-12-14 03:33:07 +01:00
guix/tests
Xinglu Chen 2ad896751c
services: configuration: Allow specifying prefix for serializer names.
Sometimes two configurations might have the same types for their field values,
but the values might be serialized in two completely different
ways (e.g. because the two programs have different configuration languages).

An example of this would be the ‘serialize-boolean’ procedure in (gnu services
mail) and (gnu services getmail).  They both serialize a boolean value, but
because the Dovecot’s configuration language has a different syntax to the
configuration language for Getmail, two different procedures have to be
defined.

One way to workaround this would be to specify custom serializers for many
fields in order to separate the serialization of the values that have the same
type but serialize in different ways.  This could get very tedious, especially
if there are many configurations in the same module.

Another way would be to move one of the configurations to its own module, like
what was done with (gnu services getmail).  However, this would mean that
there would be multiple modules containing configurations for related
programs, e.g. we have (gnu services mail) and (gnu services getmail), it
doesn’t make much sense to keep the Getmail configuration in its own module.

This patch will allow one to write something like this:

  (define-configuration foo-configuration
    (bar
      (string "bob")
      "Option bar.")
    (prefix bar-))

and the value of the ‘bar’ field would be serialized using a procedure named
‘bar-serialize-string’ instead of just ‘serialize-string’.

* gnu/services/configuration.scm (define-maybe-helper): Accept ‘prefix’
argument for using serializer with custom prefix.
(define-maybe): Pattern match on ‘prefix’ literal.
(define-configuration-helper): Accept ‘prefix’ argument for using serializer
with custom prefix.
(define-configuration): Pattern match on ‘prefix’ literal.
* tests/services/configuration.scm ("serialize-configuration with prefix"):
New test.

Signed-off-by: Ludovic Courtès <ludo@gnu.org>
2021-06-29 12:37:33 +02:00
..
services services: configuration: Allow specifying prefix for serializer names. 2021-06-29 12:37:33 +02:00
accounts.scm accounts: Delete duplicate entries. 2019-08-28 00:27:14 +02:00
base16.scm
base32.scm build: Remove references to the 'nix-hash' program. 2020-08-29 16:24:17 +02:00
base64.scm
boot-parameters.scm system: Allow separated /boot and encrypted root. 2020-12-21 18:41:11 +01:00
bournish.scm
build-utils.scm Properly deal with build directories containing '~'. 2020-11-16 11:21:42 +01:00
builders.scm tests: Remove expensive and pointless test. 2019-06-14 21:57:18 +02:00
cache.scm Remove workaround for 'time-monotonic' in Guile 2.2.2. 2020-03-22 16:49:47 +01:00
challenge.scm guix: Move narinfo code from substitute script to module. 2021-01-16 11:51:03 +00:00
channels.scm tests: Add missing copyright line. 2020-10-12 18:23:47 +02:00
civodul.key Add (guix openpgp). 2020-05-04 09:56:12 +02:00
combinators.scm
containers.scm linux-container: Reset jailed root permissions. 2020-10-01 12:51:13 +02:00
cpan.scm import: cpan: Rewrite tests to use an HTTP server instead of mocking. 2020-01-15 18:40:43 +01:00
cpio.scm
cran.scm import: cran: Avoid uses of '@@' in the tests. 2020-01-16 23:14:05 +01:00
crate.scm tests: Fix JSON syntax error in 'crate.scm'. 2021-01-13 22:42:49 +01:00
cve-sample.json tests: Fix malformed JSON. 2020-12-21 17:47:35 +01:00
cve.scm cve: Rewrite to read the JSON feed instead of the XML feed. 2019-10-23 16:40:17 +02:00
debug-link.scm
derivations.scm tests: do not hard code HTTP ports 2021-03-06 11:41:48 +01:00
discovery.scm
dsa.key Add (guix openpgp). 2020-05-04 09:56:12 +02:00
ed25519.key Add (guix openpgp). 2020-05-04 09:56:12 +02:00
ed25519.sec Add (guix openpgp). 2020-05-04 09:56:12 +02:00
ed25519bis.key git-authenticate: Add tests. 2020-06-05 22:54:06 +02:00
ed25519bis.sec git-authenticate: Add tests. 2020-06-05 22:54:06 +02:00
egg.scm import: Add CHICKEN egg importer. 2021-06-03 13:05:18 +02:00
elpa.scm tests: do not hard code HTTP ports 2021-03-06 11:41:48 +01:00
file-systems.scm bootloader: grub: Allow booting from a Btrfs subvolume. 2020-05-20 08:30:35 -04:00
gem.scm tests: Remove trailing commas in JSON tests. 2020-04-27 23:29:40 +02:00
gexp.scm gexp: #:references-graphs refers to non-native derivations. 2021-03-03 14:19:25 +01:00
git-authenticate.scm tests: Allow 'tests/git-authenticate.scm' to run when git/gpg is missing. 2020-06-28 23:26:53 +02:00
git.scm git: 'commit-difference' really excludes the ancestors of #:excluded. 2020-06-09 00:34:52 +02:00
glob.scm guix: Add globstar support. 2020-12-09 22:25:17 +01:00
gnu-maintenance.scm gnu-maintenance: 'release-file?' accepts 'v' prefix as in "PKG-v1.2.tgz". 2021-05-28 23:04:44 +02:00
go.scm tests: go: Remove duplicate go-version->git-ref test. 2021-05-05 00:58:04 -04:00
grafts.scm grafts: Support rewriting UTF-16 and UTF-32 store references. 2021-04-15 03:22:55 -04:00
graph.scm graph: Adjust test for recent OCaml changes. 2020-10-20 16:30:15 +02:00
gremlin.scm gremlin: Adjust tests for foreign distros. 2019-05-18 12:10:15 +02:00
guix-archive.sh serialization: 'restore-file' sets canonical timestamp and permissions. 2020-12-15 17:32:09 +01:00
guix-authenticate.sh authenticate: Encode strings as ISO-8859-1. 2020-09-15 14:40:20 +02:00
guix-build-branch.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-build.sh Add powerpc64le-linux as a supported Guix architecture. 2021-03-23 23:19:57 -07:00
guix-daemon.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-describe.sh
guix-download.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-environment-container.sh environment: Turn "lo" up in network-less containers. 2020-10-05 10:41:59 +02:00
guix-environment.sh environment: Fix '--root' option with relative file name. 2021-01-19 17:45:38 +01:00
guix-gc.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-git-authenticate.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-graph.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-hash.sh guix hash: Honor '-H' when used alongside '-r'. 2021-01-04 11:51:48 +01:00
guix-lint.sh packages: 'package-field-location' handles 'search-path' returning #f. 2021-02-22 12:07:45 +01:00
guix-pack-localstatedir.sh pack: '--localstatedir' and '-R' tests gracefully handle missing /gnu/store. 2019-05-18 12:23:31 +02:00
guix-pack-relocatable.sh tests: pack-relocatable: Ensure commands can run in the current namespace. 2020-12-04 13:12:08 +00:00
guix-pack.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-package-aliases.sh guix build: Record package transformations in manifest entries. 2020-10-02 23:28:09 +02:00
guix-package-net.sh tests: Simplify shell exit status negation; 2020-09-28 21:06:36 -05:00
guix-package.sh diagnostics, ui: Adjust to 'read-error' and 'syntax-error' in Guile 3.0.6. 2021-04-29 01:22:04 +02:00
guix-repl.sh repl: Look for script files in (getcwd). 2020-09-16 16:04:01 +02:00
guix-system.sh diagnostics, ui: Adjust to 'read-error' and 'syntax-error' in Guile 3.0.6. 2021-04-29 01:22:04 +02:00
hackage.scm import: hackage: Support "common" field and imports 2021-06-25 15:12:05 +02:00
import-utils.scm import/utils: alist->package: Handle SPDX license names only as fallback. 2020-12-27 12:06:49 +01:00
inferior.scm inferior: Support querying package replacements. 2021-05-15 12:14:47 +01:00
ipfs.scm Add (guix ipfs). 2021-04-12 18:42:22 +02:00
lint.scm lint: Check for trailing whitespace in description. 2021-06-08 23:28:04 +02:00
modules.scm
monads.scm
nar.scm nar: Deduplicate files right as they are restored. 2020-12-15 17:32:09 +01:00
networking.scm services: openntpd: Remove support for deprecated "-s" option. 2021-01-16 23:30:59 +01:00
offload.scm offload: Modify the build-machine record to accept multiple systems. 2020-08-25 13:45:27 -04:00
opam.scm import: opam: Generate license for package. 2021-05-28 11:36:03 +02:00
openpgp.scm openpgp: Fix argument order of 'fxbit-set?'. 2020-09-29 22:53:36 +02:00
pack.scm pack: Build the store database under a UTF-8 locale. 2020-07-20 23:25:09 +02:00
packages.scm tests: Optimize 'fold-available-packages' test. 2021-02-01 16:07:18 +01:00
pki.scm
print.scm tests: Update expected values for package->code. 2020-04-20 10:57:49 +02:00
processes.scm tests: processes: Skip tests if running with binfmt. 2019-12-10 10:49:42 +01:00
profiles.scm profiles: Build union of inputs in the right order. 2021-06-22 17:55:05 +02:00
publish.scm publish: Add '--negative-ttl'. 2021-05-16 23:28:11 +02:00
pypi.scm utils: Remove compatibility re-export of 'memoize'. 2020-07-25 19:11:36 +02:00
records.scm diagnostics, ui: Adjust to 'read-error' and 'syntax-error' in Guile 3.0.6. 2021-04-29 01:22:04 +02:00
rsa.key Add (guix openpgp). 2020-05-04 09:56:12 +02:00
scripts.scm tests: Add missing import. 2019-03-24 00:13:53 +01:00
search-paths.scm build: Remove 'gnu/packages/bootstrap' and its binaries. 2019-06-14 22:09:38 +02:00
services.scm guix system: Add 'reconfigure' module. 2019-07-26 19:19:49 +02:00
sets.scm
signing-key.pub
signing-key.sec
size.scm
status.scm status: Keep track of the current build phase. 2019-02-05 12:03:25 +01:00
store-database.scm database: Validate #:nar-size and #:time when registering store items. 2021-01-31 21:49:58 +01:00
store-deduplication.scm deduplicate: Create the '.links' directory lazily. 2020-12-15 17:32:12 +01:00
store-roots.scm Add (guix store roots). 2019-04-10 17:09:47 +02:00
store.scm store: Remove 'references/substitutes'. 2021-06-08 09:25:50 +02:00
substitute.scm daemon: 'guix substitute' replies on FD 4. 2021-04-09 17:46:38 +02:00
swh.scm swh: Test proper handling of null visit snapshot URL. 2021-01-21 11:22:08 +01:00
syscalls.scm syscalls: Add 'mounts' and the <mount> record type. 2021-02-25 11:29:35 +01:00
system.scm
test.drv
texlive.scm tests: do not hard code HTTP ports 2021-03-06 11:41:48 +01:00
transformations.scm profiles: 'package->manifest-entry' preserves transformations by default. 2021-03-05 12:49:27 +01:00
ui.scm tests: Adjust to 'show-manifest-transaction' changes. 2020-03-25 16:02:53 +01:00
union.scm tests: Make builds less expensive. 2019-06-14 21:57:39 +02:00
upstream.scm upstream: Temporarily skip failing test. 2019-01-28 23:13:40 +01:00
utils.scm utils: Add string distance. 2021-02-03 12:41:28 +01:00
uuid.scm uuid: 'fat-uuid->string' preserves leading zeros. 2019-05-07 12:18:44 +02:00
workers.scm