[bug#37642] gnu: Add filters
diff mbox series

Message ID 6f4a21523a30dcf3e3045aad994d8958c78a7b72.camel@gmail.com
State New
Headers show
Series
  • [bug#37642] gnu: Add filters
Related show

Commit Message

Jesse Gibbons Oct. 7, 2019, 2 a.m. UTC

Comments

Foxmean via Guix-patches via Oct. 8, 2019, 2:59 p.m. UTC | #1
Jesse,

Thank you!  I am b1ff and can't figure out how to make emacs quote 
an attachment, so consider +es >s below.
 
Jesse Gibbons 写道:+  %D%/packages/filters.scm			\ 

A new file's overkill.  I created a toys.scm file long ago for 
misfit toys that aren't games.  They could use some company. 
There's also games.scm which already contains talkfilters, 
although they aren't games dammit.

Choose wisely.
 
+(define-module (gnu packages filters) +#:use-module (guix 
build-system gnu) +#:use-module (guix download) +#:use-module 
(guix git-download) +#:use-module ((guix licenses) #:prefix 
license:) +#:use-module (guix packages) +#:use-module (gnu 
packages bison) +#:use-module (gnu packages flex) +#:use-module 
(gnu packages perl))

Not a relevant nitpick anymore, but this would have been indented.
 
+  (let +      ((version "2.55")

More nitpicking: convention is to write the above as one line.
 
+         (uri (git-reference +               (url 
"git://git.joeyh.name/filters")

https:// is preferred over git://, if not for any ‘security’ 
benefit, then for the fact that it's much more 
unfriendly-firewall-friendly.

https://git.joeyh.name/git/filters.git works here.

+             (lambda* (#:key outputs #:allow-other-keys) + 
(let ((out (assoc-ref outputs "out")))

Both lines can be written simply as

  (lambda _

since OUT and hence OUTPUTS are never used in this final version.
 
+                   (("kenny") +                    "")))

This part would have belonged in the phase below, but
 
+           ;; kenny is under nonfree Artistic License (Perl) 1.0. 
+           (add-after 'fix-install-directories 
'remove-nonfree-filter +             (lambda _ + 
(substitute* "Makefile" +                 (("kenny") + 
"")) +               #t)))

I'm afraid this isn't an option when unfree code is involved.  The 
offending files must be removed (and any Makefiles &c. fixed if 
feasible) in a source snippet so ‘guix build --source filters’ 
doesn't return unfree code to unsuspecting users.  Examples of 
snippets abound.
 
+         #:make-flags (list "CC=gcc" (string-append "DESTDIR=" 
%output))

Prefer putting each assignment on its own line for clarity.
 
+         #:tests? #f))

‘; no test suite’?
 
+      (home-page "http://joeyh.name/code/filters/")

Prefer HTTPS here too.
 
+      (synopsis "Various amusing text filters") + 
(description "The filters collection harks back to the late 80's, 
when

‘80s’ (1980s, even, who knows how long Guix will prosper ;-).
 
+various text filters were written to munge written language in 
amusing ways.  +The earliest and best known were legends such as 
the Swiedish Chef filter and

‘Swedish’ (or ‘Sweedish’ as below, although that's not the common 
name).

‘legends’ is a bit too PR-ish for my tastes but I'll leave it up 
to you.
 
+@item b1ff - The B1FF filter

‘A satire of a stereotypical Usenet newbie’. 

+@item censor - CDA-ize text +@item chef - convert English on 
stdin to Mock Sweedish on stdout
+@item cockney - Cockney English

This list is long, and each description is written in a wildly 
different style which annoys me for some reason.  I prefer the 
last one, it's simple and to the point.

I think a list of all filters can be justified here (it helps 
searching for ‘pirate’ :-) but >1 line each is too much.

‘jibberish’ & ‘fanboy’ focus too much the workings of the code; ‘A 
random combination of all other filters’ and ‘Speak like a fanboy 
(supports custom fandoms)’ are sufficient.   +The GNU project 
hosts a similar collection of filters, the GNU talkfilters.  Due 
+to copyright concerns and difficulty in communication between 
maintainers, these +collections have not been merged.")

I think the description is already quite long without this 
factoid.
 
+      (license (list license:gpl2+ ;; most of the filters (see 
debian/copyright) +                     license:gpl2 ;; rasterman, 
ky00te.dir/* nethackify, pirate + 
license:gpl3+ ;; scramble, scottish + 
license:public-domain ;; jethro, kraut, ken, studly + 
license:gpl1+ ;; cockney, jive, nyc only say "gpl" + 
license:expat))))) ;; newspeak. 

Thank you for taking the time to list each filter!  Trailing 
comments like this take only a single ‘;’, no ‘.’, and are 
indented together (either by your editor or by 
etc/indent-code.el).

Something like: 
 
      (license
       (list license:gpl2+    ; most of the filters (see 
       debian/copyright) 
        license:gpl2          ; rasterman, ky00te.dir/* 
        nethackify, pirate license:gpl3+         ; scramble, 
        scottish license:public-domain ; jethro, kraut, ken, 
        studly license:gpl1+         ; cockney, jive, nyc only say 
        "gpl" license:expat)))))    ; newspeak 

Thanks again,

T G-R
Foxmean via Guix-patches via Oct. 8, 2019, 3:21 p.m. UTC | #2
Tobias Geerinckx-Rice via Guix-patches via 写道:
> Something like: 
>
>      (license
>       (list license:gpl2+    ; most of the filters (see
> debian/copyright)      license:gpl2          ; rasterman, 
> ky00te.dir/*
> nethackify, pirate license:gpl3+         ; scramble, 
> scottish
> license:public-domain ; jethro, kraut, ken,      studly 
> license:gpl1+
> ; cockney, jive, nyc only say      "gpl" license:expat)))))    ;
> newspeak 

Grr.  Emacs was already acting up before I sent this, and I have 
no idea what happened here.

Just ignore this hunk,

T G-R
Jesse Gibbons Oct. 8, 2019, 7:46 p.m. UTC | #3
On Tue, 2019-10-08 at 16:59 +0200, Tobias Geerinckx-Rice wrote:
> Jesse,
> 
> Thank you!  I am b1ff and can't figure out how to make emacs quote 
> an attachment, so consider +es >s below.
>  
> ...
That review was a bit of a mess. Let's see if I can rephrase what you want,
in a human-friendly format (no emacs involved):
>      * gnu/packages/filters.scm: New file.
>      * gnu/local.mk: Add it.
>      * gnu/packages/cvassistant.scm (filters): New variable.
Spot my "commit message template" remnants!

You want me to put it into either games.scm or toys.scm, preferrably
toys.scm, for the sake of organization.

I had previously started a discussion on the guix-devel list with a similar
concern and was convinced that it is fine to have some packages isolated in
their own files. That's why I put rednotebook cv-assistant isolated in their
own sources. However, since you asked, and there are two different files it
would fit in, I will put filters in toys.scm. I'll leave it to you to
convince the others that packages like cmatrix, cowsay, fortune-mod, and no-
more-secrets should be moved to toys because they are not games.

See https://lists.gnu.org/archive/html/guix-devel/2019-07/msg00240.html
 for the explanation that convinced me solo packages are fine.

> +(define-module (gnu packages filters)
> +#:use-module (guix build-system gnu)
> +#:use-module (guix download)
> +#:use-module (guix git-download)
> +#:use-module ((guix licenses) #:prefix license:)
> +#:use-module (guix packages)
> +#:use-module (gnu packages bison)
> +#:use-module (gnu packages flex)
> +#:use-module (gnu packages perl))
Make sure these are indented when I add a new file.
I guess indent-code.el doesn't look outside the package definition...
> +
> +(define-public filters
> +  (let
> +      ((version "2.55")
> +       (commit "c5c291916b52ed9e6418448a8eee30475fb9adcf"))
Move version to the same line as let.
> +    (package
> +      (name "filters")
> +      (version "2.55")
> +      (source
> +       (origin
> +         (method git-fetch)
> +         (uri (git-reference
> +               (url "git://git.joeyh.name/filters")
> +               (commit commit)))
Use https: instead of git:
> +             (lambda* (#:key outputs #:allow-other-keys)
> +               (let ((out (assoc-ref outputs "out")))
Replace these two lines with "(lambda _"

> +           ;; kenny is under nonfree Artistic License (Perl) 1.0.
> +           (add-after 'fix-install-directories 'remove-nonfree-filter
> +             (lambda _
> +               (substitute* "Makefile"
> +                 (("kenny")
> +                  ""))
> +               #t)))
Use a patch instead or move this to the source's snippet so kenny is removed
from the raw source.
> +         #:tests? #f))
clarify we have no tests suite
> +      (home-page "http://joeyh.name/code/filters/")
use https:// for the home page.
> +      (description "The filters collection harks back to the late 80's,
> when
> +various text filters were written to munge written language in amusing
> ways.
> +The earliest and best known were legends such as the Swiedish Chef filter
Fix misspelling.

> +B1FF.
> +
> +The current filters package contains more than 20 filters:
> +@enumerate
> +@item b1ff - The B1FF filter
> +@item censor - CDA-ize text
> +@item chef - convert English on stdin to Mock Sweedish on stdout
> +@item cockney - Cockney English
> +@item eleet - K3wl hacker slang
> +@item fanboy - Speak like a fanboy.  Filters out extraneous words and
> focuses on
> +the words  fans  use.  By  default, it will speak like a fan of
> git/Linus/linux
> +development.  To change this, pass as  parameters the  words  that  the
> fanboy
> +typically uses.  Alternatively, pass the name of a topic that typically
> has
> +fanboys to use  a  predefined word list.
...
> +@end enumerate
Trim these not to be more concise.
Descriptions for programs like "jibberish" and "fanboy" should focus on
output.
> +The GNU project hosts a similar collection of filters, the GNU
> talkfilters.  Due
> +to copyright concerns and difficulty in communication between
> maintainers, these
> +collections have not been merged.")
You want me to remove this.
I think it's appropriate to say something about gnu talkfilters and note
that this is not the same package, given that filters and talkfilters
packages are often confused with each other on the internet, but I will
remove the last sentence.
> +      (license (list license:gpl2+ ;; most of the filters (see
> debian/copyright)
> +                     license:gpl2 ;; rasterman, ky00te.dir/* nethackify,
> pirate
> +                     license:gpl3+ ;; scramble, scottish
> +                     license:public-domain ;; jethro, kraut, ken, studly
> +                     license:gpl1+ ;; cockney, jive, nyc only say "gpl"
> +                     license:expat))))) ;; newspeak.

Use only one semicolon in comments at the end of the line, and indent so the
comments align.
I'm trying to keep the definition 80 characters per column or shorter so it
can be terminal-friendly. If the comments go beyond 80 characters I will
move the comments above the license. indent-code.el missed these comments.

Am I missing anything?
Foxmean via Guix-patches via Oct. 9, 2019, 1:14 p.m. UTC | #4
Jesse,

Jesse Gibbons 写道:
> That review was a bit of a mess. Let's see if I can rephrase 
> what you want,
> in a human-friendly format (no emacs involved):

Yes, I'm so sorry.  It looked fine while writing; I'm not actually 
on crack.

>>      * gnu/packages/filters.scm: New file.
>>      * gnu/local.mk: Add it.
>>      * gnu/packages/cvassistant.scm (filters): New variable.
> Spot my "commit message template" remnants!
>
> You want me to put it into either games.scm or toys.scm, 
> preferrably
> toys.scm, for the sake of organization.

Yes.  File naming and package categorization are an impromptu 
mess.  Single-package files exist, most of them probably shouldn't 
*or* they should be the norm as in Nix.  I suspect the reason that 
Guix diverged was mainly technical: many things about Guix can 
(still) be explained by ‘Guile does a bad thing otherwise’.

>> I had previously started a discussion on the guix-devel list 
>> with a similar
> concern and was convinced that it is fine to have some packages 
> isolated in
> their own files. That's why I put rednotebook cv-assistant 
> isolated in their
> own sources.

Sure.  It's impossible to document the current scheme because it's 
self-contradictory.  ‘Feels wrong to nckx’ is no great argument 
but it's all you're going to get here.  Even the name ‘filter’ 
would only make sense in the context of this package (hey, gzip is 
a filter too…).

This has officially got to much attention now :-)

> However, since you asked, and there are two different files it
> would fit in, I will put filters in toys.scm. I'll leave it to 
> you to
> convince the others that packages like cmatrix, cowsay, 
> fortune-mod, and no-
> more-secrets should be moved to toys because they are not games.

As much as I ♥ irrelevant things, that would just be noise.

> Make sure these are indented when I add a new file.
> I guess indent-code.el doesn't look outside the package 
> definition...

Good point, I hadn't thought of that.  Must be how we subtly force 
you to switch to emacs.

> Use a patch instead or move this to the source's snippet so 
> kenny is removed
> from the raw source.

A patch would contain a ‘negative’ verbatim copy of the non-free 
code so isn't an option here.

>> +         #:tests? #f))
> clarify we have no tests suite

Yep.  Ideally that comment would be redundant because we'd never 
flat-out disable tests in packages that have them, but we do.

>> +The GNU project hosts a similar collection of filters, the GNU
>> talkfilters.  Due
>> +to copyright concerns and difficulty in communication between
>> maintainers, these
>> +collections have not been merged.")
> You want me to remove this.
> I think it's appropriate to say something about gnu talkfilters 
> and note
> that this is not the same package, given that filters and 
> talkfilters
> packages are often confused with each other on the internet,

OK.  I didn't know they were often confused.  Would it make sense 
to add it to GNU's, too?

> but I will remove the last sentence.

Great.  It's the one that bothered me.

>  If the comments go beyond 80 characters I will move the 
>  comments above the license.

For such whole-line comments you *would* use ‘;;’, start with a 
capital letter, and end with a full stop…

> indent-code.el missed these comments.

Sounds like indent-code.el needs love from someone who likes 
writing elisp.

> Am I missing anything?

Not that I'm aware of.  Sorry again for the beastly formatting of 
my original message.

Kind regards,

T G-R

Patch
diff mbox series

From 88274cbcae001e14cf20807e132d2fd251a158b6 Mon Sep 17 00:00:00 2001
From: Jesse Gibbons <jgibbons2357+guix@gmail.com>
Date: Sun, 6 Oct 2019 19:52:33 -0600
Subject: [PATCH] gnu: Add filters

     * gnu/packages/filters.scm: New file.
     * gnu/local.mk: Add it.
     * gnu/packages/cvassistant.scm (filters): New variable.
---
 gnu/local.mk             |   1 +
 gnu/packages/filters.scm | 132 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 133 insertions(+)
 create mode 100644 gnu/packages/filters.scm

diff --git a/gnu/local.mk b/gnu/local.mk
index 54ae09f619..0737ebdf3b 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -181,6 +181,7 @@  GNU_SYSTEM_MODULES =				\
   %D%/packages/figlet.scm			\
   %D%/packages/file.scm				\
   %D%/packages/file-systems.scm			\
+  %D%/packages/filters.scm			\
   %D%/packages/finance.scm			\
   %D%/packages/firmware.scm			\
   %D%/packages/flashing-tools.scm		\
diff --git a/gnu/packages/filters.scm b/gnu/packages/filters.scm
new file mode 100644
index 0000000000..bd62f2a358
--- /dev/null
+++ b/gnu/packages/filters.scm
@@ -0,0 +1,132 @@ 
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2019 Jesse Gibbons <jgibbons2357+guix@gmail.com>
+;;;
+;;; 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 (gnu packages filters)
+#:use-module (guix build-system gnu)
+#:use-module (guix download)
+#:use-module (guix git-download)
+#:use-module ((guix licenses) #:prefix license:)
+#:use-module (guix packages)
+#:use-module (gnu packages bison)
+#:use-module (gnu packages flex)
+#:use-module (gnu packages perl))
+
+(define-public filters
+  (let
+      ((version "2.55")
+       (commit "c5c291916b52ed9e6418448a8eee30475fb9adcf"))
+    (package
+      (name "filters")
+      (version "2.55")
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "git://git.joeyh.name/filters")
+               (commit commit)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32
+           "1gaigpda1w9wxfh8an3sam1hpacc1bhxl696w4yj0vzhc6izqvxs"))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (add-after 'unpack 'fix-install-directories
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let ((out (assoc-ref outputs "out")))
+                 (substitute* "Makefile"
+                   (("/usr/games")
+                    "/bin/")
+                   (("/usr/share/")
+                    "/share/")
+                   (("kenny")
+                    "")))
+               #t))
+           ;; kenny is under nonfree Artistic License (Perl) 1.0.
+           (add-after 'fix-install-directories 'remove-nonfree-filter
+             (lambda _
+               (substitute* "Makefile"
+                 (("kenny")
+                  ""))
+               #t)))
+         #:make-flags (list "CC=gcc" (string-append "DESTDIR=" %output))
+         #:tests? #f))
+      (native-inputs
+       `(("bison" ,bison)
+         ("flex" ,flex)))
+      (inputs
+       `(("perl" ,perl)))
+      (home-page "http://joeyh.name/code/filters/")
+      (synopsis "Various amusing text filters")
+      (description "The filters collection harks back to the late 80's, when
+various text filters were written to munge written language in amusing ways.
+The earliest and best known were legends such as the Swiedish Chef filter and
+B1FF.
+
+The current filters package contains more than 20 filters:
+@enumerate
+@item b1ff - The B1FF filter
+@item censor - CDA-ize text
+@item chef - convert English on stdin to Mock Sweedish on stdout
+@item cockney - Cockney English
+@item eleet - K3wl hacker slang
+@item fanboy - Speak like a fanboy.  Filters out extraneous words and focuses on
+the words  fans  use.  By  default, it will speak like a fan of git/Linus/linux
+development.  To change this, pass as  parameters the  words  that  the fanboy
+typically uses.  Alternatively, pass the name of a topic that typically has
+fanboys to use  a  predefined word list.
+@item fudd - Elmer Fudd
+@item jethro - Hillbilly text filter
+@item jibberish - Runs text through a random selection of the rest of the
+filters, to make really weird output.
+@item jive - Jive English
+@item ken - English into Cockney, featuring (dubious) rhyming slang for a lot of
+computer technology.
+@item kraut - Generates text with a bad German accent.
+@item ky00te - This program places a very cute (and familiar to FurryMucck fans)
+accent on any text file.
+@item LOLCAT - as seen in internet gifs everywhere.
+@item nethackify - Wiped out text like can be found in nethack.
+@item newspeak - A-la-1984
+@item nyc - Brooklyn English
+@item pirate - Talk like a pirate.
+@item rasterman - Makes text look like it came from the keyboard of Carsten
+Haitzler.
+@item scottish - Fake scottish (dwarven) accent filter, inspired by the
+character \"Durkon\" from Order of the Stick.
+@item scramble - Scramble the \"inner\" letters of each word in the input into a
+random order.  The resulting text is still strangely readable.
+@item spammer - Turns honest text into something that is liable to be flagged as
+spam.
+@item studly - Studly caps.
+@item uniencode - Use glorious unicode to the fullest possible extent.  As seen
+previously in many man pages.
+@item upside-down - Flips the text upside down.  Stand on your head and squint
+to read the output.
+@end enumerate
+The GNU project hosts a similar collection of filters, the GNU talkfilters.  Due
+to copyright concerns and difficulty in communication between maintainers, these
+collections have not been merged.")
+      (license (list license:gpl2+ ;; most of the filters (see debian/copyright)
+                     license:gpl2 ;; rasterman, ky00te.dir/* nethackify, pirate
+                     license:gpl3+ ;; scramble, scottish
+                     license:public-domain ;; jethro, kraut, ken, studly
+                     license:gpl1+ ;; cockney, jive, nyc only say "gpl"
+                     license:expat))))) ;; newspeak.
-- 
2.23.0