public inbox for gentoo-lisp@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-lisp] common-lisp.eclass cleanup
@ 2007-10-12 21:30 Stelian Ionescu
  2007-10-13 10:05 ` Marijn Schouten (hkBst)
                   ` (2 more replies)
  0 siblings, 3 replies; 14+ messages in thread
From: Stelian Ionescu @ 2007-10-12 21:30 UTC (permalink / raw
  To: Gentoo Lisp mailing list


[-- Attachment #1.1: Type: text/plain, Size: 2013 bytes --]

hello, I've attached a cleaned up version of common-lisp.eclass. The
purpose of this change is to remove dependency on
dev-lisp/common-lisp-controller and to help reduce code duplication in
ebuilds.

I'll try to explain how CL packages work:

1) a CL package installs exactly one directory under
/usr/share/common-lisp/source. This is contained in the variable
$CLPACKAGE and it defaults to $PN. Exception: app-emacs/slime installs a
package named "swank"

2) a CL package contains one or more ASDF files(.asd). The variable
$CLSYSTEMS contains the names of those systems and defaults to $PN
because in the simplest case there is only one .asd
The .asd files usually are contained in the toplevel of the source
directory and get symlinked into /usr/share/common-lisp/systems

3) in order to find the systems, ASDF must be aware of the
/usr/share/common-lisp/systems directory, which must be added to the
list contained in the variable asdf:*central-registry*;
dev-lisp/gentoo-init takes care of setting up everything for the user

4) to load a system, one must start a Lisp and eval
(asdf:oos 'asdf:load-op <system>)


The eclass has three explicit "public" functions:

1) common-lisp-install(): must receive at least one argument. It installs
files or directories(recursively) into /usr/share/common-lisp/source

2) common-lisp-system-symlink(): when called with no arguments, it
installs the systems contained in $CLSYSTEMS. The system names must be
relative paths. Example: CLSYSTEMS="foo1 foo2 src/bar"
When called with some arguments, it installs those systems, ignoring
$CLSYSTEMS

3) do-debian-credits(): taken from common-lisp-common.eclass, since I've
dropped the inheritance on it

and an exported function, common-lisp_src_install, which is sufficient
for a good share of CL packages in the tree


if there are no objections, I'll commit the eclass next evening - Oct. 13

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

[-- Attachment #1.2: common-lisp-2.eclass --]
[-- Type: text/plain, Size: 1900 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Author Matthew Kennedy <mkennedy@gentoo.org>
#
# This eclass supports the installation of Common Lisp libraries

inherit eutils

CLSOURCEROOT=${ROOT}/usr/share/common-lisp/source/
CLSYSTEMROOT=${ROOT}/usr/share/common-lisp/systems/

CLPACKAGE=${PN}
CLSYSTEMS=${PN}

DEPEND="virtual/commonlisp"

EXPORT_FUNCTIONS src_install

common-lisp-install() {
	if [ $# == 0 ]; then
		die "common-lisp-install must receive at least one argument"
	fi
	for thing in "$@"; do
		insinto "${CLSOURCEROOT}/${CLPACKAGE}/$(dirname "${thing}")"
		doins -r "$(basename "${thing}")"
	done
}

common-lisp-install-single-system() {
	if [ $# != 1 ]; then
		die "common-lisp-install-single-system must receive exactly one argument"
	fi
    [ ! -f "${S}/$1".asd ] && die "ASDF file $1 does not exist"
	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_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
}

# Many of our Common Lisp ebuilds are either inspired by, or actually
# use packages and files from the Debian project's archives.

do-debian-credits() {
	docinto debian
	for i in copyright README.Debian changelog; do
		test -f $i && dodoc "${S}"/debian/${i}
	done
	docinto .
}

# Local Variables: ***
# mode: shell-script ***
# tab-width: 4 ***
# End: ***

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-12 21:30 [gentoo-lisp] common-lisp.eclass cleanup Stelian Ionescu
@ 2007-10-13 10:05 ` Marijn Schouten (hkBst)
  2007-10-13 11:30   ` Stelian Ionescu
  2007-10-13 10:07 ` Marijn Schouten (hkBst)
  2007-10-15  8:45 ` Christian Faulhammer
  2 siblings, 1 reply; 14+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-10-13 10:05 UTC (permalink / raw
  To: Stelian Ionescu; +Cc: Gentoo Lisp mailing list

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stelian Ionescu wrote:
> hello, I've attached a cleaned up version of common-lisp.eclass. The
> purpose of this change is to remove dependency on
> dev-lisp/common-lisp-controller and to help reduce code duplication in
> ebuilds.

Thank you very much Stelian.

> I'll try to explain how CL packages work:
> 
> 1) a CL package installs exactly one directory under
> /usr/share/common-lisp/source. This is contained in the variable
> $CLPACKAGE and it defaults to $PN. Exception: app-emacs/slime installs a
> package named "swank"

The code shows this is not really true. I couldn't find where a non-default
use was possible. You probably need to set:

[[ CLPACKAGE == "" ]] && CLPACKAGE=${PN}

or slime won't be able to install swank.

> 2) a CL package contains one or more ASDF files(.asd). The variable
> $CLSYSTEMS contains the names of those systems and defaults to $PN
> because in the simplest case there is only one .asd
> The .asd files usually are contained in the toplevel of the source
> directory and get symlinked into /usr/share/common-lisp/systems

The code shows this is not really true. Therefore you cannot set $CLPACKAGE
and expect it to be used by common-lisp_src_install in its call to
common-lisp-system-symlink. Other eclasses use a construct like this:

[[ CLSYSTEMS == "" ]] && CLSYSTEMS=${PN}

> 3) in order to find the systems, ASDF must be aware of the
> /usr/share/common-lisp/systems directory, which must be added to the
> list contained in the variable asdf:*central-registry*;
> dev-lisp/gentoo-init takes care of setting up everything for the user
> 
> 4) to load a system, one must start a Lisp and eval
> (asdf:oos 'asdf:load-op <system>)
> 
> 
> The eclass has three explicit "public" functions:
> 
> 1) common-lisp-install(): must receive at least one argument. It installs
> files or directories(recursively) into /usr/share/common-lisp/source
> 
> 2) common-lisp-system-symlink(): when called with no arguments, it
> installs the systems contained in $CLSYSTEMS. The system names must be
> relative paths. Example: CLSYSTEMS="foo1 foo2 src/bar"
> When called with some arguments, it installs those systems, ignoring
> $CLSYSTEMS

If I understand correctly the symlinks make it appear like CLPACKAGE contains
what CLSYSTEMS contains. What is the point of that or why does it need to be
that way?

> 3) do-debian-credits(): taken from common-lisp-common.eclass, since I've
> dropped the inheritance on it

Which packages use this and what's the point of doing it?

> and an exported function, common-lisp_src_install, which is sufficient
> for a good share of CL packages in the tree
> 
> 
> if there are no objections, I'll commit the eclass next evening - Oct. 13

Sure, that's what the overlay is for.

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

iD8DBQFHEJh2p/VmCx0OL2wRAiJcAJ40LXIIIyWiqACIWKFZO/5/PBacVACaA7FH
SKD5swy4qwHAn5FxgWJI0mY=
=jk9S
-----END PGP SIGNATURE-----
-- 
gentoo-lisp@gentoo.org mailing list



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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-12 21:30 [gentoo-lisp] common-lisp.eclass cleanup Stelian Ionescu
  2007-10-13 10:05 ` Marijn Schouten (hkBst)
@ 2007-10-13 10:07 ` Marijn Schouten (hkBst)
  2007-10-13 10:48   ` Stelian Ionescu
  2007-10-15  8:45 ` Christian Faulhammer
  2 siblings, 1 reply; 14+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-10-13 10:07 UTC (permalink / raw
  To: Stelian Ionescu; +Cc: Gentoo Lisp mailing list

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stelian Ionescu wrote:
> if there are no objections, I'll commit the eclass next evening - Oct. 13

I forgot to mention: quote ROOT.

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

iD8DBQFHEJjrp/VmCx0OL2wRAozKAJ9YCH3sB0BX2/640k+E6djw8NAnVACfTbMU
K9ucHicjgBTeKNONW2yinFg=
=OTqb
-----END PGP SIGNATURE-----
-- 
gentoo-lisp@gentoo.org mailing list



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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-13 10:07 ` Marijn Schouten (hkBst)
@ 2007-10-13 10:48   ` Stelian Ionescu
  0 siblings, 0 replies; 14+ messages in thread
From: Stelian Ionescu @ 2007-10-13 10:48 UTC (permalink / raw
  To: gentoo-lisp

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

On Sat, Oct 13, 2007 at 12:07:39PM +0200, Marijn Schouten (hkBst) wrote:
>Stelian Ionescu wrote:
>> if there are no objections, I'll commit the eclass next evening - Oct. 13
>
>I forgot to mention: quote ROOT.
okie, I thought quoting didn't matter in assignments, but only in
commands

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-13 10:05 ` Marijn Schouten (hkBst)
@ 2007-10-13 11:30   ` Stelian Ionescu
  2007-10-15 10:04     ` Marijn Schouten (hkBst)
  0 siblings, 1 reply; 14+ messages in thread
From: Stelian Ionescu @ 2007-10-13 11:30 UTC (permalink / raw
  To: gentoo-lisp

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

On Sat, Oct 13, 2007 at 12:05:42PM +0200, Marijn Schouten (hkBst) wrote:
[snip]
>> I'll try to explain how CL packages work:
>> 
>> 1) a CL package installs exactly one directory under
>> /usr/share/common-lisp/source. This is contained in the variable
>> $CLPACKAGE and it defaults to $PN. Exception: app-emacs/slime installs a
>> package named "swank"
>
>The code shows this is not really true. I couldn't find where a non-default
>use was possible. You probably need to set:
>
>[[ CLPACKAGE == "" ]] && CLPACKAGE=${PN}

there's no need for this construct because setting CLPACKAGE in the
ebuild is only meant as an override of the default value

>or slime won't be able to install swank.
>
>> 2) a CL package contains one or more ASDF files(.asd). The variable
>> $CLSYSTEMS contains the names of those systems and defaults to $PN
>> because in the simplest case there is only one .asd
>> The .asd files usually are contained in the toplevel of the source
>> directory and get symlinked into /usr/share/common-lisp/systems
>
>The code shows this is not really true. Therefore you cannot set $CLPACKAGE
>and expect it to be used by common-lisp_src_install in its call to
>common-lisp-system-symlink. Other eclasses use a construct like this:
>
>[[ CLSYSTEMS == "" ]] && CLSYSTEMS=${PN}

same as before

>> The eclass has three explicit "public" functions:
>> 
>> 1) common-lisp-install(): must receive at least one argument. It installs
>> files or directories(recursively) into /usr/share/common-lisp/source
>> 
>> 2) common-lisp-system-symlink(): when called with no arguments, it
>> installs the systems contained in $CLSYSTEMS. The system names must be
>> relative paths. Example: CLSYSTEMS="foo1 foo2 src/bar"
>> When called with some arguments, it installs those systems, ignoring
>> $CLSYSTEMS
>
>If I understand correctly the symlinks make it appear like CLPACKAGE contains
>what CLSYSTEMS contains. What is the point of that or why does it need to be
>that way?

most CL packages contain precisely one .asd file, named exactly as the
package; for example, kmrcl-1.97 contains only the kmrcl.asd system.
Having CLPACKAGE=$PN and CLSYSTEMS=$PN is a good default

>> 3) do-debian-credits(): taken from common-lisp-common.eclass, since I've
>> dropped the inheritance on it
>
>Which packages use this 

cl-aima, cl-irc, cl-sql, png, rt and split-sequence

> and what's the point of doing it?

as you know, many CL devs don't do releases(or not even versioning) so
mkennedy thought well of using the snapshots made by Debian developers
instead of making his own snapshots. It's meant as a way to credit
Debian for this

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-12 21:30 [gentoo-lisp] common-lisp.eclass cleanup Stelian Ionescu
  2007-10-13 10:05 ` Marijn Schouten (hkBst)
  2007-10-13 10:07 ` Marijn Schouten (hkBst)
@ 2007-10-15  8:45 ` Christian Faulhammer
  2007-10-15 13:14   ` Stelian Ionescu
  2007-10-15 22:28   ` Stelian Ionescu
  2 siblings, 2 replies; 14+ messages in thread
From: Christian Faulhammer @ 2007-10-15  8:45 UTC (permalink / raw
  To: gentoo-lisp

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

Stelian Ionescu <sionescu@common-lisp.net>:

> hello, I've attached a cleaned up version of common-lisp.eclass. The
> purpose of this change is to remove dependency on
> dev-lisp/common-lisp-controller and to help reduce code duplication in
> ebuilds.

common-lisp-install() {
	if [ $# == 0 ]; then
[...]
common-lisp-install-single-system() {
	if [ $# != 1 ]; then
[...]
common-lisp-system-symlink() {
[...]
	if [ $# -eq 0 ]; then

 Just a cosmetic...stay with one system.  The local variables for Emacs
are unncessary, or do you have problems with app-emacs/gentoo-syntax?

V-Li

-- 
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode

<URL:http://www.faulhammer.org/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-13 11:30   ` Stelian Ionescu
@ 2007-10-15 10:04     ` Marijn Schouten (hkBst)
  2007-10-15 13:39       ` Stelian Ionescu
  0 siblings, 1 reply; 14+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-10-15 10:04 UTC (permalink / raw
  To: Stelian Ionescu; +Cc: gentoo-lisp

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Stelian Ionescu wrote:
> On Sat, Oct 13, 2007 at 12:05:42PM +0200, Marijn Schouten (hkBst) wrote:
> [snip]
>>> I'll try to explain how CL packages work:
>>>
>>> 1) a CL package installs exactly one directory under
>>> /usr/share/common-lisp/source. This is contained in the variable
>>> $CLPACKAGE and it defaults to $PN. Exception: app-emacs/slime installs a
>>> package named "swank"
>> The code shows this is not really true. I couldn't find where a non-default
>> use was possible. You probably need to set:
>>
>> [[ CLPACKAGE == "" ]] && CLPACKAGE=${PN}
> 
> there's no need for this construct because setting CLPACKAGE in the
> ebuild is only meant as an override of the default value

I was thinking of having the variable set before inheriting the eclass, but if
you inherit first and set later it works as you intended. Please comment that.

>> or slime won't be able to install swank.
>>
>>> 2) a CL package contains one or more ASDF files(.asd). The variable
>>> $CLSYSTEMS contains the names of those systems and defaults to $PN
>>> because in the simplest case there is only one .asd
>>> The .asd files usually are contained in the toplevel of the source
>>> directory and get symlinked into /usr/share/common-lisp/systems
>> The code shows this is not really true. Therefore you cannot set $CLPACKAGE
>> and expect it to be used by common-lisp_src_install in its call to
>> common-lisp-system-symlink. Other eclasses use a construct like this:
>>
>> [[ CLSYSTEMS == "" ]] && CLSYSTEMS=${PN}
> 
> same as before

True. Why does common-lisp-system-symlink check for zero arguments? Is that
functionality needed by any ebuild?

>>> The eclass has three explicit "public" functions:
>>>
>>> 1) common-lisp-install(): must receive at least one argument. It installs
>>> files or directories(recursively) into /usr/share/common-lisp/source
>>>
>>> 2) common-lisp-system-symlink(): when called with no arguments, it
>>> installs the systems contained in $CLSYSTEMS. The system names must be
>>> relative paths. Example: CLSYSTEMS="foo1 foo2 src/bar"
>>> When called with some arguments, it installs those systems, ignoring
>>> $CLSYSTEMS
>> If I understand correctly the symlinks make it appear like CLPACKAGE contains
>> what CLSYSTEMS contains. What is the point of that or why does it need to be
>> that way?
> 
> most CL packages contain precisely one .asd file, named exactly as the
> package; for example, kmrcl-1.97 contains only the kmrcl.asd system.
> Having CLPACKAGE=$PN and CLSYSTEMS=$PN is a good default

That is not an answer. Why do we need to have two variables? Why can we not
collapse them into one?

>>> 3) do-debian-credits(): taken from common-lisp-common.eclass, since I've
>>> dropped the inheritance on it
>> Which packages use this 
> 
> cl-aima, cl-irc, cl-sql, png, rt and split-sequence
> 
>> and what's the point of doing it?
> 
> as you know, many CL devs don't do releases(or not even versioning) so
> mkennedy thought well of using the snapshots made by Debian developers
> instead of making his own snapshots. It's meant as a way to credit
> Debian for this

I don't know about many. A few yes. Having Debian oblige them certainly is a
mixed blessing. I don't think I like having code in our eclasss merely to give
credit and not nearly enough ebuilds seem to depend on this. Are any of the
installed files of practical use?

Stelian Ionescu wrote:
> On Sat, Oct 13, 2007 at 12:07:39PM +0200, Marijn Schouten (hkBst) wrote:
>> Stelian Ionescu wrote:
>>> if there are no objections, I'll commit the eclass next evening - Oct. 13
>> I forgot to mention: quote ROOT.
> okie, I thought quoting didn't matter in assignments, but only in
> commands

You are correct.

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

iD8DBQFHEzsgp/VmCx0OL2wRAokeAJ9l3iGrMXT1PJzC1Gm7QYkTA2FhpgCggGtR
/DM3Uflv/HxxtY7rWEUzOhM=
=RL7O
-----END PGP SIGNATURE-----
-- 
gentoo-lisp@gentoo.org mailing list



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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-15  8:45 ` Christian Faulhammer
@ 2007-10-15 13:14   ` Stelian Ionescu
  2007-10-15 22:28   ` Stelian Ionescu
  1 sibling, 0 replies; 14+ messages in thread
From: Stelian Ionescu @ 2007-10-15 13:14 UTC (permalink / raw
  To: gentoo-lisp

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

On Mon, Oct 15, 2007 at 10:45:32AM +0200, Christian Faulhammer wrote:
>common-lisp-install() {
>	if [ $# == 0 ]; then
>[...]
>common-lisp-install-single-system() {
>	if [ $# != 1 ]; then
>[...]
>common-lisp-system-symlink() {
>[...]
>	if [ $# -eq 0 ]; then
>
> Just a cosmetic...stay with one system.

ok, done

>The local variables for Emacs
>are unncessary, or do you have problems with app-emacs/gentoo-syntax?

that part comes from common-lisp.eclass - I thought they were for vim

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-15 10:04     ` Marijn Schouten (hkBst)
@ 2007-10-15 13:39       ` Stelian Ionescu
  0 siblings, 0 replies; 14+ messages in thread
From: Stelian Ionescu @ 2007-10-15 13:39 UTC (permalink / raw
  To: gentoo-lisp

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

On Mon, Oct 15, 2007 at 12:04:16PM +0200, Marijn Schouten (hkBst) wrote:
>Stelian Ionescu wrote:
>> On Sat, Oct 13, 2007 at 12:05:42PM +0200, Marijn Schouten (hkBst) wrote:
>> [snip]
>>>> I'll try to explain how CL packages work:
>>>>
>>>> 1) a CL package installs exactly one directory under
>>>> /usr/share/common-lisp/source. This is contained in the variable
>>>> $CLPACKAGE and it defaults to $PN. Exception: app-emacs/slime installs a
>>>> package named "swank"
>>> The code shows this is not really true. I couldn't find where a non-default
>>> use was possible. You probably need to set:
>>>
>>> [[ CLPACKAGE == "" ]] && CLPACKAGE=${PN}
>> 
>> there's no need for this construct because setting CLPACKAGE in the
>> ebuild is only meant as an override of the default value
>
>I was thinking of having the variable set before inheriting the eclass, but if
>you inherit first and set later it works as you intended. Please
>comment that.

Setting the variables before inheriting is useful if you want to use
those variables as global parameters to the eclass, and the eclass does
some computations based on those values at the moment of the inheriting;
in this case I merely want to override a default set by the eclass. this
allows me to have clean&little ebuilds with minimal stuff in it,
i.e. which don't set any eclass variable and don't define src_install,
because the defaults work. all for the sake of writing little code

>>> or slime won't be able to install swank.
>>>
>>>> 2) a CL package contains one or more ASDF files(.asd). The variable
>>>> $CLSYSTEMS contains the names of those systems and defaults to $PN
>>>> because in the simplest case there is only one .asd
>>>> The .asd files usually are contained in the toplevel of the source
>>>> directory and get symlinked into /usr/share/common-lisp/systems
>>> The code shows this is not really true. Therefore you cannot set $CLPACKAGE
>>> and expect it to be used by common-lisp_src_install in its call to
>>> common-lisp-system-symlink. Other eclasses use a construct like this:
>>>
>>> [[ CLSYSTEMS == "" ]] && CLSYSTEMS=${PN}
>> 
>> same as before
>
>True. Why does common-lisp-system-symlink check for zero arguments? Is that
>functionality needed by any ebuild?

yes, most ebuilds don't need to specify explicitly the name of the .asd
to install. common-lisp.eclass already has this thing and it worked well
until now

>>>> The eclass has three explicit "public" functions:
>>>>
>>>> 1) common-lisp-install(): must receive at least one argument. It installs
>>>> files or directories(recursively) into /usr/share/common-lisp/source
>>>>
>>>> 2) common-lisp-system-symlink(): when called with no arguments, it
>>>> installs the systems contained in $CLSYSTEMS. The system names must be
>>>> relative paths. Example: CLSYSTEMS="foo1 foo2 src/bar"
>>>> When called with some arguments, it installs those systems, ignoring
>>>> $CLSYSTEMS
>>> If I understand correctly the symlinks make it appear like CLPACKAGE contains
>>> what CLSYSTEMS contains. What is the point of that or why does it need to be
>>> that way?
>> 
>> most CL packages contain precisely one .asd file, named exactly as the
>> package; for example, kmrcl-1.97 contains only the kmrcl.asd system.
>> Having CLPACKAGE=$PN and CLSYSTEMS=$PN is a good default
>
>That is not an answer. Why do we need to have two variables? Why can we not
>collapse them into one?

we always install all code provided by an upstream package in the same
subdirectory of /usr/share/common-lisp/source, even if the tarball
contains multiple ASD systems. for the ease of maintenance(or laziness
if you like) I prefer to install code maintaining the exact tree it had
in the tarball. this can be changed, of course, if we really want it
only exception: cl-sql/clsql(new)

>>>> 3) do-debian-credits(): taken from common-lisp-common.eclass, since I've
>>>> dropped the inheritance on it
>>> Which packages use this 
>> 
>> cl-aima, cl-irc, cl-sql, png, rt and split-sequence
>> 
>>> and what's the point of doing it?
>> 
>> as you know, many CL devs don't do releases(or not even versioning) so
>> mkennedy thought well of using the snapshots made by Debian developers
>> instead of making his own snapshots. It's meant as a way to credit
>> Debian for this
>
>I don't know about many. A few yes. Having Debian oblige them certainly is a
>mixed blessing.

I don't think they're obliged by Debian, rather that Debian devs,
noticing that the devs don't do releases, make snapshots on their own
and use those

> I don't think I like having code in our eclasss merely to give
>credit and not nearly enough ebuilds seem to depend on this. Are any of the
>installed files of practical use?

I don't think so, I left do-debian-credits because mkennedy added
it(probably because he thought it was a good thing) and I have nothing
against it. Being this FOSS, I prefer to add credits rather than remove them

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-15  8:45 ` Christian Faulhammer
  2007-10-15 13:14   ` Stelian Ionescu
@ 2007-10-15 22:28   ` Stelian Ionescu
  2007-10-16 11:04     ` Marijn Schouten (hkBst)
  1 sibling, 1 reply; 14+ messages in thread
From: Stelian Ionescu @ 2007-10-15 22:28 UTC (permalink / raw
  To: gentoo-lisp


[-- Attachment #1.1: Type: text/plain, Size: 375 bytes --]

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?

ok, here's the last version of the eclass; sorry for the delay

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

[-- Attachment #1.2: common-lisp-2.eclass --]
[-- Type: text/plain, Size: 2901 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Author Matthew Kennedy <mkennedy@gentoo.org>
#
# This eclass supports the installation of Common Lisp libraries

inherit eutils

CLSOURCEROOT="${ROOT}"/usr/share/common-lisp/source/
CLSYSTEMROOT="${ROOT}"/usr/share/common-lisp/systems/

CLPACKAGE="${PN}"
CLSYSTEMS="${PN}"

DEPEND="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="${1}"
    [ "${path:0:1}" == / ]
}

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}"
}

common-lisp-install() {
	if [ $# -eq 0 ]; then
		die "common-lisp-install must receive at least one argument"
	fi
    local _oldclpackage="${CLPACKAGE}"
    [ "${1}" == "-p" ] && { CLPACKAGE="${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
	done
    CLPACKAGE="${_oldclpackage}"
}

common-lisp-install-single-system() {
	if [ $# -ne 1 ]; then
		die "common-lisp-install-single-system must receive exactly one argument"
	fi
    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
        local _oldclpackage="${CLPACKAGE}"
        [ "${1}" == "-p" ] && { CLPACKAGE="${2}" ; shift ; shift ; }
        [ $# -eq 0 ] && die "common-lisp-system-symlink needs more arguments"
		for package in "$@" ; do
			common-lisp-install-single-system "${package}"
		done
        CLPACKAGE="${_oldclpackage}"
	fi
}

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
}

# Many of our Common Lisp ebuilds are either inspired by, or actually
# use packages and files from the Debian project's archives.

do-debian-credits() {
	docinto debian
	for i in copyright README.Debian changelog; do
		[ -f "${S}"/debian/${i} ] && dodoc "${S}"/debian/${i}
	done
	docinto .
}

# Local Variables: ***
# mode: shell-script ***
# tab-width: 4 ***
# End: ***

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-15 22:28   ` Stelian Ionescu
@ 2007-10-16 11:04     ` Marijn Schouten (hkBst)
  2007-10-16 11:27       ` Christian Faulhammer
  2007-10-18 14:46       ` Stelian Ionescu
  0 siblings, 2 replies; 14+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-10-16 11:04 UTC (permalink / raw
  To: Stelian Ionescu; +Cc: gentoo-lisp

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

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?
> 
> 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 <mkennedy@gentoo.org>
#
# This eclass supports the installation of Common Lisp libraries

<-- Where are the usage comments? Which are the public functions? -->

inherit eutils

CLSOURCEROOT="${ROOT}"/usr/share/common-lisp/source/
CLSYSTEMROOT="${ROOT}"/usr/share/common-lisp/systems/
<-- Before I really meant to ask about these two variables. I don't understand
what the point is as CLSOURCEROOT will contain symlinks to within
CLSYSTEMROOT. Can you explain this please. -->

<-- Where is the comment about how to override these variables? -->
CLPACKAGE="${PN}"
CLSYSTEMS="${PN}"

DEPEND="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="${1}"
    [ "${path:0:1}" == / ]
}

<-- I would prefer:
path-absolute-p() {
	[ $# -ne 1 ] &&	die "path-absolute-p must receive exactly one argument"
	[ "${1:0:1}" == / ]
}

or even

path-absolute-p() {
	assert_arg_num 1 # is bash powerful enough to define and use such a function?
	[ "${1:0:1}" == / ]

and its name should be absolute-path-p.
}

or have it return true only if all its arguments start with '/'.
- -->

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}"
}

common-lisp-install() {
	if [ $# -eq 0 ]; then
		die "common-lisp-install must receive at least one argument"
	fi
    local _oldclpackage="${CLPACKAGE}"
    [ "${1}" == "-p" ] && { CLPACKAGE="${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. -->
	done
    CLPACKAGE="${_oldclpackage}"
}

common-lisp-install-single-system() {
	if [ $# -ne 1 ]; then
		die "common-lisp-install-single-system must receive exactly one argument"
	fi
    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"
<-- this is the symlinking that I ask about in the beginning -->
}

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
}

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 -->
}

# 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. -->

do-debian-credits() {
	docinto debian
	for i in copyright README.Debian changelog; do
		[ -f "${S}"/debian/${i} ] && dodoc "${S}"/debian/${i}
	done
	docinto .
}

# Local Variables: ***
# mode: shell-script ***
# tab-width: 4 ***
# End: ***
<-- were these not redundant? -->

Most importantly: add comments.

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

iD8DBQFHFJq8p/VmCx0OL2wRAvktAJ9wUftrdekr9fmXEXcQo5RwskHQRQCcDnO2
c0XrE9cjXnwaPV3iKccuxYc=
=7ZwI
-----END PGP SIGNATURE-----
-- 
gentoo-lisp@gentoo.org mailing list



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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-16 11:04     ` Marijn Schouten (hkBst)
@ 2007-10-16 11:27       ` Christian Faulhammer
  2007-10-18 14:46       ` Stelian Ionescu
  1 sibling, 0 replies; 14+ messages in thread
From: Christian Faulhammer @ 2007-10-16 11:27 UTC (permalink / raw
  To: gentoo-lisp

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

"Marijn Schouten (hkBst)" <hkBst@gentoo.org>:

> Most importantly: add comments.

 Right, very important.  Have a look at elisp-common.eclass for a
documentation that can be converted into a man page.

V-Li

-- 
Christian Faulhammer, Gentoo Lisp project
<URL:http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode

<URL:http://www.faulhammer.org/>

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-16 11:04     ` Marijn Schouten (hkBst)
  2007-10-16 11:27       ` Christian Faulhammer
@ 2007-10-18 14:46       ` Stelian Ionescu
  2007-10-18 17:15         ` Marijn Schouten (hkBst)
  1 sibling, 1 reply; 14+ messages in thread
From: Stelian Ionescu @ 2007-10-18 14:46 UTC (permalink / raw
  To: gentoo-lisp


[-- Attachment #1.1: Type: text/plain, Size: 5252 bytes --]

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?
>> 
>> 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 <mkennedy@gentoo.org>
>#
># This eclass supports the installation of Common Lisp libraries
>
><-- Where are the usage comments? Which are the public functions? -->
>
>inherit eutils
>
>CLSOURCEROOT="${ROOT}"/usr/share/common-lisp/source/
>CLSYSTEMROOT="${ROOT}"/usr/share/common-lisp/systems/
><-- Before I really meant to ask about these two variables. I don't understand
>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="${PN}"
>CLSYSTEMS="${PN}"

ok, comments added

>
>DEPEND="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="${1}"
>    [ "${path:0:1}" == / ]
>}
>
>}
>
>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}" == / ]
>
>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="${CLPACKAGE}"
>    [ "${1}" == "-p" ] && { CLPACKAGE="${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="${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

>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

-- 
Stelian Ionescu a.k.a. fe[nl]ix
Quidquid latine dictum sit, altum videtur.

[-- Attachment #1.2: common-lisp-2.eclass --]
[-- Type: text/plain, Size: 3878 bytes --]

# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $
#
# Author Matthew Kennedy <mkennedy@gentoo.org>
#
# This eclass supports the installation of Common Lisp libraries
#
# Public functions:
#
# common-lisp-install path [<other_paths>...]
#   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 [<paths>...]
#   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
}

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

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

* Re: [gentoo-lisp] common-lisp.eclass cleanup
  2007-10-18 14:46       ` Stelian Ionescu
@ 2007-10-18 17:15         ` Marijn Schouten (hkBst)
  0 siblings, 0 replies; 14+ messages in thread
From: Marijn Schouten (hkBst) @ 2007-10-18 17:15 UTC (permalink / raw
  To: gentoo-lisp

-----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@gentoo.org mailing list



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

end of thread, other threads:[~2007-10-18 17:23 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-12 21:30 [gentoo-lisp] common-lisp.eclass cleanup Stelian Ionescu
2007-10-13 10:05 ` Marijn Schouten (hkBst)
2007-10-13 11:30   ` Stelian Ionescu
2007-10-15 10:04     ` Marijn Schouten (hkBst)
2007-10-15 13:39       ` Stelian Ionescu
2007-10-13 10:07 ` Marijn Schouten (hkBst)
2007-10-13 10:48   ` Stelian Ionescu
2007-10-15  8:45 ` Christian Faulhammer
2007-10-15 13:14   ` Stelian Ionescu
2007-10-15 22:28   ` Stelian Ionescu
2007-10-16 11:04     ` Marijn Schouten (hkBst)
2007-10-16 11:27       ` Christian Faulhammer
2007-10-18 14:46       ` Stelian Ionescu
2007-10-18 17:15         ` Marijn Schouten (hkBst)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox