Gentoo Archives: gentoo-lisp

From: Stelian Ionescu <sionescu@×××××××××××.net>
To: gentoo-lisp@l.g.o
Subject: Re: [gentoo-lisp] common-lisp.eclass cleanup
Date: Thu, 18 Oct 2007 14:56:43
Message-Id: 20071018144607.GB1097429@universe.org
In Reply to: Re: [gentoo-lisp] common-lisp.eclass cleanup by "Marijn Schouten (hkBst)"
1 On Tue, Oct 16, 2007 at 01:04:28PM +0200, Marijn Schouten (hkBst) wrote:
2 >Stelian Ionescu wrote:
3 >> On Mon, Oct 15, 2007 at 10:45:32AM +0200, Christian Faulhammer wrote:
4 >> [snip]
5 >>> Just a cosmetic...stay with one system. The local variables for Emacs
6 >>> are unncessary, or do you have problems with app-emacs/gentoo-syntax?
7 >>
8 >> ok, here's the last version of the eclass; sorry for the delay
9 >
10 >Comments by me within <-- these are my comments -->
11 >
12 ># Copyright 1999-2007 Gentoo Foundation
13 ># Distributed under the terms of the GNU General Public License v2
14 ># $Header: $
15 >#
16 ># Author Matthew Kennedy <mkennedy@g.o>
17 >#
18 ># This eclass supports the installation of Common Lisp libraries
19 >
20 ><-- Where are the usage comments? Which are the public functions? -->
21 >
22 >inherit eutils
23 >
24 >CLSOURCEROOT="${ROOT}"/usr/share/common-lisp/source/
25 >CLSYSTEMROOT="${ROOT}"/usr/share/common-lisp/systems/
26 ><-- Before I really meant to ask about these two variables. I don't understand
27 >what the point is as CLSOURCEROOT will contain symlinks to within
28 >CLSYSTEMROOT. Can you explain this please. -->
29
30 it's the contrary: CLSOURCEROOT contains the source code, and
31 CLSYSTEMROOT contains symlinks to within CLSOURCEROOT. the reason is
32 that this is the way that ASDF works: it expects to find the .asd files
33 in a list of predefined directories(in fact the variable is called
34 asdf:*central-registry*), that's why we symlink .asd files into
35 CLSYSTEMROOT and configure ASDF to look only there.
36
37 there are workarounds for this, but they all imply either writing custom
38 code which would be used only in gentoo, or maintaining some sort of
39 site-gentoo.cl(much like for emacs) - but I'm strongly against either
40 solutions since I think that doing what all other distros are doing is
41 good policy because, for example, it allows users coming from other
42 distros to be able to use their extant setup unchanged, not being forced
43 to learn a new way to configure packaging
44
45
46 ><-- Where is the comment about how to override these variables? -->
47 >CLPACKAGE="${PN}"
48 >CLSYSTEMS="${PN}"
49
50 ok, comments added
51
52 >
53 >DEPEND="virtual/commonlisp"
54 >
55 >EXPORT_FUNCTIONS src_install
56 >
57 >path-absolute-p() {
58 > if [ $# -ne 1 ]; then
59 > die "path-absolute-p must receive exactly one argument"
60 > fi
61 > local path="${1}"
62 > [ "${path:0:1}" == / ]
63 >}
64 >
65 >}
66 >
67 >or even
68 >
69 >path-absolute-p() {
70 > assert_arg_num 1 # is bash powerful enough to define and use such a
71 > function?
72
73 AFAIK, no
74
75 > [ "${1:0:1}" == / ]
76 >
77 >and its name should be absolute-path-p.
78
79 done
80
81 >}
82 >
83 >or have it return true only if all its arguments start with '/'.
84 >-->
85
86 done
87
88 >common-lisp-install() {
89 > if [ $# -eq 0 ]; then
90 > die "common-lisp-install must receive at least one argument"
91 > fi
92 > local _oldclpackage="${CLPACKAGE}"
93 > [ "${1}" == "-p" ] && { CLPACKAGE="${2}" ; shift ; shift ; }
94 > for thing in "$@"; do
95 > if path-absolute-p "${thing}" ; then
96 > common-lisp-install-relatively "${thing}"
97 > else
98 > common-lisp-install-relatively "${thing}" "$(dirname "${thing}")"
99 > fi <-- indentation is screwed up here (and a lot of other places)
100 >because of a combination of spaces and tabs. -->
101
102 fixed
103
104 >common-lisp-system-symlink() {
105 > dodir "${CLSYSTEMROOT}"
106 > # if no arguments received, default to
107 > # the contents of ${CLSYSTEMS}
108 > if [ $# -eq 0 ]; then
109 > for package in ${CLSYSTEMS} ; do
110 > common-lisp-install-single-system "${package}"
111 > done
112 > else
113 > local _oldclpackage="${CLPACKAGE}"
114 > [ "${1}" == "-p" ] && { CLPACKAGE="${2}" ; shift ; shift ; }
115 ><-- what's the point of setting CLPACKAGE here? I'm not sure I like
116 >influencing common-lisp-install-single-system in that way. -->
117 > [ $# -eq 0 ] && die "common-lisp-system-symlink needs more arguments"
118 > for package in "$@" ; do
119 > common-lisp-install-single-system "${package}"
120 > done
121 > CLPACKAGE="${_oldclpackage}"
122 > fi
123 >}
124
125 setting CLPACKAGE that way is the equivalent of this:
126
127 (defun common-lisp-system-symlink (system &key (package *clpackage*))
128 (let ((*clpackage* package)) ...))
129
130 I'm faking default arguments: when $1 is "-p" CLPACKAGE gets set
131 temporarily to $2, then restored to its initial value. I've seen this
132 idiom elsewhere in sh code
133 anyway, I've removed this since it's unnecessary
134
135 >common-lisp-2_src_install() {
136 > common-lisp-install *.{lisp,asd}
137 > common-lisp-system-symlink
138 > dodoc LICENCE* LICENSE* COPYING* COPYRIGHT README HEADER TODO \
139 > CHANGELOG ChangeLog BUGS CONTRIBUTORS *NEWS 2> /dev/null
140 ><-- licenses should not be installed separately, /usr/portage/licenses/
141 >contains them already -->
142
143 done
144
145 >}
146 >
147 ># Many of our Common Lisp ebuilds are either inspired by, or actually
148 ># use packages and files from the Debian project's archives.
149 >
150 ><-- please remove this stuff. It is misleading and non-functional. -->
151
152 done
153
154 ># Local Variables: ***
155 ># mode: shell-script ***
156 ># tab-width: 4 ***
157 ># End: ***
158 ><-- were these not redundant? -->
159
160 I don't know if they were added for emacs or for vim. anyway, I've
161 removed them
162
163 --
164 Stelian Ionescu a.k.a. fe[nl]ix
165 Quidquid latine dictum sit, altum videtur.

Attachments

File name MIME type
common-lisp-2.eclass text/plain

Replies

Subject Author
Re: [gentoo-lisp] common-lisp.eclass cleanup "Marijn Schouten (hkBst)" <hkBst@g.o>