From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lists.gentoo.org ([140.105.134.102] helo=robin.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1IiWni-0007PE-RU for garchives@archives.gentoo.org; Thu, 18 Oct 2007 14:56:43 +0000 Received: from robin.gentoo.org (localhost [127.0.0.1]) by robin.gentoo.org (8.14.1/8.14.0) with SMTP id l9IEkBce010378; Thu, 18 Oct 2007 14:46:11 GMT Received: from panadol.lugroma.org (panadol.lugroma.org [194.242.232.30]) by robin.gentoo.org (8.14.1/8.14.0) with ESMTP id l9IEkBjE010373 for ; Thu, 18 Oct 2007 14:46:11 GMT Received: from localhost (localhost [127.0.0.1]) by panadol.lugroma.org (Postfix) with ESMTP id 14518316771 for ; Thu, 18 Oct 2007 16:46:09 +0200 (CEST) X-Virus-Scanned: amavisd-new at lugroma.org Received: from panadol.lugroma.org ([127.0.0.1]) by localhost (panadol.lugroma.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id kdyQ1IZ854UZ for ; Thu, 18 Oct 2007 16:46:06 +0200 (CEST) Received: from blackhole.universe.org (unknown [160.80.34.192]) by panadol.lugroma.org (Postfix) with ESMTP id E0E8B31676D for ; Thu, 18 Oct 2007 16:46:05 +0200 (CEST) Received: by blackhole.universe.org (Postfix, from userid 1000) id 9237D303E2; Thu, 18 Oct 2007 16:46:07 +0200 (CEST) Date: Thu, 18 Oct 2007 16:46:07 +0200 From: Stelian Ionescu To: gentoo-lisp@lists.gentoo.org Subject: Re: [gentoo-lisp] common-lisp.eclass cleanup Message-ID: <20071018144607.GB1097429@universe.org> References: <20071012213031.GA710952@universe.org> <20071015104532.2d8464ac@gentoo.org> <20071015222846.GA124069@universe.org> <47149ABC.1000408@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Lisp mail X-BeenThere: gentoo-lisp@gentoo.org MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="jousvV0MzM2p6OtC" Content-Disposition: inline In-Reply-To: <47149ABC.1000408@gentoo.org> User-Agent: mutt-ng/devel-r804 (Linux) X-Archives-Salt: 9405fdd1-296f-49fc-aec0-625e5ab7ce7a X-Archives-Hash: 2516ae856a2751df0479c046f04206ab --jousvV0MzM2p6OtC Content-Type: multipart/mixed; boundary="rJwd6BRFiFCcLxzm" Content-Disposition: inline --rJwd6BRFiFCcLxzm Content-Type: text/plain; charset=utf8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Oct 16, 2007 at 01:04:28PM +0200, Marijn Schouten (hkBst) wrote: >Stelian Ionescu wrote: >> On Mon, Oct 15, 2007 at 10:45:32AM +0200, Christian Faulhammer wrote: >> [snip] >>> Just a cosmetic...stay with one system. The local variables for Emacs >>> are unncessary, or do you have problems with app-emacs/gentoo-syntax? >>=20 >> ok, here's the last version of the eclass; sorry for the delay > >Comments by me within <-- these are my comments --> > ># Copyright 1999-2007 Gentoo Foundation ># Distributed under the terms of the GNU General Public License v2 ># $Header: $ ># ># Author Matthew Kennedy ># ># This eclass supports the installation of Common Lisp libraries > ><-- Where are the usage comments? Which are the public functions? --> > >inherit eutils > >CLSOURCEROOT=3D"${ROOT}"/usr/share/common-lisp/source/ >CLSYSTEMROOT=3D"${ROOT}"/usr/share/common-lisp/systems/ ><-- Before I really meant to ask about these two variables. I don't unders= tand >what the point is as CLSOURCEROOT will contain symlinks to within >CLSYSTEMROOT. Can you explain this please. --> it's the contrary: CLSOURCEROOT contains the source code, and CLSYSTEMROOT contains symlinks to within CLSOURCEROOT. the reason is that this is the way that ASDF works: it expects to find the .asd files in a list of predefined directories(in fact the variable is called asdf:*central-registry*), that's why we symlink .asd files into CLSYSTEMROOT and configure ASDF to look only there. there are workarounds for this, but they all imply either writing custom code which would be used only in gentoo, or maintaining some sort of site-gentoo.cl(much like for emacs) - but I'm strongly against either solutions since I think that doing what all other distros are doing is good policy because, for example, it allows users coming from other distros to be able to use their extant setup unchanged, not being forced to learn a new way to configure packaging ><-- Where is the comment about how to override these variables? --> >CLPACKAGE=3D"${PN}" >CLSYSTEMS=3D"${PN}" ok, comments added > >DEPEND=3D"virtual/commonlisp" > >EXPORT_FUNCTIONS src_install > >path-absolute-p() { > if [ $# -ne 1 ]; then > die "path-absolute-p must receive exactly one argument" > fi > local path=3D"${1}" > [ "${path:0:1}" =3D=3D / ] >} > >} > >or even > >path-absolute-p() { > assert_arg_num 1 # is bash powerful enough to define and use such a > function? AFAIK, no > [ "${1:0:1}" =3D=3D / ] > >and its name should be absolute-path-p. done >} > >or have it return true only if all its arguments start with '/'. >--> done >common-lisp-install() { > if [ $# -eq 0 ]; then > die "common-lisp-install must receive at least one argument" > fi > local _oldclpackage=3D"${CLPACKAGE}" > [ "${1}" =3D=3D "-p" ] && { CLPACKAGE=3D"${2}" ; shift ; shift ; } > for thing in "$@"; do > if path-absolute-p "${thing}" ; then > common-lisp-install-relatively "${thing}" > else > common-lisp-install-relatively "${thing}" "$(dirname "${thing}")" > fi <-- indentation is screwed up here (and a lot of other places) >because of a combination of spaces and tabs. --> fixed >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=3D"${CLPACKAGE}" > [ "${1}" =3D=3D "-p" ] && { CLPACKAGE=3D"${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 argumen= ts" > for package in "$@" ; do > common-lisp-install-single-system "${package}" > done > CLPACKAGE=3D"${_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 >common-lisp-2_src_install() { > common-lisp-install *.{lisp,asd} > common-lisp-system-symlink > dodoc LICENCE* LICENSE* COPYING* COPYRIGHT README HEADER TODO \ > CHANGELOG ChangeLog BUGS CONTRIBUTORS *NEWS 2> /dev/null ><-- licenses should not be installed separately, /usr/portage/licenses/ >contains them already --> done >} > ># Many of our Common Lisp ebuilds are either inspired by, or actually ># use packages and files from the Debian project's archives. > ><-- please remove this stuff. It is misleading and non-functional. --> done ># Local Variables: *** ># mode: shell-script *** ># tab-width: 4 *** ># End: *** ><-- were these not redundant? --> I don't know if they were added for emacs or for vim. anyway, I've removed them --=20 Stelian Ionescu a.k.a. fe[nl]ix Quidquid latine dictum sit, altum videtur. --rJwd6BRFiFCcLxzm Content-Type: text/plain; charset=utf8 Content-Disposition: attachment; filename="common-lisp-2.eclass" # Copyright 1999-2007 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ # # Author Matthew Kennedy # # This eclass supports the installation of Common Lisp libraries # # Public functions: # # common-lisp-install path [...] # Used to install files or directories(recursively) into # $CLSOURCEROOT/$CLPACKAGE. If a path is absolute, it gets installed directly # under $CLSOURCEROOT/$CLPACKAGE; if a path is relative, it gets copied by # concatenating its path to $CLSOURCEROOT/$CLPACKAGE. If one of the paths does # not exist, common-lisp-install dies specifying the erroneous path # Example: # common-lisp-install foo/bar/baz.lisp # installs baz.lisp into the directory $CLSOURCEROOT/$CLPACKAGE/foo/bar/ # # common-lisp-system-symlink [...] # I receives a list of ASDF systems(as relative paths into # $CLSOURCEROOT/$CLPACKAGE/) which will be symlinked into $CLSYSTEMROOT. # The list members *must not* end in ".asd" as that extension is supplied # by common-lisp-system-symlink. # If called with no arguments, the contents of $CLSYSTEMS will be used # as default. The specified files must alrady have been installed at the # time of the call, otherwise common-lisp-system-symlink dies # specifying the .asd file which could not be found. # Example: # CLSYSTEMS="src/foo" will symlink $CLSOURCEROOT/$CLPACKAGE/src/foo.asd # to $CLSYSTEMROOT/foo.asd inherit eutils CLSOURCEROOT="${ROOT}"/usr/share/common-lisp/source/ CLSYSTEMROOT="${ROOT}"/usr/share/common-lisp/systems/ # The subdirectory of ${CLSOURCEROOT} where sources will be installed. # If you need to override, set it in the ebuild after calling "inherit" CLPACKAGE="${PN}" # A list of ASDF systems(as relative paths into $CLSOURCEROOT/$CLPACKAGE/) # installed by the package which will be symlinked into $CLSYSTEMROOT. # Example: # CLSYSTEMS="src/foo" will symlink $CLSOURCEROOT/$CLPACKAGE/src/foo.asd # to $CLSYSTEMROOT/foo.asd # If you need to override, set it in the ebuild after calling "inherit" CLSYSTEMS="${PN}" DEPEND="virtual/commonlisp" EXPORT_FUNCTIONS src_install absolute-path-p() { [ $# -eq 0 ] && die "absolute-path-p must receive at least one argument" local absolute=TRUE for path in "$@" ; do [ "${path:0:1}" == / ] || absolute=FALSE done [ ${absolute} == TRUE ] } common-lisp-install-relatively() { if [ $# -lt 1 ] || [ $# -gt 2 ] ; then die "common-lisp-install-relatively must receive one or two arguments" fi local thing="${1}" ; local dir="${2}" insinto "${CLSOURCEROOT}/${CLPACKAGE}/${dir}" doins -r "${thing}" || die "Cannot install ${dir}/${thing}" } common-lisp-install() { [ $# -eq 0 ] && die "common-lisp-install must receive at least one argument" for thing in "$@"; do if absolute-path-p "${thing}" ; then common-lisp-install-relatively "${thing}" else common-lisp-install-relatively "${thing}" "$(dirname "${thing}")" fi done } common-lisp-install-single-system() { [ $# -ne 1 ] && die "common-lisp-install-single-system must receive exactly one argument" if [ ! -f "${D}/${CLSOURCEROOT}/${CLPACKAGE}/${1}.asd" ]; then die "${D}/${CLSOURCEROOT}/${CLPACKAGE}/${1}.asd does not exist" fi dosym "${CLSOURCEROOT}/${CLPACKAGE}/${1}.asd" \ "${CLSYSTEMROOT}/$(basename ${1}).asd" } 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 for package in "$@" ; do common-lisp-install-single-system "${package}" done fi } common-lisp-2_src_install() { common-lisp-install *.{lisp,asd} common-lisp-system-symlink dodoc COPYRIGHT README HEADER TODO CHANGELOG ChangeLog \ BUGS CONTRIBUTORS *NEWS 2> /dev/null } --rJwd6BRFiFCcLxzm-- --jousvV0MzM2p6OtC Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.7 (GNU/Linux) iD8DBQFHF3GvjWsER8+9ASURAmAHAJ9+09epj4W941v009SdtdRk9WOqDwCfcCoD ogYJgDwUAt+bRqYTHfu2BMI= =SUQW -----END PGP SIGNATURE----- --jousvV0MzM2p6OtC-- -- gentoo-lisp@gentoo.org mailing list