[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] guix-package: Add '--search'.
From: |
Ludovic Courtès |
Subject: |
Re: [PATCH] guix-package: Add '--search'. |
Date: |
Sat, 26 Jan 2013 22:43:56 +0100 |
User-agent: |
Gnus/5.130005 (Ma Gnus v0.5) Emacs/24.2 (gnu/linux) |
Nikita Karetnikov <address@hidden> skribis:
>> (if (or (and=> (package-synopsis package)
>> (compose matches? gettext))
>
> I came up with a different solution, which seems more readable. What
> do you think? (If you want, I'll use your version.)
[...]
> From 0083eff18eb584213f55974807d4e0e6e29d3c73 Mon Sep 17 00:00:00 2001
> From: Nikita Karetnikov <address@hidden>
> Date: Sat, 26 Jan 2013 08:36:31 +0000
> Subject: [PATCH] guix-package: Add '--search'.
>
> * guix-package.in (find-packages-by-description): New procedure.
> (show-help, %options): Add '--search'.
> (guix-package)[process-query]: Add support for '--search'.
> * doc/guix.texi (Invoking guix-package): Document it.
> * tests/guix-package.sh: Add tests.
[...]
> address@hidden address@hidden
> address@hidden -s @var{regexp}
> +Search in the @emph{synopsis} and @emph{description} fields of the
> +available packages. And list the ones that match @var{regexp}.
Rather:
List the available packages whose synopsis or description matches
@var{regexp}.
(The end-user shouldn’t have to think in terms of structure fields.)
> + (delete-duplicates
> + (sort
> + (fold-packages (lambda (package result)
> + (if (any (lambda (f)
> + (false-if-exception
> + (regexp-exec rx (gettext (f package)))))
> + (list package-synopsis package-description))
> + (cons package result)
> + result))
> + '())
I still prefer the solution that avoids ‘false-if-exception’, because
‘false-if-exception’ could hide real issues other than wrong-type-arg.
> + # Search.
> + echo "Testing 'search'..."
> + if test "`guix-package -s "GNU Hello" | cut -f1`" = "hello";
> + then echo "Test1: OK"; else echo "Test1: failed"; fi
> +
> + if test "`guix-package -s "n0t4r341p4ck4g3"`" = "";
> + then echo "Test2: OK"; else echo "Test2: failed"; fi
Please remove the ‘echo’ and ‘if’: it’s in a ‘set -x’ so everything gets
written to guix-package.log, and it’s in a ‘set -e’ so any non-zero exit
causes a test failure.
You can commit once those tiny issues are fixed.
Thank you!
Ludo’.