Gentoo Archives: gentoo-lisp

From: "Marijn Schouten (hkBst)" <hkBst@g.o>
To: gentoo-lisp@l.g.o
Subject: Re: [gentoo-lisp] common-lisp.eclass cleanup
Date: Thu, 18 Oct 2007 17:23:21
Message-Id: 471794CC.1000104@gentoo.org
In Reply to: Re: [gentoo-lisp] common-lisp.eclass cleanup by Stelian Ionescu
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stelian Ionescu wrote:
>> common-lisp-system-symlink() { >> dodir "${CLSYSTEMROOT}" >> # if no arguments received, default to >> # the contents of ${CLSYSTEMS} >> if [ $# -eq 0 ]; then >> for package in ${CLSYSTEMS} ; do >> common-lisp-install-single-system "${package}" >> done >> else >> local _oldclpackage="${CLPACKAGE}" >> [ "${1}" == "-p" ] && { CLPACKAGE="${2}" ; shift ; shift ; } >> <-- what's the point of setting CLPACKAGE here? I'm not sure I like >> influencing common-lisp-install-single-system in that way. --> >> [ $# -eq 0 ] && die "common-lisp-system-symlink needs more arguments" >> for package in "$@" ; do >> common-lisp-install-single-system "${package}" >> done >> CLPACKAGE="${_oldclpackage}" >> fi >> } > > setting CLPACKAGE that way is the equivalent of this: > > (defun common-lisp-system-symlink (system &key (package *clpackage*)) > (let ((*clpackage* package)) ...)) > > I'm faking default arguments: when $1 is "-p" CLPACKAGE gets set > temporarily to $2, then restored to its initial value. I've seen this > idiom elsewhere in sh code > anyway, I've removed this since it's unnecessary
I'm glad to see it go. I've added the following proposed replacement to the eclass. The underscore will prevent it from being used right away: # if no arguments received, default to the contents of ${CLSYSTEMS} _common-lisp-system-symlink() { dodir "${CLSYSTEMROOT}" for package in $([[ $# = 0 ]] && echo ${CLSYSTEMS} || echo "$@") ; do common-lisp-install-single-system "${package}" done } Please test it. Marijn - -- Marijn Schouten (hkBst), Gentoo Lisp project <http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHF5TMp/VmCx0OL2wRAj4QAJ9S01YNwip2pDs8FF8rDrmkHqb5LwCeMPj1 tsXPUTOAvmz1dURd8LcY0Y4= =Tebj -----END PGP SIGNATURE----- -- gentoo-lisp@g.o mailing list