author | wimpie <wimpie> | 2004-04-02 16:49:47 (UTC) |
---|---|---|
committer | wimpie <wimpie> | 2004-04-02 16:49:47 (UTC) |
commit | 9e26c10c0dc97a0956d019166caf712955094764 (patch) (unidiff) | |
tree | 9bf4f33bd02185780070e178d25e24bdff4d6cd2 /scripts/ipkg-build | |
parent | 2f2d702e37cc391dd547eaa7e2432d86285e546d (diff) | |
download | opie-9e26c10c0dc97a0956d019166caf712955094764.zip opie-9e26c10c0dc97a0956d019166caf712955094764.tar.gz opie-9e26c10c0dc97a0956d019166caf712955094764.tar.bz2 |
ipkg-build mkipkg : speedup (avoid grepping over controlfile by loading into array)
SpeciapMTFiles tothreaded : convert control files to -mt.control
-rwxr-xr-x | scripts/ipkg-build | 63 |
1 files changed, 52 insertions, 11 deletions
diff --git a/scripts/ipkg-build b/scripts/ipkg-build index c6af056..b661bbf 100755 --- a/scripts/ipkg-build +++ b/scripts/ipkg-build | |||
@@ -7,4 +7,15 @@ set -e | |||
7 | 7 | ||
8 | ipkg_extract_value() { | 8 | #declare array for values and fields found in control file |
9 | sed -e "s/^[^:]*:[[:space:]]*//" | 9 | declare -a AllValues AllFields |
10 | |||
11 | collect_values() { | ||
12 | local i line | ||
13 | |||
14 | i=0 | ||
15 | while read line | ||
16 | do | ||
17 | AllFields[$i]=${line%%:*} | ||
18 | AllValues[$i]=`echo ${line#*:}` # echo to remove spaces | ||
19 | let i=i+1 | ||
20 | done < ${pkg_dir}/${CONTROL}/control | ||
10 | } | 21 | } |
@@ -12,13 +23,37 @@ ipkg_extract_value() { | |||
12 | required_field() { | 23 | required_field() { |
13 | field=$1 | 24 | local field i |
14 | 25 | field=$1 | |
15 | value=`grep "^$field:" < $CONTROL/control | ipkg_extract_value` | 26 | |
16 | if [ -z "$value" ]; then | 27 | i=0 |
17 | echo "*** Error: $CONTROL/control is missing field $field" >&2 | 28 | for af in "${AllFields[@]}" |
18 | return 1 | 29 | do |
19 | fi | 30 | if [ "$field" = "$af" ] |
20 | echo $value | 31 | then |
21 | return 0 | 32 | # return value |
33 | echo "${AllValues[$i]}" | ||
34 | return 0; | ||
35 | fi | ||
36 | let i=i+1 | ||
37 | done | ||
38 | # not found | ||
39 | echo "*** Error: $CONTROL/control is missing field $field" >&2 | ||
40 | return 1 | ||
22 | } | 41 | } |
23 | 42 | ||
43 | #ipkg_extract_value() { | ||
44 | #sed -e "s/^[^:]*:[[:space:]]*//" | ||
45 | #} | ||
46 | # | ||
47 | #required_field() { | ||
48 | #field=$1 | ||
49 | # | ||
50 | #value=`grep "^$field:" < $CONTROL/control | ipkg_extract_value` | ||
51 | #if [ -z "$value" ]; then | ||
52 | # echo "*** Error: $CONTROL/control is missing field $field" >&2 | ||
53 | # return 1 | ||
54 | #fi | ||
55 | #echo $value | ||
56 | #return 0 | ||
57 | #} | ||
58 | |||
24 | pkg_appears_sane() { | 59 | pkg_appears_sane() { |
@@ -139,2 +174,5 @@ done | |||
139 | 174 | ||
175 | # maks sure that tar produces headers compatible with busybox format | ||
176 | # debian needs this | ||
177 | ogargs="$ogargs --format=oldgnu" | ||
140 | 178 | ||
@@ -173,2 +211,5 @@ fi | |||
173 | 211 | ||
212 | # load values | ||
213 | collect_values | ||
214 | |||
174 | if ! pkg_appears_sane $pkg_dir; then | 215 | if ! pkg_appears_sane $pkg_dir; then |