1 |
On Fri, 2004-09-03 at 08:10, Nicholas Jones wrote: |
2 |
|
3 |
> functions.sh (from baselayout) dependence needs to go away. |
4 |
> All used functions need to be logged/rewritten to not use those |
5 |
> functions, and instead maintain its own. |
6 |
|
7 |
I propose overriding einfo/... after sourcing functions.sh in ebuild.sh. |
8 |
|
9 |
> All said functions must be rewritten, for portage, with the |
10 |
> capability to handle colors and terminals and the like as |
11 |
> portage does currently. (People don't want ANSI in their logs.) |
12 |
|
13 |
Logfiles are handled seperately while screen output uses ANSI. |
14 |
If portage could relay the color decision onwards to bash, it would |
15 |
take only a small change to enforce that. |
16 |
|
17 |
> ${T}/notices.${PF}.${TYPE} |
18 |
|
19 |
I'd rather use a single file - notices.${PF} as the code shows: |
20 |
(should be inserted in ebuild.sh after functions.sh is sourced) |
21 |
|
22 |
### Code start ### |
23 |
|
24 |
einfo() { |
25 |
enotice info "${*}" |
26 |
} |
27 |
|
28 |
ewarn() { |
29 |
enotice warn "${*}" |
30 |
} |
31 |
|
32 |
eerror() |
33 |
{ |
34 |
enotice error "${*}" |
35 |
} |
36 |
|
37 |
enotice() |
38 |
{ |
39 |
local color |
40 |
local type |
41 |
|
42 |
type="${1}" |
43 |
|
44 |
case "${type}" in |
45 |
"info") |
46 |
color="${GOOD}" |
47 |
;; |
48 |
"warn") |
49 |
color="${WARN}" |
50 |
;; |
51 |
"error") |
52 |
color="${BAD}" |
53 |
;; |
54 |
esac |
55 |
|
56 |
shift |
57 |
|
58 |
echo "[${type}] ${*}" >> ${T}/notices.${PF} |
59 |
echo " ${color}*${NORMAL} ${*}" |
60 |
|
61 |
} |
62 |
|
63 |
### Code End ### |
64 |
|
65 |
You can also merge the notice file into the package inself: |
66 |
(inside dyn_install, just after calling src_install) |
67 |
|
68 |
#enotice |
69 |
if [ -n ${PORT_ENOTICE_DIR} && -r ${T}/notices.${PF} ] |
70 |
then |
71 |
install -d ${D}${PORT_ENOTICE_DIR} |
72 |
cp ${T}/notices.${PF} ${D}${PORT_ENOTICE_DIR} |
73 |
fi |
74 |
|
75 |
or any other way you think is best. |
76 |
|
77 |
If this is acceptable, I can write a matching notice reader. |
78 |
-- |
79 |
|
80 |
Eldad Zack <eldad@g.o> |
81 |
Key/Fingerprint at pgp.mit.edu, ID 0x96EA0A93 |