unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Add tcsh.
@ 2013-02-04 21:27 Cyril Roelandt
  2013-02-04 22:32 ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2013-02-04 21:27 UTC (permalink / raw)
  To: bug-guix

* gnu/packages/tcsh.scm: New file.
* gnu/packages/patches/tcsh-fix-autotest.patch: New file
* Makefile.am: Add them.
---
Hey !

This patch adds tcsh. It was a bit hard to make the testsuite work: I disabled a
few tests that I could not get working during the "check" phase, but it should
not be a problem, since they work fine with the installed binary.

Cyril Roelandt.

 Makefile.am                                  |    2 +
 gnu/packages/patches/tcsh-fix-autotest.patch |  231 ++++++++++++++++++++++++++
 gnu/packages/tcsh.scm                        |   77 +++++++++
 3 files changed, 310 insertions(+)
 create mode 100644 gnu/packages/patches/tcsh-fix-autotest.patch
 create mode 100644 gnu/packages/tcsh.scm

diff --git a/Makefile.am b/Makefile.am
index e603005..c534f6c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -133,6 +133,7 @@ MODULES =					\
   gnu/packages/subversion.scm 			\
   gnu/packages/system.scm			\
   gnu/packages/tcl.scm				\
+  gnu/packages/tcsh.scm 			\
   gnu/packages/texinfo.scm			\
   gnu/packages/time.scm				\
   gnu/packages/tor.scm				\
@@ -183,6 +184,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/readline-link-ncurses.patch		\
   gnu/packages/patches/shishi-gets-undeclared.patch		\
   gnu/packages/patches/tar-gets-undeclared.patch		\
+  gnu/packages/patches/tcsh-fix-autotest.patch 			\
   gnu/packages/patches/teckit-cstdio.patch
 
 bootstrapdir = $(guilemoduledir)/gnu/packages/bootstrap
diff --git a/gnu/packages/patches/tcsh-fix-autotest.patch b/gnu/packages/patches/tcsh-fix-autotest.patch
new file mode 100644
index 0000000..a169801
--- /dev/null
+++ b/gnu/packages/patches/tcsh-fix-autotest.patch
@@ -0,0 +1,231 @@
+--- tests/commands.at	2011-01-22 01:04:02.000000000 +0100
++++ tests/commands.at	2013-02-04 10:57:24.000000000 +0100
+@@ -919,26 +919,27 @@
+ TCSH_UNTESTED([notify])
+ 
+ 
+-AT_SETUP([onintr])
+-
+-AT_DATA([onintr.csh],
+-[[onintr label
+-kill -INT $$
+-echo fail
+-label:
+-echo caught
+-onintr -
+-kill -INT $$
+-echo OK
+-onintr -
+-kill -INT $$
+-]])
+-AT_CHECK([tcsh -f onintr.csh], ,
+-[caught
+-OK
+-])
+-
+-AT_CLEANUP
++# XXX This test does not work: "fail" is printed on stdout.
++#AT_SETUP([onintr])
++#
++#AT_DATA([onintr.csh],
++#[[onintr label
++#kill -INT $$
++#echo fail
++#label:
++#echo caught
++#onintr -
++#kill -INT $$
++#echo OK
++#onintr -
++#kill -INT $$
++#]])
++#AT_CHECK([tcsh -f onintr.csh], ,
++#[caught
++#OK
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([popd])
+@@ -1203,11 +1204,12 @@
+ AT_DATA([script.csh],
+ [[set var=$1
+ ]])
+-AT_CHECK([[tcsh -f -c 'source -h script.csh foo; history' \
+-	   | sed 's/	[^	]*	/ TIME /']], ,
+-[     1 TIME source -h script.csh foo ; history
+-     2 TIME set var=$1
+-])
++# XXX: Not sure why this fails. The output is : "1 TIME set var=$1"
++#AT_CHECK([[tcsh -f -c 'source -h script.csh foo; history' \
++#	   | sed 's/	[^	]*	/ TIME /']], ,
++#[     1 TIME source -h script.csh foo ; history
++#     2 TIME set var=$1
++#])
+ 
+ AT_CHECK([tcsh -f -c 'source -h script.csh foo; echo $var'], 1, [],
+ [var: Undefined variable.
+--- tests/lexical.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/lexical.at	2013-02-04 10:53:21.000000000 +0100
+@@ -33,9 +33,9 @@
+ AT_CHECK([echo 'echo OK@%:@comment' | tcsh -f], , [OK
+ ])
+ 
+-AT_CHECK([tcsh -f -c 'echo @%:@no comment'], ,
+-[@%:@no comment
+-])
++#AT_CHECK([tcsh -f -c 'echo @%:@no comment'], ,
++#[@%:@no comment
++#])
+ 
+ AT_DATA([comment2.csh],
+ [[echo testing...@%:@\
+--- tests/subst.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/subst.at	2013-02-01 08:14:25.000000000 +0100
+@@ -54,7 +54,7 @@
+ , [1
+ ])
+ 
+-AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | uniq dnl
++AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | grep -v "/homeless-shelter" | uniq dnl
+ 	  | wc -l | tr -d ' \t'], , [1
+ ])
+ 
+--- tests/variables.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/variables.at	2013-02-04 11:40:35.000000000 +0100
+@@ -317,17 +317,18 @@
+ AT_CLEANUP
+ 
+ 
+-AT_SETUP([$ edit])
+-
+-AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], ,
+-[1
+-])
+-
+-AT_CHECK([TERM=dumb tcsh -f -c 'echo $?edit'], ,
+-[0
+-])
+-
+-AT_CLEANUP
++# XXX
++#AT_SETUP([$ edit])
++#
++#AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], ,
++#[1
++#])
++#
++#AT_CHECK([TERM=dumb tcsh -f -c 'echo $?edit'], ,
++#[0
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([$ ellipsis])
+@@ -642,7 +643,8 @@
+ ls-F -something .
+ ]])
+ AT_DATA([args.sh],
+-[[echo "$@"
++[[#!/bin/sh
++echo "$@"
+ ]])
+ chmod a+x args.sh
+ AT_CHECK([tcsh -f listflags.csh], ,
+@@ -695,55 +697,57 @@
+ AT_SETUP([$ owd])
+ 
+ AT_DATA([owd.csh],
+-[[echo $owd
+-cd /
++[[mkdir -p a/b/
+ echo $owd
+-pushd /bin
++cd a
++echo $owd
++pushd b
+ echo $owd
+ popd
+ echo $owd
+ ]])
+-AT_CHECK([tcsh -f owd.csh | sed "s,$PWD,CWD,"], ,
++AT_CHECK([tcsh -f owd.csh | sed "s,$PWD,CWD,g"], ,
+ [
+ CWD
+-/bin / @&t@
+-/
+-/ @&t@
+-/bin
++CWD/a/b CWD/a @&t@
++CWD/a
++CWD/a @&t@
++CWD/a/b
+ ])
+ 
+ AT_CLEANUP
+ 
+ 
+-AT_SETUP([$ path])
+-
+-mkdir subdir
+-AT_DATA([script.sh],
+-[[echo home
+-]])
+-AT_DATA([subdir/script.sh],
+-[[echo subdir
+-]])
+-chmod a+x script.sh subdir/script.sh
+-AT_DATA([path.csh],
+-[[echo $?path
+-set path=(. subdir)
+-script.sh
+-set path=(subdir .)
+-script.sh
+-printenv PATH
+-setenv PATH :foo::bar:
+-echo $path
+-]])
+-AT_CHECK([tcsh -f path.csh], ,
+-[1
+-home
+-subdir
+-subdir:.
+-. foo . bar .
+-])
+-
+-AT_CLEANUP
++# XXX Not sure why this does not work. "home" is printed out twice on stdout.
++#AT_SETUP([$ path])
++#
++#mkdir subdir
++#AT_DATA([script.sh],
++#[[echo home
++#]])
++#AT_DATA([subdir/script.sh],
++#[[echo subdir
++#]])
++#chmod a+x script.sh subdir/script.sh
++#AT_DATA([path.csh],
++#[[echo $?path
++#set path=(. subdir)
++#script.sh
++#set path=(subdir .)
++#script.sh
++#printenv PATH
++#setenv PATH :foo::bar:
++#echo $path
++#]])
++#AT_CHECK([tcsh -f path.csh], ,
++#[1
++#home
++#subdir
++#subdir:.
++#. foo . bar .
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([$ printexitvalue])
diff --git a/gnu/packages/tcsh.scm b/gnu/packages/tcsh.scm
new file mode 100644
index 0000000..9069f35
--- /dev/null
+++ b/gnu/packages/tcsh.scm
@@ -0,0 +1,77 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Cyril Roelandt <tipecaml@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 tcsh)
+  #:use-module (guix licenses)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages ncurses))
+
+(define-public tcsh
+  (package
+    (name "tcsh")
+    (version "6.18.01")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "ftp://ftp.astron.com/pub/tcsh/tcsh-"
+                                 version ".tar.gz"))
+             (sha256
+              (base32 "1a4z9kwgx1iqqzvv64si34m60gj34p7lp6rrcrb59s7ka5wa476q"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("autoconf" ,autoconf)
+       ("coreutils" ,coreutils)
+       ("ncurses" ,ncurses)
+       ("patch/skip-tests"
+        ,(search-patch "tcsh-fix-autotest.patch"))))
+    (arguments
+     `(#:phases
+       (alist-replace
+        'check
+        (lambda* (#:key inputs #:allow-other-keys #:rest args)
+          (let ((check (assoc-ref %standard-phases 'check)))
+            ;; Take care of pwd
+            (substitute* "tests/commands.at" (("/bin/pwd") (which "pwd")))
+            (substitute* "tests/variables.at" (("/bin/pwd") (which "pwd")))
+            ;; The .at files create shell scripts without shebangs. Erk.
+            (substitute* "tests/commands.at"
+                         (("./output.sh")
+                          (string-append (which "bash") " output.sh")))
+            (substitute* "tests/syntax.at"
+                         (("; other_script.csh")
+                          (string-append "; " (which "bash")
+                                         " other_script.csh")))
+            (system* "make" "tests/testsuite")
+            (substitute* "tests/testsuite" (("/bin/sh") (which "bash")))
+            (apply check args)))
+        %standard-phases)
+        #:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
+        #:patch-flags '("-p0")))
+    (home-page "http://www.tcsh.org/")
+    (synopsis "A Unix shell based on csh")
+    (description
+     "Tcsh is an enhanced, but completely compatible version of the Berkeley
+UNIX C shell (csh). It is a command language interpreter usable both as an
+interactive login shell and a shell script command processor. It includes a
+command-line editor, programmable word completion, spelling correction, a
+history mechanism, job control and a C-like syntax.")
+    (license bsd-4)))
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH] Add tcsh.
  2013-02-04 21:27 [PATCH] Add tcsh Cyril Roelandt
@ 2013-02-04 22:32 ` Ludovic Courtès
  2013-02-04 22:40   ` Cyril Roelandt
  2013-02-06  1:38   ` Cyril Roelandt
  0 siblings, 2 replies; 14+ messages in thread
From: Ludovic Courtès @ 2013-02-04 22:32 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: bug-guix

Cyril Roelandt <tipecaml@gmail.com> skribis:

> This patch adds tcsh. It was a bit hard to make the testsuite work: I disabled a
> few tests that I could not get working during the "check" phase, but it should
> not be a problem, since they work fine with the installed binary.

Good!

> +    (inputs
> +     `(("autoconf" ,autoconf)
> +       ("coreutils" ,coreutils)
> +       ("ncurses" ,ncurses)
> +       ("patch/skip-tests"
> +        ,(search-patch "tcsh-fix-autotest.patch"))))

In general, rebuilding the build infrastructure with Autoconf &
co. should be avoided for several reasons: we may get it wrong, and it
will yield a rebuild on every Autoconf update.

Could this be easily avoided here?  (I suspect you already tried...)
One option would be to make the patch against ‘testsuite’ instead of
against the .at files, with the risk of it no longer being applicable on
the next release.

WDYT?

> +        (lambda* (#:key inputs #:allow-other-keys #:rest args)
> +          (let ((check (assoc-ref %standard-phases 'check)))
> +            ;; Take care of pwd
> +            (substitute* "tests/commands.at" (("/bin/pwd") (which "pwd")))
> +            (substitute* "tests/variables.at" (("/bin/pwd") (which "pwd")))

‘substitute*’ can be passed a list of files instead of a single file.

> +            ;; The .at files create shell scripts without shebangs. Erk.
> +            (substitute* "tests/commands.at"
> +                         (("./output.sh")
> +                          (string-append (which "bash") " output.sh")))

(which "sh") may be more correct (Bash behaves differently depending no
whether it’s invoked as sh or bash.)

Please align the opening parenthesis under the ‘u’ of ‘substitute*’.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Add tcsh.
  2013-02-04 22:32 ` Ludovic Courtès
@ 2013-02-04 22:40   ` Cyril Roelandt
  2013-02-05  8:56     ` Ludovic Courtès
  2013-02-06  1:38   ` Cyril Roelandt
  1 sibling, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2013-02-04 22:40 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guix

On 02/04/2013 11:32 PM, Ludovic Courtès wrote:
> Cyril Roelandt<tipecaml@gmail.com>  skribis:
>
>> This patch adds tcsh. It was a bit hard to make the testsuite work: I disabled a
>> few tests that I could not get working during the "check" phase, but it should
>> not be a problem, since they work fine with the installed binary.
>
> Good!

Not so good: it's way too weird that some tests fail when running "make 
check", it'd be great to understand why.

>
>> +    (inputs
>> +     `(("autoconf" ,autoconf)
>> +       ("coreutils" ,coreutils)
>> +       ("ncurses" ,ncurses)
>> +       ("patch/skip-tests"
>> +        ,(search-patch "tcsh-fix-autotest.patch"))))
>
> In general, rebuilding the build infrastructure with Autoconf&
> co. should be avoided for several reasons: we may get it wrong, and it
> will yield a rebuild on every Autoconf update.
>
> Could this be easily avoided here?  (I suspect you already tried...)
> One option would be to make the patch against ‘testsuite’ instead of
> against the .at files, with the risk of it no longer being applicable on
> the next release.
>
> WDYT?

It would make sense patch the .at files, generate a new "testsuite" 
file, and patch "testsuite" when running make check. But it would be 
nice to keep the *.at files somewhere to quickly regenerate the patch 
against "testsuite" when a new version of tcsh comes out. Can we do that ?

>
>> +        (lambda* (#:key inputs #:allow-other-keys #:rest args)
>> +          (let ((check (assoc-ref %standard-phases 'check)))
>> +            ;; Take care of pwd
>> +            (substitute* "tests/commands.at" (("/bin/pwd") (which "pwd")))
>> +            (substitute* "tests/variables.at" (("/bin/pwd") (which "pwd")))
>
> ‘substitute*’ can be passed a list of files instead of a single file.
>

OK.

>> +            ;; The .at files create shell scripts without shebangs. Erk.
>> +            (substitute* "tests/commands.at"
>> +                         (("./output.sh")
>> +                          (string-append (which "bash") " output.sh")))
>
> (which "sh") may be more correct (Bash behaves differently depending no
> whether it’s invoked as sh or bash.)
>

OK.

> Please align the opening parenthesis under the ‘u’ of ‘substitute*’.
>

OK.

Cyril.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Add tcsh.
  2013-02-04 22:40   ` Cyril Roelandt
@ 2013-02-05  8:56     ` Ludovic Courtès
  0 siblings, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2013-02-05  8:56 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: bug-guix

Cyril Roelandt <tipecaml@gmail.com> skribis:

> On 02/04/2013 11:32 PM, Ludovic Courtès wrote:
>> Cyril Roelandt<tipecaml@gmail.com>  skribis:
>>
>>> This patch adds tcsh. It was a bit hard to make the testsuite work: I disabled a
>>> few tests that I could not get working during the "check" phase, but it should
>>> not be a problem, since they work fine with the installed binary.
>>
>> Good!
>
> Not so good: it's way too weird that some tests fail when running
> "make check", it'd be great to understand why.

If it’s deterministic, that shouldn’t be too difficult.  Most likely a
/bin/sh or similar issue, no?

>>
>>> +    (inputs
>>> +     `(("autoconf" ,autoconf)
>>> +       ("coreutils" ,coreutils)
>>> +       ("ncurses" ,ncurses)
>>> +       ("patch/skip-tests"
>>> +        ,(search-patch "tcsh-fix-autotest.patch"))))
>>
>> In general, rebuilding the build infrastructure with Autoconf&
>> co. should be avoided for several reasons: we may get it wrong, and it
>> will yield a rebuild on every Autoconf update.
>>
>> Could this be easily avoided here?  (I suspect you already tried...)
>> One option would be to make the patch against ‘testsuite’ instead of
>> against the .at files, with the risk of it no longer being applicable on
>> the next release.
>>
>> WDYT?
>
> It would make sense patch the .at files, generate a new "testsuite"
> file, and patch "testsuite" when running make check. But it would be
> nice to keep the *.at files somewhere to quickly regenerate the patch
> against "testsuite" when a new version of tcsh comes out. Can we do
> that ?

Seems tricky to me.  Better keep your current version than do that, I
think.

So what about patching ‘testsuite’ directly?  Did it seem feasible here?

Thanks,
Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Add tcsh.
  2013-02-04 22:32 ` Ludovic Courtès
  2013-02-04 22:40   ` Cyril Roelandt
@ 2013-02-06  1:38   ` Cyril Roelandt
  2013-02-06 14:17     ` Ludovic Courtès
  1 sibling, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2013-02-06  1:38 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guix

On 02/04/2013 11:32 PM, Ludovic Courtès wrote:
> Cyril Roelandt<tipecaml@gmail.com>  skribis:
>

[...]

>> +            ;; The .at files create shell scripts without shebangs. Erk.
>> +            (substitute* "tests/commands.at"
>> +                         (("./output.sh")
>> +                          (string-append (which "bash") " output.sh")))
>
> (which "sh") may be more correct (Bash behaves differently depending no
> whether it’s invoked as sh or bash.)
>

When using (which "sh"), 2 tests fail with the following error:

/nix/store/4mg8b8vvmava68y64qmm70gqfnhhjzmx-bash-4.2/nix/store/4mg8b8vvmava68y64qmm70gqfnhhjzmx-bash-4.2/bin/sh: 
Command not found

Any idea ?


Cyril.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Add tcsh.
  2013-02-06  1:38   ` Cyril Roelandt
@ 2013-02-06 14:17     ` Ludovic Courtès
  2013-02-07  0:04       ` Cyril Roelandt
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2013-02-06 14:17 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: bug-guix

Cyril Roelandt <tipecaml@gmail.com> skribis:

> When using (which "sh"), 2 tests fail with the following error:
>
> /nix/store/4mg8b8vvmava68y64qmm70gqfnhhjzmx-bash-4.2/nix/store/4mg8b8vvmava68y64qmm70gqfnhhjzmx-bash-4.2/bin/sh:
> Command not found
>
> Any idea ?

Presumably there’s double-patching occurring.

That is, there’s /bin/sh that first gets changed to /nix/…/bin/sh
(perhaps by ‘patch-shebangs’), and then that gets changed to
/nix/…/nix/…/bin/sh.

HTH,
Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH] Add tcsh.
  2013-02-06 14:17     ` Ludovic Courtès
@ 2013-02-07  0:04       ` Cyril Roelandt
  2013-02-07  0:09         ` [PATCH v2] " Cyril Roelandt
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2013-02-07  0:04 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: bug-guix

On 02/06/2013 03:17 PM, Ludovic Courtès wrote:
> Cyril Roelandt<tipecaml@gmail.com>  skribis:
>
>> When using (which "sh"), 2 tests fail with the following error:
>>
>> /nix/store/4mg8b8vvmava68y64qmm70gqfnhhjzmx-bash-4.2/nix/store/4mg8b8vvmava68y64qmm70gqfnhhjzmx-bash-4.2/bin/sh:
>> Command not found
>>
>> Any idea ?
>
> Presumably there’s double-patching occurring.
>
> That is, there’s /bin/sh that first gets changed to /nix/…/bin/sh
> (perhaps by ‘patch-shebangs’), and then that gets changed to
> /nix/…/nix/…/bin/sh.
>

Sorry, I hadn't noticed that. I'll resend.

Cyril.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v2] Add tcsh.
  2013-02-07  0:04       ` Cyril Roelandt
@ 2013-02-07  0:09         ` Cyril Roelandt
  2013-02-07  9:29           ` Andreas Enge
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2013-02-07  0:09 UTC (permalink / raw)
  To: bug-guix

* gnu/packages/tcsh.scm: New file.
* gnu/packages/patches/tcsh-fix-autotest.patch: New file
* Makefile.am: Add them.
---
 Makefile.am                                  |    2 +
 gnu/packages/patches/tcsh-fix-autotest.patch |  231 ++++++++++++++++++++++++++
 gnu/packages/tcsh.scm                        |   76 +++++++++
 3 files changed, 309 insertions(+)
 create mode 100644 gnu/packages/patches/tcsh-fix-autotest.patch
 create mode 100644 gnu/packages/tcsh.scm

diff --git a/Makefile.am b/Makefile.am
index c44c159..2f7cc42 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -134,6 +134,7 @@ MODULES =					\
   gnu/packages/subversion.scm 			\
   gnu/packages/system.scm			\
   gnu/packages/tcl.scm				\
+  gnu/packages/tcsh.scm 			\
   gnu/packages/texinfo.scm			\
   gnu/packages/texlive.scm			\
   gnu/packages/time.scm				\
@@ -185,6 +186,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/readline-link-ncurses.patch		\
   gnu/packages/patches/shishi-gets-undeclared.patch		\
   gnu/packages/patches/tar-gets-undeclared.patch		\
+  gnu/packages/patches/tcsh-fix-autotest.patch 			\
   gnu/packages/patches/teckit-cstdio.patch
 
 bootstrapdir = $(guilemoduledir)/gnu/packages/bootstrap
diff --git a/gnu/packages/patches/tcsh-fix-autotest.patch b/gnu/packages/patches/tcsh-fix-autotest.patch
new file mode 100644
index 0000000..a169801
--- /dev/null
+++ b/gnu/packages/patches/tcsh-fix-autotest.patch
@@ -0,0 +1,231 @@
+--- tests/commands.at	2011-01-22 01:04:02.000000000 +0100
++++ tests/commands.at	2013-02-04 10:57:24.000000000 +0100
+@@ -919,26 +919,27 @@
+ TCSH_UNTESTED([notify])
+ 
+ 
+-AT_SETUP([onintr])
+-
+-AT_DATA([onintr.csh],
+-[[onintr label
+-kill -INT $$
+-echo fail
+-label:
+-echo caught
+-onintr -
+-kill -INT $$
+-echo OK
+-onintr -
+-kill -INT $$
+-]])
+-AT_CHECK([tcsh -f onintr.csh], ,
+-[caught
+-OK
+-])
+-
+-AT_CLEANUP
++# XXX This test does not work: "fail" is printed on stdout.
++#AT_SETUP([onintr])
++#
++#AT_DATA([onintr.csh],
++#[[onintr label
++#kill -INT $$
++#echo fail
++#label:
++#echo caught
++#onintr -
++#kill -INT $$
++#echo OK
++#onintr -
++#kill -INT $$
++#]])
++#AT_CHECK([tcsh -f onintr.csh], ,
++#[caught
++#OK
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([popd])
+@@ -1203,11 +1204,12 @@
+ AT_DATA([script.csh],
+ [[set var=$1
+ ]])
+-AT_CHECK([[tcsh -f -c 'source -h script.csh foo; history' \
+-	   | sed 's/	[^	]*	/ TIME /']], ,
+-[     1 TIME source -h script.csh foo ; history
+-     2 TIME set var=$1
+-])
++# XXX: Not sure why this fails. The output is : "1 TIME set var=$1"
++#AT_CHECK([[tcsh -f -c 'source -h script.csh foo; history' \
++#	   | sed 's/	[^	]*	/ TIME /']], ,
++#[     1 TIME source -h script.csh foo ; history
++#     2 TIME set var=$1
++#])
+ 
+ AT_CHECK([tcsh -f -c 'source -h script.csh foo; echo $var'], 1, [],
+ [var: Undefined variable.
+--- tests/lexical.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/lexical.at	2013-02-04 10:53:21.000000000 +0100
+@@ -33,9 +33,9 @@
+ AT_CHECK([echo 'echo OK@%:@comment' | tcsh -f], , [OK
+ ])
+ 
+-AT_CHECK([tcsh -f -c 'echo @%:@no comment'], ,
+-[@%:@no comment
+-])
++#AT_CHECK([tcsh -f -c 'echo @%:@no comment'], ,
++#[@%:@no comment
++#])
+ 
+ AT_DATA([comment2.csh],
+ [[echo testing...@%:@\
+--- tests/subst.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/subst.at	2013-02-01 08:14:25.000000000 +0100
+@@ -54,7 +54,7 @@
+ , [1
+ ])
+ 
+-AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | uniq dnl
++AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | grep -v "/homeless-shelter" | uniq dnl
+ 	  | wc -l | tr -d ' \t'], , [1
+ ])
+ 
+--- tests/variables.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/variables.at	2013-02-04 11:40:35.000000000 +0100
+@@ -317,17 +317,18 @@
+ AT_CLEANUP
+ 
+ 
+-AT_SETUP([$ edit])
+-
+-AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], ,
+-[1
+-])
+-
+-AT_CHECK([TERM=dumb tcsh -f -c 'echo $?edit'], ,
+-[0
+-])
+-
+-AT_CLEANUP
++# XXX
++#AT_SETUP([$ edit])
++#
++#AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], ,
++#[1
++#])
++#
++#AT_CHECK([TERM=dumb tcsh -f -c 'echo $?edit'], ,
++#[0
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([$ ellipsis])
+@@ -642,7 +643,8 @@
+ ls-F -something .
+ ]])
+ AT_DATA([args.sh],
+-[[echo "$@"
++[[#!/bin/sh
++echo "$@"
+ ]])
+ chmod a+x args.sh
+ AT_CHECK([tcsh -f listflags.csh], ,
+@@ -695,55 +697,57 @@
+ AT_SETUP([$ owd])
+ 
+ AT_DATA([owd.csh],
+-[[echo $owd
+-cd /
++[[mkdir -p a/b/
+ echo $owd
+-pushd /bin
++cd a
++echo $owd
++pushd b
+ echo $owd
+ popd
+ echo $owd
+ ]])
+-AT_CHECK([tcsh -f owd.csh | sed "s,$PWD,CWD,"], ,
++AT_CHECK([tcsh -f owd.csh | sed "s,$PWD,CWD,g"], ,
+ [
+ CWD
+-/bin / @&t@
+-/
+-/ @&t@
+-/bin
++CWD/a/b CWD/a @&t@
++CWD/a
++CWD/a @&t@
++CWD/a/b
+ ])
+ 
+ AT_CLEANUP
+ 
+ 
+-AT_SETUP([$ path])
+-
+-mkdir subdir
+-AT_DATA([script.sh],
+-[[echo home
+-]])
+-AT_DATA([subdir/script.sh],
+-[[echo subdir
+-]])
+-chmod a+x script.sh subdir/script.sh
+-AT_DATA([path.csh],
+-[[echo $?path
+-set path=(. subdir)
+-script.sh
+-set path=(subdir .)
+-script.sh
+-printenv PATH
+-setenv PATH :foo::bar:
+-echo $path
+-]])
+-AT_CHECK([tcsh -f path.csh], ,
+-[1
+-home
+-subdir
+-subdir:.
+-. foo . bar .
+-])
+-
+-AT_CLEANUP
++# XXX Not sure why this does not work. "home" is printed out twice on stdout.
++#AT_SETUP([$ path])
++#
++#mkdir subdir
++#AT_DATA([script.sh],
++#[[echo home
++#]])
++#AT_DATA([subdir/script.sh],
++#[[echo subdir
++#]])
++#chmod a+x script.sh subdir/script.sh
++#AT_DATA([path.csh],
++#[[echo $?path
++#set path=(. subdir)
++#script.sh
++#set path=(subdir .)
++#script.sh
++#printenv PATH
++#setenv PATH :foo::bar:
++#echo $path
++#]])
++#AT_CHECK([tcsh -f path.csh], ,
++#[1
++#home
++#subdir
++#subdir:.
++#. foo . bar .
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([$ printexitvalue])
diff --git a/gnu/packages/tcsh.scm b/gnu/packages/tcsh.scm
new file mode 100644
index 0000000..500854a
--- /dev/null
+++ b/gnu/packages/tcsh.scm
@@ -0,0 +1,76 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Cyril Roelandt <tipecaml@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 tcsh)
+  #:use-module (guix licenses)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages ncurses))
+
+(define-public tcsh
+  (package
+    (name "tcsh")
+    (version "6.18.01")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "ftp://ftp.astron.com/pub/tcsh/tcsh-"
+                                 version ".tar.gz"))
+             (sha256
+              (base32 "1a4z9kwgx1iqqzvv64si34m60gj34p7lp6rrcrb59s7ka5wa476q"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("autoconf" ,autoconf)
+       ("coreutils" ,coreutils)
+       ("ncurses" ,ncurses)
+       ("patch/skip-tests"
+        ,(search-patch "tcsh-fix-autotest.patch"))))
+    (arguments
+     `(#:phases
+       (alist-replace
+        'check
+        (lambda* (#:key inputs #:allow-other-keys #:rest args)
+          (let ((check (assoc-ref %standard-phases 'check)))
+            ;; Take care of pwd
+            (substitute* '("tests/commands.at" "tests/variables.at")
+              (("/bin/pwd") (which "pwd")))
+            ;; The .at files create shell scripts without shebangs. Erk.
+            (substitute* "tests/commands.at"
+              (("./output.sh") "/bin/sh output.sh"))
+            (substitute* "tests/syntax.at"
+              (("; other_script.csh") "; /bin/sh other_script.csh"))
+	    ;; Now, let's generate the test suite, patch it and finally run the
+            ;; tests.
+            (system* "make" "tests/testsuite")
+            (substitute* "tests/testsuite" (("/bin/sh") (which "sh")))
+            (apply check args)))
+        %standard-phases)
+        #:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
+        #:patch-flags '("-p0")))
+    (home-page "http://www.tcsh.org/")
+    (synopsis "A Unix shell based on csh")
+    (description
+     "Tcsh is an enhanced, but completely compatible version of the Berkeley
+UNIX C shell (csh). It is a command language interpreter usable both as an
+interactive login shell and a shell script command processor. It includes a
+command-line editor, programmable word completion, spelling correction, a
+history mechanism, job control and a C-like syntax.")
+    (license bsd-4)))
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] Add tcsh.
  2013-02-07  0:09         ` [PATCH v2] " Cyril Roelandt
@ 2013-02-07  9:29           ` Andreas Enge
  2013-02-07 10:10             ` Cyril Roelandt
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Enge @ 2013-02-07  9:29 UTC (permalink / raw)
  To: bug-guix

[-- Attachment #1: Type: text/plain, Size: 294 bytes --]

Hello,

does tcsh include a csh binary? If not, would it make sense to add a 
symbolic link? I have seen the patch-shebangs phase complain about a 
missing csh interpreter (apparently without any incidence, since the tests 
pass, but it would nevertheless be nice to patch correctly).

Andreas

[-- Attachment #2: Type: text/html, Size: 1508 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] Add tcsh.
  2013-02-07  9:29           ` Andreas Enge
@ 2013-02-07 10:10             ` Cyril Roelandt
  2013-02-07 10:34               ` Andreas Enge
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2013-02-07 10:10 UTC (permalink / raw)
  To: Andreas Enge; +Cc: bug-guix

On 02/07/2013 10:29 AM, Andreas Enge wrote:
> Hello,
>
> does tcsh include a csh binary? If not, would it make sense to add a
> symbolic link? I have seen the patch-shebangs phase complain about a
> missing csh interpreter (apparently without any incidence, since the tests
> pass, but it would nevertheless be nice to patch correctly).
>

We could do that, since tcsh is fully compatible with csh, but shouldn't 
we rather package csh as well ? The "csh" package in Debian uses sources 
from the OpenBSD CVS repository, so we'd need a cvs-fetch method.

WDYT ?

Cyril.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] Add tcsh.
  2013-02-07 10:10             ` Cyril Roelandt
@ 2013-02-07 10:34               ` Andreas Enge
  2013-02-07 10:56                 ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Andreas Enge @ 2013-02-07 10:34 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: bug-guix

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

Am Donnerstag, 7. Februar 2013 schrieb Cyril Roelandt:
> We could do that, since tcsh is fully compatible with csh, but shouldn't
> we rather package csh as well ? The "csh" package in Debian uses sources
> from the OpenBSD CVS repository, so we'd need a cvs-fetch method.

My impression was that the csh code was not maintained any more. Wikipedia 
states the following:

"On many systems, such as Mac OS X and Red Hat Linux, csh is actually tcsh, 
an improved version of csh. One file containing the tcsh executable has 
links to it as both "csh" and "tcsh" so that either name refers to the same 
improved version of the C shell.
On Debian, Ubuntu, and their derivatives, there are two different packages: 
csh and tcsh. The former is based on the original BSD version of csh and 
the latter is the improved tcsh."
I am wary about using unmaintained code for which not even a web page with 
a tarball seems to exist, and would rather opt for the symlink.
Andreas

[-- Attachment #2: Type: text/html, Size: 3802 bytes --]

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH v2] Add tcsh.
  2013-02-07 10:34               ` Andreas Enge
@ 2013-02-07 10:56                 ` Ludovic Courtès
  2013-02-10 20:57                   ` [PATCH v3] gnu: " Cyril Roelandt
  0 siblings, 1 reply; 14+ messages in thread
From: Ludovic Courtès @ 2013-02-07 10:56 UTC (permalink / raw)
  To: Andreas Enge; +Cc: bug-guix

Andreas Enge <andreas@enge.fr> skribis:

> "On many systems, such as Mac OS X and Red Hat Linux, csh is actually tcsh, 
> an improved version of csh. One file containing the tcsh executable has 
> links to it as both "csh" and "tcsh" so that either name refers to the same 
> improved version of the C shell.
> On Debian, Ubuntu, and their derivatives, there are two different packages: 
> csh and tcsh. The former is based on the original BSD version of csh and 
> the latter is the improved tcsh."
> I am wary about using unmaintained code for which not even a web page with 
> a tarball seems to exist, and would rather opt for the symlink.

Yeah, probably a good idea to add that symlink in a post-install phase.

Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH v3] gnu: Add tcsh.
  2013-02-07 10:56                 ` Ludovic Courtès
@ 2013-02-10 20:57                   ` Cyril Roelandt
  2013-02-10 21:44                     ` Ludovic Courtès
  0 siblings, 1 reply; 14+ messages in thread
From: Cyril Roelandt @ 2013-02-10 20:57 UTC (permalink / raw)
  To: bug-guix

* gnu/packages/tcsh.scm: New file.
* gnu/packages/patches/tcsh-fix-autotest.patch: New file
* Makefile.am: Add them.
---
Third version of the patch. "csh" is now a symlink to "tcsh".

Cyril Roelandt.


 Makefile.am                                  |    2 +
 gnu/packages/patches/tcsh-fix-autotest.patch |  231 ++++++++++++++++++++++++++
 gnu/packages/tcsh.scm                        |   83 +++++++++
 3 files changed, 316 insertions(+)
 create mode 100644 gnu/packages/patches/tcsh-fix-autotest.patch
 create mode 100644 gnu/packages/tcsh.scm

diff --git a/Makefile.am b/Makefile.am
index bd8a0e1..f9b64e7 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -139,6 +139,7 @@ MODULES =					\
   gnu/packages/subversion.scm 			\
   gnu/packages/system.scm			\
   gnu/packages/tcl.scm				\
+  gnu/packages/tcsh.scm 			\
   gnu/packages/texinfo.scm			\
   gnu/packages/texlive.scm			\
   gnu/packages/time.scm				\
@@ -191,6 +192,7 @@ dist_patch_DATA =						\
   gnu/packages/patches/readline-link-ncurses.patch		\
   gnu/packages/patches/shishi-gets-undeclared.patch		\
   gnu/packages/patches/tar-gets-undeclared.patch		\
+  gnu/packages/patches/tcsh-fix-autotest.patch 			\
   gnu/packages/patches/teckit-cstdio.patch
 
 bootstrapdir = $(guilemoduledir)/gnu/packages/bootstrap
diff --git a/gnu/packages/patches/tcsh-fix-autotest.patch b/gnu/packages/patches/tcsh-fix-autotest.patch
new file mode 100644
index 0000000..a169801
--- /dev/null
+++ b/gnu/packages/patches/tcsh-fix-autotest.patch
@@ -0,0 +1,231 @@
+--- tests/commands.at	2011-01-22 01:04:02.000000000 +0100
++++ tests/commands.at	2013-02-04 10:57:24.000000000 +0100
+@@ -919,26 +919,27 @@
+ TCSH_UNTESTED([notify])
+ 
+ 
+-AT_SETUP([onintr])
+-
+-AT_DATA([onintr.csh],
+-[[onintr label
+-kill -INT $$
+-echo fail
+-label:
+-echo caught
+-onintr -
+-kill -INT $$
+-echo OK
+-onintr -
+-kill -INT $$
+-]])
+-AT_CHECK([tcsh -f onintr.csh], ,
+-[caught
+-OK
+-])
+-
+-AT_CLEANUP
++# XXX This test does not work: "fail" is printed on stdout.
++#AT_SETUP([onintr])
++#
++#AT_DATA([onintr.csh],
++#[[onintr label
++#kill -INT $$
++#echo fail
++#label:
++#echo caught
++#onintr -
++#kill -INT $$
++#echo OK
++#onintr -
++#kill -INT $$
++#]])
++#AT_CHECK([tcsh -f onintr.csh], ,
++#[caught
++#OK
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([popd])
+@@ -1203,11 +1204,12 @@
+ AT_DATA([script.csh],
+ [[set var=$1
+ ]])
+-AT_CHECK([[tcsh -f -c 'source -h script.csh foo; history' \
+-	   | sed 's/	[^	]*	/ TIME /']], ,
+-[     1 TIME source -h script.csh foo ; history
+-     2 TIME set var=$1
+-])
++# XXX: Not sure why this fails. The output is : "1 TIME set var=$1"
++#AT_CHECK([[tcsh -f -c 'source -h script.csh foo; history' \
++#	   | sed 's/	[^	]*	/ TIME /']], ,
++#[     1 TIME source -h script.csh foo ; history
++#     2 TIME set var=$1
++#])
+ 
+ AT_CHECK([tcsh -f -c 'source -h script.csh foo; echo $var'], 1, [],
+ [var: Undefined variable.
+--- tests/lexical.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/lexical.at	2013-02-04 10:53:21.000000000 +0100
+@@ -33,9 +33,9 @@
+ AT_CHECK([echo 'echo OK@%:@comment' | tcsh -f], , [OK
+ ])
+ 
+-AT_CHECK([tcsh -f -c 'echo @%:@no comment'], ,
+-[@%:@no comment
+-])
++#AT_CHECK([tcsh -f -c 'echo @%:@no comment'], ,
++#[@%:@no comment
++#])
+ 
+ AT_DATA([comment2.csh],
+ [[echo testing...@%:@\
+--- tests/subst.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/subst.at	2013-02-01 08:14:25.000000000 +0100
+@@ -54,7 +54,7 @@
+ , [1
+ ])
+ 
+-AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | uniq dnl
++AT_CHECK([echo "echo ~$(id -un)/foo; echo \"$HOME/foo\"" | tcsh -f | grep -v "/homeless-shelter" | uniq dnl
+ 	  | wc -l | tr -d ' \t'], , [1
+ ])
+ 
+--- tests/variables.at	2011-12-27 22:50:52.000000000 +0100
++++ tests/variables.at	2013-02-04 11:40:35.000000000 +0100
+@@ -317,17 +317,18 @@
+ AT_CLEANUP
+ 
+ 
+-AT_SETUP([$ edit])
+-
+-AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], ,
+-[1
+-])
+-
+-AT_CHECK([TERM=dumb tcsh -f -c 'echo $?edit'], ,
+-[0
+-])
+-
+-AT_CLEANUP
++# XXX
++#AT_SETUP([$ edit])
++#
++#AT_CHECK([TERM=something tcsh -f -c 'echo $?edit'], ,
++#[1
++#])
++#
++#AT_CHECK([TERM=dumb tcsh -f -c 'echo $?edit'], ,
++#[0
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([$ ellipsis])
+@@ -642,7 +643,8 @@
+ ls-F -something .
+ ]])
+ AT_DATA([args.sh],
+-[[echo "$@"
++[[#!/bin/sh
++echo "$@"
+ ]])
+ chmod a+x args.sh
+ AT_CHECK([tcsh -f listflags.csh], ,
+@@ -695,55 +697,57 @@
+ AT_SETUP([$ owd])
+ 
+ AT_DATA([owd.csh],
+-[[echo $owd
+-cd /
++[[mkdir -p a/b/
+ echo $owd
+-pushd /bin
++cd a
++echo $owd
++pushd b
+ echo $owd
+ popd
+ echo $owd
+ ]])
+-AT_CHECK([tcsh -f owd.csh | sed "s,$PWD,CWD,"], ,
++AT_CHECK([tcsh -f owd.csh | sed "s,$PWD,CWD,g"], ,
+ [
+ CWD
+-/bin / @&t@
+-/
+-/ @&t@
+-/bin
++CWD/a/b CWD/a @&t@
++CWD/a
++CWD/a @&t@
++CWD/a/b
+ ])
+ 
+ AT_CLEANUP
+ 
+ 
+-AT_SETUP([$ path])
+-
+-mkdir subdir
+-AT_DATA([script.sh],
+-[[echo home
+-]])
+-AT_DATA([subdir/script.sh],
+-[[echo subdir
+-]])
+-chmod a+x script.sh subdir/script.sh
+-AT_DATA([path.csh],
+-[[echo $?path
+-set path=(. subdir)
+-script.sh
+-set path=(subdir .)
+-script.sh
+-printenv PATH
+-setenv PATH :foo::bar:
+-echo $path
+-]])
+-AT_CHECK([tcsh -f path.csh], ,
+-[1
+-home
+-subdir
+-subdir:.
+-. foo . bar .
+-])
+-
+-AT_CLEANUP
++# XXX Not sure why this does not work. "home" is printed out twice on stdout.
++#AT_SETUP([$ path])
++#
++#mkdir subdir
++#AT_DATA([script.sh],
++#[[echo home
++#]])
++#AT_DATA([subdir/script.sh],
++#[[echo subdir
++#]])
++#chmod a+x script.sh subdir/script.sh
++#AT_DATA([path.csh],
++#[[echo $?path
++#set path=(. subdir)
++#script.sh
++#set path=(subdir .)
++#script.sh
++#printenv PATH
++#setenv PATH :foo::bar:
++#echo $path
++#]])
++#AT_CHECK([tcsh -f path.csh], ,
++#[1
++#home
++#subdir
++#subdir:.
++#. foo . bar .
++#])
++#
++#AT_CLEANUP
+ 
+ 
+ AT_SETUP([$ printexitvalue])
diff --git a/gnu/packages/tcsh.scm b/gnu/packages/tcsh.scm
new file mode 100644
index 0000000..dcf709b
--- /dev/null
+++ b/gnu/packages/tcsh.scm
@@ -0,0 +1,83 @@
+;;; GNU Guix --- Functional package management for GNU
+;;; Copyright © 2013 Cyril Roelandt <tipecaml@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 tcsh)
+  #:use-module (guix licenses)
+  #:use-module (guix packages)
+  #:use-module (guix download)
+  #:use-module (guix build-system gnu)
+  #:use-module (gnu packages)
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages base)
+  #:use-module (gnu packages ncurses))
+
+(define-public tcsh
+  (package
+    (name "tcsh")
+    (version "6.18.01")
+    (source (origin
+             (method url-fetch)
+             (uri (string-append "ftp://ftp.astron.com/pub/tcsh/tcsh-"
+                                 version ".tar.gz"))
+             (sha256
+              (base32 "1a4z9kwgx1iqqzvv64si34m60gj34p7lp6rrcrb59s7ka5wa476q"))))
+    (build-system gnu-build-system)
+    (inputs
+     `(("autoconf" ,autoconf)
+       ("coreutils" ,coreutils)
+       ("ncurses" ,ncurses)
+       ("patch/skip-tests"
+        ,(search-patch "tcsh-fix-autotest.patch"))))
+    (arguments
+     `(#:phases
+       (alist-replace
+        'check
+        (lambda* (#:key inputs #:allow-other-keys #:rest args)
+          (let ((check (assoc-ref %standard-phases 'check)))
+            ;; Take care of pwd
+            (substitute* '("tests/commands.at" "tests/variables.at")
+              (("/bin/pwd") (which "pwd")))
+            ;; The .at files create shell scripts without shebangs. Erk.
+            (substitute* "tests/commands.at"
+              (("./output.sh") "/bin/sh output.sh"))
+            (substitute* "tests/syntax.at"
+              (("; other_script.csh") "; /bin/sh other_script.csh"))
+	    ;; Now, let's generate the test suite, patch it and finally run the
+            ;; tests.
+            (system* "make" "tests/testsuite")
+            (substitute* "tests/testsuite" (("/bin/sh") (which "sh")))
+            (apply check args)))
+        (alist-cons-after
+         'install 'post-install
+         (lambda* (#:key inputs outputs #:allow-other-keys)
+          (let* ((out (assoc-ref %outputs "out"))
+                 (bin (string-append out "/bin")))
+           (with-directory-excursion bin
+             (symlink "tcsh" "csh"))))
+         %standard-phases))
+        #:patches (list (assoc-ref %build-inputs "patch/skip-tests"))
+        #:patch-flags '("-p0")))
+    (home-page "http://www.tcsh.org/")
+    (synopsis "A Unix shell based on csh")
+    (description
+     "Tcsh is an enhanced, but completely compatible version of the Berkeley
+UNIX C shell (csh). It is a command language interpreter usable both as an
+interactive login shell and a shell script command processor. It includes a
+command-line editor, programmable word completion, spelling correction, a
+history mechanism, job control and a C-like syntax.")
+    (license bsd-4)))
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 14+ messages in thread

* Re: [PATCH v3] gnu: Add tcsh.
  2013-02-10 20:57                   ` [PATCH v3] gnu: " Cyril Roelandt
@ 2013-02-10 21:44                     ` Ludovic Courtès
  0 siblings, 0 replies; 14+ messages in thread
From: Ludovic Courtès @ 2013-02-10 21:44 UTC (permalink / raw)
  To: Cyril Roelandt; +Cc: bug-guix

Cyril Roelandt <tipecaml@gmail.com> skribis:

> * gnu/packages/tcsh.scm: New file.
> * gnu/packages/patches/tcsh-fix-autotest.patch: New file
> * Makefile.am: Add them.
> ---
> Third version of the patch. "csh" is now a symlink to "tcsh".

Perfect, please push after removing tabs from the file.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-02-10 21:44 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-04 21:27 [PATCH] Add tcsh Cyril Roelandt
2013-02-04 22:32 ` Ludovic Courtès
2013-02-04 22:40   ` Cyril Roelandt
2013-02-05  8:56     ` Ludovic Courtès
2013-02-06  1:38   ` Cyril Roelandt
2013-02-06 14:17     ` Ludovic Courtès
2013-02-07  0:04       ` Cyril Roelandt
2013-02-07  0:09         ` [PATCH v2] " Cyril Roelandt
2013-02-07  9:29           ` Andreas Enge
2013-02-07 10:10             ` Cyril Roelandt
2013-02-07 10:34               ` Andreas Enge
2013-02-07 10:56                 ` Ludovic Courtès
2013-02-10 20:57                   ` [PATCH v3] gnu: " Cyril Roelandt
2013-02-10 21:44                     ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).