Gentoo Archives: gentoo-commits

From: "Mike Frysinger (vapier)" <vapier@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in sys-apps/openrc/files/9999: 0002-useful-functions.patch 0001-msg-style.patch 0003-KV.patch
Date: Sun, 30 Mar 2008 17:42:15
Message-Id: E1Jg1Xo-0006jY-9O@stork.gentoo.org
1 vapier 08/03/30 17:42:12
2
3 Added: 0002-useful-functions.patch 0001-msg-style.patch
4 0003-KV.patch
5 Log:
6 Move patches here so we get them in releases.
7 (Portage version: 2.2_pre5)
8
9 Revision Changes Path
10 1.1 sys-apps/openrc/files/9999/0002-useful-functions.patch
11
12 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/9999/0002-useful-functions.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/9999/0002-useful-functions.patch?rev=1.1&content-type=text/plain
14
15 Index: 0002-useful-functions.patch
16 ===================================================================
17 From c5552432d21e964ea1dbda7415040259b87ea77e Mon Sep 17 00:00:00 2001
18 From: Mike Frysinger <vapier@g.o>
19 Date: Mon, 24 Mar 2008 02:03:39 -0400
20 Subject: [PATCH] add a softlevel() function to the API so people dont have to worry about inner details and move get_bootparam back to the exported function.sh api
21
22 ---
23 sh/functions.sh.in | 27 +++++++++++++++++++++++++++
24 sh/rc-functions.sh.in | 22 ----------------------
25 2 files changed, 27 insertions(+), 22 deletions(-)
26
27 diff --git a/sh/functions.sh.in b/sh/functions.sh.in
28 index 1a1fbba..140f6dc 100644
29 --- a/sh/functions.sh.in
30 +++ b/sh/functions.sh.in
31 @@ -38,6 +38,33 @@ yesno()
32 esac
33 }
34
35 +softlevel()
36 +{
37 + echo $(rc-status --runlevel)
38 +}
39 +
40 +get_bootparam()
41 +{
42 + local match="$1"
43 + [ -z "${match}" -o ! -r /proc/cmdline ] && return 1
44 +
45 + set -- $(cat /proc/cmdline)
46 + while [ -n "$1" ]; do
47 + case "$1" in
48 + gentoo=*)
49 + local params="${1##*=}"
50 + local IFS=, x=
51 + for x in ${params}; do
52 + [ "${x}" = "${match}" ] && return 0
53 + done
54 + ;;
55 + esac
56 + shift
57 + done
58 +
59 + return 1
60 +}
61 +
62 _sanitize_path()
63 {
64 local IFS=":" p= path=
65 diff --git a/sh/rc-functions.sh.in b/sh/rc-functions.sh.in
66 index 74db71e..eb45e49 100644
67 --- a/sh/rc-functions.sh.in
68 +++ b/sh/rc-functions.sh.in
69 @@ -51,28 +51,6 @@ is_union_fs()
70 unionctl "$1" --list >/dev/null 2>&1
71 }
72
73 -get_bootparam()
74 -{
75 - local match="$1"
76 - [ -z "${match}" -o ! -r /proc/cmdline ] && return 1
77 -
78 - set -- $(cat /proc/cmdline)
79 - while [ -n "$1" ]; do
80 - case "$1" in
81 - gentoo=*)
82 - local params="${1##*=}"
83 - local IFS=, x=
84 - for x in ${params}; do
85 - [ "${x}" = "${match}" ] && return 0
86 - done
87 - ;;
88 - esac
89 - shift
90 - done
91 -
92 - return 1
93 -}
94 -
95 # Add our sbin to $PATH
96 case "${PATH}" in
97 @PREFIX@/lib/rc/sbin|@PREFIX@/lib/rc/sbin:*);;
98 --
99 1.5.4.4
100
101
102
103
104 1.1 sys-apps/openrc/files/9999/0001-msg-style.patch
105
106 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/9999/0001-msg-style.patch?rev=1.1&view=markup
107 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/9999/0001-msg-style.patch?rev=1.1&content-type=text/plain
108
109 Index: 0001-msg-style.patch
110 ===================================================================
111 From 1eddb56f11b41c4bf4f878c995c5d140b1f9d44d Mon Sep 17 00:00:00 2001
112 From: Mike Frysinger <vapier@g.o>
113 Date: Mon, 24 Mar 2008 01:48:19 -0400
114 Subject: [PATCH] This reverts commit 0e2f160c95b15e95f3885e3f5a3670ec5ae0a709. 2 spaces in 80 cols has never made any sort of realistic difference and we're not going to change this behavior in Gentoo.
115
116 ---
117 src/libeinfo/libeinfo.c | 9 +++------
118 1 files changed, 3 insertions(+), 6 deletions(-)
119
120 diff --git a/src/libeinfo/libeinfo.c b/src/libeinfo/libeinfo.c
121 index f8ddcb5..c46cacb 100644
122 --- a/src/libeinfo/libeinfo.c
123 +++ b/src/libeinfo/libeinfo.c
124 @@ -787,7 +787,7 @@ static void _eend(FILE * __EINFO_RESTRICT fp, int col, ECOLOR color,
125 if (! msg)
126 return;
127
128 - cols = get_term_columns(fp) - (strlen(msg) + 3);
129 + cols = get_term_columns(fp) - (strlen(msg) + 5);
130
131 /* cons25 is special - we need to remove one char, otherwise things
132 * do not align properly at all. */
133 @@ -801,18 +801,15 @@ static void _eend(FILE * __EINFO_RESTRICT fp, int col, ECOLOR color,
134 if (term_is_cons25)
135 cols--;
136
137 - /* If extra spacing is required around msg, then please change
138 - * via a runtime knob and leave this default as is as it saves 2
139 - * valuable columns when running on 80 column screens. */
140 if (cols > 0 && colour_terminal(fp)) {
141 - fprintf(fp, "%s%s %s[%s%s%s]%s\n", up, tgoto(goto_column, 0, cols),
142 + fprintf(fp, "%s%s %s[%s %s %s]%s\n", up, tgoto(goto_column, 0, cols),
143 ecolor(ECOLOR_BRACKET), ecolor(color), msg,
144 ecolor(ECOLOR_BRACKET), ecolor(ECOLOR_NORMAL));
145 } else {
146 if (col > 0)
147 for (i = 0; i < cols - col; i++)
148 fprintf(fp, " ");
149 - fprintf(fp, " [%s]\n", msg);
150 + fprintf(fp, " [ %s ]\n", msg);
151 }
152 }
153
154 --
155 1.5.4.4
156
157
158
159
160 1.1 sys-apps/openrc/files/9999/0003-KV.patch
161
162 file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/9999/0003-KV.patch?rev=1.1&view=markup
163 plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/sys-apps/openrc/files/9999/0003-KV.patch?rev=1.1&content-type=text/plain
164
165 Index: 0003-KV.patch
166 ===================================================================
167 From dac703b26c71cd8479b71d101c4e1ddb8eadc194 Mon Sep 17 00:00:00 2001
168 From: Mike Frysinger <vapier@g.o>
169 Date: Mon, 24 Mar 2008 03:14:02 -0400
170 Subject: [PATCH] add back KV_* funcs
171
172 ---
173 sh/functions.sh.in | 35 +++++++++++++++++++++++++++++++++++
174 sh/runtests.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
175 2 files changed, 80 insertions(+), 0 deletions(-)
176
177 diff --git a/sh/functions.sh.in b/sh/functions.sh.in
178 index 140f6dc..0522792 100644
179 --- a/sh/functions.sh.in
180 +++ b/sh/functions.sh.in
181 @@ -65,6 +65,41 @@ get_bootparam()
182 return 1
183 }
184
185 +KV_major() {
186 + [ -z "$*" ] && return 1
187 + local KV="$*"
188 + echo ${KV%%.*}
189 +}
190 +
191 +KV_minor() {
192 + [ -z "$*" ] && return 1
193 + local KV="$*"
194 + KV=${KV#*.}
195 + echo ${KV%%.*}
196 +}
197 +
198 +KV_micro() {
199 + [ -z "$*" ] && return 1
200 + local KV="$*"
201 + KV=${KV#*.*.}
202 + echo ${KV%%[![:digit:]]*}
203 +}
204 +
205 +KV_to_int() {
206 + [ -z "$*" ] && return 1
207 + local KV_MAJOR="$(KV_major "$*")"
208 + local KV_MINOR="$(KV_minor "$*")"
209 + local KV_MICRO="$(KV_micro "$*")"
210 + local KV_int="$(( KV_MAJOR * 65536 + KV_MINOR * 256 + KV_MICRO ))"
211 + echo "${KV_int}"
212 +}
213 +
214 +_RC_GET_KV_CACHE=""
215 +get_KV() {
216 + [ -z ${_RC_GET_KV_CACHE} ] && _RC_GET_KV_CACHE=$(uname -r)
217 + echo $(KV_to_int "${_RC_GET_KV_CACHE}")
218 +}
219 +
220 _sanitize_path()
221 {
222 local IFS=":" p= path=
223 diff --git a/sh/runtests.sh b/sh/runtests.sh
224 index d0d6a17..debcf4f 100755
225 --- a/sh/runtests.sh
226 +++ b/sh/runtests.sh
227 @@ -3,6 +3,19 @@
228 top_srcdir=${top_srcdir:-..}
229 . ${top_srcdir}/test/setup_env.sh
230
231 +checkit() {
232 + local output=$($1 $3)
233 + local lret=$?
234 + if [ ${lret} -ne 0 ] ; then
235 + ((tret+=lret))
236 + echo "FAIL: exec: $*"
237 + fi
238 + if [ "${output}" != "$2" ] ; then
239 + ((tret+=lret))
240 + echo "FAIL: output: $* : got='${output}' wanted='$2'"
241 + fi
242 +}
243 +
244 ret=0
245
246 tret=0
247 @@ -22,4 +35,36 @@ done
248 eend ${tret}
249 ((ret+=tret))
250
251 +compare_int() {
252 + local got=$(KV_to_int $1)
253 + local exp=$(KV_to_int $3)
254 + if ! [ ${got} $2 ${exp} ] ; then
255 + ((tret+=1))
256 + echo "FAIL: KV_to_int '${v}'(${got}) $2 '1.2.2'(${exp})"
257 + fi
258 +}
259 +
260 +tret=0
261 +ebegin "Testing KV_{major,minor,micro,to_int}"
262 +for v in \
263 + 1.2.3 1.2.3-rc0 1.2.3_rc0 "1.2.3 rc0" \
264 + 1.2.3.4 1.2.3.4-rc0 1.2.3.4_rc0 "1.2.3.4 rc0"
265 +do
266 + checkit KV_major 1 ${v}
267 + checkit KV_minor 2 ${v}
268 + checkit KV_micro 3 ${v}
269 +
270 + compare_int 1.2.2 -lt ${v}
271 + compare_int 1.2.2.10 -lt ${v}
272 + compare_int 1.2.4 -gt ${v}
273 + compare_int 1.2.4-rc0 -gt ${v}
274 + compare_int 1.2.3 -eq ${v}
275 + compare_int 1.2.3-rc0 -eq ${v}
276 + compare_int 1.2.3.2 -eq ${v}
277 + compare_int 1.2.3.3 -eq ${v}
278 + compare_int 1.2.3.4 -eq ${v}
279 +done
280 +eend ${tret}
281 +((ret+=tret))
282 +
283 exit ${ret}
284 --
285 1.5.4.4
286
287
288
289
290 --
291 gentoo-commits@l.g.o mailing list