Gentoo Archives: gentoo-lisp

From: "Marijn Schouten (hkBst)" <hkBst@g.o>
To: Stelian Ionescu <sionescu@×××××××××××.net>
Cc: gentoo-lisp@l.g.o
Subject: Re: [gentoo-lisp] common-lisp.eclass cleanup
Date: Tue, 16 Oct 2007 11:12:10
Message-Id: 47149ABC.1000408@gentoo.org
In Reply to: Re: [gentoo-lisp] common-lisp.eclass cleanup by Stelian Ionescu
1 -----BEGIN PGP SIGNED MESSAGE-----
2 Hash: SHA1
3
4 Stelian Ionescu wrote:
5 > On Mon, Oct 15, 2007 at 10:45:32AM +0200, Christian Faulhammer wrote:
6 > [snip]
7 >> Just a cosmetic...stay with one system. The local variables for Emacs
8 >> are unncessary, or do you have problems with app-emacs/gentoo-syntax?
9 >
10 > ok, here's the last version of the eclass; sorry for the delay
11
12 Comments by me within <-- these are my comments -->
13
14 # Copyright 1999-2007 Gentoo Foundation
15 # Distributed under the terms of the GNU General Public License v2
16 # $Header: $
17 #
18 # Author Matthew Kennedy <mkennedy@g.o>
19 #
20 # This eclass supports the installation of Common Lisp libraries
21
22 <-- Where are the usage comments? Which are the public functions? -->
23
24 inherit eutils
25
26 CLSOURCEROOT="${ROOT}"/usr/share/common-lisp/source/
27 CLSYSTEMROOT="${ROOT}"/usr/share/common-lisp/systems/
28 <-- Before I really meant to ask about these two variables. I don't understand
29 what the point is as CLSOURCEROOT will contain symlinks to within
30 CLSYSTEMROOT. Can you explain this please. -->
31
32 <-- Where is the comment about how to override these variables? -->
33 CLPACKAGE="${PN}"
34 CLSYSTEMS="${PN}"
35
36 DEPEND="virtual/commonlisp"
37
38 EXPORT_FUNCTIONS src_install
39
40 path-absolute-p() {
41 if [ $# -ne 1 ]; then
42 die "path-absolute-p must receive exactly one argument"
43 fi
44 local path="${1}"
45 [ "${path:0:1}" == / ]
46 }
47
48 <-- I would prefer:
49 path-absolute-p() {
50 [ $# -ne 1 ] && die "path-absolute-p must receive exactly one argument"
51 [ "${1:0:1}" == / ]
52 }
53
54 or even
55
56 path-absolute-p() {
57 assert_arg_num 1 # is bash powerful enough to define and use such a function?
58 [ "${1:0:1}" == / ]
59
60 and its name should be absolute-path-p.
61 }
62
63 or have it return true only if all its arguments start with '/'.
64 - -->
65
66 common-lisp-install-relatively() {
67 if [ $# -lt 1 ] || [ $# -gt 2 ] ; then
68 die "common-lisp-install-relatively must receive one or two arguments"
69 fi
70 local thing="${1}" ; local dir="${2}"
71 insinto "${CLSOURCEROOT}/${CLPACKAGE}/${dir}"
72 doins -r "${thing}"
73 }
74
75 common-lisp-install() {
76 if [ $# -eq 0 ]; then
77 die "common-lisp-install must receive at least one argument"
78 fi
79 local _oldclpackage="${CLPACKAGE}"
80 [ "${1}" == "-p" ] && { CLPACKAGE="${2}" ; shift ; shift ; }
81 for thing in "$@"; do
82 if path-absolute-p "${thing}" ; then
83 common-lisp-install-relatively "${thing}"
84 else
85 common-lisp-install-relatively "${thing}" "$(dirname "${thing}")"
86 fi <-- indentation is screwed up here (and a lot of other places)
87 because of a combination of spaces and tabs. -->
88 done
89 CLPACKAGE="${_oldclpackage}"
90 }
91
92 common-lisp-install-single-system() {
93 if [ $# -ne 1 ]; then
94 die "common-lisp-install-single-system must receive exactly one argument"
95 fi
96 if [ ! -f "${D}/${CLSOURCEROOT}/${CLPACKAGE}/${1}.asd" ]; then
97 die "${D}/${CLSOURCEROOT}/${CLPACKAGE}/${1}.asd does not exist"
98 fi
99 dosym "${CLSOURCEROOT}/${CLPACKAGE}/${1}.asd" \
100 "${CLSYSTEMROOT}/$(basename ${1}).asd"
101 <-- this is the symlinking that I ask about in the beginning -->
102 }
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 common-lisp-2_src_install() {
126 common-lisp-install *.{lisp,asd}
127 common-lisp-system-symlink
128 dodoc LICENCE* LICENSE* COPYING* COPYRIGHT README HEADER TODO \
129 CHANGELOG ChangeLog BUGS CONTRIBUTORS *NEWS 2> /dev/null
130 <-- licenses should not be installed separately, /usr/portage/licenses/
131 contains them already -->
132 }
133
134 # Many of our Common Lisp ebuilds are either inspired by, or actually
135 # use packages and files from the Debian project's archives.
136
137 <-- please remove this stuff. It is misleading and non-functional. -->
138
139 do-debian-credits() {
140 docinto debian
141 for i in copyright README.Debian changelog; do
142 [ -f "${S}"/debian/${i} ] && dodoc "${S}"/debian/${i}
143 done
144 docinto .
145 }
146
147 # Local Variables: ***
148 # mode: shell-script ***
149 # tab-width: 4 ***
150 # End: ***
151 <-- were these not redundant? -->
152
153 Most importantly: add comments.
154
155 Marijn
156
157 - --
158 Marijn Schouten (hkBst), Gentoo Lisp project
159 <http://www.gentoo.org/proj/en/lisp/>, #gentoo-lisp on FreeNode
160 -----BEGIN PGP SIGNATURE-----
161 Version: GnuPG v2.0.7 (GNU/Linux)
162 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
163
164 iD8DBQFHFJq8p/VmCx0OL2wRAvktAJ9wUftrdekr9fmXEXcQo5RwskHQRQCcDnO2
165 c0XrE9cjXnwaPV3iKccuxYc=
166 =7ZwI
167 -----END PGP SIGNATURE-----
168 --
169 gentoo-lisp@g.o mailing list

Replies

Subject Author
Re: [gentoo-lisp] common-lisp.eclass cleanup Christian Faulhammer <opfer@g.o>
Re: [gentoo-lisp] common-lisp.eclass cleanup Stelian Ionescu <sionescu@×××××××××××.net>