-rwxr-xr-x | scripts/tothreaded | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/scripts/tothreaded b/scripts/tothreaded index 31ed31e..f916ad8 100755 --- a/scripts/tothreaded +++ b/scripts/tothreaded | |||
@@ -1,136 +1,136 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | # PURPOSE : | 3 | # PURPOSE : |
4 | # | 4 | # |
5 | # this script converts a non-threaded control file to a threaded one | 5 | # this script converts a non-threaded control file to a threaded one |
6 | # by extending appropriate names with -mt as extension | 6 | # by extending appropriate names with -mt as extension |
7 | # | 7 | # |
8 | # eg abc.control becoms abc-mt.control | 8 | # eg abc.control becoms abc-mt.control |
9 | # | 9 | # |
10 | 10 | ||
11 | # | 11 | # |
12 | # make sure that the depends expression has enough spaces | 12 | # make sure that the depends expression has enough spaces |
13 | # expression can contian : , ( ) || && | 13 | # expression can contian : , ( ) || && |
14 | # | 14 | # |
15 | tokenize() { | 15 | tokenize() { |
16 | sed "s/,/ & /g" | sed "s/)/ & /g" | sed "s/(/ & /g" | sed "s/|/ & /g" | sed "s/&/ & /g" | 16 | sed "s/,/ & /g" | sed "s/)/ & /g" | sed "s/(/ & /g" | sed "s/|/ & /g" | sed "s/&/ & /g" |
17 | } | 17 | } |
18 | 18 | ||
19 | # | 19 | # |
20 | # function converts package name to threaded equivalend IF the | 20 | # function converts package name to threaded equivalend IF the |
21 | # package file HAS a threaded version | 21 | # package file HAS a threaded version |
22 | # | 22 | # |
23 | findthreadedequiv() { | 23 | findthreadedequiv() { |
24 | local isin i | 24 | local isin i |
25 | for i in $* | 25 | for i in $* |
26 | do | 26 | do |
27 | isin=`grep "^$i\$" "$ALLTHREADEDPKGSFILE"` | 27 | isin=`grep "^$i\$" "$ALLTHREADEDPKGSFILE"` |
28 | if [ -z "$isin" ] | 28 | if [ -z "$isin" ] |
29 | then | 29 | then |
30 | # no threaded package | 30 | # no threaded package |
31 | echo -n "$i " | 31 | echo -n "$i" |
32 | else | 32 | else |
33 | # threaded package | 33 | # threaded package |
34 | echo -n "${isin}-mt " | 34 | echo -n "${isin}-mt" |
35 | fi | 35 | fi |
36 | done | 36 | done |
37 | echo | 37 | echo |
38 | } | 38 | } |
39 | 39 | ||
40 | # | 40 | # |
41 | # signature of binary files | 41 | # signature of binary files |
42 | # currently obsolete | 42 | # currently obsolete |
43 | # | 43 | # |
44 | # ISBINARY="*ELF*LSB*" | 44 | # ISBINARY="*ELF*LSB*" |
45 | 45 | ||
46 | usage() { | 46 | usage() { |
47 | echo "Usage : tothreaded <controlfile> <ALLPackages file>" | 47 | echo "Usage : tothreaded <controlfile> <ALLPackages file>" |
48 | exit 2 | 48 | exit 2 |
49 | } | 49 | } |
50 | 50 | ||
51 | . scripts/SpecialMTFiles | 51 | . scripts/SpecialMTFiles |
52 | 52 | ||
53 | # | 53 | # |
54 | # get the name of the controlfile to check for threading | 54 | # get the name of the controlfile to check for threading |
55 | # | 55 | # |
56 | if [ -z "$1" ] | 56 | if [ -z "$1" ] |
57 | then | 57 | then |
58 | usage | 58 | usage |
59 | fi | 59 | fi |
60 | controlfile=$1 | 60 | controlfile=$1 |
61 | shift | 61 | shift |
62 | 62 | ||
63 | case $controlfile in | 63 | case $controlfile in |
64 | *-mt.control) | 64 | *-mt.control) |
65 | #already threaded | 65 | #already threaded |
66 | echo $controlfile | 66 | echo $controlfile |
67 | exit 0; | 67 | exit 0; |
68 | ;; | 68 | ;; |
69 | esac | 69 | esac |
70 | 70 | ||
71 | # | 71 | # |
72 | # file containing list of all known threaded packages | 72 | # file containing list of all known threaded packages |
73 | # | 73 | # |
74 | if [ -z "$1" ] | 74 | if [ -z "$1" ] |
75 | then | 75 | then |
76 | usage | 76 | usage |
77 | fi | 77 | fi |
78 | ALLTHREADEDPKGSFILE=$1 | 78 | ALLTHREADEDPKGSFILE=$1 |
79 | shift | 79 | shift |
80 | 80 | ||
81 | # | 81 | # |
82 | # strip out the name of the package | 82 | # strip out the name of the package |
83 | # | 83 | # |
84 | packagename=${controlfile##*/} # path | 84 | packagename=${controlfile##*/} # path |
85 | packagename=${packagename%.control} # extension | 85 | packagename=${packagename%.control} # extension |
86 | 86 | ||
87 | # | 87 | # |
88 | # generate new control file | 88 | # generate new control file |
89 | # | 89 | # |
90 | newcontrolfile=${controlfile/\.control/-mt\.control} | 90 | newcontrolfile=${controlfile/\.control/-mt\.control} |
91 | 91 | ||
92 | # | 92 | # |
93 | # read all lines in original control file | 93 | # read all lines in original control file |
94 | # | 94 | # |
95 | while read line | 95 | while read line |
96 | do | 96 | do |
97 | case $line in | 97 | case $line in |
98 | # convert some files to threaded equivalent | 98 | # convert some files to threaded equivalent |
99 | "Files:"*) | 99 | "Files:"*) |
100 | files=${line#Files:} | 100 | files=${line#Files:} |
101 | # thread-converted files | 101 | # thread-converted files |
102 | T_files=`ConvertSpecialFiles "$files"` | 102 | T_files=`ConvertSpecialFiles "$files"` |
103 | echo "Files: $T_files" | 103 | echo "Files: $T_files" |
104 | ;; | 104 | ;; |
105 | "Package: "*) | 105 | "Package: "*) |
106 | T_package=`findthreadedequiv ${line#Package: }` | 106 | T_package=`findthreadedequiv ${line#Package: }` |
107 | echo "Package: ${T_package}" | 107 | echo "Package: ${T_package}" |
108 | ;; | 108 | ;; |
109 | "Depends: "*) | 109 | "Depends: "*) |
110 | depends=`echo "${line#Depends: }" | tokenize` | 110 | depends=`echo "${line#Depends: }" | tokenize` |
111 | T_depends=`findthreadedequiv ${depends}` | 111 | T_depends=`findthreadedequiv ${depends}` |
112 | echo "Depends: $T_depends" | 112 | echo "Depends: $T_depends" |
113 | ;; | 113 | ;; |
114 | "Provides: "*) | 114 | "Provides: "*) |
115 | T_provides=`findthreadedequiv ${line#Provides: }` | 115 | T_provides=`findthreadedequiv ${line#Provides: }` |
116 | echo "Provides: $T_provides" | 116 | echo "Provides: $T_provides" |
117 | ;; | 117 | ;; |
118 | "Recommends: "*) | 118 | "Recommends: "*) |
119 | T_recommends=`findthreadedequiv ${line#Recommends: }` | 119 | T_recommends=`findthreadedequiv ${line#Recommends: }` |
120 | echo "Recommends: $T_recommends" | 120 | echo "Recommends: $T_recommends" |
121 | ;; | 121 | ;; |
122 | "Conflicts: "*) | 122 | "Conflicts: "*) |
123 | conflicts=`echo "${line#Conflicts: }" | tokenize` | 123 | conflicts=`echo "${line#Conflicts: }" | tokenize` |
124 | T_conflicts=`findthreadedequiv ${conflicts}` | 124 | T_conflicts=`findthreadedequiv ${conflicts}` |
125 | echo "Conflicts: $T_conflicts" | 125 | echo "Conflicts: $T_conflicts" |
126 | ;; | 126 | ;; |
127 | *":"*) | 127 | *":"*) |
128 | echo "$line" | 128 | echo "$line" |
129 | ;; | 129 | ;; |
130 | *) # al other lines | 130 | *) # al other lines |
131 | echo " $line" | 131 | echo " $line" |
132 | ;; | 132 | ;; |
133 | esac | 133 | esac |
134 | done < $controlfile > $newcontrolfile | 134 | done < $controlfile > $newcontrolfile |
135 | 135 | ||
136 | echo $newcontrolfile | 136 | echo $newcontrolfile |