rev |
line source |
pankso@7
|
1 #!/bin/sh
|
pankso@7
|
2 # Tazwok - SliTaz source compiler and binary packages generator/cooker.
|
pankso@7
|
3 #
|
MikeDSmith25@82
|
4 # Tazwok can compile source packages and create binary packages suitable for
|
MikeDSmith25@82
|
5 # Tazpkg (Tiny Autonomous zone package manager). You can build individual
|
MikeDSmith25@82
|
6 # packages or a list of packages with one command, rebuild the full distro,
|
pankso@7
|
7 # generate a packages repository and also list and get info about packages.
|
pankso@7
|
8 #
|
pankso@106
|
9 # (C) 2007-2009 SliTaz - GNU General Public License.
|
pankso@7
|
10 #
|
pankso@7
|
11
|
gokhlayeh@396
|
12 VERSION=4.3
|
gokhlayeh@186
|
13 . /usr/lib/slitaz/libtaz
|
gokhlayeh@186
|
14 source_lib commons
|
pankso@7
|
15
|
gokhlayeh@186
|
16 # Use text instead of numbers, don't get $2 here if it's an option.
|
gokhlayeh@186
|
17 [ "$2" = "${2#--}" ] && PACKAGE=$2 && LIST=$2 && ARG=$2
|
gokhlayeh@186
|
18 COMMAND=$1
|
pankso@7
|
19
|
gokhlayeh@186
|
20 ########################################################################
|
gokhlayeh@186
|
21 # TAZWOK USAGE
|
gokhlayeh@186
|
22 ########################
|
gokhlayeh@186
|
23 # Print the usage (English).
|
pankso@7
|
24
|
gokhlayeh@237
|
25 usage()
|
pankso@7
|
26 {
|
pankso@7
|
27 echo -e "\nSliTaz sources compiler and packages generator - Version: $VERSION\n
|
pankso@107
|
28 \033[1mUsage: \033[0m `basename $0` [command] [package|list|category|dir|id] [--option]
|
pankso@7
|
29 \033[1mCommands: \033[0m\n
|
pankso@7
|
30 usage Print this short usage.
|
pankso@7
|
31 stats Print Tazwok statistics from the config file and the wok.
|
pankso@133
|
32 edit Edit a package receipt in the current wok.
|
paul@121
|
33 build-depends Generate a list of packages to build a wok.
|
pankso@7
|
34 list List all packages in the wok tree or by category.
|
MikeDSmith25@82
|
35 info Get information about a package in the wok.
|
gokhlayeh@283
|
36 report Display commit/cooklist/broken/blocked.
|
pascal@92
|
37 check Check every receipt for common errors.
|
pankso@7
|
38 check-log Check the process log file of a package.
|
gokhlayeh@186
|
39 check-depends* Check every receipt for DEPENDS - doesn't scan ELF files.
|
erjo@159
|
40 check-src Check upstream tarball for package in the wok.
|
pankso@7
|
41 search Search for a package in the wok by pattern or name.
|
MikeDSmith25@82
|
42 compile Configure and build a package using the receipt rules.
|
pankso@7
|
43 genpkg Generate a suitable package for Tazpkg with the rules.
|
pankso@7
|
44 cook Compile and generate a package directly.
|
pankso@7
|
45 cook-list Cook all packages specified in the list by order.
|
gokhlayeh@186
|
46 cook-commit Cook all modified receipts.
|
gokhlayeh@186
|
47 cook-all Cook all packages excepted toolchain.
|
gokhlayeh@186
|
48 cook-toolchain Cook the toolchain packages.
|
gokhlayeh@240
|
49 gen-cooklist Generate a sorted cooklist using packages or list.
|
gokhlayeh@186
|
50 sort-cooklist Sort the cooklist given in argument.
|
gokhlayeh@186
|
51 get-src Download the tarball of the package given in argument.
|
pankso@7
|
52 clean Clean all generated files in the package tree.
|
pankso@7
|
53 new-tree Prepare a new package tree and receipt (--interactive).
|
gokhlayeh@186
|
54 gen-list (Re-)Generate a packages list for a repository.
|
gokhlayeh@240
|
55 check-list Update packages lists for a repository.
|
gokhlayeh@186
|
56 gen-wok-db (Re-)Generate wok lists with depends and wanted datas.
|
gokhlayeh@240
|
57 gen-clean-wok Generate a clean wok in a dir.
|
gokhlayeh@186
|
58 clean-wok Clean entirely the wok.
|
gokhlayeh@266
|
59 clean-src Remove old/unrelated-to-wok sources.
|
pankso@107
|
60 remove Remove a package from the wok.
|
gokhlayeh@240
|
61 webserver Enable/disable webserver on localhost.
|
gokhlayeh@304
|
62 update-wok Update the wok.
|
pankso@108
|
63 maintainers List all maintainers in the wok.
|
gokhlayeh@281
|
64 maintained-by List packages maintained by a contributor.
|
pankso@355
|
65 tags List all tags used in wok receipts.
|
pankso@355
|
66 block Add package from the blocked list to prevent cooking it.
|
pankso@355
|
67 unblock Remove package from the blocked list.\n
|
gokhlayeh@186
|
68
|
gokhlayeh@186
|
69 You can use `basename $0` command --help to list avaible options.
|
gokhlayeh@186
|
70 \033[1mImportant - *: \033[0m Commands which need a rewrite."
|
pankso@7
|
71 }
|
pankso@7
|
72
|
gokhlayeh@186
|
73 # This function display an error message without returning any error code.
|
gokhlayeh@186
|
74 # It also log the message in source package's warnings.txt; this file can be
|
gokhlayeh@186
|
75 # used on an eventual package page on website to display cooking warnings.
|
gokhlayeh@186
|
76 tazwok_warning()
|
pankso@7
|
77 {
|
gokhlayeh@186
|
78 echo -e "tazwok: $1" >&2
|
gokhlayeh@186
|
79 echo -e "$1" >> $WOK/${WANTED:-$PACKAGE}/warning.txt
|
gokhlayeh@186
|
80 return
|
pankso@7
|
81 }
|
pankso@7
|
82
|
gokhlayeh@186
|
83 ########################################################################
|
gokhlayeh@186
|
84 # TAZWOK VARIABLES & INITIAL CONFIGURATION
|
gokhlayeh@186
|
85 ########################
|
gokhlayeh@186
|
86
|
gokhlayeh@398
|
87 # Check if all packages are up to date into build environnement
|
gokhlayeh@398
|
88 check_env_status()
|
gokhlayeh@398
|
89 {
|
gokhlayeh@398
|
90 { [ "${COMMAND#cook}" = "$COMMAND" ] || \
|
gokhlayeh@398
|
91 [ "$COMMAND" = cook-toolchain ] ; } && return
|
gokhlayeh@398
|
92 MIRROR_path=$(grep -l "^$1$" $LOCALSTATE/mirror $LOCALSTATE/undigest/*/mirror)
|
gokhlayeh@398
|
93
|
gokhlayeh@398
|
94 if [ ! "$MIRROR_path" ]; then
|
gokhlayeh@398
|
95 echo "You are trying to cook something but you don't use $1 repository, which is \
|
gokhlayeh@398
|
96 needed for this operation." | fold -s >&2
|
gokhlayeh@398
|
97 exit 1
|
gokhlayeh@398
|
98 fi
|
gokhlayeh@398
|
99
|
gokhlayeh@398
|
100 LOCALSTATE_path=${MIRROR_path%/mirror}
|
gokhlayeh@398
|
101
|
gokhlayeh@398
|
102 # Check is possible only if repository use ID.
|
gokhlayeh@398
|
103 if [ "${MIRROR_path:0:1}" = '/' ]; then
|
gokhlayeh@398
|
104 [ -f "$MIRROR_path/ID" ] || return
|
gokhlayeh@398
|
105 else
|
gokhlayeh@398
|
106 wget -a -s $MIRROR_path/ID 2>/dev/null || return
|
gokhlayeh@398
|
107 fi
|
gokhlayeh@398
|
108
|
gokhlayeh@398
|
109 [ -f $LOCALSTATE_path/ID ] && ID=$(cat $LOCALSATE_path/ID)
|
gokhlayeh@398
|
110
|
gokhlayeh@398
|
111 if [ "$LOCALSTATE_path" = "$LOCALSTATE" ]; then
|
gokhlayeh@398
|
112 tazpkg recharge main
|
gokhlayeh@398
|
113 else
|
gokhlayeh@398
|
114 tazpkg recharge ${LOCALSTATE_path##*/}
|
gokhlayeh@398
|
115 fi
|
gokhlayeh@398
|
116
|
gokhlayeh@398
|
117 [ "$(cat $LOCALSTATE_path/ID)" = "$ID" ] || env_status=1
|
gokhlayeh@398
|
118 }
|
gokhlayeh@398
|
119
|
gokhlayeh@186
|
120 get_tazwok_config()
|
pankso@7
|
121 {
|
gokhlayeh@186
|
122 # Get configuration file.
|
gokhlayeh@186
|
123 get_config
|
gokhlayeh@186
|
124
|
gokhlayeh@186
|
125 # Define & get options.
|
gokhlayeh@186
|
126 get_options_list="$get_options_list SLITAZ_DIR SLITAZ_VERSION undigest"
|
gokhlayeh@186
|
127 get_options
|
gokhlayeh@186
|
128
|
gokhlayeh@364
|
129 LOCAL_REPOSITORY=$SLITAZ_DIR/${undigest:-$SLITAZ_VERSION}
|
gokhlayeh@235
|
130
|
gokhlayeh@235
|
131 if ! [ "$save_dir" ]; then
|
gokhlayeh@235
|
132 if [ -f $LOCAL_REPOSITORY/tazwok.conf ] || [ -f $LOCAL_REPOSITORY/slitaz.conf ]; then
|
gokhlayeh@235
|
133 save_dir=$LOCAL_REPOSITORY
|
gokhlayeh@235
|
134 [ -f $LOCAL_REPOSITORY/slitaz.conf ] && source $LOCAL_REPOSITORY/slitaz.conf
|
gokhlayeh@235
|
135 cd $save_dir
|
gokhlayeh@235
|
136 get_tazwok_config
|
gokhlayeh@235
|
137 unset save_dir
|
gokhlayeh@235
|
138 return
|
gokhlayeh@235
|
139 fi
|
gokhlayeh@235
|
140 fi
|
gokhlayeh@405
|
141
|
gokhlayeh@186
|
142 set_common_path
|
gokhlayeh@186
|
143
|
gokhlayeh@398
|
144 # Check that packages are up to date if user intend to cook.
|
gokhlayeh@398
|
145 check_env_status ${USE_ONLINE_PKG:-$PACKAGES_REPOSITORY}
|
gokhlayeh@398
|
146 check_env_status $INCOMING_REPOSITORY
|
gokhlayeh@398
|
147
|
gokhlayeh@398
|
148 # In case undigest is used, we need to upgrade system.
|
gokhlayeh@398
|
149 if [ "$undigest" ]; then
|
gokhlayeh@410
|
150 use_undigest_scan_core
|
gokhlayeh@398
|
151 ref_PACKAGES_REPOSITORY=$SLITAZ_DIR/$SLITAZ_VERSION/packages
|
gokhlayeh@398
|
152 if [ -f $SLITAZ_DIR/$SLITAZ_VERSION/tazwok.conf ] && \
|
gokhlayeh@398
|
153 grep -q ^USE_ONLINE_PKG $SLITAZ_DIR/$SLITAZ_VERSION/tazwok.conf; then
|
gokhlayeh@398
|
154 ref_USE_ONLINE_PKG=$(source $SLITAZ_DIR/$SLITAZ_VERSION/tazwok.conf && \
|
gokhlayeh@398
|
155 echo $USE_ONLINE_PKG)
|
gokhlayeh@398
|
156 fi
|
gokhlayeh@398
|
157
|
gokhlayeh@398
|
158 check_env_status ${ref_USE_ONLINE_PKG:-$ref_PACKAGES_REPOSITORY}
|
gokhlayeh@398
|
159 cd $ref_PACKAGES_REPOSITORY
|
gokhlayeh@398
|
160 if [ "$ref_USE_ONLINE_PKG" ]; then
|
gokhlayeh@398
|
161 ref_dep_db=$LOCALSTATE_path/wok-depends.txt
|
gokhlayeh@398
|
162 ref_wan_db=$LOCALSTATE_path/wok-wanted.txt
|
gokhlayeh@398
|
163 else
|
gokhlayeh@398
|
164 ref_dep_db=$ref_PACKAGES_REPOSITORY/wok-depends.txt
|
gokhlayeh@398
|
165 ref_wan_db=$ref_PACKAGES_REPOSITORY/wok-wanted.txt
|
gokhlayeh@398
|
166 fi
|
gokhlayeh@398
|
167
|
gokhlayeh@398
|
168 for file in $ref_dep_db $ref_wan_db; do
|
gokhlayeh@398
|
169 [ -f "$file" ] && continue
|
gokhlayeh@398
|
170 missing_file=t
|
gokhlayeh@398
|
171 echo "$file is missing." >&2
|
gokhlayeh@398
|
172 done
|
gokhlayeh@398
|
173 if [ "$missing_file" ]; then
|
gokhlayeh@398
|
174 echo "
|
gokhlayeh@398
|
175 Theses files are needed to get datas about packages from the reference repository $SLITAZ_VERSION. \
|
gokhlayeh@398
|
176 If you don't intend to build this reference repository yourself, you should set USE_ONLINE_PKG variable \
|
gokhlayeh@398
|
177 into tazwok.conf of this reference repository. How-to:" | fold -s >&2
|
gokhlayeh@398
|
178 echo "echo 'USE_ONLINE_PKG=\"packages_repository_url\"' >> $SLITAZ_DIR/$SLITAZ_VERSION/tazwok.conf"
|
gokhlayeh@398
|
179 echo ""
|
gokhlayeh@398
|
180 exit 1
|
gokhlayeh@398
|
181 fi
|
gokhlayeh@398
|
182 fi
|
gokhlayeh@398
|
183
|
gokhlayeh@398
|
184 # If $env_status exists, it means an upgrade may be needed.
|
gokhlayeh@398
|
185 if [ "$env_status" ]; then
|
gokhlayeh@398
|
186 if [ -x /usr/bin/clean-chroot ]; then
|
gokhlayeh@398
|
187 echo y | tazpkg upgrade
|
gokhlayeh@398
|
188 else
|
gokhlayeh@398
|
189 echo "\e[0;31mWarning: \e[m"
|
gokhlayeh@398
|
190 echo "You're environnement may need a package upgrade."
|
gokhlayeh@398
|
191 echo "Upgrading is highly recommanded to ensure repository consistency."
|
gokhlayeh@398
|
192 echo "You can (E)xit, (U)pgrade, or (C)ontinue."
|
gokhlayeh@398
|
193 echo -n "What do you want to do ?"
|
gokhlayeh@398
|
194 read answer
|
gokhlayeh@398
|
195 case $answer in
|
gokhlayeh@398
|
196 [Cc]*) ;;
|
gokhlayeh@398
|
197 [Uu]*) echo y | tazpkg upgrade ;;
|
gokhlayeh@398
|
198 *) exit
|
gokhlayeh@398
|
199 esac
|
gokhlayeh@398
|
200 fi
|
gokhlayeh@398
|
201 fi
|
gokhlayeh@186
|
202
|
gokhlayeh@186
|
203 # Check commons directories, create them if user is root.
|
gokhlayeh@186
|
204 if test $(id -u) = 0 ; then
|
gokhlayeh@186
|
205 check_dir $WOK || chmod 777 $WOK
|
gokhlayeh@304
|
206 check_dir $LOCAL_REPOSITORY/clean-wok || chmod 777 $LOCAL_REPOSITORY/clean-wok
|
gokhlayeh@186
|
207 check_dir $PACKAGES_REPOSITORY
|
gokhlayeh@186
|
208 check_dir $SOURCES_REPOSITORY
|
gokhlayeh@186
|
209 check_dir $INCOMING_REPOSITORY
|
gokhlayeh@186
|
210 check_dir $LOCAL_REPOSITORY/log
|
gokhlayeh@405
|
211 for file in $dep_db $wan_db $cookorder $commit $cooklist \
|
gokhlayeh@405
|
212 $broken $blocked $SOURCES_REPOSITORY/sources.list
|
gokhlayeh@405
|
213 do
|
gokhlayeh@405
|
214 [ -f $file ] || touch $file
|
gokhlayeh@293
|
215 done
|
gokhlayeh@186
|
216 fi
|
gokhlayeh@235
|
217
|
gokhlayeh@186
|
218 # Limit memory usage.
|
pascal@386
|
219 ulimit -v $(awk '/MemTotal|SwapTotal/ { n+=$2 } END { print int((n*80)/100) }' < /proc/meminfo)
|
gokhlayeh@405
|
220 }
|
gokhlayeh@405
|
221
|
gokhlayeh@405
|
222 # The path to the most important files/dir used by Tazwok.
|
gokhlayeh@405
|
223 set_common_path()
|
gokhlayeh@405
|
224 {
|
gokhlayeh@405
|
225 PACKAGES_REPOSITORY=$LOCAL_REPOSITORY/packages
|
gokhlayeh@405
|
226 WOK=$LOCAL_REPOSITORY/wok
|
gokhlayeh@405
|
227 INCOMING_REPOSITORY=$LOCAL_REPOSITORY/packages-incoming
|
gokhlayeh@405
|
228 SOURCES_REPOSITORY=$LOCAL_REPOSITORY/src
|
gokhlayeh@405
|
229 RECEIPT="$WOK/$PACKAGE/receipt"
|
gokhlayeh@405
|
230 LOG="$WOK/$PACKAGE/process.log"
|
gokhlayeh@405
|
231 dep_db=$INCOMING_REPOSITORY/wok-depends.txt
|
gokhlayeh@405
|
232 wan_db=$INCOMING_REPOSITORY/wok-wanted.txt
|
gokhlayeh@405
|
233 cookorder=$PACKAGES_REPOSITORY/cookorder.txt
|
gokhlayeh@405
|
234 commit=$PACKAGES_REPOSITORY/commit
|
gokhlayeh@405
|
235 cooklist=$PACKAGES_REPOSITORY/cooklist
|
gokhlayeh@405
|
236 broken=$PACKAGES_REPOSITORY/broken
|
gokhlayeh@405
|
237 blocked=$PACKAGES_REPOSITORY/blocked
|
gokhlayeh@352
|
238
|
gokhlayeh@352
|
239 # log steps for webserver.
|
gokhlayeh@352
|
240 log_step="$LOCAL_REPOSITORY/log/step"
|
gokhlayeh@352
|
241 run_on_exit="$run_on_exit
|
gokhlayeh@352
|
242 rm -f $LOCAL_REPOSITORY/log/step
|
gokhlayeh@352
|
243 rm -f $LOCAL_REPOSITORY/log/package"
|
pankso@7
|
244 }
|
pankso@7
|
245
|
gokhlayeh@186
|
246 ########################################################################
|
gokhlayeh@186
|
247 # TAZWOK CHECK FUNCTIONS
|
gokhlayeh@186
|
248 ########################
|
gokhlayeh@186
|
249
|
pankso@7
|
250 # Check for a package name on cmdline.
|
pankso@7
|
251 check_for_package_on_cmdline()
|
pankso@7
|
252 {
|
gokhlayeh@186
|
253 if [ ! "$PACKAGE" ]; then
|
gokhlayeh@186
|
254 echo -e "\nYou must specify a package name on the command line." >&2
|
gokhlayeh@186
|
255 echo -e "Example : tazwok $COMMAND package\n" >&2
|
gokhlayeh@186
|
256 exit 1
|
pankso@7
|
257 fi
|
pankso@7
|
258 }
|
pankso@7
|
259
|
pankso@7
|
260 # Check for the receipt of a package used to cook.
|
pankso@7
|
261 check_for_receipt()
|
pankso@7
|
262 {
|
pankso@7
|
263 if [ ! -f "$RECEIPT" ]; then
|
gokhlayeh@186
|
264 echo -e "\nUnable to find the receipt : $RECEIPT\n" >&2
|
gokhlayeh@186
|
265 exit 1
|
pankso@7
|
266 fi
|
pankso@7
|
267 }
|
pankso@7
|
268
|
pankso@7
|
269 # Check for a specified file list on cmdline.
|
pankso@7
|
270 check_for_list()
|
pankso@7
|
271 {
|
gokhlayeh@186
|
272 if [ ! "$LIST" ]; then
|
gokhlayeh@186
|
273 echo -e "\nPlease specify the path to the list of packages to cook.\n" >&2
|
gokhlayeh@186
|
274 exit 1
|
gokhlayeh@405
|
275 elif ! [ -f "$LIST" ]; then
|
gokhlayeh@186
|
276 echo -e "\nUnable to find $LIST packages list.\n" >&2
|
gokhlayeh@186
|
277 exit 1
|
gokhlayeh@405
|
278 elif ! [ -s "$LIST" ]; then
|
gokhlayeh@186
|
279 echo -e "\nList is empty.\n" >&2
|
gokhlayeh@186
|
280 exit 1
|
gokhlayeh@186
|
281 fi
|
gokhlayeh@186
|
282 }
|
gokhlayeh@186
|
283
|
gokhlayeh@186
|
284 ########################################################################
|
gokhlayeh@186
|
285 # TAZWOK CORE FUNCTIONS
|
gokhlayeh@186
|
286 ########################
|
gokhlayeh@186
|
287
|
gokhlayeh@186
|
288 remove_src()
|
gokhlayeh@186
|
289 {
|
gokhlayeh@204
|
290 [ "$WANTED" ] && return
|
gokhlayeh@186
|
291 look_for_cookopt !remove_src && return
|
gokhlayeh@215
|
292 if [ ! -d $WOK/$PACKAGE/install ] && [ "$src" ] && [ -d "$src/_pkg" ]; then
|
gokhlayeh@186
|
293 check_for_var_modification _pkg src || return
|
gokhlayeh@215
|
294 mv "$src/_pkg" $WOK/$PACKAGE/install
|
gokhlayeh@186
|
295 fi
|
gokhlayeh@186
|
296
|
gokhlayeh@186
|
297 # Don't remove sources if a package use src variable in his
|
gokhlayeh@186
|
298 # genpkg_rules: it maybe need something inside.
|
gokhlayeh@186
|
299 for i in $PACKAGE $(look_for_rwanted); do
|
gokhlayeh@186
|
300 sed -n '/^genpkg_rules\(\)/','/}/'p $WOK/$i/receipt | \
|
gokhlayeh@195
|
301 fgrep -q '$src' && tazwok_warning "Sources will not be removed \
|
gokhlayeh@186
|
302 because $i use \$src in his receipt." && return
|
gokhlayeh@186
|
303 done
|
gokhlayeh@186
|
304
|
gokhlayeh@186
|
305 report step "Removing sources directory"
|
gokhlayeh@186
|
306 rm -fr "$src"
|
gokhlayeh@186
|
307 report end-step
|
gokhlayeh@186
|
308 }
|
gokhlayeh@186
|
309
|
gokhlayeh@186
|
310 # Check $COOK_OPT; usage : get_cookopt particular_opt
|
gokhlayeh@186
|
311 # Return error if not founded
|
gokhlayeh@186
|
312 # Return args if the opt is in the format opt=arg1:arg2:etc
|
gokhlayeh@186
|
313 look_for_cookopt()
|
gokhlayeh@186
|
314 {
|
gokhlayeh@186
|
315 for arg in $COOK_OPT; do
|
gokhlayeh@186
|
316 case $arg in
|
gokhlayeh@186
|
317 $1=*)
|
gokhlayeh@186
|
318 arg=${arg#$1=}
|
gokhlayeh@186
|
319 while [ "$arg" ]; do
|
gokhlayeh@186
|
320 echo "${arg%%:*}"
|
gokhlayeh@186
|
321 [ "${arg/:}" = "$arg" ] && return
|
gokhlayeh@186
|
322 arg=${arg#*:}
|
gokhlayeh@186
|
323 done
|
gokhlayeh@186
|
324 ;;
|
gokhlayeh@186
|
325 $1)
|
gokhlayeh@186
|
326 return
|
gokhlayeh@186
|
327 ;;
|
gokhlayeh@186
|
328 esac
|
gokhlayeh@186
|
329 done
|
gokhlayeh@186
|
330 return 1
|
pankso@7
|
331 }
|
pankso@7
|
332
|
pankso@7
|
333 # Check for the wanted package if specified in WANTED
|
paul@166
|
334 # receipt variable. Set the $src/$_pkg variable to help compile
|
paul@166
|
335 # and generate packages.
|
pankso@7
|
336 check_for_wanted()
|
pankso@7
|
337 {
|
gokhlayeh@186
|
338 if [ "$WANTED" ]; then
|
gokhlayeh@186
|
339 report "Checking for the wanted package"
|
pankso@7
|
340 if [ ! -d "$WOK/$WANTED" ]; then
|
gokhlayeh@186
|
341 report exit "\nWanted package is missing in the work directory.\n"
|
pankso@7
|
342 fi
|
gokhlayeh@186
|
343
|
erjo@38
|
344 # Checking for buildtree of Wanted package
|
pankso@39
|
345 if [ ! -d "$WOK/$WANTED/taz" ]; then
|
erjo@38
|
346 echo -e "\n\nSource files of wanted package is missing in the work directory."
|
erjo@38
|
347 echo -n "Would you like to build the missing package (y/N) ? " ; read anser
|
erjo@38
|
348 if [ "$anser" == "y" ]; then
|
erjo@38
|
349 tazwok cook $WANTED
|
erjo@38
|
350 else
|
gokhlayeh@186
|
351 report exit "\nWanted package source tree is missing in the work directory.\n"
|
erjo@38
|
352 fi
|
erjo@38
|
353 fi
|
gokhlayeh@186
|
354 report end-step
|
gokhlayeh@186
|
355
|
pankso@7
|
356 # Set wanted src path.
|
gokhlayeh@186
|
357 set_src_path && set_pkg_path
|
gokhlayeh@186
|
358
|
pascal@178
|
359 fi
|
pascal@178
|
360 }
|
pascal@178
|
361
|
pascal@178
|
362 # Check for build dependencies, notify user and install if specified.
|
pascal@178
|
363 check_for_build_depends()
|
pascal@178
|
364 {
|
gokhlayeh@204
|
365 [ "$WANTED" ] && return
|
gokhlayeh@213
|
366 [ "$CATEGORY" = meta ] && ! fgrep -q compile_rules $RECEIPT && return
|
gokhlayeh@272
|
367 [ ! "$BUILD_DEPENDS" ] && ! fgrep -q compile_rules $RECEIPT && return
|
gokhlayeh@186
|
368 report step "Looking for build dependencies"
|
gokhlayeh@186
|
369
|
gokhlayeh@186
|
370 # Keep the list of previously installed build_depends then compare
|
gokhlayeh@186
|
371 # it with new build_depends to know what to install and what to
|
gokhlayeh@186
|
372 # what to remove.
|
gokhlayeh@186
|
373 plan_remove=" $MISSING_PACKAGE $remove_later "
|
gokhlayeh@186
|
374 [ ! "${plan_remove// }" ] && unset plan_remove
|
gokhlayeh@186
|
375 unset MISSING_PACKAGE remove_later
|
gokhlayeh@186
|
376 rwanted=$(look_for_rwanted)
|
gokhlayeh@186
|
377
|
gokhlayeh@215
|
378 for pkg in $(scan $PACKAGE --look_for=bdep --with_dev | \
|
gokhlayeh@394
|
379 grep -v $(for i in $(look_for_rwanted) $PACKAGE; do echo " -e ^$i$"; done))
|
pascal@178
|
380 do
|
gokhlayeh@186
|
381
|
gokhlayeh@186
|
382 # Delay the removing of previous cook depends if they are needed
|
gokhlayeh@186
|
383 # for next cook too.
|
gokhlayeh@186
|
384 if [ ! -d "$INSTALLED/$pkg" ] ; then
|
gokhlayeh@186
|
385 MISSING_PACKAGE="$MISSING_PACKAGE $pkg"
|
gokhlayeh@186
|
386 fi
|
gokhlayeh@186
|
387 if [ "$plan_remove" != "${plan_remove/ $pkg }" ]; then
|
gokhlayeh@186
|
388 plan_remove="${plan_remove/ $pkg / }"
|
gokhlayeh@186
|
389 remove_later="$remove_later $pkg"
|
gokhlayeh@186
|
390 fi
|
gokhlayeh@405
|
391 grep -q ^$pkg$ $broken && broken_pkg="$broken_pkg$pkg "
|
pascal@178
|
392 done
|
gokhlayeh@186
|
393
|
gokhlayeh@186
|
394 # Don't cook if a depend is broken.
|
gokhlayeh@405
|
395 if [ "$broken_pkg" ]; then
|
gokhlayeh@186
|
396 MISSING_PACKAGE=$plan_remove
|
gokhlayeh@405
|
397 echo "Can't cook $PACKAGE because broken depend(s) : $broken_pkg" >&2
|
gokhlayeh@186
|
398 unset plan_remove broken
|
gokhlayeh@186
|
399
|
gokhlayeh@186
|
400 # Set report step to failed.
|
gokhlayeh@186
|
401 report_return_code=1
|
gokhlayeh@186
|
402 report end-step
|
gokhlayeh@186
|
403 return 1
|
gokhlayeh@186
|
404 fi
|
gokhlayeh@186
|
405 if [ "$MISSING_PACKAGE" ]; then
|
gokhlayeh@186
|
406 install_missing()
|
gokhlayeh@186
|
407 {
|
gokhlayeh@186
|
408 echo "Installing missing packages : $MISSING_PACKAGE"
|
gokhlayeh@186
|
409 for pkg in $MISSING_PACKAGE; do
|
gokhlayeh@186
|
410 [ -d "$INSTALLED/$pkg" ] || tazpkg get-install $pkg
|
gokhlayeh@186
|
411 done
|
gokhlayeh@186
|
412 }
|
gokhlayeh@186
|
413 if [ "$auto_install" = yes ]; then
|
gokhlayeh@186
|
414 install_missing
|
gokhlayeh@186
|
415 else
|
gokhlayeh@186
|
416 echo "================================================================================"
|
gokhlayeh@186
|
417 for pkg in $MISSING_PACKAGE
|
gokhlayeh@186
|
418 do
|
pascal@178
|
419 echo "Missing : $pkg"
|
gokhlayeh@186
|
420 done
|
gokhlayeh@186
|
421 echo "================================================================================"
|
gokhlayeh@186
|
422 echo "You can continue, exit or install missing dependencies."
|
gokhlayeh@186
|
423 echo -n "Install, continue or exit (install/y/N) ? "; read answer
|
gokhlayeh@186
|
424 case $answer in
|
gokhlayeh@186
|
425 install)
|
gokhlayeh@186
|
426 install_missing ;;
|
gokhlayeh@186
|
427 y|yes)
|
gokhlayeh@186
|
428 unset MISSING_PACKAGE;;
|
gokhlayeh@186
|
429 *)
|
gokhlayeh@186
|
430 report stop
|
gokhlayeh@186
|
431 exit 0 ;;
|
gokhlayeh@186
|
432 esac
|
gokhlayeh@186
|
433 fi
|
gokhlayeh@186
|
434 fi
|
gokhlayeh@186
|
435 report end-step
|
gokhlayeh@186
|
436 remove_build_depends $plan_remove
|
gokhlayeh@186
|
437 unset plan_remove
|
gokhlayeh@186
|
438 }
|
gokhlayeh@186
|
439
|
gokhlayeh@186
|
440 remove_build_depends()
|
gokhlayeh@186
|
441 {
|
gokhlayeh@186
|
442 [ "$1" ] || return
|
gokhlayeh@186
|
443 report step "Removing previous build dependencies"
|
gokhlayeh@186
|
444 echo "Removing theses packages : $@"
|
gokhlayeh@186
|
445 for pkg in $@; do
|
gokhlayeh@382
|
446 [ -f "$INSTALLED/$pkg/receipt" ] && tazpkg remove $pkg --auto
|
gokhlayeh@186
|
447 done
|
gokhlayeh@382
|
448 cd $PWD
|
gokhlayeh@186
|
449 report end-step
|
gokhlayeh@186
|
450 }
|
gokhlayeh@186
|
451
|
gokhlayeh@186
|
452 # Check if we can use the new way to handle tarball
|
gokhlayeh@186
|
453 # or if we keep the previous method by check for
|
gokhlayeh@186
|
454 # _pkg=/src= in receipt and reverse-wanted.
|
gokhlayeh@186
|
455 check_for_var_modification()
|
gokhlayeh@186
|
456 {
|
gokhlayeh@186
|
457 for var in $@; do
|
gokhlayeh@186
|
458 for pkg in $PACKAGE $(look_for_wanted) $(look_for_rwanted); do
|
gokhlayeh@186
|
459 [ -f $WOK/$pkg/receipt ] || continue
|
gokhlayeh@195
|
460 fgrep -q "$var=" $WOK/$pkg/receipt && return 1
|
pascal@178
|
461 done
|
gokhlayeh@186
|
462 done
|
gokhlayeh@186
|
463
|
gokhlayeh@186
|
464 # Tweak to make if; then...; fi function working with this one.
|
gokhlayeh@186
|
465 echo -n ""
|
gokhlayeh@186
|
466 }
|
gokhlayeh@186
|
467
|
gokhlayeh@186
|
468 set_src_path()
|
gokhlayeh@186
|
469 {
|
gokhlayeh@186
|
470 if check_for_var_modification src _pkg; then
|
gokhlayeh@186
|
471 src=$WOK/${WANTED:-$PACKAGE}/${WANTED:-$PACKAGE}-$VERSION
|
gokhlayeh@186
|
472 else
|
gokhlayeh@266
|
473 tazwok_warning "Use original name or tarball root directory because src/_pkg are defined into the receipt (this is no more needed!)."
|
gokhlayeh@186
|
474 src=$WOK/${WANTED:-$PACKAGE}/${SOURCE:-${WANTED:-$PACKAGE}}-$VERSION
|
pascal@178
|
475 fi
|
gokhlayeh@298
|
476 stuff=$WOK/$PACKAGE/stuff
|
gokhlayeh@298
|
477 [ "$WANTED" ] && wanted_stuff=$WOK/$WANTED/stuff
|
pascal@178
|
478 }
|
pascal@178
|
479
|
gokhlayeh@186
|
480 set_pkg_path()
|
gokhlayeh@186
|
481 {
|
slaxemulator@269
|
482 if [ -d $WOK/${WANTED:-$PACKAGE}/install ] ; then
|
gokhlayeh@186
|
483 _pkg=$WOK/${WANTED:-$PACKAGE}/install
|
gokhlayeh@186
|
484 else
|
pankso@7
|
485 _pkg=$src/_pkg
|
pankso@7
|
486 fi
|
pankso@7
|
487 }
|
pankso@7
|
488
|
gokhlayeh@186
|
489 # Output $VERSION-$EXTRAVERSION using packages.txt
|
gokhlayeh@186
|
490 get_pkg_version()
|
gokhlayeh@186
|
491 {
|
gokhlayeh@186
|
492 [ "$PACKAGE" ] || return
|
gokhlayeh@204
|
493 grep -m1 -A1 -sh ^$PACKAGE$ $1/packages.txt | tail -1 | sed 's/ *//'
|
gokhlayeh@186
|
494 }
|
erjo@38
|
495
|
gokhlayeh@186
|
496 remove_previous_package()
|
pankso@18
|
497 {
|
gokhlayeh@186
|
498 [ "$prev_VERSION" ] || return
|
gokhlayeh@186
|
499 if [ "$VERSION$EXTRAVERSION" != "$prev_VERSION" ]; then
|
gokhlayeh@186
|
500 rm -f $1/$PACKAGE-$prev_VERSION.tazpkg
|
gokhlayeh@186
|
501 fi
|
gokhlayeh@382
|
502 return 0
|
gokhlayeh@186
|
503 }
|
gokhlayeh@186
|
504
|
gokhlayeh@186
|
505 # Check for src tarball and wget if needed.
|
gokhlayeh@186
|
506 check_for_tarball()
|
gokhlayeh@186
|
507 {
|
gokhlayeh@258
|
508 [ "$WGET_URL" ] || return 0
|
gokhlayeh@364
|
509 look_for_cookopt !unpack && nounpack=yes
|
gokhlayeh@290
|
510 report step "Checking for source tarball: $PACKAGE"
|
slaxemulator@326
|
511 local repack_src=$repack_src TARBALL=$TARBALL
|
gokhlayeh@266
|
512 if [ "$repack_src" = yes ] && look_for_cookopt !repack_src; then
|
gokhlayeh@266
|
513 repack_src=no
|
gokhlayeh@266
|
514 fi
|
gokhlayeh@266
|
515 if [ "$target" ]; then
|
gokhlayeh@266
|
516 src="$target"
|
gokhlayeh@266
|
517 else
|
gokhlayeh@266
|
518 set_src_path
|
gokhlayeh@266
|
519 fi
|
gokhlayeh@266
|
520 tmp_src=$tmp/tarball-$$
|
gokhlayeh@253
|
521 if [ ! -f "$SOURCES_REPOSITORY/$TARBALL" ] && \
|
gokhlayeh@253
|
522 [ ! -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ] ; then
|
gokhlayeh@253
|
523 cd $SOURCES_REPOSITORY
|
gokhlayeh@266
|
524 if [ "$SOURCE" ]; then
|
gokhlayeh@266
|
525 alt_url="http://mirror.slitaz.org/sources/packages/${SOURCE:0:1}/$SOURCE-$VERSION.tar.lzma"
|
pascal@361
|
526 alt_url2="http://mirror.slitaz.org/sources/packages/${SOURCE:0:1}/$TARBALL"
|
gokhlayeh@266
|
527 else
|
gokhlayeh@266
|
528 alt_url="http://mirror.slitaz.org/sources/packages/${PACKAGE:0:1}/$PACKAGE-$VERSION.tar.lzma"
|
pascal@361
|
529 alt_url2="http://mirror.slitaz.org/sources/packages/${PACKAGE:0:1}/$TARBALL"
|
pankso@18
|
530 fi
|
pascal@361
|
531 download $WGET_URL $alt_url $alt_url2 http://mirror.slitaz.org/sources/packages/${file:0:1}/$file
|
gokhlayeh@266
|
532 unset alt_url
|
pascal@361
|
533 unset alt_url2
|
gokhlayeh@253
|
534 if [ ! -f "$SOURCES_REPOSITORY/$TARBALL" ] && \
|
gokhlayeh@266
|
535 [ ! -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ] && \
|
gokhlayeh@266
|
536 [ ! -d $tmp_src ]; then
|
gokhlayeh@253
|
537 echo -e "\nDownload failed, exiting. Please check WGET_URL variable.\n" >&2
|
gokhlayeh@253
|
538 report end-step
|
gokhlayeh@253
|
539 return 1
|
gokhlayeh@253
|
540 fi
|
slaxemulator@232
|
541 fi
|
gokhlayeh@253
|
542 report end-step
|
gokhlayeh@364
|
543 if { [ -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ] && [ "$nounpack" ] ; } || \
|
gokhlayeh@364
|
544 { [ -f "$SOURCES_REPOSITORY/$TARBALL" ] && [ "$repack_src" != yes ] && [ "$nounpack" ] ; }; then
|
gokhlayeh@266
|
545 [ -d "$tmp_src" ] && rm -r $tmp_src
|
gokhlayeh@364
|
546 return 0
|
slaxemulator@232
|
547 fi
|
slaxemulator@232
|
548
|
slaxemulator@232
|
549 # Untaring source if necessary. We don't need to extract source if
|
slaxemulator@232
|
550 # the package is built with a wanted source package.
|
slaxemulator@232
|
551 if [ "$WANTED" ]; then
|
gokhlayeh@266
|
552 [ -d "$tmp_src" ] && rm -r $tmp_src
|
slaxemulator@232
|
553 return
|
slaxemulator@232
|
554 fi
|
slaxemulator@232
|
555
|
slaxemulator@232
|
556 report step "Untaring source tarball"
|
slaxemulator@232
|
557
|
slaxemulator@232
|
558 # Log process.
|
slaxemulator@232
|
559 echo "untaring source tarball" >> $LOG
|
gokhlayeh@266
|
560
|
gokhlayeh@266
|
561 # If $tmp_src exists, there's already the unpacked tarball into it.
|
gokhlayeh@266
|
562 if ! [ -d $tmp_src ]; then
|
gokhlayeh@266
|
563 mkdir $tmp_src
|
gokhlayeh@266
|
564 if [ -f "$SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma" ] && [ "$repack_src" = yes ]; then
|
gokhlayeh@266
|
565 lzma d $SOURCES_REPOSITORY/${SOURCE:-$PACKAGE}-$VERSION.tar.lzma -so | \
|
gokhlayeh@266
|
566 tar xf - -C $tmp_src
|
gokhlayeh@266
|
567 repack_src=no
|
gokhlayeh@266
|
568 TARBALL=${SOURCE:-$PACKAGE}-$VERSION.tar.lzma
|
gokhlayeh@266
|
569 elif [ -f "$SOURCES_REPOSITORY/$TARBALL" ]; then
|
gokhlayeh@266
|
570 case "$TARBALL" in
|
gokhlayeh@266
|
571 *zip|*xpi) cd $tmp_src && unzip -o $SOURCES_REPOSITORY/$TARBALL ;;
|
gokhlayeh@266
|
572 *bz2|*tbz|*gem) tar xjf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;;
|
gokhlayeh@266
|
573 *tar) tar xf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;;
|
gokhlayeh@266
|
574 *lzma|*lz) unlzma -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;;
|
gokhlayeh@266
|
575 *xz) unxz -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;;
|
gokhlayeh@266
|
576 *Z|*taz) uncompress -c $SOURCES_REPOSITORY/$TARBALL | tar xf - -C $tmp_src;;
|
gokhlayeh@266
|
577 *gz) tar xzf $SOURCES_REPOSITORY/$TARBALL -C $tmp_src;;
|
gokhlayeh@266
|
578 *rpm) cd $tmp_src && rpm2cpio $SOURCES_REPOSITORY/$TARBALL | cpio -idm --quiet;;
|
gokhlayeh@266
|
579
|
gokhlayeh@266
|
580 # It's a plain file or something receipt unpack itself.
|
gokhlayeh@266
|
581 *)
|
gokhlayeh@266
|
582 mkdir $tmp_src/${SOURCE:-$PACKAGE}-$VERSION
|
gokhlayeh@266
|
583 cp $SOURCES_REPOSITORY/$TARBALL $tmp_src/${src##*/}
|
gokhlayeh@266
|
584 ;;
|
gokhlayeh@266
|
585
|
gokhlayeh@271
|
586 esac || { report end-step
|
gokhlayeh@271
|
587 rm -f $SOURCES_REPOSITORY/$TARBALL
|
gokhlayeh@271
|
588 rm -r $tmp_src
|
gokhlayeh@271
|
589 return 1
|
gokhlayeh@271
|
590 }
|
gokhlayeh@266
|
591 fi
|
gokhlayeh@266
|
592
|
slaxemulator@232
|
593 # Check if uncompressed tarball is in a root dir or not.
|
gokhlayeh@266
|
594 if [ "$(ls -A $tmp_src | wc -l)" -gt 1 ] || [ -f $(echo $tmp_src/*) ]; then
|
slaxemulator@232
|
595 if check_for_var_modification src _pkg; then
|
slaxemulator@232
|
596 mv $tmp_src $tmp_src-1
|
slaxemulator@232
|
597 mkdir $tmp_src
|
gokhlayeh@233
|
598 mv $tmp_src-1 $tmp_src/${SOURCE:-$PACKAGE}-$VERSION
|
slaxemulator@232
|
599 else
|
slaxemulator@232
|
600 mv $tmp_src/* $WOK/$PACKAGE
|
slaxemulator@232
|
601 repack_src=no
|
slaxemulator@232
|
602 rm -r $tmp_src
|
gokhlayeh@266
|
603 tazwok_warning "Put all files into $WOK/$PACKAGE; not sure about how to handle this tarball (no root dir)... Please try to remove src/_pkg definition from receipt if you encounter a problem."
|
pankso@18
|
604 fi
|
slaxemulator@232
|
605 fi
|
gokhlayeh@266
|
606 fi
|
gokhlayeh@266
|
607
|
gokhlayeh@266
|
608 if [ "$repack_src" = yes ]; then
|
slaxemulator@232
|
609 report step "Repacking sources in .tar.lzma format"
|
gokhlayeh@266
|
610 [ "$TARBALL" ] && rm -f $SOURCES_REPOSITORY/$TARBALL
|
gokhlayeh@266
|
611 TARBALL=${SOURCE:-$PACKAGE}-$VERSION.tar.lzma
|
slaxemulator@232
|
612 cd $tmp_src
|
gokhlayeh@266
|
613 tar -c * | lzma e $SOURCES_REPOSITORY/$TARBALL -si
|
gokhlayeh@266
|
614 fi
|
slaxemulator@232
|
615
|
gokhlayeh@266
|
616 # Remove previous tarball if no other package needs it. We take care to
|
gokhlayeh@266
|
617 # keep tarball if the same package use it into main repository.
|
gokhlayeh@266
|
618 if [ "$TARBALL" ]; then
|
gokhlayeh@266
|
619 previous_tarball=$(grep ^$PACKAGE:incoming $SOURCES_REPOSITORY/sources.list | cut -f2)
|
gokhlayeh@266
|
620 if [ "$previous_tarball" ]; then
|
gokhlayeh@266
|
621 sed "/^$PACKAGE:incoming/ s/.*/$PACKAGE:incoming\t$TARBALL/" \
|
gokhlayeh@266
|
622 -i $SOURCES_REPOSITORY/sources.list
|
gokhlayeh@266
|
623 grep -q $'\t'$previous_tarball$ $SOURCES_REPOSITORY/sources.list || \
|
gokhlayeh@266
|
624 rm -f $SOURCES_REPOSITORY/$previous_tarball
|
gokhlayeh@266
|
625 else
|
gokhlayeh@266
|
626 echo -e "$PACKAGE:incoming\t$TARBALL" >> $SOURCES_REPOSITORY/sources.list
|
slaxemulator@232
|
627 fi
|
slaxemulator@232
|
628 fi
|
gokhlayeh@266
|
629
|
slaxemulator@232
|
630 if [ "$nounpack" ]; then
|
slaxemulator@232
|
631 [ -d "$tmp_src" ] && rm -r $tmp_src
|
gokhlayeh@285
|
632 report end-step
|
slaxemulator@232
|
633 return
|
slaxemulator@232
|
634 fi
|
gokhlayeh@285
|
635 if [ ! -d "$src" ]|| [ "$target" ]; then
|
gokhlayeh@285
|
636 # Permissions settings.
|
gokhlayeh@285
|
637 chown -R root.root "$tmp_src"
|
gokhlayeh@285
|
638 if [ -d "$src" ]; then
|
gokhlayeh@285
|
639 mkdir -p $src
|
gokhlayeh@285
|
640 for f in $tmp_src/*/*; do
|
gokhlayeh@285
|
641 cp -a $f $src || { report end-step; rm -r $tmp_src; return 1; }
|
gokhlayeh@285
|
642 done
|
gokhlayeh@285
|
643 else
|
gokhlayeh@285
|
644 if ! check_for_var_modification src _pkg && ! [ "$target" ]; then
|
gokhlayeh@285
|
645 src="${src%/*}/$(ls $tmp_src)"
|
gokhlayeh@285
|
646 fi
|
gokhlayeh@285
|
647 mv $(echo $tmp_src/*) "$src" || { report end-step; rm -r $tmp_src; return 1; }
|
gokhlayeh@186
|
648 fi
|
gokhlayeh@266
|
649 rm -r $tmp_src
|
gokhlayeh@266
|
650 else
|
gokhlayeh@266
|
651 [ -d "$tmp_src" ] && rm -r $tmp_src
|
gokhlayeh@266
|
652 echo "There's already something at $src. Abort." >&2
|
gokhlayeh@186
|
653 fi
|
gokhlayeh@285
|
654 report end-step
|
gokhlayeh@186
|
655 }
|
gokhlayeh@186
|
656
|
gokhlayeh@186
|
657 # Log and execute compile_rules function if it exists, to configure and
|
gokhlayeh@186
|
658 # make the package if it exists.
|
gokhlayeh@186
|
659 check_for_compile_rules()
|
gokhlayeh@186
|
660 {
|
gokhlayeh@186
|
661 if grep -q ^compile_rules $RECEIPT; then
|
gokhlayeh@186
|
662 echo "executing compile_rules" >> $LOG
|
gokhlayeh@186
|
663 report step "Executing compile_rules"
|
gokhlayeh@186
|
664 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
665 rm -f /tmp/config.site
|
pascal@385
|
666 ulimit -d unlimited
|
pascal@385
|
667 ulimit -m unlimited
|
gokhlayeh@186
|
668
|
gokhlayeh@186
|
669 # Free some RAM by cleaning cache if option is enabled.
|
slaxemulator@200
|
670 freeram=$(free | fgrep '/+ buffers' | tr -s ' ' | cut -f 4 -d ' ')
|
gokhlayeh@186
|
671
|
gokhlayeh@186
|
672 # Disable -pipe in CFLAGS/CXXFLAGS if less than 512Mb of free
|
gokhlayeh@186
|
673 # RAM are available.
|
gokhlayeh@195
|
674 if [ "$freeram" -lt 524288 ] && [ "$CFLAGS" != "${CFLAGS/-pipe}" -o \
|
gokhlayeh@195
|
675 "$CXXFLAGS" != "${CXXFLAGS/-pipe}" ]; then
|
gokhlayeh@195
|
676 tazwok_warning "Disabling -pipe compile flag because only ${freeram}b of RAM are available."
|
gokhlayeh@186
|
677 CFLAGS="${CFLAGS/-pipe}"
|
gokhlayeh@186
|
678 CXXFLAGS="${CXXFLAGS/-pipe}"
|
gokhlayeh@186
|
679 fi
|
gokhlayeh@186
|
680 unset freeram
|
gokhlayeh@186
|
681
|
gokhlayeh@186
|
682 # Set cook environnement variables.
|
gokhlayeh@186
|
683 [ "$src" ] || set_src_path
|
gokhlayeh@186
|
684 [ "$DESTDIR" ] || DESTDIR="$WOK/$PACKAGE/install"
|
gokhlayeh@186
|
685 [ "$CONFIG_SITE" ] || CONFIG_SITE=/etc/config.site
|
gokhlayeh@186
|
686 export CFLAGS CXXFLAGS MAKEFLAGS DESTDIR BUILD_HOST \
|
gokhlayeh@186
|
687 CONFIG_SITE default_prefix \
|
gokhlayeh@186
|
688 default_datarootdir default_datadir default_localedir \
|
gokhlayeh@186
|
689 default_infodir default_mandir default_build default_host
|
gokhlayeh@186
|
690 local LC_ALL=POSIX LANG=POSIX
|
gokhlayeh@186
|
691 compile_rules
|
gokhlayeh@186
|
692
|
gokhlayeh@186
|
693 # Check if config.site has been used.
|
gokhlayeh@186
|
694 # /!\ disabled since it screw the return_code of the step.
|
gokhlayeh@186
|
695 #if [ -f /tmp/config.site ]; then
|
gokhlayeh@186
|
696 # rm /tmp/config.site
|
gokhlayeh@186
|
697 #else
|
gokhlayeh@186
|
698 # tazwok_warning "config.site hasn't been used during \
|
gokhlayeh@186
|
699 #configuration process."
|
gokhlayeh@186
|
700 #fi
|
gokhlayeh@186
|
701 report end-step
|
pankso@18
|
702 fi
|
pankso@18
|
703 }
|
pascal@76
|
704
|
gokhlayeh@186
|
705 # Check for loop in deps tree. /!\ can be removed
|
pascal@76
|
706 check_for_deps_loop()
|
pascal@76
|
707 {
|
pascal@76
|
708 local list
|
pascal@76
|
709 local pkg
|
pascal@76
|
710 local deps
|
pascal@76
|
711 pkg=$1
|
pascal@76
|
712 shift
|
pascal@76
|
713 [ -n "$1" ] || return
|
pascal@76
|
714 list=""
|
gokhlayeh@204
|
715
|
pascal@76
|
716 # Filter out already processed deps
|
pascal@76
|
717 for i in $@; do
|
pascal@76
|
718 case " $ALL_DEPS" in
|
pascal@76
|
719 *\ $i\ *);;
|
pascal@76
|
720 *) list="$list $i";;
|
pascal@76
|
721 esac
|
pascal@76
|
722 done
|
pascal@76
|
723 ALL_DEPS="$ALL_DEPS$list "
|
pascal@76
|
724 for i in $list; do
|
pascal@76
|
725 [ -f $i/receipt ] || continue
|
pascal@76
|
726 deps="$(DEPENDS=""; . $i/receipt; echo $DEPENDS)"
|
pascal@76
|
727 case " $deps " in
|
pascal@76
|
728 *\ $pkg\ *) echo -e "$MSG $i"; MSG="";;
|
pascal@76
|
729 *) check_for_deps_loop $pkg $deps;;
|
pascal@76
|
730 esac
|
pascal@76
|
731 done
|
pascal@76
|
732 }
|
pascal@76
|
733
|
gokhlayeh@266
|
734 # Function used by download().
|
gokhlayeh@266
|
735 revert_vcs_failure()
|
gokhlayeh@266
|
736 {
|
gokhlayeh@266
|
737 cd $SOURCES_REPOSITORY
|
gokhlayeh@266
|
738 rm -r $tmp_src
|
gokhlayeh@266
|
739 }
|
gokhlayeh@266
|
740
|
erjo@53
|
741 download()
|
erjo@53
|
742 {
|
gokhlayeh@278
|
743 if [ "$COMMAND" = get-src ]; then
|
gokhlayeh@278
|
744 if [ "${DEPENDS/tar}" != "$DEPENDS" ] || [ "${BUILD_DEPENDS/tar}" != "$BUILD_DEPENDS" ]; then
|
slaxemulator@287
|
745 [ -f $INSTALLED/tar/receipt ] || tazpkg get-install tar --forced
|
pankso@7
|
746 fi
|
pankso@7
|
747 fi
|
pascal@178
|
748 for file in $@; do
|
gokhlayeh@266
|
749 echo "Downloading from ${file#*|}..."
|
gokhlayeh@255
|
750 case "$file" in
|
gokhlayeh@266
|
751 git\|*)
|
gokhlayeh@266
|
752 file=${file#git|}
|
gokhlayeh@278
|
753 [ "$COMMAND" = get-src ] && [ ! -f $INSTALLED/git/receipt ] && tazpkg get-install git --forced
|
slaxemulator@274
|
754 if [ -f $INSTALLED/git/receipt ]; then
|
gokhlayeh@266
|
755 mkdir $tmp_src
|
gokhlayeh@266
|
756 cd $tmp_src
|
gokhlayeh@266
|
757 if [ "$BRANCH" ]; then
|
gokhlayeh@266
|
758 git clone $file ${src##*/} && cd ${src##*/} && \
|
gokhlayeh@266
|
759 git checkout $BRANCH && rm -rf .git* && break
|
gokhlayeh@266
|
760 else
|
gokhlayeh@266
|
761 git clone $file ${src##*/} && rm -rf ${src##*/}/.git* && break
|
gokhlayeh@266
|
762 fi
|
gokhlayeh@266
|
763 revert_vcs_failure
|
gokhlayeh@266
|
764 else
|
gokhlayeh@266
|
765 tazwok_warning "Needs git to download the source tarball from $file, please add it as build-depend."
|
gokhlayeh@266
|
766 continue
|
gokhlayeh@266
|
767 fi
|
gokhlayeh@266
|
768 ;;
|
gokhlayeh@266
|
769 subversion\|*)
|
gokhlayeh@266
|
770 file=${file#subversion|}
|
gokhlayeh@278
|
771 [ "$COMMAND" = get-src ] && [ ! -f $INSTALLED/subversion/receipt ] && tazpkg get-install subversion --forced
|
slaxemulator@274
|
772 if [ -f $INSTALLED/subversion/receipt ]; then
|
gokhlayeh@266
|
773 mkdir $tmp_src
|
gokhlayeh@266
|
774 cd $tmp_src
|
gokhlayeh@266
|
775 if [ "$BRANCH" ]; then
|
gokhlayeh@266
|
776 echo t | svn co $file -r $BRANCH ${src##*/} && rm -rf ${src##*/}/.svn* && break
|
gokhlayeh@266
|
777 else
|
gokhlayeh@266
|
778 echo t | svn co $file ${src##*/} && rm -rf ${src##*/}/.svn* && break
|
gokhlayeh@266
|
779 fi
|
gokhlayeh@266
|
780 revert_vcs_failure
|
gokhlayeh@266
|
781 else
|
gokhlayeh@266
|
782 tazwok_warning "Needs subversion to download the source tarball from $file, please add it as build-depend."
|
gokhlayeh@266
|
783 continue
|
gokhlayeh@266
|
784 fi
|
gokhlayeh@266
|
785 ;;
|
gokhlayeh@266
|
786 mercurial\|*)
|
gokhlayeh@266
|
787 file=${file#mercurial|}
|
gokhlayeh@278
|
788 [ "$COMMAND" = get-src ] && [ ! -f $INSTALLED/mercurial/receipt ] && tazpkg get-install mercurial --forced
|
slaxemulator@274
|
789 if [ -f $INSTALLED/mercurial/receipt ]; then
|
gokhlayeh@266
|
790 mkdir $tmp_src
|
gokhlayeh@266
|
791 cd $tmp_src
|
gokhlayeh@266
|
792 if [ "$BRANCH" ]; then
|
gokhlayeh@266
|
793 hg clone $file --rev $BRANCH ${src##*/} && rm -rf ${src##*/}/.hg* && break
|
gokhlayeh@266
|
794 else
|
gokhlayeh@266
|
795 hg clone $file ${src##*/} && rm -rf ${src##*/}/.hg* && break
|
gokhlayeh@266
|
796 fi
|
gokhlayeh@266
|
797 revert_vcs_failure
|
gokhlayeh@266
|
798 else
|
gokhlayeh@266
|
799 tazwok_warning "Needs mercurial to download the source tarball from $file, please add it as build-depend."
|
gokhlayeh@266
|
800 continue
|
gokhlayeh@266
|
801 fi
|
gokhlayeh@266
|
802 ;;
|
gokhlayeh@266
|
803 https*)
|
gokhlayeh@278
|
804 [ "$COMMAND" = get-src ] && [ ! -f $INSTALLED/wget/receipt ] && tazpkg get-install wget --forced
|
gokhlayeh@255
|
805 if [ -d $INSTALLED/wget ]; then
|
gokhlayeh@266
|
806 if [ "${WGET_URL%$TARBALL}" = "$WGET_URL" ] && [ "$file" = "$WGET_URL" ]; then
|
gokhlayeh@266
|
807 wget -q --no-check-certificate -O $TARBALL $file && break
|
gokhlayeh@266
|
808 else
|
gokhlayeh@290
|
809 wget -q --no-check-certificate $file && break
|
gokhlayeh@266
|
810 fi
|
gokhlayeh@255
|
811 else
|
gokhlayeh@266
|
812 tazwok_warning "Needs wget to download the source tarball from $file, please add it as build-depend."
|
gokhlayeh@266
|
813 continue
|
gokhlayeh@255
|
814 fi
|
gokhlayeh@266
|
815 ;;
|
gokhlayeh@266
|
816 http*|ftp*)
|
gokhlayeh@266
|
817 # Handle crappy URL.
|
gokhlayeh@278
|
818 if [ "$COMMAND" = get-src ]; then
|
gokhlayeh@278
|
819 if [ "${DEPENDS/wget}" != "$DEPENDS" ] || [ "${BUILD_DEPENDS/wget}" != "$BUILD_DEPENDS" ]; then
|
gokhlayeh@278
|
820 [ -f $INSALLED/wget/receipt ] || tazpkg get-install wget --forced
|
gokhlayeh@278
|
821 fi
|
gokhlayeh@278
|
822 fi
|
gokhlayeh@266
|
823 if [ "${WGET_URL%$TARBALL}" = "$WGET_URL" ] && [ "$file" = "$WGET_URL" ]; then
|
gokhlayeh@266
|
824 wget -q -O $TARBALL $file && break
|
gokhlayeh@266
|
825 else
|
gokhlayeh@266
|
826 wget -q $file && break
|
gokhlayeh@266
|
827 fi
|
gokhlayeh@266
|
828 ;;
|
gokhlayeh@255
|
829 esac
|
pascal@178
|
830 done
|
pankso@7
|
831 }
|
pankso@7
|
832
|
pascal@156
|
833 # Regenerate every package that wants a PACKAGE compiled
|
pascal@156
|
834 refresh_packages_from_compile()
|
pascal@156
|
835 {
|
pascal@156
|
836 # make tazwok genpkg happy
|
pascal@156
|
837 mkdir $WOK/$PACKAGE/taz
|
gokhlayeh@204
|
838
|
gokhlayeh@186
|
839 # Cook rwanted in default or specied order
|
gokhlayeh@186
|
840 genlist=" $(look_for_rwanted | tr '\n' ' ') "
|
gokhlayeh@186
|
841 for i in $(look_for_cookopt genpkg | tac); do
|
gokhlayeh@186
|
842 [ "${genlist/ $i }" = "$genlist" ] && continue
|
gokhlayeh@186
|
843 genlist=" $i${genlist/ $i / }"
|
pascal@156
|
844 done
|
gokhlayeh@215
|
845 if [ "$genlist" ]; then
|
gokhlayeh@215
|
846 local PACKAGE SOURCE VERSION EXTRAVERSION CATEGORY SHORT_DESC \
|
gokhlayeh@215
|
847 MAINTAINER WEB_SITE WGET_URL DEPENDS BUILD_DEPENDS WANTED \
|
gokhlayeh@215
|
848 PACKED_SIZE UNPACKED_SIZE COOK_OPT PROVIDE CONFIG_FILES TAGS \
|
gokhlayeh@298
|
849 src _pkg DESTDIR CONFIG_SITE RECEIPT LOG stuff wanted_stuff
|
gokhlayeh@215
|
850 for PACKAGE in $genlist; do
|
gokhlayeh@215
|
851 set_common_path
|
gokhlayeh@215
|
852 gen_package
|
gokhlayeh@215
|
853 done
|
gokhlayeh@215
|
854 fi
|
pascal@156
|
855 }
|
pascal@156
|
856
|
MikeDSmith25@82
|
857 # Copy all generic files (locale, pixmaps, .desktop). We use standard paths,
|
pankso@22
|
858 # so some packages need to copy these files with the receipt and genpkg_rules.
|
pankso@22
|
859 # This function is executed by gen_package when 'tazwok genpkg'.
|
pankso@22
|
860 copy_generic_files()
|
pankso@22
|
861 {
|
MikeDSmith25@82
|
862 # In most cases, locales are in $_pkg/usr/share/locale so we copy files
|
pankso@22
|
863 # using generic variables and $LOCALE from Tazwok config file.
|
gokhlayeh@186
|
864 if [ "$LOCALE" ]; then
|
pankso@22
|
865 if [ -d "$_pkg/usr/share/locale" ]; then
|
pankso@22
|
866 for i in $LOCALE
|
pankso@22
|
867 do
|
pankso@37
|
868 if [ -d "$_pkg/usr/share/locale/$i" ]; then
|
pankso@37
|
869 mkdir -p $fs/usr/share/locale
|
pankso@37
|
870 cp -a $_pkg/usr/share/locale/$i $fs/usr/share/locale
|
pankso@37
|
871 fi
|
pankso@22
|
872 done
|
pankso@22
|
873 fi
|
pankso@22
|
874 fi
|
gokhlayeh@186
|
875
|
pankso@133
|
876 # Pixmaps (PNG or/and XPM only). Some icons/images can be added through
|
MikeDSmith25@82
|
877 # genpkg_rules and generic copy can be disabled with GENERIC_PIXMAPS="no"
|
pankso@31
|
878 # in pkg receipt.
|
gokhlayeh@186
|
879 if [ "$GENERIC_PIXMAPS" != "no" ]; then
|
pankso@22
|
880 if [ -d "$_pkg/usr/share/pixmaps" ]; then
|
pankso@27
|
881 mkdir -p $fs/usr/share/pixmaps
|
pankso@31
|
882 cp -a $_pkg/usr/share/pixmaps/$PACKAGE.png \
|
pankso@31
|
883 $fs/usr/share/pixmaps 2>/dev/null
|
pankso@31
|
884 cp -a $_pkg/usr/share/pixmaps/$PACKAGE.xpm \
|
pankso@22
|
885 $fs/usr/share/pixmaps 2>/dev/null
|
pankso@23
|
886 fi
|
gokhlayeh@186
|
887
|
MikeDSmith25@82
|
888 # Custom or homemade PNG pixmap can be in stuff.
|
pankso@23
|
889 if [ -f "stuff/$PACKAGE.png" ]; then
|
pankso@27
|
890 mkdir -p $fs/usr/share/pixmaps
|
pankso@23
|
891 cp -a stuff/$PACKAGE.png $fs/usr/share/pixmaps
|
pankso@22
|
892 fi
|
pankso@22
|
893 fi
|
gokhlayeh@186
|
894
|
pankso@22
|
895 # Desktop entry (.desktop).
|
pankso@22
|
896 if [ -d "$_pkg/usr/share/applications" ]; then
|
pankso@22
|
897 cp -a $_pkg/usr/share/applications $fs/usr/share
|
pankso@23
|
898 fi
|
gokhlayeh@186
|
899
|
MikeDSmith25@82
|
900 # Homemade desktop file(s) can be in stuff.
|
pankso@34
|
901 if [ -d "stuff/applications" ]; then
|
pankso@42
|
902 mkdir -p $fs/usr/share
|
pankso@42
|
903 cp -a stuff/applications $fs/usr/share
|
pankso@34
|
904 fi
|
pankso@34
|
905 if [ -f "stuff/$PACKAGE.desktop" ]; then
|
pankso@42
|
906 mkdir -p $fs/usr/share/applications
|
pankso@42
|
907 cp -a stuff/$PACKAGE.desktop $fs/usr/share/applications
|
pankso@22
|
908 fi
|
pankso@22
|
909 }
|
pankso@22
|
910
|
pankso@25
|
911 # Find and strip : --strip-all (-s) or --strip-debug on static libs.
|
pankso@25
|
912 strip_package()
|
pankso@25
|
913 {
|
gokhlayeh@186
|
914 report step "Executing strip on all files"
|
gokhlayeh@186
|
915
|
pankso@25
|
916 # Binaries.
|
pankso@25
|
917 for dir in $fs/bin $fs/sbin $fs/usr/bin $fs/usr/sbin $fs/usr/games
|
pankso@25
|
918 do
|
pankso@25
|
919 if [ -d "$dir" ]; then
|
pankso@25
|
920 find $dir -type f -exec strip -s '{}' 2>/dev/null \;
|
pankso@25
|
921 fi
|
pankso@25
|
922 done
|
gokhlayeh@186
|
923
|
pankso@25
|
924 # Libraries.
|
pankso@25
|
925 find $fs -name "*.so*" -exec strip -s '{}' 2>/dev/null \;
|
pankso@25
|
926 find $fs -name "*.a" -exec strip --strip-debug '{}' 2>/dev/null \;
|
gokhlayeh@186
|
927 report end-step
|
pankso@25
|
928 }
|
pankso@25
|
929
|
slaxemulator@183
|
930 # Remove .pyc and .pyo files from packages
|
slaxemulator@183
|
931 py_compiled_files_remove()
|
slaxemulator@183
|
932 {
|
gokhlayeh@186
|
933 report step "Removing all .pyc and .pyo files from package ..."
|
slaxemulator@183
|
934 find $fs -type f -name "*.pyc" -delete 2>/dev/null
|
slaxemulator@183
|
935 find $fs -type f -name "*.pyo" -delete 2>/dev/null
|
gokhlayeh@186
|
936 report end-step
|
slaxemulator@183
|
937 }
|
slaxemulator@183
|
938
|
pankso@135
|
939 # Check FSH in a slitaz package (Path: /:/usr)
|
pankso@135
|
940 check_fsh()
|
pankso@135
|
941 {
|
pankso@135
|
942 cd $WOK/$PACKAGE/taz/*/fs
|
pascal@389
|
943 if [ -z "$(find * -type f)" ] && [ "$CATEGORY" != meta ]; then
|
gokhlayeh@381
|
944 echo "$PACKAGE fs is empty." >&2
|
gokhlayeh@381
|
945 cd $WOK/$PACKAGE && rm -rf taz
|
gokhlayeh@381
|
946 return 1
|
gokhlayeh@381
|
947 fi
|
pascal@149
|
948 [ -n "$FSH" ] || FSH="bin boot dev etc home init lib media mnt proc \
|
pascal@149
|
949 root sbin share sys tmp usr var vz usr/bin usr/games usr/include usr/lib \
|
pascal@149
|
950 usr/local usr/sbin usr/share usr/src"
|
pankso@135
|
951 for i in `ls -d * usr/* 2>/dev/null`
|
pankso@135
|
952 do
|
gokhlayeh@195
|
953 if ! echo $FSH | fgrep -q $i; then
|
gokhlayeh@186
|
954 echo "Wrong path: /$i" >&2
|
pankso@135
|
955 error=1
|
pankso@135
|
956 fi
|
pankso@135
|
957 done
|
pankso@135
|
958 if [ "$error" = "1" ]; then
|
pankso@135
|
959 cat << _EOT_
|
pankso@135
|
960
|
paul@155
|
961 Package will install files in a non standard directory and won't be generated.
|
paul@154
|
962 You may have a wrong copy path in genpkg_rules or need to add some options to
|
pankso@135
|
963 configure in compile_rules. Some valid options for SliTaz (Linux FSH):
|
pankso@135
|
964
|
pankso@135
|
965 --prefix=/usr
|
pankso@135
|
966 --sysconfdir=/etc
|
pankso@135
|
967 --libexecdir=/usr/lib/(pkgname)
|
pankso@135
|
968 --localstatedir=/var
|
pankso@135
|
969 --mandir=/usr/share/man
|
pankso@135
|
970 --infodir=/usr/share/info
|
pankso@135
|
971
|
paul@152
|
972 For more information please read SliTaz docs and run: ./configure --help
|
pankso@135
|
973 ================================================================================
|
pankso@135
|
974 $PACKAGE package generation aborted.
|
pankso@135
|
975
|
pankso@135
|
976 _EOT_
|
gokhlayeh@186
|
977
|
pankso@135
|
978 # Dont generate a corrupted package.
|
pankso@137
|
979 cd $WOK/$PACKAGE && rm -rf taz
|
gokhlayeh@381
|
980 return 1
|
pankso@135
|
981 fi
|
gokhlayeh@381
|
982 return 0
|
gokhlayeh@186
|
983 }
|
gokhlayeh@186
|
984
|
gokhlayeh@186
|
985 gen_cookmd5()
|
gokhlayeh@186
|
986 {
|
gokhlayeh@186
|
987 # md5sum of cooking stuff make tazwok able to check for changes
|
gokhlayeh@186
|
988 # without hg.
|
gokhlayeh@186
|
989 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
990 md5sum receipt > md5
|
gokhlayeh@186
|
991 [ -f description.txt ] && md5sum description.txt >> md5
|
gokhlayeh@186
|
992 if [ -d stuff ]; then
|
gokhlayeh@186
|
993 find stuff | while read file; do
|
gokhlayeh@186
|
994 md5sum $file >> md5
|
gokhlayeh@186
|
995 done
|
gokhlayeh@186
|
996 fi
|
pankso@135
|
997 }
|
pankso@135
|
998
|
gokhlayeh@381
|
999 set_pkg_broken()
|
gokhlayeh@381
|
1000 {
|
gokhlayeh@405
|
1001 grep -q ^$PACKAGE$ $broken || echo $PACKAGE >> $broken
|
gokhlayeh@381
|
1002
|
gokhlayeh@381
|
1003 # Remove pkg from cooklist to avoid re-cook it if no changes happens
|
gokhlayeh@381
|
1004 # in the cook stuff.
|
gokhlayeh@405
|
1005 sed "/^$PACKAGE$/d" -i $cooklist $commit
|
gokhlayeh@381
|
1006
|
gokhlayeh@381
|
1007 gen_cookmd5
|
gokhlayeh@381
|
1008
|
gokhlayeh@381
|
1009 # Return 1 to make report know that's mother-function failed.
|
gokhlayeh@381
|
1010 return 1
|
gokhlayeh@381
|
1011 }
|
gokhlayeh@381
|
1012
|
MikeDSmith25@82
|
1013 # Create a package tree and build the gziped cpio archive
|
pankso@7
|
1014 # to make a SliTaz (.tazpkg) package.
|
pankso@7
|
1015 gen_package()
|
pankso@7
|
1016 {
|
pankso@7
|
1017 check_root
|
pankso@7
|
1018 check_for_package_on_cmdline
|
pankso@7
|
1019 check_for_receipt
|
gokhlayeh@381
|
1020 source_receipt
|
gokhlayeh@186
|
1021
|
pascal@86
|
1022 # May compute VERSION
|
pascal@86
|
1023 if grep -q ^get_version $RECEIPT; then
|
pascal@86
|
1024 get_version
|
pascal@86
|
1025 fi
|
pankso@7
|
1026 check_for_wanted
|
pankso@7
|
1027 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
1028
|
pankso@7
|
1029 # Remove old Tazwok package files.
|
gokhlayeh@186
|
1030 [ -d "taz" ] && rm -rf taz
|
gokhlayeh@186
|
1031
|
MikeDSmith25@82
|
1032 # Create the package tree and set useful variables.
|
gokhlayeh@266
|
1033 fs=$WOK/$PACKAGE/taz/$PACKAGE-$VERSION/fs
|
gokhlayeh@381
|
1034 mkdir -p $fs
|
gokhlayeh@186
|
1035
|
MikeDSmith25@82
|
1036 # Set $src for standard package and $_pkg variables.
|
gokhlayeh@302
|
1037 set_src_path
|
gokhlayeh@302
|
1038 set_pkg_path
|
gokhlayeh@186
|
1039
|
pankso@135
|
1040 # Execute genpkg_rules, check package and copy generic files to build
|
pankso@135
|
1041 # the package.
|
gokhlayeh@186
|
1042 report step "Building $PACKAGE with the receipt"
|
gokhlayeh@186
|
1043 report open-bloc
|
gokhlayeh@381
|
1044 if look_for_cookopt !fs; then
|
gokhlayeh@381
|
1045 :
|
gokhlayeh@381
|
1046 elif grep -q ^genpkg_rules $RECEIPT; then
|
gokhlayeh@186
|
1047
|
pankso@7
|
1048 # Log process.
|
pankso@7
|
1049 echo "executing genpkg_rules" >> $LOG
|
gokhlayeh@186
|
1050 report step "Executing genpkg_rules"
|
gokhlayeh@381
|
1051 ( set -e; genpkg_rules ) || { set_pkg_broken; report close-bloc; return 1; }
|
gokhlayeh@381
|
1052 check_fsh || { set_pkg_broken; report close-bloc; return 1; }
|
gokhlayeh@381
|
1053 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
1054 report end-step
|
gokhlayeh@381
|
1055
|
pankso@133
|
1056 # Skip generic files for packages with a WANTED variable
|
pankso@24
|
1057 # (dev and splited pkgs).
|
gokhlayeh@186
|
1058 if [ ! "$WANTED" ]; then
|
pankso@24
|
1059 copy_generic_files
|
pankso@24
|
1060 fi
|
gokhlayeh@204
|
1061 look_for_cookopt !strip || strip_package
|
slaxemulator@183
|
1062 py_compiled_files_remove
|
pankso@7
|
1063 else
|
gokhlayeh@186
|
1064 echo "No package rules to gen $PACKAGE..." >&2
|
gokhlayeh@381
|
1065 set_pkg_broken
|
gokhlayeh@381
|
1066 report close-bloc
|
gokhlayeh@381
|
1067 return 1
|
pankso@7
|
1068 fi
|
gokhlayeh@186
|
1069
|
paul@154
|
1070 # Copy the receipt and description (if exists) into the binary package tree.
|
pankso@7
|
1071 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
1072 report step "Copying the receipt"
|
pankso@7
|
1073 cp receipt taz/$PACKAGE-$VERSION
|
gokhlayeh@186
|
1074 report end-step
|
pascal@89
|
1075 if grep -q ^get_version $RECEIPT; then
|
gokhlayeh@186
|
1076 report step "Updating version in receipt"
|
pascal@89
|
1077 sed -i "s/^VERSION=.*/VERSION=\"$VERSION\"/" \
|
pascal@89
|
1078 taz/$PACKAGE-$VERSION/receipt
|
gokhlayeh@186
|
1079 report end-step
|
pascal@89
|
1080 fi
|
pankso@7
|
1081 if [ -f "description.txt" ]; then
|
gokhlayeh@186
|
1082 report step "Copying the description file"
|
pankso@7
|
1083 cp description.txt taz/$PACKAGE-$VERSION
|
gokhlayeh@186
|
1084 report end-step
|
pankso@7
|
1085 fi
|
gokhlayeh@186
|
1086
|
gokhlayeh@186
|
1087 # Generate md5 of cooking stuff to look for commit later.
|
gokhlayeh@186
|
1088 gen_cookmd5
|
gokhlayeh@186
|
1089 echo -e "\n# md5sum of cooking stuff :" >> taz/$PACKAGE-$VERSION/receipt
|
gokhlayeh@186
|
1090 cat md5 | sed 's/^/# /' >> taz/$PACKAGE-$VERSION/receipt
|
gokhlayeh@186
|
1091
|
MikeDSmith25@82
|
1092 # Create the files.list by redirecting find output.
|
gokhlayeh@186
|
1093 report step "Creating the list of files"
|
pascal@15
|
1094 cd taz/$PACKAGE-$VERSION
|
pascal@13
|
1095 LAST_FILE=""
|
gokhlayeh@195
|
1096 { find fs -print; echo; } | while read file; do
|
gokhlayeh@186
|
1097 if [ "$LAST_FILE" ]; then
|
pascal@15
|
1098 case "$file" in
|
pascal@13
|
1099 $LAST_FILE/*)
|
pankso@133
|
1100 case "$(ls -ld "$LAST_FILE")" in
|
pascal@15
|
1101 drwxr-xr-x\ *\ root\ *\ root\ *);;
|
pascal@15
|
1102 *) echo ${LAST_FILE#fs};;
|
pascal@13
|
1103 esac;;
|
pascal@15
|
1104 *) echo ${LAST_FILE#fs};;
|
pascal@13
|
1105 esac
|
pascal@13
|
1106 fi
|
pascal@15
|
1107 LAST_FILE="$file"
|
pascal@15
|
1108 done > files.list
|
gokhlayeh@186
|
1109
|
gokhlayeh@186
|
1110 # Next, check if something has changed in lib files.
|
gokhlayeh@215
|
1111 if fgrep -q '.so' files.list; then
|
gokhlayeh@215
|
1112 for rep in $INCOMING_REPOSITORY $PACKAGES_REPOSITORY \
|
gokhlayeh@295
|
1113 $([ "$undigest" ] && echo $SLITAZ_DIR/$SLITAZ_VERSION/packages-incoming && \
|
gokhlayeh@215
|
1114 echo $SLITAZ_DIR/$SLITAZ_VERSION/packages); do
|
gokhlayeh@215
|
1115 prev_VERSION=$(get_pkg_version $rep)
|
gokhlayeh@215
|
1116 [ "$prev_VERSION" ] && pkg_file=$rep/$PACKAGE-$prev_VERSION.tazpkg && break
|
gokhlayeh@215
|
1117 done
|
gokhlayeh@215
|
1118 if [ "$pkg_file" ]; then
|
gokhlayeh@295
|
1119 report step "Look for major/minor update in libraries"
|
gokhlayeh@215
|
1120 get_pkg_files $pkg_file
|
gokhlayeh@215
|
1121 cd $WOK/$PACKAGE/taz/$PACKAGE-$VERSION
|
gokhlayeh@215
|
1122 fgrep ".so" files.list | egrep -v "[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*" | \
|
gokhlayeh@215
|
1123 while read lib; do
|
gokhlayeh@215
|
1124 fgrep -q "$lib" $pkg_files_dir/files.list && continue
|
gokhlayeh@215
|
1125 echo "A minor/major update in libraries is detected, planning re-cook of reverse-depends of $PACKAGE."
|
gokhlayeh@215
|
1126 for rdep in $(scan $PACKAGE --look_for=rdep | use_wanted); do
|
gokhlayeh@215
|
1127 [ "$rdep" = "${WANTED:-$PACKAGE}" ] && continue
|
gokhlayeh@405
|
1128 grep -q ^$rdep$ $blocked $cooklist && continue
|
gokhlayeh@405
|
1129 echo $rdep >> $cooklist
|
gokhlayeh@215
|
1130 done
|
gokhlayeh@215
|
1131 regen_cooklist=yes
|
gokhlayeh@215
|
1132 break
|
gokhlayeh@215
|
1133 done
|
gokhlayeh@215
|
1134 rm -r $pkg_files_dir
|
gokhlayeh@295
|
1135 unset pkg_file
|
gokhlayeh@295
|
1136 report end-step
|
gokhlayeh@295
|
1137 fi
|
gokhlayeh@295
|
1138 fi
|
gokhlayeh@186
|
1139 if [ ! "$EXTRAVERSION" ]; then
|
pascal@84
|
1140 case "$PACKAGE" in
|
pascal@84
|
1141 linux*);;
|
pascal@85
|
1142 *) EXTRAVERSION="$(grep '/lib/modules/.*-slitaz/' files.list |\
|
pascal@84
|
1143 head -1 | sed 's|/lib/modules/\(.*\)-slitaz/.*|_\1|')";;
|
pascal@84
|
1144 esac
|
pascal@84
|
1145 fi
|
gokhlayeh@186
|
1146 rm -f $INCOMING_REPOSITORY/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg 2> /dev/null
|
gokhlayeh@186
|
1147 report step "Creating md5sum of files"
|
pascal@70
|
1148 while read file; do
|
pascal@71
|
1149 [ -L "fs$file" ] && continue
|
pascal@71
|
1150 [ -f "fs$file" ] || continue
|
pascal@71
|
1151 md5sum "fs$file" | sed 's/ fs/ /'
|
pascal@70
|
1152 done < files.list > md5sum
|
gokhlayeh@204
|
1153 report end-step
|
pascal@84
|
1154 UNPACKED_SIZE=$(du -chs fs receipt files.list md5sum description.txt \
|
pascal@84
|
1155 2> /dev/null | awk '{ sz=$1 } END { print sz }')
|
gokhlayeh@186
|
1156
|
pankso@7
|
1157 # Build cpio archives. Find, cpio and gzip the fs, finish by
|
pankso@7
|
1158 # removing the fs tree.
|
gokhlayeh@186
|
1159 # Don't log this because compression always output error messages.
|
pascal@150
|
1160 find fs -print | cpio -o -H newc | case "$PACKAGE-$COMPRESSION" in
|
pascal@150
|
1161 tazpkg-lzma) gzip > fs.cpio.gz;;
|
pascal@150
|
1162 *-lzma) lzma e fs.cpio.lzma -si;;
|
pascal@150
|
1163 *) gzip > fs.cpio.gz;;
|
pascal@150
|
1164 esac && rm -rf fs
|
pascal@150
|
1165 PACKED_SIZE=$(du -chs fs.cpio.* receipt files.list md5sum \
|
pascal@84
|
1166 description.txt 2> /dev/null | awk '{ sz=$1 } END { print sz }')
|
gokhlayeh@186
|
1167 report step "Updating receipt sizes"
|
pascal@138
|
1168 sed -i '/^PACKED_SIZE/d' receipt
|
pascal@138
|
1169 sed -i '/^UNPACKED_SIZE/d' receipt
|
pascal@59
|
1170 sed -i "s/^PACKAGE=/PACKED_SIZE=\"$PACKED_SIZE\"\nUNPACKED_SIZE=\"$UNPACKED_SIZE\"\nPACKAGE=/" receipt
|
pascal@86
|
1171 sed -i "s/^VERSION=$/VERSION=\"$VERSION\"/" receipt
|
gokhlayeh@212
|
1172 report end-step
|
gokhlayeh@212
|
1173 if [ "$EXTRAVERSION" ]; then
|
gokhlayeh@186
|
1174 report step "Updating receipt EXTRAVERSION"
|
pascal@72
|
1175 sed -i s/^EXTRAVERSION.*$// receipt
|
pascal@72
|
1176 sed -i "s/^VERSION=/EXTRAVERSION=\"$EXTRAVERSION\"\nVERSION=/" receipt
|
pascal@72
|
1177 fi
|
gokhlayeh@186
|
1178 prev_VERSION=$(get_pkg_version $INCOMING_REPOSITORY)
|
gokhlayeh@186
|
1179 remove_previous_package $INCOMING_REPOSITORY
|
gokhlayeh@186
|
1180 report step "Creating full cpio archive"
|
gokhlayeh@186
|
1181 find . -print | cpio -o -H newc > $INCOMING_REPOSITORY/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg
|
gokhlayeh@186
|
1182
|
paul@154
|
1183 # Restore package tree in case we want to browse it.
|
gokhlayeh@186
|
1184 report step "Restoring original package tree"
|
gokhlayeh@195
|
1185 { zcat fs.cpio.gz 2> /dev/null || unlzma -c fs.cpio.lzma; } | cpio --quiet -id
|
pascal@150
|
1186 rm fs.cpio.* && cd ..
|
gokhlayeh@383
|
1187
|
gokhlayeh@383
|
1188 # Recook of reverse-depends if package was broken.
|
gokhlayeh@405
|
1189 if grep -q "^$PACKAGE$" $broken; then
|
gokhlayeh@383
|
1190 report step "Planning re-try a cook of reverse depends"
|
gokhlayeh@405
|
1191 sed "/^$PACKAGE$/d" -i $broken
|
gokhlayeh@383
|
1192 for rdep in $(look_for_rdep); do
|
gokhlayeh@405
|
1193 grep -q "^$rdep$" $broken || continue
|
gokhlayeh@405
|
1194 grep -q "^$rdep$" $cooklist && continue
|
gokhlayeh@383
|
1195 echo "Adding $rdep to the cooklist"
|
gokhlayeh@405
|
1196 echo $rdep >> $cooklist
|
gokhlayeh@383
|
1197 regen_cooklist=t
|
gokhlayeh@383
|
1198 done
|
gokhlayeh@383
|
1199 report end-step
|
gokhlayeh@383
|
1200 fi
|
gokhlayeh@405
|
1201 sed "/^$PACKAGE$/d" -i $commit $cooklist
|
gokhlayeh@186
|
1202
|
pankso@7
|
1203 # Log process.
|
pascal@69
|
1204 echo "$PACKAGE-$VERSION$EXTRAVERSION.tazpkg (done)" >> $LOG
|
gokhlayeh@186
|
1205 report close-bloc
|
pascal@68
|
1206 echo "Package $PACKAGE ($VERSION$EXTRAVERSION) generated."
|
gokhlayeh@186
|
1207 echo "Size : `du -sh $INCOMING_REPOSITORY/$PACKAGE-$VERSION$EXTRAVERSION.tazpkg`"
|
pankso@7
|
1208 echo ""
|
pankso@7
|
1209 }
|
pankso@7
|
1210
|
gokhlayeh@186
|
1211 ########################################################################
|
gokhlayeh@186
|
1212 # This section contains functions used by several other functions
|
gokhlayeh@186
|
1213 # bellow.
|
gokhlayeh@186
|
1214 ########################
|
gokhlayeh@186
|
1215
|
gokhlayeh@186
|
1216 # Look for receipt/files.list in wok. If they can't be found, get them
|
gokhlayeh@186
|
1217 # from package. Accept one argument : absolute path to package.
|
gokhlayeh@186
|
1218 get_pkg_files()
|
pankso@28
|
1219 {
|
gokhlayeh@186
|
1220 pkg_files_dir=$tmp/$(basename ${1%.tazpkg})
|
gokhlayeh@186
|
1221 mkdir -p $pkg_files_dir && \
|
gokhlayeh@186
|
1222 cd $pkg_files_dir && \
|
gokhlayeh@186
|
1223 cpio --quiet -idm receipt < $1 && \
|
gokhlayeh@186
|
1224 cpio --quiet -idm files.list < $1
|
gokhlayeh@186
|
1225 }
|
gokhlayeh@170
|
1226
|
gokhlayeh@186
|
1227 ########################################################################
|
gokhlayeh@204
|
1228 # This section contains functions to generate packages databases.
|
gokhlayeh@186
|
1229 ########################
|
gokhlayeh@186
|
1230
|
gokhlayeh@186
|
1231
|
gokhlayeh@186
|
1232 gen_packages_db()
|
gokhlayeh@186
|
1233 {
|
gokhlayeh@186
|
1234 # pkg_repository can be $PACKAGES_REPOSITORY or $INCOMING_REPOSITORY.
|
gokhlayeh@204
|
1235 [ "$pkg_repository" ] || pkg_repository=$PACKAGES_REPOSITORY
|
gokhlayeh@186
|
1236 cd $pkg_repository
|
gokhlayeh@204
|
1237 report step "Generating packages lists: $pkg_repository"
|
gokhlayeh@204
|
1238 report open-bloc
|
gokhlayeh@204
|
1239 report step "Removing old files"
|
gokhlayeh@204
|
1240 for file in files.list.lzma packages.list packages.txt \
|
gokhlayeh@204
|
1241 packages.desc packages.equiv packages.md5; do
|
gokhlayeh@415
|
1242 rm -rf $file
|
gokhlayeh@204
|
1243 done
|
gokhlayeh@204
|
1244 touch files.list
|
gokhlayeh@204
|
1245
|
gokhlayeh@186
|
1246 packages_db_start
|
gokhlayeh@186
|
1247 unset RECEIPT
|
gokhlayeh@186
|
1248 report step "Reading datas from all packages"
|
gokhlayeh@195
|
1249 for pkg in $(echo $pkg_repository/*.tazpkg | fgrep -v '*'); do
|
gokhlayeh@186
|
1250 get_packages_info
|
gokhlayeh@186
|
1251 done
|
gokhlayeh@186
|
1252 report end-step
|
gokhlayeh@186
|
1253 packages_db_end
|
gokhlayeh@204
|
1254 report close-bloc
|
gokhlayeh@186
|
1255 }
|
gokhlayeh@186
|
1256
|
gokhlayeh@186
|
1257 update_packages_db()
|
gokhlayeh@186
|
1258 {
|
gokhlayeh@204
|
1259 [ "$pkg_repository" ] || pkg_repository=$PACKAGES_REPOSITORY
|
gokhlayeh@186
|
1260 cd $pkg_repository
|
gokhlayeh@204
|
1261 for file in packages.list packages.equiv packages.md5 packages.desc \
|
gokhlayeh@204
|
1262 packages.txt; do
|
gokhlayeh@186
|
1263 if [ ! -f "$file" ]; then
|
gokhlayeh@204
|
1264 gen_packages_db
|
gokhlayeh@186
|
1265 return
|
gokhlayeh@170
|
1266 fi
|
gokhlayeh@170
|
1267 done
|
gokhlayeh@186
|
1268 if [ -f files.list.lzma ]; then
|
gokhlayeh@186
|
1269 lzma d files.list.lzma files.list
|
gokhlayeh@186
|
1270 else
|
gokhlayeh@204
|
1271 gen_packages_db
|
gokhlayeh@186
|
1272 fi
|
gokhlayeh@204
|
1273 report step "Updating packages lists: $pkg_repository"
|
gokhlayeh@186
|
1274 packages_db_start
|
gokhlayeh@412
|
1275
|
gokhlayeh@186
|
1276 # Look for removed/update packages.
|
gokhlayeh@412
|
1277 touch stamp -r packages.list
|
gokhlayeh@186
|
1278 for PACKAGE in $(grep ^[0-9,a-z,A-Z] packages.txt); do
|
gokhlayeh@202
|
1279 pkg="$pkg_repository/$(grep -m1 ^$PACKAGE- packages.list).tazpkg"
|
gokhlayeh@195
|
1280 if ! [ -f "$pkg" ]; then
|
gokhlayeh@186
|
1281 erase_package_info
|
gokhlayeh@186
|
1282 else
|
gokhlayeh@412
|
1283 if [ "$pkg" -nt "stamp" ]; then
|
gokhlayeh@215
|
1284 updated_pkg="$updated_pkg
|
gokhlayeh@215
|
1285 $PACKAGE $pkg"
|
gokhlayeh@266
|
1286 elif [ ! -f $WOK/$PACKAGE/receipt ] && \
|
gokhlayeh@266
|
1287 [ "$COMMAND" = check-incoming -o "$pkg_repository" = "$INCOMING_REPOSITORY" ]; then
|
gokhlayeh@266
|
1288 erase_package_info
|
gokhlayeh@415
|
1289 echo "Removing $PACKAGE from $pkg_repository."
|
gokhlayeh@266
|
1290 rm $pkg
|
gokhlayeh@415
|
1291 rm -rf $WOK/$PACKAGE
|
gokhlayeh@397
|
1292 sed "/^$PACKAGE\t/d" -i $wan_db $dep_db $cookorder
|
gokhlayeh@405
|
1293 sed "/^$PACKAGE$/d" -i $cooklist $commit $blocked $broken
|
gokhlayeh@415
|
1294 rm -f $LOCAL_REPOSITORY/log/$PACKAGE.html
|
gokhlayeh@352
|
1295 if [ "$pkg_repository" = "$INCOMING_REPOSITORY" ] && \
|
gokhlayeh@397
|
1296 [ "$(sed 1!d $cookorder)" != "#PlanSort" ] ; then
|
gokhlayeh@397
|
1297 sed 1i"#PlanSort" -i $cookorder
|
gokhlayeh@266
|
1298 regen_cooklist=yes
|
gokhlayeh@266
|
1299 else
|
gokhlayeh@415
|
1300 echo "$PACKAGE" >> removed
|
gokhlayeh@415
|
1301 sed -n '1,10p' -i removed
|
gokhlayeh@266
|
1302 fi
|
gokhlayeh@186
|
1303 fi
|
pascal@178
|
1304 fi
|
pascal@178
|
1305 done
|
gokhlayeh@412
|
1306 rm stamp
|
gokhlayeh@215
|
1307 echo "$updated_pkg" | sed 1d | while read PACKAGE pkg; do
|
gokhlayeh@202
|
1308 erase_package_info
|
gokhlayeh@202
|
1309 get_packages_info
|
gokhlayeh@202
|
1310 done
|
gokhlayeh@204
|
1311 unset updated_pkg
|
gokhlayeh@202
|
1312
|
gokhlayeh@186
|
1313 # Look for new packages.
|
gokhlayeh@415
|
1314 for pkg in $pkg_repository/*.tazpkg; do
|
gokhlayeh@415
|
1315 fgrep -q " ${pkg##*/}" packages.md5 || get_packages_info
|
gokhlayeh@186
|
1316 done
|
gokhlayeh@186
|
1317 report end-step
|
gokhlayeh@186
|
1318 packages_db_end
|
gokhlayeh@186
|
1319 }
|
gokhlayeh@186
|
1320
|
gokhlayeh@186
|
1321 packages_db_start()
|
gokhlayeh@186
|
1322 {
|
gokhlayeh@415
|
1323 if [ -s packages.txt ]; then
|
gokhlayeh@415
|
1324 sed -e 's/^# Packages :.*/# Packages : unknow/' \
|
gokhlayeh@415
|
1325 -e "s/# Date :.*/# Date : $(date +%Y-%m-%d\ \%H:%M:%S)/" \
|
gokhlayeh@415
|
1326 -i packages.txt
|
gokhlayeh@415
|
1327 else
|
gokhlayeh@186
|
1328 echo "# SliTaz GNU/Linux - Packages list
|
gokhlayeh@186
|
1329 #
|
gokhlayeh@186
|
1330 # Packages : unknow
|
gokhlayeh@186
|
1331 # Date : $(date +%Y-%m-%d\ \%H:%M:%S)
|
gokhlayeh@215
|
1332 #
|
gokhlayeh@215
|
1333 " > packages.txt
|
pascal@60
|
1334 fi
|
gokhlayeh@186
|
1335
|
gokhlayeh@186
|
1336 # Needed in some case as tazwok define RECEIPT at configuration time
|
gokhlayeh@186
|
1337 # in this particular case it can broke the script.
|
gokhlayeh@186
|
1338 unset RECEIPT
|
gokhlayeh@410
|
1339
|
gokhlayeh@410
|
1340 # If $packages_repository is the main one, configure few functions
|
gokhlayeh@410
|
1341 # to act as they should, without having loop on them (speed-up)
|
gokhlayeh@410
|
1342 if [ "${pkg_repository##*/}" = packages ]; then
|
gokhlayeh@410
|
1343 erase_package_info_extracmd="erase_package_info_main"
|
gokhlayeh@410
|
1344 get_packages_info_extracmd="erase_packages_info_main"
|
gokhlayeh@410
|
1345 fi
|
gokhlayeh@186
|
1346 }
|
pankso@28
|
1347
|
gokhlayeh@186
|
1348 erase_package_info()
|
gokhlayeh@186
|
1349 {
|
gokhlayeh@186
|
1350 cd $pkg_repository
|
gokhlayeh@186
|
1351 sed "/^$PACKAGE$/,/^$/d" -i packages.txt
|
gokhlayeh@186
|
1352 sed "/^$PACKAGE /d" -i packages.desc
|
gokhlayeh@186
|
1353 sed -e "s/=$PACKAGE /= /" -e "s/ $PACKAGE / /" -e "s/ $PACKAGE$//" \
|
gokhlayeh@186
|
1354 -e "/=$PACKAGE$/d" -e "s/=[0-9,a-z,A-Z]:$PACKAGE /= /" \
|
gokhlayeh@186
|
1355 -e "s/ [0-9,a-z,A-Z]:$PACKAGE / /" -e "s/ [0-9,a-z,A-Z]:$PACKAGE$/ /" \
|
gokhlayeh@186
|
1356 -e "/=[0-9,a-z,A-Z]:$PACKAGE$/d" \
|
gokhlayeh@186
|
1357 -i packages.equiv
|
gokhlayeh@186
|
1358 sed "/^$PACKAGE:/d" -i files.list
|
gokhlayeh@186
|
1359 sed "/^$(basename ${pkg%.tazpkg})$/d" -i packages.list
|
gokhlayeh@186
|
1360 sed "/ $(basename $pkg)$/d" -i packages.md5
|
gokhlayeh@410
|
1361 $erase_package_info_extracmd
|
gokhlayeh@410
|
1362 }
|
gokhlayeh@410
|
1363
|
gokhlayeh@410
|
1364 erase_package_info_main()
|
gokhlayeh@410
|
1365 {
|
gokhlayeh@409
|
1366 for i in wanted.txt depends.txt; do
|
gokhlayeh@399
|
1367 [ -f $i ] || continue
|
gokhlayeh@399
|
1368 sed "/^$PACKAGE\t/d" -i $i
|
gokhlayeh@399
|
1369 done
|
gokhlayeh@186
|
1370 }
|
gokhlayeh@186
|
1371
|
gokhlayeh@186
|
1372 get_packages_info()
|
gokhlayeh@186
|
1373 {
|
gokhlayeh@186
|
1374 # If there's no taz folder in the wok, extract infos from the
|
gokhlayeh@186
|
1375 # package.
|
gokhlayeh@186
|
1376 get_pkg_files $pkg
|
gokhlayeh@186
|
1377 source_receipt
|
gokhlayeh@186
|
1378 echo "Getting datas from $PACKAGE"
|
gokhlayeh@186
|
1379
|
gokhlayeh@186
|
1380 cat >> $pkg_repository/packages.txt << _EOT_
|
pankso@28
|
1381 $PACKAGE
|
gokhlayeh@186
|
1382 $VERSION$EXTRAVERSION
|
pankso@28
|
1383 $SHORT_DESC
|
pankso@28
|
1384 _EOT_
|
gokhlayeh@215
|
1385 if [ "$PACKED_SIZE" ]; then
|
gokhlayeh@215
|
1386 cat >> $pkg_repository/packages.txt << _EOT_
|
pankso@133
|
1387 $PACKED_SIZE ($UNPACKED_SIZE installed)
|
gokhlayeh@215
|
1388
|
pascal@60
|
1389 _EOT_
|
gokhlayeh@215
|
1390 else
|
gokhlayeh@215
|
1391 echo "" >> $pkg_repository/packages.txt
|
pascal@60
|
1392 fi
|
gokhlayeh@186
|
1393
|
paul@121
|
1394 # Packages.desc is used by Tazpkgbox <tree>.
|
gokhlayeh@186
|
1395 echo "$PACKAGE | $VERSION$EXTRAVERSION | $SHORT_DESC | $CATEGORY | $WEB_SITE" >> $pkg_repository/packages.desc
|
gokhlayeh@186
|
1396
|
paul@121
|
1397 # Packages.equiv is used by tazpkg install to check depends
|
pascal@99
|
1398 for i in $PROVIDE; do
|
pascal@99
|
1399 DEST=""
|
gokhlayeh@195
|
1400 echo $i | fgrep -q : && DEST="${i#*:}:"
|
gokhlayeh@186
|
1401 if grep -qs ^${i%:*}= $pkg_repository/packages.equiv; then
|
gokhlayeh@186
|
1402 sed -i "s/^${i%:*}=/${i%:*}=$DEST$PACKAGE /" $pkg_repository/packages.equiv
|
pascal@99
|
1403 else
|
gokhlayeh@186
|
1404 echo "${i%:*}=$DEST$PACKAGE" >> $pkg_repository/packages.equiv
|
gokhlayeh@186
|
1405 fi
|
gokhlayeh@186
|
1406 done
|
gokhlayeh@186
|
1407
|
gokhlayeh@186
|
1408 if [ -f files.list ]; then
|
gokhlayeh@186
|
1409 { echo "$PACKAGE"; cat files.list; } | awk '
|
gokhlayeh@186
|
1410 BEGIN { name="" } { if (name == "") name=$0; else printf("%s: %s\n",name,$0); }' >> $pkg_repository/files.list
|
gokhlayeh@186
|
1411 fi
|
gokhlayeh@186
|
1412
|
gokhlayeh@186
|
1413 cd .. && rm -r "$pkg_files_dir"
|
gokhlayeh@186
|
1414
|
gokhlayeh@186
|
1415 cd $pkg_repository
|
gokhlayeh@186
|
1416 echo $(basename ${pkg%.tazpkg}) >> packages.list
|
gokhlayeh@410
|
1417 md5sum $(basename $pkg) >> packages.md5
|
gokhlayeh@410
|
1418 $get_packages_info_extracmd
|
gokhlayeh@410
|
1419 }
|
gokhlayeh@399
|
1420
|
gokhlayeh@410
|
1421 get_packages_info_main()
|
gokhlayeh@410
|
1422 {
|
gokhlayeh@410
|
1423 [ "$WANTED" ] && echo -e "$PACKAGE\t$WANTED" >> wanted.txt
|
gokhlayeh@410
|
1424 echo -e "$PACKAGE\t "$DEPENDS" \t "$BUILD_DEPENDS" " >> package.txt
|
gokhlayeh@186
|
1425 }
|
gokhlayeh@186
|
1426
|
gokhlayeh@186
|
1427 source_receipt()
|
gokhlayeh@186
|
1428 {
|
gokhlayeh@186
|
1429 unset PACKAGE SOURCE VERSION EXTRAVERSION CATEGORY SHORT_DESC \
|
gokhlayeh@186
|
1430 MAINTAINER WEB_SITE WGET_URL DEPENDS BUILD_DEPENDS WANTED \
|
gokhlayeh@186
|
1431 PACKED_SIZE UNPACKED_SIZE COOK_OPT PROVIDE CONFIG_FILES TAGS \
|
gokhlayeh@298
|
1432 src _pkg DESTDIR CONFIG_SITE BRANCH TARBALL stuff wanted_stuff
|
gokhlayeh@186
|
1433 . ${RECEIPT:-$PWD/receipt}
|
gokhlayeh@186
|
1434 }
|
gokhlayeh@186
|
1435
|
gokhlayeh@186
|
1436 packages_db_end()
|
gokhlayeh@186
|
1437 {
|
gokhlayeh@186
|
1438 cd $pkg_repository
|
gokhlayeh@186
|
1439 pkgs=$(wc -l packages.list | sed 's/ .*//')
|
gokhlayeh@186
|
1440 sed "s/# Packages : .*/# Packages : $pkgs/" -i packages.txt
|
gokhlayeh@186
|
1441
|
gokhlayeh@186
|
1442 # If lists was updated it's generally needed to sort them well.
|
gokhlayeh@186
|
1443 if ! sort -c packages.list 2> /dev/null; then
|
gokhlayeh@186
|
1444 report step "Sorting packages lists"
|
gokhlayeh@399
|
1445 files_list="packages.list packages.desc packages.equiv"
|
gokhlayeh@415
|
1446 [ "${pkg_repository##*/}" = packages ] && \
|
gokhlayeh@409
|
1447 files_list="$files_list wanted.txt depends.txt"
|
gokhlayeh@399
|
1448 for file in $files_list; do
|
gokhlayeh@186
|
1449 [ -f $file ] || continue
|
gokhlayeh@186
|
1450 sort -o $file $file
|
gokhlayeh@186
|
1451 done
|
gokhlayeh@399
|
1452 md5sum packages.md5 | cut -f1 -d' ' > ID
|
gokhlayeh@186
|
1453 report end-step
|
gokhlayeh@186
|
1454 fi
|
gokhlayeh@186
|
1455
|
gokhlayeh@186
|
1456 # Dont log this because lzma always output error.
|
gokhlayeh@186
|
1457 lzma e files.list files.list.lzma
|
gokhlayeh@204
|
1458 rm -f files.list
|
gokhlayeh@204
|
1459 [ -f packages.equiv ] || touch packages.equiv
|
gokhlayeh@186
|
1460 }
|
gokhlayeh@186
|
1461
|
gokhlayeh@186
|
1462 ########################################################################
|
gokhlayeh@186
|
1463 # This section contains functions to generate wok database.
|
gokhlayeh@186
|
1464 ########################
|
gokhlayeh@186
|
1465
|
gokhlayeh@186
|
1466 gen_wok_db()
|
gokhlayeh@186
|
1467 {
|
gokhlayeh@204
|
1468 report step "Generating wok database"
|
gokhlayeh@186
|
1469 report open-bloc
|
gokhlayeh@204
|
1470 report step "Removing old files"
|
gokhlayeh@397
|
1471 for file in $wan_db $dep_db $cookorder; do
|
gokhlayeh@204
|
1472 [ -f $file ] && rm $file
|
gokhlayeh@204
|
1473 done
|
gokhlayeh@186
|
1474 report step "Generating wok-wanted.txt"
|
gokhlayeh@204
|
1475 gen_wan_db
|
gokhlayeh@186
|
1476 report step "Generating wok-depends.txt"
|
gokhlayeh@204
|
1477 for PACKAGE in $(cut -f1 -d '|' $PACKAGES_REPOSITORY/packages.desc \
|
gokhlayeh@204
|
1478 $INCOMING_REPOSITORY/packages.desc | sort -u); do
|
gokhlayeh@186
|
1479 RECEIPT=$WOK/$PACKAGE/receipt
|
gokhlayeh@186
|
1480 if [ -s $RECEIPT ]; then
|
gokhlayeh@186
|
1481 source_receipt
|
gokhlayeh@186
|
1482 echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ' >> $dep_db
|
pankso@133
|
1483 fi
|
pascal@99
|
1484 done
|
gokhlayeh@215
|
1485 sort_db
|
gokhlayeh@204
|
1486 report close-bloc
|
pankso@28
|
1487 }
|
pankso@28
|
1488
|
gokhlayeh@204
|
1489 gen_wan_db()
|
pascal@91
|
1490 {
|
gokhlayeh@204
|
1491 for RECEIPT in $(fgrep -l WANTED $WOK/*/receipt); do
|
gokhlayeh@204
|
1492 WANTED=
|
gokhlayeh@204
|
1493 source $RECEIPT
|
gokhlayeh@204
|
1494 [ "$WANTED" ] || continue
|
gokhlayeh@204
|
1495 echo -e $PACKAGE"\t"$WANTED >> $tmp/wan_db
|
gokhlayeh@204
|
1496 done
|
gokhlayeh@215
|
1497 if ! [ -f $wan_db ] || [ "$(diff -q $tmp/wan_db $wan_db)" ]; then
|
gokhlayeh@204
|
1498 mv -f $tmp/wan_db $wan_db
|
gokhlayeh@204
|
1499 plan_regen_cookorder=yes
|
gokhlayeh@204
|
1500 else
|
gokhlayeh@204
|
1501 rm $tmp/wan_db
|
gokhlayeh@204
|
1502 fi
|
pascal@91
|
1503 }
|
pascal@91
|
1504
|
gokhlayeh@215
|
1505 update_wan_db()
|
gokhlayeh@215
|
1506 {
|
slaxemulator@326
|
1507 local PACKAGE=$PACKAGE
|
gokhlayeh@215
|
1508 for RECEIPT in $(fgrep WANTED $WOK/*/receipt | \
|
gokhlayeh@215
|
1509 fgrep $PACKAGE | cut -f1 -d ':'); do
|
gokhlayeh@215
|
1510 WANTED=
|
gokhlayeh@215
|
1511 source $RECEIPT
|
gokhlayeh@215
|
1512 [ "$WANTED" ] || continue
|
gokhlayeh@219
|
1513 wan_info=$(echo -e $PACKAGE"\t"$WANTED)
|
gokhlayeh@411
|
1514 [ "$wan_info" = "$(grep -m1 ^$PACKAGE$'\t' $wan_db 2>/dev/null)" ] && continue
|
gokhlayeh@215
|
1515 sed "/^$PACKAGE\t/d" -i $wan_db
|
gokhlayeh@220
|
1516 echo "$wan_info" >> $wan_db
|
gokhlayeh@215
|
1517 plan_regen_cookorder=yes
|
gokhlayeh@215
|
1518 plan_sort_wandb=yes
|
gokhlayeh@215
|
1519 done
|
gokhlayeh@215
|
1520 }
|
gokhlayeh@215
|
1521
|
gokhlayeh@204
|
1522 update_dep_db()
|
gokhlayeh@204
|
1523 {
|
gokhlayeh@204
|
1524 dep_info=$(echo -e $PACKAGE"\t "$DEPENDS" \t "$BUILD_DEPENDS' ')
|
gokhlayeh@215
|
1525 [ "$dep_info" = "$(grep -m1 ^$PACKAGE$'\t' $dep_db 2>/dev/null)" ] && return
|
gokhlayeh@204
|
1526 sed "/^$PACKAGE\t/d" -i $dep_db
|
gokhlayeh@204
|
1527 echo "$dep_info" >> $dep_db
|
gokhlayeh@204
|
1528 plan_regen_cookorder=yes
|
gokhlayeh@204
|
1529 plan_sort_depdb=yes
|
pascal@178
|
1530 }
|
pascal@178
|
1531
|
gokhlayeh@186
|
1532 sort_db()
|
pascal@178
|
1533 {
|
gokhlayeh@186
|
1534 report step "Generating cookorder.txt"
|
gokhlayeh@415
|
1535 sed 's/ \t / /' $dep_db | while read PACKAGE BUILD_DEPENDS; do
|
gokhlayeh@186
|
1536 grep -q ^$PACKAGE$'\t' $wan_db && continue
|
gokhlayeh@186
|
1537
|
gokhlayeh@186
|
1538 # Replace each BUILD_DEPENDS with a WANTED package by it's
|
gokhlayeh@186
|
1539 # WANTED package.
|
gokhlayeh@415
|
1540 echo -e $PACKAGE"\t $(echo $BUILD_DEPENDS | use_wanted | \
|
gokhlayeh@415
|
1541 sort -u | sed "/^$PACKAGE$/d" | tr '\n' ' ') "
|
gokhlayeh@186
|
1542 done > $tmp/db
|
gokhlayeh@186
|
1543 while [ -s "$tmp/db" ]; do
|
gokhlayeh@186
|
1544 status=start
|
gokhlayeh@186
|
1545 for pkg in $(cut -f 1 $tmp/db); do
|
gokhlayeh@195
|
1546 if ! fgrep -q ' '$pkg' ' $tmp/db; then
|
gokhlayeh@186
|
1547 echo $pkg >> $tmp/cookorder
|
gokhlayeh@186
|
1548 sed -e "/^$pkg\t/d" -e "s/ $pkg / /g" -i $tmp/db
|
gokhlayeh@186
|
1549 status=proceed
|
gokhlayeh@186
|
1550 fi
|
gokhlayeh@186
|
1551 done
|
gokhlayeh@186
|
1552 if [ "$status" = start ]; then
|
gokhlayeh@186
|
1553 cp -f $tmp/db /tmp/remain-depends.txt
|
gokhlayeh@186
|
1554 echo "Can't go further because there's depency(ies) loop(s). The remaining packages will be commentend in the cookorder and will be unbuild in case of major update until the problem is solved." >&2
|
gokhlayeh@415
|
1555 for remaining in $(cut -f 1 $tmp/db); do
|
gokhlayeh@415
|
1556 echo "$remaining" >> $blocked
|
gokhlayeh@186
|
1557 done
|
gokhlayeh@186
|
1558 break
|
gokhlayeh@186
|
1559 fi
|
gokhlayeh@186
|
1560 done
|
gokhlayeh@186
|
1561 [ -s $tmp/cookorder ] || touch $tmp/cookorder
|
gokhlayeh@186
|
1562
|
gokhlayeh@186
|
1563 # The toolchain packages are moved in first position.
|
gokhlayeh@186
|
1564 grep $(for pkg in `scan "$SLITAZ_TOOLCHAIN $SLITAZ_TOOLCHAIN_EXTRA" \
|
gokhlayeh@186
|
1565 --look_for=all --with_args`; do echo " -e ^$pkg$"; done) \
|
gokhlayeh@397
|
1566 $tmp/cookorder | tac > $cookorder
|
gokhlayeh@397
|
1567 for pkg in $(cat $cookorder); do
|
gokhlayeh@186
|
1568 sed "/^$pkg$/d" -i $tmp/cookorder
|
gokhlayeh@186
|
1569 done
|
gokhlayeh@186
|
1570
|
gokhlayeh@397
|
1571 tac $tmp/cookorder >> $cookorder
|
gokhlayeh@204
|
1572 unset plan_regen_cookorder
|
gokhlayeh@186
|
1573 report end-step
|
pascal@178
|
1574 }
|
pascal@178
|
1575
|
gokhlayeh@186
|
1576 ########################################################################
|
gokhlayeh@186
|
1577 # SCAN CORE
|
gokhlayeh@186
|
1578 ########################
|
gokhlayeh@186
|
1579 # Include various scan core-functions. It's not intended to be used
|
gokhlayeh@186
|
1580 # directly : prefer scan wrappers in next section.
|
gokhlayeh@186
|
1581
|
gokhlayeh@186
|
1582 look_for_dep()
|
gokhlayeh@186
|
1583 {
|
gokhlayeh@410
|
1584 grep -m1 ^$PACKAGE$'\t' $dep_db | cut -f 2
|
gokhlayeh@186
|
1585 }
|
gokhlayeh@186
|
1586
|
gokhlayeh@186
|
1587 look_for_bdep()
|
gokhlayeh@186
|
1588 {
|
gokhlayeh@186
|
1589 look_for_all
|
gokhlayeh@186
|
1590 }
|
gokhlayeh@186
|
1591
|
gokhlayeh@186
|
1592 look_for_all()
|
gokhlayeh@186
|
1593 {
|
gokhlayeh@410
|
1594 grep -m1 ^$PACKAGE$'\t' $dep_db | cut -f 2,3 | sed 's/ / /'
|
gokhlayeh@186
|
1595 }
|
gokhlayeh@186
|
1596
|
gokhlayeh@186
|
1597 look_for_rdep()
|
gokhlayeh@186
|
1598 {
|
gokhlayeh@399
|
1599 fgrep ' '$PACKAGE' ' $dep_db | cut -f 1
|
gokhlayeh@186
|
1600 }
|
gokhlayeh@186
|
1601
|
gokhlayeh@186
|
1602 look_for_rbdep()
|
gokhlayeh@186
|
1603 {
|
gokhlayeh@399
|
1604 fgrep ' '$PACKAGE' ' $dep_db | cut -f 1,3 | fgrep ' '$PACKAGE' ' | cut -f 1
|
gokhlayeh@186
|
1605 }
|
gokhlayeh@186
|
1606
|
gokhlayeh@186
|
1607 # Return WANTED if it exists.
|
gokhlayeh@186
|
1608 look_for_wanted()
|
gokhlayeh@186
|
1609 {
|
gokhlayeh@410
|
1610 grep -m1 ^$PACKAGE$'\t' $wan_db | cut -f 2
|
gokhlayeh@186
|
1611 }
|
gokhlayeh@186
|
1612
|
gokhlayeh@186
|
1613 # Return packages which wants PACKAGE.
|
gokhlayeh@186
|
1614 look_for_rwanted()
|
gokhlayeh@186
|
1615 {
|
gokhlayeh@399
|
1616 grep $'\t'$PACKAGE$ $wan_db | cut -f 1
|
gokhlayeh@186
|
1617 }
|
gokhlayeh@186
|
1618
|
gokhlayeh@186
|
1619 look_for_dev()
|
gokhlayeh@186
|
1620 {
|
gokhlayeh@223
|
1621 WANTED=$(look_for_wanted)
|
gokhlayeh@223
|
1622 if [ "$WANTED" ]; then
|
gokhlayeh@410
|
1623 [ -f "$WOK/$WANTED-dev/receipt" ] && echo $WANTED-dev
|
gokhlayeh@223
|
1624 fi
|
gokhlayeh@410
|
1625 [ -f "$WOK/$PACKAGE-dev/receipt" ] && echo $PACKAGE-dev
|
gokhlayeh@186
|
1626 }
|
gokhlayeh@186
|
1627
|
gokhlayeh@215
|
1628 with_dev()
|
gokhlayeh@215
|
1629 {
|
gokhlayeh@215
|
1630 for PACKAGE in $(cat); do
|
gokhlayeh@215
|
1631 echo $PACKAGE
|
gokhlayeh@215
|
1632 look_for_dev
|
gokhlayeh@215
|
1633 done
|
gokhlayeh@215
|
1634 }
|
gokhlayeh@215
|
1635
|
gokhlayeh@215
|
1636 with_wanted()
|
gokhlayeh@215
|
1637 {
|
gokhlayeh@215
|
1638 for PACKAGE in $(cat); do
|
gokhlayeh@215
|
1639 echo $PACKAGE
|
gokhlayeh@215
|
1640 look_for_wanted
|
gokhlayeh@215
|
1641 done
|
gokhlayeh@215
|
1642 }
|
gokhlayeh@215
|
1643
|
gokhlayeh@215
|
1644 use_wanted()
|
gokhlayeh@215
|
1645 {
|
gokhlayeh@410
|
1646 for input in $(cat); do
|
gokhlayeh@410
|
1647 { grep ^$input$'\t' $wan_db || echo $input
|
gokhlayeh@415
|
1648 }
|
gokhlayeh@415
|
1649 done | sed 's/.*\t//'
|
gokhlayeh@415
|
1650 }
|
gokhlayeh@415
|
1651
|
gokhlayeh@415
|
1652 check_for_pkg_in_wok()
|
gokhlayeh@415
|
1653 {
|
gokhlayeh@415
|
1654 [ -f $WOK/$PACKAGE/receipt ] && return
|
gokhlayeh@415
|
1655 echo "Can't find $PACKAGE in wok or mirror" >&2
|
gokhlayeh@415
|
1656 return 2
|
gokhlayeh@410
|
1657 }
|
gokhlayeh@410
|
1658
|
gokhlayeh@410
|
1659 # Define how theses functions should act when using --undigest.
|
gokhlayeh@410
|
1660 use_undigest_scan_core()
|
gokhlayeh@410
|
1661 {
|
gokhlayeh@410
|
1662 look_for_dep()
|
gokhlayeh@410
|
1663 {
|
gokhlayeh@410
|
1664 if [ -f "$WOK/$PACKAGE/receipt" ]; then
|
gokhlayeh@410
|
1665 grep -m1 ^$PACKAGE$'\t' $dep_db | cut -f 2
|
gokhlayeh@410
|
1666 else
|
gokhlayeh@410
|
1667 grep -m1 ^$PACKAGE$'\t' $ref_dep_db | cut -f 2
|
gokhlayeh@410
|
1668 fi
|
gokhlayeh@410
|
1669 }
|
gokhlayeh@410
|
1670
|
gokhlayeh@410
|
1671 look_for_all()
|
gokhlayeh@410
|
1672 {
|
gokhlayeh@410
|
1673 if [ -f "$WOK/$PACKAGE/receipt" ]; then
|
gokhlayeh@410
|
1674 grep -m1 ^$PACKAGE$'\t' $dep_db | cut -f 2,3 | sed 's/ / /'
|
gokhlayeh@410
|
1675 else
|
gokhlayeh@410
|
1676 grep -m1 ^$PACKAGE$'\t' $ref_dep_db | cut -f 2,3 | sed 's/ / /'
|
gokhlayeh@410
|
1677 fi
|
gokhlayeh@410
|
1678 }
|
gokhlayeh@410
|
1679
|
gokhlayeh@410
|
1680 look_for_rdep()
|
gokhlayeh@410
|
1681 {
|
gokhlayeh@410
|
1682 fgrep ' '$PACKAGE' ' $dep_db | cut -f 1
|
gokhlayeh@410
|
1683 for rdep in $(fgrep ' '$PACKAGE' ' $ref_dep_db | cut -f 1); do
|
gokhlayeh@410
|
1684 [ -f "WOK$/$rdep/receipt" ] || echo "$rdep"
|
gokhlayeh@410
|
1685 done
|
gokhlayeh@410
|
1686 }
|
gokhlayeh@410
|
1687
|
gokhlayeh@410
|
1688 look_for_rbdep()
|
gokhlayeh@410
|
1689 {
|
gokhlayeh@410
|
1690 fgrep ' '$PACKAGE' ' $dep_db | cut -f 1,3 | fgrep ' '$PACKAGE' ' | cut -f 1
|
gokhlayeh@410
|
1691 for rdep in $(fgrep ' '$PACKAGE' ' $ref_dep_db | cut -f 1,3 | fgrep ' '$PACKAGE' ' | cut -f 1); do
|
gokhlayeh@410
|
1692 [ -f "WOK$/$rdep/receipt" ] || echo "$rdep"
|
gokhlayeh@410
|
1693 done
|
gokhlayeh@410
|
1694 }
|
gokhlayeh@410
|
1695
|
gokhlayeh@410
|
1696 look_for_wanted()
|
gokhlayeh@410
|
1697 {
|
gokhlayeh@410
|
1698 if [ -f "$WOK/$PACKAGE/receipt" ]; then
|
gokhlayeh@410
|
1699 grep -m1 ^$PACKAGE$'\t' $wan_db | cut -f 2
|
gokhlayeh@410
|
1700 else
|
gokhlayeh@410
|
1701 grep -m1 ^$PACKAGE$'\t' $ref_wan_db | cut -f 2
|
gokhlayeh@410
|
1702 fi
|
gokhlayeh@410
|
1703 }
|
gokhlayeh@410
|
1704
|
gokhlayeh@410
|
1705 look_for_rwanted()
|
gokhlayeh@410
|
1706 {
|
gokhlayeh@410
|
1707 if [ -f "$WOK/$PACKAGE/receipt" ]; then
|
gokhlayeh@410
|
1708 grep $'\t'$PACKAGE$ $wan_db | cut -f 1
|
gokhlayeh@410
|
1709 else
|
gokhlayeh@410
|
1710 grep $'\t'$PACKAGE$ $ref_wan_db | cut -f 1
|
gokhlayeh@410
|
1711 fi
|
gokhlayeh@410
|
1712 }
|
gokhlayeh@410
|
1713
|
gokhlayeh@410
|
1714 look_for_dev()
|
gokhlayeh@410
|
1715 {
|
gokhlayeh@410
|
1716 WANTED=$(look_for_wanted)
|
gokhlayeh@410
|
1717 if [ "$WANTED" ]; then
|
gokhlayeh@410
|
1718 if [ -f "$WOK/$WANTED/receipt" ]; then
|
gokhlayeh@410
|
1719 [ -f "$WOK/$WANTED-dev/receipt" ] && echo $WANTED-dev
|
gokhlayeh@410
|
1720 else
|
gokhlayeh@410
|
1721 grep -q ^$WANTED-dev$'\t' $ref_dep_db && echo $WANTED-dev
|
gokhlayeh@410
|
1722 fi
|
gokhlayeh@410
|
1723 fi
|
gokhlayeh@410
|
1724 if [ -f "$WOK/$PACKAGE/receipt" ]; then
|
gokhlayeh@410
|
1725 [ -f "$WOK/$PACKAGE-dev/receipt" ] && echo $PACKAGE-dev
|
gokhlayeh@410
|
1726 else
|
gokhlayeh@410
|
1727 grep -q ^$PACKAGE-dev$'\t' $ref_dep_db && echo $PACKAGE-dev
|
gokhlayeh@410
|
1728 fi
|
gokhlayeh@410
|
1729 }
|
gokhlayeh@415
|
1730
|
gokhlayeh@415
|
1731 check_for_pkg_in_wok()
|
gokhlayeh@415
|
1732 {
|
gokhlayeh@415
|
1733 [ -f $WOK/$PACKAGE/receipt ] && return
|
gokhlayeh@415
|
1734 grep -q ^$PACKAGE'$\t' $ref_dep_db && return 1
|
gokhlayeh@415
|
1735 echo "Can't find $PACKAGE in wok or mirror" >&2
|
gokhlayeh@415
|
1736 return 2
|
gokhlayeh@415
|
1737 }
|
gokhlayeh@215
|
1738 }
|
gokhlayeh@215
|
1739
|
gokhlayeh@186
|
1740 ########################################################################
|
gokhlayeh@186
|
1741 # SCAN
|
gokhlayeh@186
|
1742 ########################
|
gokhlayeh@186
|
1743 # Use wok-wanted.txt and wok-depeds.txt to scan depends.
|
gokhlayeh@186
|
1744 # Option in command line (must be first arg) :
|
gokhlayeh@186
|
1745 # --look_for=bdep/rbdep - Look for depends or reverse depends.
|
gokhlayeh@186
|
1746 # --with_dev - Add development packages (*-dev) in the result.
|
gokhlayeh@186
|
1747 # --with_wanted - Add package+reverse wanted in the result.
|
gokhlayeh@186
|
1748 # --with_args - Include packages in argument in the result.
|
gokhlayeh@186
|
1749
|
gokhlayeh@186
|
1750 scan()
|
gokhlayeh@186
|
1751 {
|
gokhlayeh@186
|
1752 # Get packages in argument.
|
slaxemulator@326
|
1753 local PACKAGE=$PACKAGE WANTED=$WANTED pkg_list=
|
gokhlayeh@186
|
1754 for arg in $@; do
|
gokhlayeh@186
|
1755 [ "$arg" = "${arg#--}" ] || continue
|
gokhlayeh@186
|
1756 pkg_list="$pkg_list $arg"
|
gokhlayeh@186
|
1757 done
|
gokhlayeh@204
|
1758
|
gokhlayeh@186
|
1759 # Get options.
|
gokhlayeh@186
|
1760 [ "$pkg_list" ] || return
|
gokhlayeh@186
|
1761 local cooklist= look_for= with_dev= with_wanted= with_args= log_command="$0 $@" \
|
gokhlayeh@215
|
1762 get_options_list="look_for with_dev with_wanted with_args cooklist use_wanted"
|
gokhlayeh@186
|
1763 get_options
|
gokhlayeh@186
|
1764
|
gokhlayeh@186
|
1765 # Cooklist is a special case where we need to modify a little
|
gokhlayeh@186
|
1766 # scan behavior
|
gokhlayeh@186
|
1767 if [ "$cooklist" ]; then
|
gokhlayeh@204
|
1768 gen_wan_db
|
gokhlayeh@204
|
1769 look_for=all && with_args=yes && with_dev= && with_wanted=
|
gokhlayeh@204
|
1770 filter=use_wanted
|
gokhlayeh@241
|
1771 if [ "$COMMAND" = gen-cooklist ]; then
|
gokhlayeh@241
|
1772 for PACKAGE in $pkg_list; do
|
gokhlayeh@241
|
1773 grep -q ^$PACKAGE$'\t' $dep_db && continue
|
gokhlayeh@241
|
1774 [ -d "$WOK/$p" ] || continue
|
gokhlayeh@241
|
1775 check_for_missing
|
gokhlayeh@241
|
1776 done
|
gokhlayeh@241
|
1777 append_to_dep()
|
gokhlayeh@241
|
1778 {
|
gokhlayeh@415
|
1779 if grep -q ^$PACKAGE$'\t' $dep_db; then
|
gokhlayeh@415
|
1780 echo $PACKAGE >> $tmp/dep
|
gokhlayeh@415
|
1781 else
|
gokhlayeh@241
|
1782 check_for_missing && echo $PACKAGE >> $tmp/dep
|
gokhlayeh@241
|
1783 fi
|
gokhlayeh@241
|
1784 }
|
gokhlayeh@241
|
1785 else
|
gokhlayeh@241
|
1786 append_to_dep()
|
gokhlayeh@241
|
1787 {
|
gokhlayeh@241
|
1788 check_for_commit && echo $PACKAGE >> $tmp/dep
|
gokhlayeh@241
|
1789 }
|
gokhlayeh@241
|
1790 fi
|
gokhlayeh@204
|
1791 else
|
gokhlayeh@204
|
1792 append_to_dep()
|
gokhlayeh@204
|
1793 {
|
gokhlayeh@204
|
1794 echo $PACKAGE >> $tmp/dep
|
gokhlayeh@204
|
1795 }
|
gokhlayeh@240
|
1796 # If requested packages are not in dep_db, partial generation of this db is needed.
|
gokhlayeh@241
|
1797 for PACKAGE in $pkg_list; do
|
gokhlayeh@241
|
1798 grep -q ^$PACKAGE$'\t' $dep_db && continue
|
gokhlayeh@240
|
1799 [ -d "$WOK/$p" ] || continue
|
gokhlayeh@240
|
1800 plan_check_for_missing=yes
|
gokhlayeh@240
|
1801 check_for_missing
|
gokhlayeh@240
|
1802 done
|
gokhlayeh@240
|
1803 if [ "$plan_check_for_missing" ]; then
|
gokhlayeh@240
|
1804 append_to_dep()
|
gokhlayeh@240
|
1805 {
|
gokhlayeh@415
|
1806 if grep -q ^$PACKAGE$'\t' $dep_db; then
|
gokhlayeh@415
|
1807 echo $PACKAGE >> $tmp/dep
|
gokhlayeh@415
|
1808 else
|
gokhlayeh@240
|
1809 check_for_missing && echo $PACKAGE >> $tmp/dep
|
gokhlayeh@240
|
1810 fi
|
gokhlayeh@240
|
1811 }
|
gokhlayeh@240
|
1812 check_db_status=yes
|
gokhlayeh@240
|
1813 unset plan_check_for_missing
|
gokhlayeh@240
|
1814 fi
|
gokhlayeh@186
|
1815 fi
|
gokhlayeh@215
|
1816
|
gokhlayeh@204
|
1817 [ "$with_dev" ] && filter=with_dev
|
gokhlayeh@204
|
1818 [ "$with_wanted" ] && filter=with_wanted
|
gokhlayeh@204
|
1819 if [ "$filter" ]; then
|
gokhlayeh@291
|
1820 pkg_list=$(echo $pkg_list | $filter | sort -u)
|
gokhlayeh@204
|
1821 scan_pkg()
|
gokhlayeh@204
|
1822 {
|
gokhlayeh@204
|
1823 look_for_$look_for | $filter
|
gokhlayeh@204
|
1824 }
|
gokhlayeh@204
|
1825 else
|
gokhlayeh@204
|
1826 scan_pkg()
|
gokhlayeh@204
|
1827 {
|
gokhlayeh@204
|
1828 look_for_$look_for
|
gokhlayeh@204
|
1829 }
|
gokhlayeh@204
|
1830 fi
|
gokhlayeh@215
|
1831 touch $tmp/dep
|
gokhlayeh@204
|
1832 for PACKAGE in $pkg_list; do
|
gokhlayeh@204
|
1833 [ "$with_args" ] && append_to_dep
|
gokhlayeh@204
|
1834 scan_pkg
|
gokhlayeh@186
|
1835 done | tr ' ' '\n' | sort -u > $tmp/list
|
gokhlayeh@186
|
1836 [ "$look_for" = bdep ] && look_for=dep
|
gokhlayeh@186
|
1837 while [ -s $tmp/list ]; do
|
gokhlayeh@186
|
1838 PACKAGE=$(sed 1!d $tmp/list)
|
gokhlayeh@186
|
1839 sed 1d -i $tmp/list
|
gokhlayeh@204
|
1840 append_to_dep
|
gokhlayeh@204
|
1841 for pkg in $(scan_pkg); do
|
gokhlayeh@415
|
1842 grep -q ^$pkg$ $tmp/list $tmp/dep || echo $pkg >> $tmp/list
|
gokhlayeh@186
|
1843 done
|
gokhlayeh@186
|
1844 done
|
gokhlayeh@204
|
1845 if [ "$cooklist" ]; then
|
gokhlayeh@204
|
1846 mv $tmp/dep $tmp/cooklist
|
gokhlayeh@215
|
1847 else
|
gokhlayeh@204
|
1848 cat $tmp/dep | sort -u
|
gokhlayeh@186
|
1849 fi
|
gokhlayeh@204
|
1850 rm -f $tmp/dep $tmp/list
|
gokhlayeh@240
|
1851 if [ "$check_db_status" ]; then
|
gokhlayeh@240
|
1852 [ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb
|
gokhlayeh@240
|
1853 [ "$plan_sort_wandb" ] && sort -o $wan_db $wan_db && unset plan_sort_wandb
|
gokhlayeh@352
|
1854 if [ "$plan_regen_cookorder" ] && \
|
gokhlayeh@397
|
1855 [ "$(sed 1!d $cookorder)" != "#PlanSort" ]; then
|
gokhlayeh@397
|
1856 grep -q "^#" $cookorder || sed 1i"#PlanSort" -i $cookorder
|
gokhlayeh@240
|
1857 fi
|
gokhlayeh@240
|
1858 fi
|
gokhlayeh@186
|
1859 }
|
gokhlayeh@186
|
1860
|
gokhlayeh@186
|
1861 ########################################################################
|
gokhlayeh@186
|
1862 # This section contains functions to check package repository and
|
gokhlayeh@186
|
1863 # find which packages to cook.
|
gokhlayeh@186
|
1864 ########################
|
gokhlayeh@186
|
1865
|
gokhlayeh@240
|
1866 check_for_missing()
|
gokhlayeh@240
|
1867 {
|
slaxemulator@326
|
1868 local PACKAGE=$PACKAGE
|
gokhlayeh@240
|
1869 if ! check_for_pkg_in_wok; then
|
gokhlayeh@240
|
1870 [ "$?" = 2 ] && return 1
|
gokhlayeh@240
|
1871 return
|
gokhlayeh@240
|
1872 fi
|
gokhlayeh@241
|
1873 RECEIPT=$WOK/$PACKAGE/receipt
|
gokhlayeh@240
|
1874 source_receipt
|
gokhlayeh@240
|
1875 PACKAGE=${WANTED:-$PACKAGE}
|
gokhlayeh@240
|
1876 update_wan_db
|
gokhlayeh@240
|
1877 for PACKAGE in $(look_for_rwanted) $PACKAGE; do
|
gokhlayeh@240
|
1878 RECEIPT=$WOK/$PACKAGE/receipt
|
gokhlayeh@240
|
1879 source_receipt
|
gokhlayeh@240
|
1880 update_dep_db
|
gokhlayeh@240
|
1881 done
|
gokhlayeh@240
|
1882 }
|
gokhlayeh@240
|
1883
|
gokhlayeh@186
|
1884 check_for_commit()
|
gokhlayeh@186
|
1885 {
|
gokhlayeh@204
|
1886 if ! check_for_pkg_in_wok; then
|
gokhlayeh@204
|
1887 [ "$?" = 2 ] && return 1
|
gokhlayeh@204
|
1888 return
|
gokhlayeh@204
|
1889 fi
|
gokhlayeh@204
|
1890 for PACKAGE in $(look_for_rwanted) $PACKAGE; do
|
gokhlayeh@204
|
1891 RECEIPT=$WOK/$PACKAGE/receipt
|
gokhlayeh@186
|
1892 source_receipt
|
gokhlayeh@204
|
1893
|
gokhlayeh@186
|
1894 # We use md5 of cooking stuff in the packaged receipt to check
|
gokhlayeh@186
|
1895 # commit. We look consecutively in 3 different locations :
|
gokhlayeh@204
|
1896 # - in the wok/PACKAGE/taz/* folder
|
gokhlayeh@186
|
1897 # - in the receipt in the package in incoming repository
|
gokhlayeh@186
|
1898 # - in the receipt in the package in packages repository
|
gokhlayeh@186
|
1899 # If md5sum match, there's no commit.
|
gokhlayeh@186
|
1900 check_for_commit_using_md5sum()
|
gokhlayeh@186
|
1901 {
|
gokhlayeh@186
|
1902 if [ ! -f $WOK/$PACKAGE/md5 ]; then
|
gokhlayeh@186
|
1903 sed -n '/# md5sum of cooking stuff :/,$p' receipt | \
|
gokhlayeh@186
|
1904 sed -e 1d -e 's/^# //' > $WOK/$PACKAGE/md5
|
gokhlayeh@186
|
1905 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
1906 fi
|
gokhlayeh@204
|
1907
|
gokhlayeh@186
|
1908 if [ -s md5 ]; then
|
gokhlayeh@186
|
1909 if md5sum -cs md5; then
|
gokhlayeh@204
|
1910
|
gokhlayeh@204
|
1911 # If md5sum check if ok, check for new/missing files in
|
gokhlayeh@204
|
1912 # cooking stuff.
|
gokhlayeh@204
|
1913 for file in $([ -f receipt ] && echo receipt; \
|
gokhlayeh@204
|
1914 [ -f description.txt ] && echo description.txt; \
|
gokhlayeh@204
|
1915 [ -d stuff ] && find stuff); do
|
gokhlayeh@204
|
1916 if ! fgrep -q " $file" md5; then
|
gokhlayeh@186
|
1917 set_commited
|
gokhlayeh@186
|
1918 fi
|
gokhlayeh@186
|
1919 done
|
gokhlayeh@186
|
1920 else
|
gokhlayeh@186
|
1921 set_commited
|
gokhlayeh@186
|
1922 fi
|
gokhlayeh@186
|
1923 else
|
gokhlayeh@204
|
1924 set_commited
|
gokhlayeh@186
|
1925 fi
|
gokhlayeh@186
|
1926 }
|
gokhlayeh@186
|
1927 set_commited()
|
gokhlayeh@186
|
1928 {
|
gokhlayeh@405
|
1929 grep -q ^$PACKAGE$ $commit || echo $PACKAGE >> $commit
|
gokhlayeh@186
|
1930 gen_cookmd5
|
gokhlayeh@204
|
1931 update_dep_db
|
gokhlayeh@186
|
1932 }
|
gokhlayeh@195
|
1933 taz_dir=$(echo $WOK/$PACKAGE/taz/$PACKAGE-* | fgrep -v '*')
|
gokhlayeh@186
|
1934 if [ -f $WOK/$PACKAGE/md5 ]; then
|
gokhlayeh@186
|
1935 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
1936 check_for_commit_using_md5sum
|
gokhlayeh@186
|
1937 elif [ "$taz_dir" ]; then
|
gokhlayeh@186
|
1938 cd $taz_dir
|
gokhlayeh@186
|
1939 check_for_commit_using_md5sum
|
gokhlayeh@186
|
1940 else
|
gokhlayeh@195
|
1941 pkg=$(echo $INCOMING_REPOSITORY/$PACKAGE-$VERSION*.tazpkg | fgrep -v '*')
|
gokhlayeh@195
|
1942 [ "$pkg" ] || pkg=$(echo $PACKAGES_REPOSITORY/$PACKAGE-$VERSION*.tazpkg | fgrep -v '*')
|
gokhlayeh@186
|
1943 if [ "$pkg" ]; then
|
gokhlayeh@186
|
1944 get_pkg_files $pkg
|
gokhlayeh@186
|
1945 check_for_commit_using_md5sum
|
gokhlayeh@186
|
1946 rm -r $pkg_files_dir
|
gokhlayeh@204
|
1947 else
|
gokhlayeh@204
|
1948 set_commited
|
gokhlayeh@186
|
1949 fi
|
gokhlayeh@186
|
1950 fi
|
gokhlayeh@204
|
1951 [ "$forced" ] || echo $PACKAGE >> $tmp/checked
|
gokhlayeh@186
|
1952 done
|
gokhlayeh@204
|
1953 return
|
gokhlayeh@186
|
1954 }
|
gokhlayeh@186
|
1955
|
gokhlayeh@186
|
1956 gen_cook_list()
|
gokhlayeh@186
|
1957 {
|
gokhlayeh@204
|
1958 report step "Scanning wok"
|
gokhlayeh@204
|
1959 if [ "$pkg" ]; then
|
gokhlayeh@204
|
1960 scan $pkg --cooklist
|
gokhlayeh@405
|
1961 elif [ "$LIST" ]; then
|
gokhlayeh@405
|
1962 scan `cat $LIST` --cooklist
|
gokhlayeh@204
|
1963 else
|
gokhlayeh@204
|
1964 scan `cat $cooklist` --cooklist
|
gokhlayeh@204
|
1965 fi
|
gokhlayeh@204
|
1966 report end-step
|
gokhlayeh@209
|
1967
|
gokhlayeh@209
|
1968 [ -s $tmp/checked ] || [ -s $tmp/cooklist ] || return
|
gokhlayeh@209
|
1969
|
gokhlayeh@209
|
1970 # Core toolchain should not be cooked unless cook-toolchain is used.
|
gokhlayeh@209
|
1971 if ! [ -f /etc/config.site.tmptoolchain ] ; then
|
gokhlayeh@209
|
1972 for PACKAGE in $(scan gcc --look_for=all --with_args --with_wanted); do
|
gokhlayeh@405
|
1973 grep -q ^$PACKAGE$ $blocked || echo $PACKAGE >> $blocked
|
gokhlayeh@209
|
1974 done
|
gokhlayeh@209
|
1975 fi
|
gokhlayeh@313
|
1976
|
gokhlayeh@405
|
1977 if [ -s $commit ] && [ "$COMMAND" != gen-cooklist ]; then
|
gokhlayeh@405
|
1978 for PACKAGE in $(cat $commit); do
|
gokhlayeh@186
|
1979 WANTED="$(look_for_wanted)"
|
gokhlayeh@186
|
1980 if [ "$WANTED" ]; then
|
gokhlayeh@405
|
1981 grep -q ^$WANTED$ $broken $cooklist $blocked $commit && continue
|
gokhlayeh@186
|
1982 fi
|
gokhlayeh@405
|
1983 grep -q ^$PACKAGE$ $blocked $cooklist && continue
|
gokhlayeh@405
|
1984 echo $PACKAGE >> $cooklist
|
gokhlayeh@186
|
1985 done
|
gokhlayeh@186
|
1986 fi
|
gokhlayeh@186
|
1987 sort_cooklist
|
gokhlayeh@186
|
1988 }
|
gokhlayeh@186
|
1989
|
gokhlayeh@186
|
1990 sort_cooklist()
|
gokhlayeh@186
|
1991 {
|
gokhlayeh@397
|
1992 if [ "$(sed 1!d $cookorder)" = "#PlanSort" ]; then
|
gokhlayeh@397
|
1993 sed 1d -i $cookorder
|
gokhlayeh@266
|
1994 plan_regen_cookorder=yes
|
gokhlayeh@266
|
1995 fi
|
gokhlayeh@266
|
1996 [ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb
|
gokhlayeh@266
|
1997 [ "$plan_regen_cookorder" ] && sort_db
|
gokhlayeh@313
|
1998 report step "Generating cooklist"
|
gokhlayeh@204
|
1999 if [ -f "$tmp/checked" ]; then
|
gokhlayeh@204
|
2000 rm -f $tmp/cooklist
|
gokhlayeh@204
|
2001 cat $tmp/checked | while read PACKAGE; do
|
gokhlayeh@405
|
2002 grep -q ^$PACKAGE$ $cooklist && echo $PACKAGE >> $tmp/cooklist
|
gokhlayeh@204
|
2003 done
|
gokhlayeh@209
|
2004 elif ! [ "$COMMAND" = gen-cooklist ]; then
|
gokhlayeh@405
|
2005 cat $blocked | while read PACKAGE; do
|
gokhlayeh@209
|
2006 sed "/^$PACKAGE/d" -i $tmp/cooklist
|
gokhlayeh@209
|
2007 done
|
gokhlayeh@204
|
2008 fi
|
gokhlayeh@313
|
2009 report end-step
|
gokhlayeh@313
|
2010 [ -s $tmp/cooklist ] || return
|
gokhlayeh@215
|
2011
|
gokhlayeh@313
|
2012 report step "Sorting cooklist"
|
gokhlayeh@204
|
2013 for PACKAGE in $(cat $tmp/cooklist); do
|
gokhlayeh@204
|
2014 WANTED="$(look_for_wanted)"
|
gokhlayeh@204
|
2015 [ "$WANTED" ] || continue
|
gokhlayeh@405
|
2016 if grep -q ^$WANTED$ $broken $tmp/cooklist; then
|
gokhlayeh@186
|
2017 sed "/^$PACKAGE$/d" -i $tmp/cooklist
|
gokhlayeh@204
|
2018 elif [ ! -d $WOK/$WANTED/install ]; then
|
gokhlayeh@204
|
2019 sed "/^$PACKAGE$/d" -i $tmp/cooklist
|
gokhlayeh@204
|
2020 echo $WANTED >> $tmp/cooklist
|
gokhlayeh@186
|
2021 fi
|
gokhlayeh@186
|
2022 done
|
gokhlayeh@186
|
2023
|
gokhlayeh@204
|
2024 # Use cookorder.txt to sort cooklist.
|
gokhlayeh@204
|
2025 if [ -s $tmp/cooklist ]; then
|
gokhlayeh@397
|
2026 cat $cookorder | while read PACKAGE; do
|
gokhlayeh@204
|
2027 if grep -q ^$PACKAGE$ $tmp/cooklist; then
|
gokhlayeh@204
|
2028 sed "/^$PACKAGE$/d" -i $tmp/cooklist
|
gokhlayeh@204
|
2029 echo $PACKAGE >> $tmp/cooklist.tmp
|
gokhlayeh@204
|
2030 fi
|
gokhlayeh@204
|
2031 done
|
gokhlayeh@204
|
2032
|
gokhlayeh@204
|
2033 # Remaining packages in cooklist are thoses without compile_rules.
|
gokhlayeh@204
|
2034 # They can be cooked first in any order.
|
gokhlayeh@204
|
2035 if [ -f $tmp/cooklist.tmp ]; then
|
gokhlayeh@204
|
2036 cat $tmp/cooklist.tmp >> $tmp/cooklist
|
gokhlayeh@204
|
2037 rm $tmp/cooklist.tmp
|
gokhlayeh@204
|
2038 fi
|
gokhlayeh@204
|
2039
|
gokhlayeh@204
|
2040 cat $tmp/cooklist
|
gokhlayeh@405
|
2041 [ "$LIST" ] || cat $tmp/cooklist > $cooklist
|
gokhlayeh@204
|
2042 fi
|
gokhlayeh@204
|
2043
|
gokhlayeh@186
|
2044 report end-step
|
gokhlayeh@186
|
2045 }
|
gokhlayeh@186
|
2046
|
gokhlayeh@284
|
2047 look_for_missing_pkg()
|
gokhlayeh@284
|
2048 {
|
gokhlayeh@284
|
2049 for pkg in $(cat $PACKAGES_REPOSITORY/$1); do
|
gokhlayeh@284
|
2050 grep -q ^$pkg$ $INCOMING_REPOSITORY/packages.txt \
|
gokhlayeh@284
|
2051 $PACKAGES_REPOSITORY/packages.txt || \
|
gokhlayeh@284
|
2052 continue
|
gokhlayeh@284
|
2053 echo $pkg
|
gokhlayeh@284
|
2054 done
|
gokhlayeh@284
|
2055 }
|
gokhlayeh@284
|
2056
|
gokhlayeh@186
|
2057 check_for_incoming()
|
gokhlayeh@186
|
2058 {
|
gokhlayeh@307
|
2059 report step "Check that all packages were cooked fine"
|
gokhlayeh@204
|
2060 [ -s $INCOMING_REPOSITORY/packages.desc ] || {
|
gokhlayeh@204
|
2061 echo "No packages in $INCOMING_REPOSITORY."
|
gokhlayeh@307
|
2062 report end-step; return; }
|
gokhlayeh@405
|
2063 if [ -s $broken ]; then
|
gokhlayeh@290
|
2064 missingpkg=$(look_for_missing_pkg broken)
|
gokhlayeh@290
|
2065 if [ "$missingpkg" ]; then
|
gokhlayeh@290
|
2066 echo "Don't move incoming packages to main repository because theses ones are broken:" >&2
|
gokhlayeh@290
|
2067 echo "$missingpkg"
|
gokhlayeh@307
|
2068 report end-step
|
gokhlayeh@307
|
2069 return 1
|
gokhlayeh@290
|
2070 fi
|
gokhlayeh@186
|
2071 fi
|
gokhlayeh@405
|
2072 if [ -s $cooklist ]; then
|
gokhlayeh@290
|
2073 missingpkg=$(look_for_missing_pkg cooklist)
|
gokhlayeh@290
|
2074 if [ "$missingpkg" ]; then
|
gokhlayeh@290
|
2075 echo "Don't move incoming packages to main repository because theses ones needs to be cooked:" >&2
|
gokhlayeh@290
|
2076 echo "$missingpkg"
|
gokhlayeh@307
|
2077 report end-step
|
gokhlayeh@307
|
2078 return 1
|
gokhlayeh@290
|
2079 fi
|
gokhlayeh@204
|
2080 fi
|
gokhlayeh@306
|
2081 incoming_pkgs="$(cut -f 1 -d '|' $INCOMING_REPOSITORY/packages.desc)"
|
gokhlayeh@214
|
2082 if ! [ "$forced" ]; then
|
gokhlayeh@214
|
2083 cooklist=$PACKAGES_REPOSITORY/cooklist
|
gokhlayeh@313
|
2084 pkg="$incoming_pkgs"
|
gokhlayeh@214
|
2085 gen_cook_list
|
gokhlayeh@405
|
2086 if [ -s $cooklist ]; then
|
gokhlayeh@290
|
2087 missingpkg=$(look_for_missing_pkg cooklist)
|
gokhlayeh@290
|
2088 if [ "$missingpkg" ]; then
|
gokhlayeh@290
|
2089 echo "Don't move incoming packages to main repository because theses ones needs to be cooked:" >&2
|
gokhlayeh@290
|
2090 echo "$missingpkg"
|
gokhlayeh@307
|
2091 report end-step
|
gokhlayeh@307
|
2092 return 1
|
gokhlayeh@290
|
2093 fi
|
gokhlayeh@214
|
2094 fi
|
gokhlayeh@204
|
2095 fi
|
gokhlayeh@313
|
2096
|
gokhlayeh@204
|
2097 report step "Moving incoming packages to main repository"
|
gokhlayeh@401
|
2098 mkdir -p $PACKAGES_REPOSITORY/wok
|
gokhlayeh@204
|
2099 unset EXTRAVERSION
|
gokhlayeh@306
|
2100 for PACKAGE in $incoming_pkgs; do
|
gokhlayeh@186
|
2101 prev_VERSION=$(get_pkg_version $PACKAGES_REPOSITORY)
|
gokhlayeh@204
|
2102 VERSION=$(get_pkg_version $INCOMING_REPOSITORY)
|
gokhlayeh@186
|
2103 remove_previous_package $PACKAGES_REPOSITORY
|
gokhlayeh@204
|
2104 echo "Moving $PACKAGE..."
|
gokhlayeh@204
|
2105 mv -f $INCOMING_REPOSITORY/$PACKAGE-$VERSION.tazpkg $PACKAGES_REPOSITORY
|
gokhlayeh@204
|
2106 touch $PACKAGES_REPOSITORY/$PACKAGE-$VERSION.tazpkg
|
gokhlayeh@415
|
2107 previous_tarball=$(grep -m1 ^$PACKAGE:main $SOURCES_REPOSITORY/sources.list | cut -f2)
|
gokhlayeh@266
|
2108 sed -e "/^$PACKAGE:main/d" \
|
slaxemulator@275
|
2109 -e "s/^$PACKAGE:incoming/$PACKAGE:main/" \
|
gokhlayeh@266
|
2110 -i $SOURCES_REPOSITORY/sources.list
|
gokhlayeh@266
|
2111 if [ "$previous_tarball" ]; then
|
gokhlayeh@266
|
2112 grep -q $'\t'$previous_tarball$ $SOURCES_REPOSITORY/sources.list || \
|
gokhlayeh@266
|
2113 rm -f $SOURCES_REPOSITORY/$previous_tarball
|
gokhlayeh@266
|
2114 fi
|
gokhlayeh@401
|
2115 rm -rf $PACKAGES_REPOSITORY/wok/$PACKAGE
|
gokhlayeh@401
|
2116 mkdir -p $PACKAGES_REPOSITORY/wok/$PACKAGE
|
gokhlayeh@401
|
2117 for i in $WOK/$PACKAGE/receipt $WOK/$PACKAGE/description.txt \
|
gokhlayeh@401
|
2118 $WOK/$PACKAGE/stuff; do
|
gokhlayeh@401
|
2119 cp -a $i $PACKAGES_REPOSITORY/wok/$PACKAGE
|
gokhlayeh@401
|
2120 done
|
gokhlayeh@204
|
2121 done
|
gokhlayeh@401
|
2122
|
gokhlayeh@401
|
2123 if [ "$GEN_SAFE_WOK_TARBALL" ]; then
|
gokhlayeh@415
|
2124 rm -f $PACKAGES_REPOSITORY/wok.tar.lzma
|
gokhlayeh@401
|
2125 cd $PACKAGES_REPOSITORY/wok
|
gokhlayeh@401
|
2126 report step "Generating safe-wok tarball"
|
gokhlayeh@401
|
2127 tar -c * | lzma e $PACKAGES_REPOSITORY/wok.tar.lzma
|
gokhlayeh@401
|
2128 report end-step
|
gokhlayeh@401
|
2129 fi
|
gokhlayeh@401
|
2130
|
gokhlayeh@204
|
2131 for file in packages.list packages.equiv packages.md5 packages.desc \
|
gokhlayeh@204
|
2132 packages.txt; do
|
gokhlayeh@204
|
2133 echo -n "" > $INCOMING_REPOSITORY/$file
|
gokhlayeh@204
|
2134 done
|
gokhlayeh@204
|
2135 rm -r $INCOMING_REPOSITORY/files.list.lzma
|
gokhlayeh@186
|
2136 pkg_repository=$PACKAGES_REPOSITORY && update_packages_db
|
gokhlayeh@313
|
2137
|
gokhlayeh@313
|
2138 report step "Updating flavors"
|
gokhlayeh@313
|
2139 if [ -x /usr/bin/tazlito ] || [ -x /usr/bin/clean-chroot ]; then
|
gokhlayeh@313
|
2140 if ! [ -x /usr/bin/tazlito ]; then
|
gokhlayeh@313
|
2141 tazpkg get-install tazlito
|
gokhlayeh@313
|
2142 fi
|
gokhlayeh@313
|
2143
|
gokhlayeh@313
|
2144 # Handle cases where tazwok is used into main system;
|
gokhlayeh@313
|
2145 # Handle cases where SLITAZ_DIR is not /home/slitaz.
|
gokhlayeh@313
|
2146 [ -L /home/slitaz/flavors ] && rm /home/slitaz/flavors
|
gokhlayeh@313
|
2147 mkdir -p /home/slitaz
|
gokhlayeh@313
|
2148 ln -s $LOCAL_REPOSITORY/flavors /home/slitaz/flavors
|
gokhlayeh@313
|
2149
|
gokhlayeh@313
|
2150 cd $LOCAL_REPOSITORY/packages
|
gokhlayeh@313
|
2151 for i in $LOCAL_REPOSITORY/flavors/*; do
|
gokhlayeh@331
|
2152 [ -d "$i" ] || continue
|
gokhlayeh@313
|
2153 tazlito pack-flavor ${i##*/}
|
gokhlayeh@313
|
2154 done
|
gokhlayeh@313
|
2155
|
gokhlayeh@313
|
2156 noheader=""
|
gokhlayeh@313
|
2157 for i in *.flavor; do
|
gokhlayeh@313
|
2158 tazlito show-flavor $i --brief $noheader
|
gokhlayeh@313
|
2159 noheader="--noheader"
|
gokhlayeh@313
|
2160 done > flavors.list
|
gokhlayeh@313
|
2161 [ -x /usr/bin/clean-chroot ] && clean-chroot
|
gokhlayeh@313
|
2162 else
|
gokhlayeh@313
|
2163 echo "Can't create up-to-date flavors because tazlito package is missing." >&2
|
gokhlayeh@313
|
2164 fi
|
gokhlayeh@313
|
2165 report end-step
|
gokhlayeh@186
|
2166 }
|
gokhlayeh@186
|
2167
|
gokhlayeh@186
|
2168 ########################################################################
|
gokhlayeh@186
|
2169 # TAZWOK MAIN FUNCTIONS
|
gokhlayeh@186
|
2170 ########################
|
gokhlayeh@186
|
2171
|
gokhlayeh@186
|
2172 clean()
|
gokhlayeh@186
|
2173 {
|
gokhlayeh@186
|
2174 cd $WOK/$PACKAGE
|
gokhlayeh@186
|
2175 ls -A $WOK/$PACKAGE | grep -q -v -e ^receipt$ -e ^description.txt$ \
|
gokhlayeh@186
|
2176 -e ^stuff$ || return
|
gokhlayeh@186
|
2177
|
gokhlayeh@249
|
2178 [ "$COMMAND" = clean-wok ] || report step "Cleaning $PACKAGE"
|
gokhlayeh@186
|
2179 # Check for clean_wok function.
|
gokhlayeh@186
|
2180 if grep -q ^clean_wok $RECEIPT; then
|
gokhlayeh@186
|
2181 clean_wok
|
gokhlayeh@186
|
2182 fi
|
gokhlayeh@415
|
2183 # Clean should only have a receipt, stuff and optionals desc/md5.
|
gokhlayeh@186
|
2184 for f in `ls .`
|
gokhlayeh@186
|
2185 do
|
gokhlayeh@186
|
2186 case $f in
|
gokhlayeh@250
|
2187 receipt|stuff|description.txt|md5)
|
gokhlayeh@186
|
2188 continue ;;
|
gokhlayeh@186
|
2189 *)
|
gokhlayeh@263
|
2190 rm -rf $f ;;
|
gokhlayeh@186
|
2191 esac
|
gokhlayeh@186
|
2192 done
|
gokhlayeh@262
|
2193 [ "$COMMAND" != clean-wok ] && report end-step
|
gokhlayeh@186
|
2194 }
|
gokhlayeh@186
|
2195
|
gokhlayeh@186
|
2196 # Configure and make a package with the receipt.
|
gokhlayeh@186
|
2197 compile_package()
|
gokhlayeh@186
|
2198 {
|
gokhlayeh@186
|
2199 check_for_package_on_cmdline
|
gokhlayeh@186
|
2200
|
gokhlayeh@186
|
2201 # Include the receipt to get all needed variables and functions
|
gokhlayeh@186
|
2202 # and cd into the work directory to start the work.
|
gokhlayeh@186
|
2203 check_for_receipt
|
gokhlayeh@186
|
2204 source_receipt
|
gokhlayeh@186
|
2205
|
gokhlayeh@186
|
2206 # Log the package name and date.
|
gokhlayeh@186
|
2207 echo "date `date +%Y%m%d\ \%H:%M:%S`" >> $LOG
|
gokhlayeh@186
|
2208 echo "package $PACKAGE (compile)" >> $LOG
|
gokhlayeh@186
|
2209
|
gokhlayeh@186
|
2210 # Set wanted $src variable to help compiling.
|
gokhlayeh@186
|
2211 [ ! "$src" ] && set_src_path
|
gokhlayeh@186
|
2212 check_for_build_depends || return 1
|
gokhlayeh@186
|
2213 check_for_wanted
|
gokhlayeh@186
|
2214 unset target
|
gokhlayeh@186
|
2215 check_for_tarball && check_for_compile_rules
|
gokhlayeh@186
|
2216 }
|
gokhlayeh@186
|
2217
|
gokhlayeh@186
|
2218 # Cook command also include all features to manage lists which keep
|
gokhlayeh@186
|
2219 # track of wok/packages state.
|
gokhlayeh@186
|
2220 cook()
|
gokhlayeh@186
|
2221 {
|
gokhlayeh@186
|
2222 cook_code=
|
gokhlayeh@186
|
2223 set_common_path
|
gokhlayeh@186
|
2224 check_for_receipt
|
gokhlayeh@186
|
2225 source_receipt
|
gokhlayeh@186
|
2226
|
gokhlayeh@186
|
2227 # Define log path and start report.
|
gokhlayeh@415
|
2228 for i in $(look_for_rwanted) $PACKAGE; do
|
gokhlayeh@415
|
2229 rm -f $LOCAL_REPOSITORY/log/$i.html
|
gokhlayeh@415
|
2230 done
|
gokhlayeh@186
|
2231 report sublog $LOCAL_REPOSITORY/log/$PACKAGE.html
|
pascal@349
|
2232 echo "$PACKAGE" > $LOCAL_REPOSITORY/log/package
|
gokhlayeh@186
|
2233 report step "Cooking $PACKAGE"
|
gokhlayeh@186
|
2234 report open-bloc
|
gokhlayeh@186
|
2235
|
gokhlayeh@186
|
2236 clean $PACKAGE
|
gokhlayeh@186
|
2237 [ -s $tmp/cooklist ] && sed "/^$PACKAGE$/d" -i $tmp/cooklist
|
gokhlayeh@381
|
2238
|
gokhlayeh@186
|
2239 if compile_package; then
|
gokhlayeh@215
|
2240 remove_src
|
gokhlayeh@186
|
2241 refresh_packages_from_compile
|
gokhlayeh@186
|
2242 gen_package
|
gokhlayeh@186
|
2243
|
gokhlayeh@186
|
2244 # Update packages-incoming repository.
|
gokhlayeh@186
|
2245 store_pkgname=$PACKAGE
|
gokhlayeh@186
|
2246 pkg_repository=$INCOMING_REPOSITORY
|
gokhlayeh@186
|
2247 update_packages_db
|
gokhlayeh@186
|
2248
|
gokhlayeh@186
|
2249 PACKAGE=$store_pkgname
|
gokhlayeh@186
|
2250 unset store_pkgname
|
gokhlayeh@186
|
2251
|
gokhlayeh@186
|
2252 # Upgrade to cooked packages if it was previously installed.
|
gokhlayeh@186
|
2253 report step "Look for package(s) to upgrade"
|
gokhlayeh@186
|
2254 for pkg in $(look_for_rwanted) $PACKAGE; do
|
gokhlayeh@415
|
2255 if [ -f $INSTALLED/$pkg/receipt ]; then
|
gokhlayeh@186
|
2256 tazpkg get-install $pkg --forced
|
gokhlayeh@186
|
2257 fi
|
gokhlayeh@186
|
2258 done
|
gokhlayeh@186
|
2259 report end-step
|
gokhlayeh@186
|
2260 else
|
gokhlayeh@381
|
2261 set_pkg_broken
|
gokhlayeh@186
|
2262 cook_code=1
|
gokhlayeh@186
|
2263 fi
|
gokhlayeh@186
|
2264
|
gokhlayeh@186
|
2265 # Remove build_depends in cook mode (if in cooklist, it's done when
|
gokhlayeh@186
|
2266 # checking build_depends of next package and we remove only unneeded
|
gokhlayeh@186
|
2267 # packages to keep chroot minimal and gain some time).
|
gokhlayeh@210
|
2268 if [ "$COMMAND" = cook ]; then
|
gokhlayeh@210
|
2269 remove_build_depends $MISSING_PACKAGE
|
gokhlayeh@210
|
2270 [ -x /usr/bin/clean-chroot ] && clean-chroot
|
gokhlayeh@210
|
2271 fi
|
gokhlayeh@210
|
2272
|
gokhlayeh@186
|
2273 # Regen the cooklist if it was planned and command is not cook.
|
gokhlayeh@405
|
2274 [ "$regen_cooklist" ] && unset regen_cooklist &&
|
gokhlayeh@405
|
2275 [ "$COMMAND" != cook ] && sort_cooklist
|
gokhlayeh@186
|
2276
|
gokhlayeh@186
|
2277 # Some hacks to set the bloc & function status as failed if cook was
|
gokhlayeh@186
|
2278 # failed.
|
gokhlayeh@186
|
2279 report_return_code=$cook_code
|
gokhlayeh@186
|
2280 report close-bloc
|
gokhlayeh@186
|
2281 report end-sublog
|
pascal@351
|
2282 rm -f $LOCAL_REPOSITORY/log/package
|
gokhlayeh@186
|
2283 return $cook_code
|
gokhlayeh@186
|
2284 }
|
gokhlayeh@186
|
2285
|
gokhlayeh@186
|
2286 cook_list()
|
gokhlayeh@186
|
2287 {
|
gokhlayeh@204
|
2288 if [ -s $tmp/cooklist ]; then
|
gokhlayeh@204
|
2289 if [ -f /usr/bin/tazchroot ]; then
|
gokhlayeh@204
|
2290 # Note : options -main variables- are automatically keeped by
|
gokhlayeh@204
|
2291 # the sub-applications tazchroot/tazwok; as well as report data.
|
gokhlayeh@204
|
2292 cd $LOCAL_REPOSITORY
|
gokhlayeh@204
|
2293 [ ! -f tazchroot.conf ] && configure_tazchroot
|
gokhlayeh@204
|
2294 tazchroot tazwok cook-list --SLITAZ_DIR=$SLITAZ_DIR --SLITAZ_VERSION=$SLITAZ_VERSION ${undigest:+ --undigest=$undigest}
|
gokhlayeh@204
|
2295 return
|
gokhlayeh@204
|
2296 fi
|
gokhlayeh@204
|
2297 while [ -s $tmp/cooklist ]; do
|
gokhlayeh@204
|
2298 PACKAGE=$(sed 1!d $tmp/cooklist)
|
gokhlayeh@204
|
2299 cook
|
gokhlayeh@204
|
2300 done
|
gokhlayeh@204
|
2301 remove_build_depends $MISSING_PACKAGE $remove_later
|
gokhlayeh@210
|
2302 [ -x /usr/bin/clean-chroot ] && clean-chroot
|
gokhlayeh@204
|
2303 else
|
gokhlayeh@186
|
2304 echo "Nothing to cook."
|
gokhlayeh@186
|
2305 return
|
gokhlayeh@186
|
2306 fi
|
gokhlayeh@186
|
2307 }
|
gokhlayeh@186
|
2308
|
gokhlayeh@186
|
2309 configure_tazchroot()
|
gokhlayeh@186
|
2310 {
|
gokhlayeh@190
|
2311 cat > $LOCAL_REPOSITORY/tazchroot.conf << EOF
|
gokhlayeh@186
|
2312 # Tazchroot configuration file - created by tazwok.
|
gokhlayeh@186
|
2313
|
gokhlayeh@407
|
2314 # Local repository definition.
|
gokhlayeh@186
|
2315 SLITAZ_DIR=$SLITAZ_DIR
|
gokhlayeh@186
|
2316 SLITAZ_VERSION=$SLITAZ_VERSION
|
gokhlayeh@407
|
2317 LOCAL_REPOSITORY=$SLITAZ_DIR/${undigest:-$SLITAZ_VERSION}
|
gokhlayeh@407
|
2318 ${USE_ONLINE_PKG:+USE_ONLINE_PKG=$USE_ONLINE_PKG}
|
gokhlayeh@407
|
2319 ${undigest:+undigest=$undigest}
|
gokhlayeh@407
|
2320 ${ref_USE_ONLINE_PKG:+ref_USE_ONLINE_PKG=$ref_USE_ONLINE_PKG}
|
gokhlayeh@407
|
2321
|
gokhlayeh@407
|
2322 # Chroot path.
|
gokhlayeh@407
|
2323 # You can use a chroot into /tmp if it's mounted in RAM
|
gokhlayeh@407
|
2324 # to speed-up the process, be sure you have a free GB.
|
gokhlayeh@407
|
2325 # (minimal chroot is like 150~200MB, can be a lot more during cook)
|
gokhlayeh@407
|
2326 # chroot_dir=/tmp/chroot-${undigest:-$SLITAZ_VERSION}
|
gokhlayeh@186
|
2327 chroot_dir=\$LOCAL_REPOSITORY/chroot
|
gokhlayeh@186
|
2328
|
gokhlayeh@186
|
2329 # Default scripts path (theses scripts are added in the
|
gokhlayeh@186
|
2330 # $chroot_dir/usr/bin and can be called with tazchroot script)
|
gokhlayeh@314
|
2331 script_dir=/usr/lib/slitaz/chroot-scripts/tazwok
|
gokhlayeh@186
|
2332
|
gokhlayeh@186
|
2333 # List of directories to mount.
|
gokhlayeh@407
|
2334 list_dir="$LOCAL_REPOSITORY
|
gokhlayeh@186
|
2335 $SLITAZ_LOG$( [ "$undigest" ] && echo -e "\n$SLITAZ_DIR/$SLITAZ_VERSION/packages" )"
|
gokhlayeh@186
|
2336
|
gokhlayeh@186
|
2337 create_chroot()
|
gokhlayeh@186
|
2338 {
|
gokhlayeh@186
|
2339 mkdir -p \$chroot_dir
|
gokhlayeh@186
|
2340 for pkg in \$(tazwok build-depends toolchain --SLITAZ_DIR=\$SLITAZ_DIR --SLITAZ_VERSION=\$SLITAZ_VERSION${undigest:+ --undigest=\$undigest}); do
|
gokhlayeh@186
|
2341 tazpkg get-install \$pkg --root="\$chroot_dir"
|
gokhlayeh@186
|
2342 done
|
gokhlayeh@186
|
2343
|
gokhlayeh@186
|
2344 # Store list of installed packages needed by cleanchroot.
|
gokhlayeh@194
|
2345 ls -1 \$chroot_dir/\$INSTALLED > \$chroot_dir/\$LOCALSTATE/chroot-pkgs
|
gokhlayeh@186
|
2346
|
gokhlayeh@186
|
2347 sed -e "s~^SLITAZ_DIR=.*~SLITAZ_DIR=\$SLITAZ_DIR~" \\
|
gokhlayeh@186
|
2348 -e "s/^SLITAZ_VERSION=.*/SLITAZ_VERSION=\$SLITAZ_VERSION/" \\
|
gokhlayeh@186
|
2349 -i \$chroot_dir/etc/slitaz/slitaz.conf
|
gokhlayeh@407
|
2350 echo "\$SLITAZ_VERSION" > /etc/slitaz-release
|
gokhlayeh@186
|
2351 $( [ "$undigest" ] && echo ' echo "undigest='"$undigest"'" >> $chroot_dir/etc/slitaz/tazwok.conf')
|
gokhlayeh@186
|
2352 sed 's/LC_ALL/LC_ALL=POSIX/' -i \$chroot_dir/etc/profile
|
gokhlayeh@407
|
2353
|
pascal@368
|
2354 # The build bot may run in a sandbox: link sandbox lockfile
|
pascal@368
|
2355 ln -s \$LOCAL_REPOSITORY/sandbox/proc/1 \$chroot_dir/proc/1
|
gokhlayeh@186
|
2356 }
|
gokhlayeh@186
|
2357
|
gokhlayeh@186
|
2358 mount_chroot()
|
gokhlayeh@186
|
2359 {
|
gokhlayeh@186
|
2360 cp -a /etc/resolv.conf \$chroot_dir/etc/resolv.conf
|
gokhlayeh@407
|
2361 $( if [ "$USE_ONLINE_PKG" ]; then
|
gokhlayeh@407
|
2362 echo ' echo "$USE_ONLINE_PKG" > $chroot_dir$LOCALSTATE/mirror'
|
gokhlayeh@407
|
2363 else
|
gokhlayeh@407
|
2364 echo ' echo $LOCAL_REPOSITORY/packages" > $chroot_dir$LOCALSTATE/mirror'
|
gokhlayeh@407
|
2365 fi
|
gokhlayeh@407
|
2366 )
|
gokhlayeh@194
|
2367 mkdir -p \$chroot_dir\$LOCALSTATE/undigest/\${LOCAL_REPOSITORY##*/}-incoming
|
gokhlayeh@194
|
2368 echo "\$LOCAL_REPOSITORY/packages-incoming" > \$chroot_dir\$LOCALSTATE/undigest/\${LOCAL_REPOSITORY##*/}-incoming/mirror
|
gokhlayeh@407
|
2369 $( [ "$undigest" ] || continue
|
gokhlayeh@407
|
2370 echo ' mkdir -p $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION'
|
gokhlayeh@407
|
2371 if [ "$ref_USE_ONLINE_PKG" ]; then
|
gokhlayeh@407
|
2372 echo ' echo "$ref_USE_ONLINE_PKG" > $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION/mirror'
|
gokhlayeh@407
|
2373 else
|
gokhlayeh@407
|
2374 echo ' echo "$ref_LOCAL_REPOSITORY/packages" > $chroot_dir$LOCALSTATE/undigest/$SLITAZ_VERSION/mirror'
|
gokhlayeh@407
|
2375 fi
|
gokhlayeh@407
|
2376 )
|
gokhlayeh@194
|
2377 echo -e "\${LOCAL_REPOSITORY##*/}-incoming\nmain" > \$chroot_dir\$LOCALSTATE/priority
|
gokhlayeh@186
|
2378 mount -t proc proc \$chroot_dir/proc
|
gokhlayeh@186
|
2379 mount -t sysfs sysfs \$chroot_dir/sys
|
gokhlayeh@186
|
2380 mount -t devpts devpts \$chroot_dir/dev/pts
|
gokhlayeh@186
|
2381 mount -t tmpfs shm \$chroot_dir/dev/shm
|
gokhlayeh@186
|
2382 for dir in \$list_dir; do
|
gokhlayeh@186
|
2383 mkdir -p \$dir \$chroot_dir\$dir
|
gokhlayeh@186
|
2384 mount \$dir \$chroot_dir\$dir
|
gokhlayeh@186
|
2385 done
|
gokhlayeh@186
|
2386 }
|
gokhlayeh@186
|
2387
|
gokhlayeh@186
|
2388 umount_chroot()
|
gokhlayeh@186
|
2389 {
|
gokhlayeh@186
|
2390 for dir in \$list_dir; do
|
gokhlayeh@186
|
2391 umount \$chroot_dir\$dir
|
gokhlayeh@186
|
2392 done
|
gokhlayeh@186
|
2393 umount \$chroot_dir/dev/shm
|
gokhlayeh@186
|
2394 umount \$chroot_dir/dev/pts
|
gokhlayeh@186
|
2395 umount \$chroot_dir/sys
|
gokhlayeh@186
|
2396 umount \$chroot_dir/proc
|
gokhlayeh@186
|
2397 }
|
gokhlayeh@186
|
2398 EOF
|
gokhlayeh@186
|
2399 }
|
gokhlayeh@186
|
2400
|
gokhlayeh@186
|
2401 ########################################################################
|
gokhlayeh@186
|
2402 ######################### END OF NEW FUNCTIONS #########################
|
gokhlayeh@186
|
2403 ########################################################################
|
gokhlayeh@186
|
2404
|
pascal@111
|
2405 # List packages providing a virtual package
|
pascal@111
|
2406 whoprovide()
|
pascal@111
|
2407 {
|
pascal@111
|
2408 local i;
|
gokhlayeh@195
|
2409 for i in $(fgrep -l PROVIDE $WOK/*/receipt); do
|
pascal@111
|
2410 . $i
|
pascal@111
|
2411 case " $PROVIDE " in
|
pascal@111
|
2412 *\ $1\ *|*\ $1:*) echo $(basename $(dirname $i));;
|
pascal@111
|
2413 esac
|
pascal@111
|
2414 done
|
pascal@111
|
2415 }
|
pascal@111
|
2416
|
gokhlayeh@186
|
2417 ########################################################################
|
gokhlayeh@186
|
2418 # TAZWOK COMMANDS
|
gokhlayeh@186
|
2419 ########################
|
pankso@7
|
2420
|
pankso@7
|
2421 case "$COMMAND" in
|
pankso@7
|
2422 stats)
|
paul@166
|
2423 # Tazwok general statistics from the wok config file.
|
pankso@7
|
2424 #
|
gokhlayeh@186
|
2425 get_tazwok_config
|
gokhlayeh@186
|
2426 echo -e "\n\033[1mTazwok configuration statistics\033[0m
|
pankso@7
|
2427 ================================================================================
|
pankso@7
|
2428 Wok directory : $WOK
|
pankso@7
|
2429 Packages repository : $PACKAGES_REPOSITORY
|
gokhlayeh@186
|
2430 Incoming repository : $INCOMING_REPOSITORY
|
pankso@7
|
2431 Sources repository : $SOURCES_REPOSITORY
|
gokhlayeh@186
|
2432 Log directory : $LOCAL_REPOSITORY/log
|
pankso@7
|
2433 Packages in the wok : `ls -1 $WOK | wc -l`
|
pankso@16
|
2434 Cooked packages : `ls -1 $PACKAGES_REPOSITORY/*.tazpkg 2>/dev/null | wc -l`
|
gokhlayeh@186
|
2435 Incoming packages : `ls -1 $INCOMING_REPOSITORY/*.tazpkg 2>/dev/null | wc -l`
|
gokhlayeh@186
|
2436 ================================================================================\n"
|
gokhlayeh@186
|
2437 ;;
|
pankso@133
|
2438 edit)
|
gokhlayeh@186
|
2439 get_tazwok_config
|
pankso@133
|
2440 check_for_package_on_cmdline
|
pankso@133
|
2441 check_for_receipt
|
gokhlayeh@186
|
2442 $EDITOR $WOK/$PACKAGE/receipt
|
gokhlayeh@186
|
2443 ;;
|
pascal@98
|
2444 build-depends)
|
gokhlayeh@186
|
2445 # List dependencies to rebuild wok, or only a package
|
gokhlayeh@186
|
2446 get_tazwok_config
|
gokhlayeh@215
|
2447 report(){ : ; }
|
gokhlayeh@242
|
2448 if [ ! "$PACKAGE" ] || [ "$PACKAGE" = toolchain ]; then
|
gokhlayeh@186
|
2449 scan "$SLITAZ_TOOLCHAIN $SLITAZ_TOOLCHAIN_EXTRA" \
|
gokhlayeh@186
|
2450 --look_for=dep --with_dev --with_args
|
gokhlayeh@186
|
2451 else
|
gokhlayeh@186
|
2452 check_for_package_on_cmdline
|
gokhlayeh@186
|
2453 scan $PACKAGE --look_for=bdep --with_dev
|
gokhlayeh@186
|
2454 fi
|
gokhlayeh@186
|
2455 ;;
|
gokhlayeh@186
|
2456 gen-cooklist)
|
gokhlayeh@215
|
2457 check_root
|
gokhlayeh@204
|
2458 get_options_list="pkg"
|
gokhlayeh@186
|
2459 get_tazwok_config
|
gokhlayeh@215
|
2460 report(){ : ; }
|
gokhlayeh@204
|
2461 if ! [ "$pkg" ]; then
|
gokhlayeh@242
|
2462 if [ ! "$LIST" ] || [ "$LIST" = toolchain ]; then
|
gokhlayeh@242
|
2463 pkg="$SLITAZ_TOOLCHAIN $SLITAZ_TOOLCHAIN_EXTRA"
|
gokhlayeh@242
|
2464 else
|
gokhlayeh@405
|
2465 check_for_list
|
gokhlayeh@242
|
2466 fi
|
gokhlayeh@186
|
2467 fi
|
gokhlayeh@204
|
2468 gen_cook_list
|
gokhlayeh@186
|
2469 ;;
|
pascal@119
|
2470 check-depends)
|
gokhlayeh@186
|
2471 # Check package depends /!\
|
gokhlayeh@186
|
2472 get_tazwok_config
|
pascal@119
|
2473 echo ""
|
paul@121
|
2474 echo -e "\033[1mCheck every receipt for DEPENDS - doesn't scan ELF files\033[0m
|
pascal@119
|
2475 ================================================================================"
|
pascal@119
|
2476 TMPDIR=/tmp/tazwok$$
|
pascal@119
|
2477 DEFAULT_DEPENDS="glibc-base gcc-lib-base"
|
pascal@119
|
2478
|
pascal@119
|
2479 # Build ALL_DEPENDS variable
|
pascal@119
|
2480 scan_dep()
|
pascal@119
|
2481 {
|
pascal@119
|
2482 local i
|
pascal@119
|
2483 ALL_DEPENDS="$ALL_DEPENDS$PACKAGE "
|
pascal@128
|
2484 for i in $DEPENDS $SUGGESTED ; do
|
pascal@119
|
2485 case " $ALL_DEPENDS " in
|
pascal@119
|
2486 *\ $i\ *) continue;;
|
pascal@119
|
2487 esac
|
pascal@120
|
2488 [ -d $WOK/$i ] || {
|
pascal@120
|
2489 ALL_DEPENDS="$ALL_DEPENDS$i "
|
pascal@120
|
2490 continue
|
pascal@120
|
2491 }
|
pascal@128
|
2492 DEPENDS=""
|
pascal@128
|
2493 SUGGESTED=""
|
pascal@119
|
2494 . $WOK/$i/receipt
|
pascal@119
|
2495 scan_dep
|
pascal@119
|
2496 done
|
pascal@119
|
2497 }
|
pankso@133
|
2498
|
pascal@119
|
2499 # Check for ELF file
|
pascal@119
|
2500 is_elf()
|
pascal@119
|
2501 {
|
slaxemulator@323
|
2502 [ "$(dd if=$1 bs=1 skip=1 count=3 2> /dev/null)" = "ELF" ]
|
pascal@119
|
2503 }
|
pascal@119
|
2504
|
pascal@119
|
2505 # Print shared library dependencies
|
pascal@119
|
2506 ldd()
|
pascal@119
|
2507 {
|
pascal@130
|
2508 LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $1 2> /dev/null
|
pascal@119
|
2509 }
|
pascal@119
|
2510
|
pascal@119
|
2511 mkdir $TMPDIR
|
pascal@119
|
2512 cd $TMPDIR
|
pascal@140
|
2513 for i in $LOCALSTATE/files.list.lzma \
|
pascal@140
|
2514 $LOCALSTATE/undigest/*/files.list.lzma ; do
|
pascal@119
|
2515 [ -f $i ] && lzma d $i -so >> files.list
|
pascal@119
|
2516 done
|
pascal@119
|
2517 for pkg in $PACKAGES_REPOSITORY/*.tazpkg ; do
|
pascal@119
|
2518 tazpkg extract $pkg > /dev/null 2>&1
|
pascal@119
|
2519 . */receipt
|
pascal@119
|
2520 ALL_DEPENDS="$DEFAULT_DEPENDS "
|
pascal@119
|
2521 scan_dep
|
pascal@119
|
2522 find */fs -type f | while read file ; do
|
pascal@119
|
2523 is_elf $file || continue
|
pascal@119
|
2524 case "$file" in
|
pascal@119
|
2525 *.o|*.ko|*.ko.gz) continue;;
|
pascal@119
|
2526 esac
|
pascal@119
|
2527 ldd $file | while read lib rem; do
|
pascal@119
|
2528 case "$lib" in
|
pascal@128
|
2529 statically|linux-gate.so*|ld-*.so|*/ld-*.so)
|
pascal@119
|
2530 continue;;
|
pascal@119
|
2531 esac
|
gokhlayeh@195
|
2532 for dep in $(fgrep $lib files.list | cut -d: -f1); do
|
pascal@119
|
2533 case " $ALL_DEPENDS " in
|
pascal@119
|
2534 *\ $dep\ *) continue 2;;
|
pascal@119
|
2535 esac
|
gokhlayeh@195
|
2536 for vdep in $(fgrep $dep $LOCALSTATE/packages.equiv | cut -d= -f1); do
|
pascal@128
|
2537 case " $ALL_DEPENDS " in
|
pascal@129
|
2538 *\ $vdep\ *) continue 3;;
|
pascal@128
|
2539 esac
|
pascal@128
|
2540 done
|
pascal@119
|
2541 done
|
pascal@128
|
2542 [ -n "$dep" ] || dep="UNKNOWN"
|
pascal@119
|
2543 echo "$(basename $pkg): ${file#*fs} depends on package $dep for the shared library $lib"
|
pascal@119
|
2544 done
|
pascal@119
|
2545 done
|
pascal@119
|
2546 rm -rf */
|
pascal@119
|
2547 done
|
pascal@119
|
2548 cd /tmp
|
pascal@119
|
2549 rm -rf $TMPDIR
|
gokhlayeh@186
|
2550 ;;
|
pascal@76
|
2551 check)
|
paul@154
|
2552 # Check wok consistency
|
gokhlayeh@186
|
2553 get_tazwok_config
|
pascal@76
|
2554 echo ""
|
pascal@76
|
2555 echo -e "\033[1mWok and packages checking\033[0m
|
pascal@76
|
2556 ================================================================================"
|
pascal@77
|
2557 cd $WOK
|
pascal@77
|
2558 for pkg in $(ls)
|
pascal@76
|
2559 do
|
pascal@76
|
2560 [ -f $pkg/receipt ] || continue
|
gokhlayeh@186
|
2561 RECEIPT= $pkg/receipt
|
gokhlayeh@186
|
2562 source_receipt
|
gokhlayeh@186
|
2563 [ "$PACKAGE" = "$pkg" ] || echo "Package $PACKAGE should be $pkg" >&2
|
gokhlayeh@186
|
2564 [ -n "$VERSION" ] || echo "Package $PACKAGE has no VERSION" >&2
|
gokhlayeh@186
|
2565 [ -n "$PACKED_SIZE" ] && echo "Package $PACKAGE has hardcoded PACKED_SIZE" >&2
|
gokhlayeh@186
|
2566 [ -n "$UNPACKED_SIZE" ] && echo "Package $PACKAGE has hardcoded UNPACKED_SIZE" >&2
|
gokhlayeh@186
|
2567 [ -n "$EXTRAVERSION" ] && echo "Package $PACKAGE has hardcoded EXTRAVERSION" >&2
|
pascal@97
|
2568 if [ -n "$WANTED" ]; then
|
pascal@97
|
2569 if [ ! -f $WANTED/receipt ]; then
|
gokhlayeh@186
|
2570 echo "Package $PACKAGE wants unknown $WANTED package" >&2
|
pascal@97
|
2571 else
|
pascal@97
|
2572 BASEVERSION=$(. $WANTED/receipt ; echo $VERSION)
|
pascal@103
|
2573 if [ "$VERSION" = "$WANTED" ]; then
|
pascal@103
|
2574 # BASEVERSION is computed in receipt
|
gokhlayeh@195
|
2575 fgrep -q '_pkg=' $pkg/receipt &&
|
pascal@103
|
2576 BASEVERSION=$VERSION
|
pascal@103
|
2577 fi
|
pascal@97
|
2578 if [ "$VERSION" != "$BASEVERSION" ]; then
|
gokhlayeh@186
|
2579 echo "Package $PACKAGE ($VERSION) wants $WANTED ($BASEVERSION)" >&2
|
pascal@97
|
2580 fi
|
pascal@97
|
2581 fi
|
pascal@97
|
2582 fi
|
pascal@97
|
2583
|
pascal@94
|
2584 if [ -n "$CATEGORY" ]; then
|
pascal@94
|
2585 case " $(echo $CATEGORIES) " in
|
pascal@94
|
2586 *\ $CATEGORY\ *);;
|
gokhlayeh@186
|
2587 *) echo "Package $PACKAGE has an invalid CATEGORY" >&2;;
|
pascal@94
|
2588 esac
|
pascal@94
|
2589 else
|
gokhlayeh@186
|
2590 echo"Package $PACKAGE has no CATEGORY" >&2
|
pascal@94
|
2591 fi
|
gokhlayeh@186
|
2592 [ -n "$SHORT_DESC" ] || echo "Package $PACKAGE has no SHORT_DESC" >&2
|
gokhlayeh@186
|
2593 [ -n "$MAINTAINER" ] || echo "Package $PACKAGE has no MAINTAINER" >&2
|
pascal@122
|
2594 case "$WGET_URL" in
|
pascal@178
|
2595 ftp*|http*) busybox wget -s $WGET_URL 2> /dev/null ||
|
gokhlayeh@186
|
2596 echo "Package $PACKAGE has a wrong WGET_URL" >&2;;
|
pascal@122
|
2597 '') ;;
|
gokhlayeh@186
|
2598 *) echo "Package $PACKAGE has an invalid WGET_URL" >&2;;
|
pascal@122
|
2599 esac
|
pascal@112
|
2600 case "$WEB_SITE" in
|
pascal@125
|
2601 ftp*|http*);;
|
gokhlayeh@186
|
2602 '') echo "Package $PACKAGE has no WEB_SITE" >&2;;
|
gokhlayeh@186
|
2603 *) echo "Package $PACKAGE has an invalid WEB_SITE" >&2;;
|
pascal@112
|
2604 esac
|
pascal@78
|
2605 case "$MAINTAINER" in
|
gokhlayeh@186
|
2606 *\<*|*\>*) echo "Package $PACKAGE has an invalid MAINTAINER: $MAINTAINER" >&2;;
|
pascal@78
|
2607 esac
|
pascal@78
|
2608 case "$MAINTAINER" in
|
pascal@78
|
2609 *@*);;
|
gokhlayeh@186
|
2610 *) echo "Package $PACKAGE MAINTAINER is not an email address" >&2;;
|
pascal@78
|
2611 esac
|
gokhlayeh@186
|
2612 MSG="Missing dependencies for $PACKAGE $VERSION$EXTRAVERSION :\n" >&2
|
pascal@76
|
2613 for i in $DEPENDS; do
|
pascal@76
|
2614 [ -d $i ] && continue
|
pascal@111
|
2615 [ -n "$(whoprovide $i)" ] && continue
|
pascal@76
|
2616 echo -e "$MSG $i"
|
pascal@76
|
2617 MSG=""
|
pascal@76
|
2618 done
|
gokhlayeh@186
|
2619 MSG="Missing build dependencies for $PACKAGE $VERSION$EXTRAVERSION :\n" >&2
|
pascal@92
|
2620 for i in $BUILD_DEPENDS; do
|
pascal@92
|
2621 [ -d $i ] && continue
|
pascal@111
|
2622 [ -n "$(whoprovide $i)" ] && continue
|
pascal@92
|
2623 echo -e "$MSG $i"
|
pascal@92
|
2624 MSG=""
|
pascal@92
|
2625 done
|
pascal@76
|
2626 MSG="Dependencies loop between $PACKAGE and :\n"
|
pascal@76
|
2627 ALL_DEPS=""
|
pascal@76
|
2628 check_for_deps_loop $PACKAGE $DEPENDS
|
pascal@140
|
2629 [ -d $WOK/$pkg/taz ] && for i in $BUILD_DEPENDS; do
|
pascal@141
|
2630 [ $WOK/$pkg/taz -nt $INSTALLED/$i/files.list ] && continue
|
paul@154
|
2631 echo "$pkg should be rebuilt after $i installation"
|
pascal@140
|
2632 done
|
pascal@76
|
2633 done
|
gokhlayeh@186
|
2634 ;;
|
pankso@7
|
2635 list)
|
paul@166
|
2636 # List packages in wok directory. User can specify a category.
|
pankso@7
|
2637 #
|
gokhlayeh@186
|
2638 get_tazwok_config
|
pankso@7
|
2639 if [ "$2" = "category" ]; then
|
pankso@7
|
2640 echo -e "\033[1m\nPackages categories :\033[0m $CATEGORIES\n"
|
pankso@7
|
2641 exit 0
|
pankso@7
|
2642 fi
|
pankso@7
|
2643 # Check for an asked category.
|
pankso@7
|
2644 if [ -n "$2" ]; then
|
pankso@7
|
2645 ASKED_CATEGORY=$2
|
pankso@7
|
2646 echo ""
|
pankso@7
|
2647 echo -e "\033[1mPackages in category :\033[0m $ASKED_CATEGORY"
|
pankso@7
|
2648 echo "================================================================================"
|
pankso@7
|
2649 for pkg in $WOK/*
|
pankso@7
|
2650 do
|
erjo@168
|
2651 [ ! -f $pkg/receipt ] && continue
|
pankso@7
|
2652 . $pkg/receipt
|
pankso@7
|
2653 if [ "$CATEGORY" == "$ASKED_CATEGORY" ]; then
|
pankso@7
|
2654 echo -n "$PACKAGE"
|
pankso@28
|
2655 echo -e "\033[28G $VERSION"
|
pankso@7
|
2656 packages=$(($packages+1))
|
pankso@7
|
2657 fi
|
pankso@7
|
2658 done
|
pankso@7
|
2659 echo "================================================================================"
|
pankso@7
|
2660 echo -e "$packages packages in category $ASKED_CATEGORY.\n"
|
pankso@7
|
2661 else
|
pankso@7
|
2662 # By default list all packages and version.
|
pankso@7
|
2663 echo ""
|
pankso@7
|
2664 echo -e "\033[1mList of packages in the wok\033[0m"
|
pankso@7
|
2665 echo "================================================================================"
|
pankso@7
|
2666 for pkg in $WOK/*
|
pankso@7
|
2667 do
|
erjo@168
|
2668 [ ! -f $pkg/receipt ] && continue
|
pankso@7
|
2669 . $pkg/receipt
|
pankso@7
|
2670 echo -n "$PACKAGE"
|
pankso@28
|
2671 echo -en "\033[28G $VERSION"
|
pankso@7
|
2672 echo -e "\033[42G $CATEGORY"
|
pankso@7
|
2673 packages=$(($packages+1))
|
pankso@7
|
2674 done
|
pankso@7
|
2675 echo "================================================================================"
|
MikeDSmith25@82
|
2676 echo -e "$packages packages available in the wok.\n"
|
pankso@7
|
2677 fi
|
pankso@7
|
2678 ;;
|
pankso@7
|
2679 info)
|
MikeDSmith25@82
|
2680 # Information about a package.
|
pankso@7
|
2681 #
|
gokhlayeh@186
|
2682 get_tazwok_config
|
pankso@7
|
2683 check_for_package_on_cmdline
|
pankso@7
|
2684 check_for_receipt
|
pankso@7
|
2685 . $WOK/$PACKAGE/receipt
|
pankso@7
|
2686 echo ""
|
MikeDSmith25@82
|
2687 echo -e "\033[1mTazwok package information\033[0m
|
pankso@7
|
2688 ================================================================================
|
pankso@7
|
2689 Package : $PACKAGE
|
pankso@7
|
2690 Version : $VERSION
|
pankso@7
|
2691 Category : $CATEGORY
|
pankso@7
|
2692 Short desc : $SHORT_DESC
|
pankso@7
|
2693 Maintainer : $MAINTAINER"
|
pankso@7
|
2694 if [ ! "$WEB_SITE" = "" ]; then
|
pankso@7
|
2695 echo "Web site : $WEB_SITE"
|
pankso@7
|
2696 fi
|
pankso@7
|
2697 if [ ! "$DEPENDS" = "" ]; then
|
pankso@7
|
2698 echo "Depends : $DEPENDS"
|
pankso@7
|
2699 fi
|
pankso@7
|
2700 if [ ! "$WANTED" = "" ]; then
|
pankso@7
|
2701 echo "Wanted src : $WANTED"
|
pankso@7
|
2702 fi
|
pankso@7
|
2703 echo "================================================================================"
|
pankso@7
|
2704 echo ""
|
gokhlayeh@186
|
2705 ;;
|
pankso@7
|
2706 check-log)
|
pankso@7
|
2707 # We just cat the file log to view process info.
|
pankso@7
|
2708 #
|
gokhlayeh@186
|
2709 get_tazwok_config
|
pankso@7
|
2710 if [ ! -f "$LOG" ]; then
|
gokhlayeh@186
|
2711 echo -e "\nNo process log found. The package is probably not cooked.\n" >&2
|
gokhlayeh@186
|
2712 exit 1
|
pankso@7
|
2713 else
|
pankso@7
|
2714 echo ""
|
pankso@7
|
2715 echo -e "\033[1mPackage process log for :\033[0m $PACKAGE"
|
pankso@7
|
2716 echo "================================================================================"
|
pankso@7
|
2717 cat $LOG
|
pankso@7
|
2718 echo "================================================================================"
|
pankso@7
|
2719 echo ""
|
gokhlayeh@237
|
2720 if [ -s "$WOK/$PACKAGE/warning.txt" ]; then
|
gokhlayeh@237
|
2721 echo -e "\033[1mCook warning(s) for :\033[0m $PACKAGE"
|
gokhlayeh@237
|
2722 echo "================================================================================"
|
gokhlayeh@237
|
2723 cat "$WOK/$PACKAGE/warning.txt"
|
gokhlayeh@237
|
2724 echo "================================================================================"
|
gokhlayeh@237
|
2725 echo ""
|
gokhlayeh@237
|
2726 fi
|
pankso@7
|
2727 fi
|
gokhlayeh@186
|
2728 ;;
|
pankso@7
|
2729 search)
|
pankso@7
|
2730 # Search for a package by pattern or name.
|
pankso@7
|
2731 #
|
gokhlayeh@186
|
2732 get_tazwok_config
|
pankso@7
|
2733 if [ -z "$2" ]; then
|
gokhlayeh@186
|
2734 echo -e "\nPlease specify a pattern or a package name to search." >&2
|
gokhlayeh@186
|
2735 echo -e "Example : 'tazwok search gcc'.\n" >&2
|
gokhlayeh@186
|
2736 exit 1
|
pankso@7
|
2737 fi
|
pankso@7
|
2738 echo ""
|
pankso@7
|
2739 echo -e "\033[1mSearch result for :\033[0m $2"
|
pankso@7
|
2740 echo "================================================================================"
|
gokhlayeh@195
|
2741 list=`ls -1 $WOK | fgrep $2`
|
pankso@7
|
2742 for pkg in $list
|
pankso@7
|
2743 do
|
pankso@7
|
2744 . $WOK/$pkg/receipt
|
pankso@7
|
2745 echo -n "$PACKAGE "
|
pankso@7
|
2746 echo -en "\033[24G $VERSION"
|
pankso@7
|
2747 echo -e "\033[42G $CATEGORY"
|
gokhlayeh@186
|
2748 packages=$(($PACKAGEs+1))
|
pankso@7
|
2749 done
|
pankso@7
|
2750 echo "================================================================================"
|
pankso@7
|
2751 echo "$packages packages found for : $2"
|
pankso@7
|
2752 echo ""
|
gokhlayeh@186
|
2753 ;;
|
pankso@7
|
2754 compile)
|
pankso@7
|
2755 # Configure and make a package with the receipt.
|
pankso@7
|
2756 #
|
gokhlayeh@186
|
2757 get_tazwok_config
|
gokhlayeh@186
|
2758 source_lib report
|
gokhlayeh@186
|
2759 report start
|
pankso@7
|
2760 compile_package
|
gokhlayeh@186
|
2761 ;;
|
pankso@7
|
2762 genpkg)
|
paul@121
|
2763 # Generate a package.
|
pankso@7
|
2764 #
|
gokhlayeh@186
|
2765 get_tazwok_config
|
gokhlayeh@186
|
2766 source_lib report
|
gokhlayeh@186
|
2767 report start
|
pankso@7
|
2768 gen_package
|
gokhlayeh@186
|
2769 ;;
|
pankso@7
|
2770 cook)
|
pankso@7
|
2771 # Compile and generate a package. Just execute tazwok with
|
pankso@7
|
2772 # the good commands.
|
pankso@7
|
2773 #
|
pankso@7
|
2774 check_root
|
gokhlayeh@186
|
2775 get_tazwok_config
|
gokhlayeh@186
|
2776 source_lib report
|
gokhlayeh@186
|
2777 report start
|
gokhlayeh@215
|
2778 update_wan_db
|
gokhlayeh@215
|
2779 check_for_commit
|
gokhlayeh@215
|
2780 [ "$plan_sort_depdb" ] && sort -o $dep_db $dep_db && unset plan_sort_depdb
|
gokhlayeh@215
|
2781 [ "$plan_sort_wandb" ] && sort -o $wan_db $wan_db && unset plan_sort_wandb
|
gokhlayeh@215
|
2782 if [ "$plan_regen_cookorder" ]; then
|
gokhlayeh@397
|
2783 [ "$(sed 1!d $cookorder)" = "#PlanSort" ] || \
|
gokhlayeh@397
|
2784 sed 1i"#PlanSort" -i $cookorder
|
gokhlayeh@215
|
2785 fi
|
gokhlayeh@186
|
2786 cook
|
gokhlayeh@186
|
2787 ;;
|
gokhlayeh@186
|
2788 sort-cooklist)
|
gokhlayeh@297
|
2789 check_root
|
gokhlayeh@186
|
2790 get_tazwok_config
|
gokhlayeh@405
|
2791 check_for_list
|
gokhlayeh@297
|
2792 report(){ : ; }
|
gokhlayeh@297
|
2793 # When using sort-cooklist, the script should behave as for gen-cooklist
|
gokhlayeh@297
|
2794 # The only difference between theses two is where the output is sended.
|
gokhlayeh@297
|
2795 COMMAND=gen-cooklist
|
gokhlayeh@297
|
2796 gen_cook_list
|
gokhlayeh@405
|
2797 cp -af $tmp/cooklist $LIST
|
gokhlayeh@186
|
2798 ;;
|
pankso@7
|
2799 cook-list)
|
gokhlayeh@204
|
2800 # Cook all packages listed in a file or in default cooklist.
|
gokhlayeh@186
|
2801 check_root
|
gokhlayeh@204
|
2802 get_options_list="pkg forced"
|
gokhlayeh@186
|
2803 get_tazwok_config
|
gokhlayeh@186
|
2804 source_lib report
|
gokhlayeh@186
|
2805 report start
|
gokhlayeh@204
|
2806 if ! [ "$pkg" ]; then
|
gokhlayeh@405
|
2807 [ "$LIST" ] && check_for_list
|
gokhlayeh@186
|
2808 fi
|
gokhlayeh@204
|
2809 gen_cook_list
|
gokhlayeh@186
|
2810 cook_list
|
gokhlayeh@186
|
2811 ;;
|
gokhlayeh@186
|
2812 clean)
|
gokhlayeh@186
|
2813 # Clean up a package work directory + thoses which want it.
|
pankso@7
|
2814 #
|
gokhlayeh@186
|
2815 get_tazwok_config
|
pankso@7
|
2816 check_for_package_on_cmdline
|
pankso@7
|
2817 check_for_receipt
|
gokhlayeh@186
|
2818 source_lib report
|
gokhlayeh@186
|
2819 report start
|
pankso@7
|
2820 . $RECEIPT
|
gokhlayeh@186
|
2821 clean
|
gokhlayeh@186
|
2822 ;;
|
pankso@7
|
2823 gen-clean-wok)
|
paul@121
|
2824 # Generate a clean wok from the current wok by copying all receipts
|
pankso@7
|
2825 # and stuff directory.
|
pankso@7
|
2826 #
|
gokhlayeh@186
|
2827 get_tazwok_config
|
gokhlayeh@186
|
2828 source_lib report
|
gokhlayeh@186
|
2829 report start
|
gokhlayeh@186
|
2830 if [ -z "$ARG" ]; then
|
gokhlayeh@186
|
2831 echo -e "\nPlease specify the destination for the new clean wok.\n" >&2
|
gokhlayeh@186
|
2832 exit 1
|
pankso@7
|
2833 else
|
gokhlayeh@186
|
2834 dest=$ARG
|
pankso@7
|
2835 mkdir -p $dest
|
pankso@7
|
2836 fi
|
gokhlayeh@186
|
2837 report step "Creating clean wok in : $dest"
|
pankso@7
|
2838 for pkg in `ls -1 $WOK`
|
pankso@7
|
2839 do
|
pankso@7
|
2840 mkdir -p $dest/$pkg
|
pankso@7
|
2841 cp -a $WOK/$pkg/receipt $dest/$pkg
|
gokhlayeh@186
|
2842 [ -f $WOK/$pkg/description.txt ] && \
|
gokhlayeh@186
|
2843 cp -a $WOK/$pkg/description.txt $dest/$pkg
|
pankso@7
|
2844 if [ -d "$WOK/$pkg/stuff" ]; then
|
pankso@7
|
2845 cp -a $WOK/$pkg/stuff $dest/$pkg
|
pankso@7
|
2846 fi
|
pankso@7
|
2847 done
|
gokhlayeh@186
|
2848 [ -d $WOK/.hg ] && cp -a $WOK/.hg $dest
|
gokhlayeh@186
|
2849 report end-step
|
pankso@7
|
2850 echo "Packages cleaned : `ls -1 $dest | wc -l`"
|
pankso@7
|
2851 echo ""
|
gokhlayeh@186
|
2852 ;;
|
pankso@7
|
2853 clean-wok)
|
pankso@7
|
2854 # Clean all packages in the work directory
|
pankso@7
|
2855 #
|
gokhlayeh@186
|
2856 get_tazwok_config
|
gokhlayeh@186
|
2857 source_lib report
|
gokhlayeh@186
|
2858 report start
|
gokhlayeh@186
|
2859 report step "Cleaning wok"
|
gokhlayeh@186
|
2860 for PACKAGE in `ls -1 $WOK`
|
pankso@7
|
2861 do
|
gokhlayeh@186
|
2862 set_common_path
|
gokhlayeh@186
|
2863 source_receipt
|
gokhlayeh@186
|
2864 clean
|
pankso@7
|
2865 done
|
pankso@7
|
2866 echo "`ls -1 $WOK | wc -l` packages cleaned."
|
gokhlayeh@186
|
2867 ;;
|
gokhlayeh@266
|
2868 clean-src)
|
gokhlayeh@266
|
2869 # Remove tarball unrelated to wok receipts from src repo.
|
gokhlayeh@266
|
2870 check_root
|
gokhlayeh@266
|
2871 get_options_list="forced"
|
gokhlayeh@266
|
2872 get_tazwok_config
|
gokhlayeh@266
|
2873 cd $SOURCES_REPOSITORY
|
gokhlayeh@266
|
2874 echo -n "Checking $SOURCES_REPOSITORY..."
|
gokhlayeh@266
|
2875 for TARBALL in *; do
|
gokhlayeh@266
|
2876 [ "$TARBALL" = sources.list ] && continue
|
gokhlayeh@266
|
2877 grep -q $'\t'$TARBALL$ $SOURCES_REPOSITORY/sources.list || \
|
gokhlayeh@266
|
2878 echo $TARBALL >> $tmp/obsolete
|
gokhlayeh@266
|
2879 done
|
gokhlayeh@266
|
2880 status
|
slaxemulator@273
|
2881 if ! [ -f $tmp/obsolete ]; then
|
slaxemulator@273
|
2882 echo "No sources need to be removed."
|
slaxemulator@273
|
2883 exit 1
|
slaxemulator@273
|
2884 fi
|
gokhlayeh@266
|
2885 echo ""
|
gokhlayeh@266
|
2886 echo -e "\033[1mObsolete/unrelated-to-wok sourcess :\033[0m"
|
gokhlayeh@266
|
2887 horizontal_line
|
gokhlayeh@266
|
2888 cat $tmp/obsolete
|
gokhlayeh@266
|
2889 horizontal_line
|
gokhlayeh@266
|
2890 echo "$(wc -l $tmp/obsolete | cut -f1 -d' ') tarballs to remove."
|
pankso@7
|
2891 echo ""
|
gokhlayeh@266
|
2892 echo -n "Please confirm removing (type uppercase YES): "
|
gokhlayeh@266
|
2893 read answer
|
gokhlayeh@266
|
2894 if [ "$answer" = YES ]; then
|
gokhlayeh@266
|
2895 echo -n "Removing old sources..."
|
gokhlayeh@266
|
2896 cat $tmp/obsolete | while read i; do
|
gokhlayeh@266
|
2897 rm -f $SOURCES_REPOSITORY/$i
|
gokhlayeh@266
|
2898 done
|
gokhlayeh@266
|
2899 status
|
gokhlayeh@266
|
2900 fi
|
gokhlayeh@266
|
2901 ;;
|
pankso@7
|
2902 gen-list)
|
gokhlayeh@186
|
2903 get_tazwok_config
|
gokhlayeh@204
|
2904 if [ "$2" ]; then
|
pankso@7
|
2905 if [ -d "$2" ]; then
|
gokhlayeh@204
|
2906 pkg_repository=$2
|
pankso@7
|
2907 else
|
gokhlayeh@204
|
2908 echo -e "\nUnable to find directory : $2\n" >&2
|
gokhlayeh@204
|
2909 exit 1
|
pankso@7
|
2910 fi
|
pankso@7
|
2911 fi
|
gokhlayeh@204
|
2912
|
gokhlayeh@186
|
2913 source_lib report
|
gokhlayeh@186
|
2914 report start
|
gokhlayeh@204
|
2915 if [ "$pkg_repository" ]; then
|
gokhlayeh@204
|
2916 gen_packages_db
|
gokhlayeh@204
|
2917 else
|
gokhlayeh@204
|
2918 pkg_repository=$PACKAGES_REPOSITORY && gen_packages_db
|
gokhlayeh@204
|
2919 pkg_repository=$INCOMING_REPOSITORY && gen_packages_db
|
pankso@28
|
2920 fi
|
gokhlayeh@186
|
2921 ;;
|
gokhlayeh@186
|
2922 check-list)
|
gokhlayeh@186
|
2923 # The directory to move into by default is the repository,
|
gokhlayeh@186
|
2924 # if $2 is not empty cd into $2.
|
pascal@178
|
2925 #
|
gokhlayeh@186
|
2926 get_tazwok_config
|
gokhlayeh@204
|
2927 if [ "$2" ]; then
|
pascal@178
|
2928 if [ -d "$2" ]; then
|
gokhlayeh@204
|
2929 pkg_repository=$2
|
pascal@178
|
2930 else
|
gokhlayeh@186
|
2931 echo -e "\nUnable to find directory : $2\n" >&2
|
gokhlayeh@186
|
2932 exit 1
|
pascal@178
|
2933 fi
|
pascal@178
|
2934 fi
|
gokhlayeh@186
|
2935
|
gokhlayeh@186
|
2936 source_lib report
|
gokhlayeh@204
|
2937 report start
|
gokhlayeh@204
|
2938 if [ "$pkg_repository" ]; then
|
gokhlayeh@204
|
2939 update_packages_db
|
gokhlayeh@204
|
2940 else
|
gokhlayeh@204
|
2941 pkg_repository=$PACKAGES_REPOSITORY && update_packages_db
|
gokhlayeh@204
|
2942 pkg_repository=$INCOMING_REPOSITORY && update_packages_db
|
gokhlayeh@204
|
2943 fi
|
gokhlayeh@186
|
2944 ;;
|
pankso@7
|
2945 new-tree)
|
MikeDSmith25@82
|
2946 # Just create a few directories and generate an empty receipt to prepare
|
pankso@7
|
2947 # the creation of a new package.
|
pankso@7
|
2948 #
|
gokhlayeh@186
|
2949 get_tazwok_config
|
pankso@7
|
2950 check_for_package_on_cmdline
|
slaxemulator@362
|
2951 clean_wok=$LOCAL_REPOSITORY/clean-wok
|
slaxemulator@362
|
2952 if [ -d $clean_wok/$PACKAGE ]; then
|
gokhlayeh@186
|
2953 echo -e "\n$PACKAGE package tree already exists.\n" >&2
|
gokhlayeh@186
|
2954 exit 1
|
pankso@7
|
2955 fi
|
pankso@7
|
2956 echo "Creating : $WOK/$PACKAGE"
|
slaxemulator@362
|
2957 mkdir $clean_wok/$PACKAGE
|
slaxemulator@362
|
2958 cd $clean_wok/$PACKAGE
|
pankso@7
|
2959 echo -n "Preparing the receipt..."
|
pankso@7
|
2960 #
|
pankso@7
|
2961 # Default receipt begin.
|
pankso@7
|
2962 #
|
pankso@7
|
2963 echo "# SliTaz package receipt." > receipt
|
pankso@7
|
2964 echo "" >> receipt
|
pankso@7
|
2965 echo "PACKAGE=\"$PACKAGE\"" >> receipt
|
pankso@7
|
2966 # Finish the empty receipt.
|
pankso@7
|
2967 cat >> receipt << "EOF"
|
pankso@7
|
2968 VERSION=""
|
pankso@7
|
2969 CATEGORY=""
|
pankso@7
|
2970 SHORT_DESC=""
|
pankso@7
|
2971 MAINTAINER=""
|
pankso@7
|
2972 DEPENDS=""
|
pankso@7
|
2973 TARBALL="$PACKAGE-$VERSION.tar.gz"
|
pankso@7
|
2974 WEB_SITE=""
|
pankso@7
|
2975 WGET_URL=""
|
pankso@7
|
2976
|
pankso@7
|
2977 # Rules to configure and make the package.
|
pankso@7
|
2978 compile_rules()
|
pankso@7
|
2979 {
|
pankso@7
|
2980 cd $src
|
gokhlayeh@204
|
2981 ./configure && make && make install
|
pankso@7
|
2982 }
|
pankso@7
|
2983
|
pankso@7
|
2984 # Rules to gen a SliTaz package suitable for Tazpkg.
|
pankso@7
|
2985 genpkg_rules()
|
pankso@7
|
2986 {
|
pankso@7
|
2987 mkdir -p $fs/usr
|
pankso@7
|
2988 cp -a $_pkg/usr/bin $fs/usr
|
pankso@7
|
2989 }
|
pankso@7
|
2990
|
pankso@7
|
2991 EOF
|
pankso@7
|
2992 #
|
pankso@7
|
2993 # Default receipt end.
|
pankso@7
|
2994 #
|
pankso@7
|
2995 status
|
pankso@7
|
2996 # Interactive mode, asking and seding.
|
pankso@7
|
2997 if [ "$3" = "--interactive" ]; then
|
paul@154
|
2998 echo "Entering into interactive mode..."
|
pankso@7
|
2999 echo "================================================================================"
|
pankso@7
|
3000 echo "Package : $PACKAGE"
|
pankso@7
|
3001 # Version.
|
pankso@7
|
3002 echo -n "Version : " ; read anser
|
pankso@7
|
3003 sed -i s/'VERSION=\"\"'/"VERSION=\"$anser\""/ receipt
|
pankso@7
|
3004 # Category.
|
pankso@7
|
3005 echo -n "Category : " ; read anser
|
pankso@7
|
3006 sed -i s/'CATEGORY=\"\"'/"CATEGORY=\"$anser\""/ receipt
|
pankso@7
|
3007 # Short description.
|
pankso@7
|
3008 echo -n "Short desc : " ; read anser
|
pankso@7
|
3009 sed -i s/'SHORT_DESC=\"\"'/"SHORT_DESC=\"$anser\""/ receipt
|
pankso@7
|
3010 # Maintainer.
|
pankso@7
|
3011 echo -n "Maintainer : " ; read anser
|
pankso@7
|
3012 sed -i s/'MAINTAINER=\"\"'/"MAINTAINER=\"$anser\""/ receipt
|
pankso@7
|
3013 # Web site.
|
pankso@7
|
3014 echo -n "Web site : " ; read anser
|
pankso@133
|
3015 sed -i s#'WEB_SITE=\"\"'#"WEB_SITE=\"$anser\""# receipt
|
pankso@7
|
3016 echo ""
|
pankso@7
|
3017 # Wget URL.
|
pankso@7
|
3018 echo "Wget URL to download source tarball."
|
pankso@7
|
3019 echo "Example : \$GNU_MIRROR/\$PACKAGE/\$TARBALL"
|
pankso@7
|
3020 echo -n "Wget url : " ; read anser
|
pankso@7
|
3021 sed -i s#'WGET_URL=\"\"'#"WGET_URL=\"$anser\""# receipt
|
pankso@7
|
3022 # Ask for a stuff dir.
|
pankso@7
|
3023 echo -n "Do you need a stuff directory ? (y/N) : " ; read anser
|
pankso@7
|
3024 if [ "$anser" = "y" ]; then
|
pankso@7
|
3025 echo -n "Creating the stuff directory..."
|
pankso@7
|
3026 mkdir stuff && status
|
pankso@7
|
3027 fi
|
pankso@7
|
3028 # Ask for a description file.
|
pankso@7
|
3029 echo -n "Are you going to write a description ? (y/N) : " ; read anser
|
pankso@7
|
3030 if [ "$anser" = "y" ]; then
|
pankso@7
|
3031 echo -n "Creating the description.txt file..."
|
pankso@7
|
3032 echo "" > description.txt && status
|
pankso@7
|
3033 fi
|
pankso@7
|
3034 echo "================================================================================"
|
pankso@7
|
3035 echo ""
|
pankso@7
|
3036 fi
|
gokhlayeh@186
|
3037 ;;
|
pankso@7
|
3038 remove)
|
pankso@7
|
3039 # Remove a package from the wok.
|
pankso@7
|
3040 #
|
gokhlayeh@186
|
3041 get_tazwok_config
|
pankso@7
|
3042 check_for_package_on_cmdline
|
pankso@7
|
3043 echo ""
|
pascal@83
|
3044 echo -n "Please confirm deletion (y/N) : "; read anser
|
pascal@83
|
3045 if [ "$anser" = "y" ]; then
|
pascal@83
|
3046 echo -n "Removing $PACKAGE..."
|
pascal@83
|
3047 rm -rf $WOK/$PACKAGE && status
|
pascal@83
|
3048 echo ""
|
pascal@83
|
3049 fi
|
gokhlayeh@186
|
3050 ;;
|
gokhlayeh@304
|
3051 update-wok)
|
paul@166
|
3052 # Pull and update a Hg wok.
|
gokhlayeh@304
|
3053 get_options_list="local"
|
gokhlayeh@186
|
3054 get_tazwok_config
|
gokhlayeh@309
|
3055 source_lib report
|
gokhlayeh@310
|
3056 report start
|
gokhlayeh@304
|
3057 clean_wok=$LOCAL_REPOSITORY/clean-wok
|
gokhlayeh@304
|
3058 cd $clean_wok
|
gokhlayeh@304
|
3059 if ! [ "$local" ]; then
|
gokhlayeh@304
|
3060 if [ "$WOK_UPDATE_METHOD" = hg ]; then
|
gokhlayeh@304
|
3061 if ! [ -f "$INSTALLED/mercurial/receipt" ]; then
|
gokhlayeh@304
|
3062
|
gokhlayeh@304
|
3063 # Auto-install only if we are in a cook chroot.
|
gokhlayeh@304
|
3064 if [ -x /usr/bin/clean-chroot ]; then
|
gokhlayeh@392
|
3065 tazpkg get-install mercurial
|
gokhlayeh@392
|
3066 else
|
gokhlayeh@304
|
3067 echo "" >&2
|
slaxemulator@327
|
3068 echo "You need to install mercurial to get wok from hg (recommended). Oherwise, you can switch wok get method to \"tarball\" into $LOCAL_RESOSITORY/tazwok.conf (per-repository configuration, it not always exists) or /etc/slitaz/tazwok.conf (global configuration)." | fold -s >&2
|
gokhlayeh@304
|
3069 echo "">&2
|
gokhlayeh@330
|
3070 exit 1
|
gokhlayeh@304
|
3071 fi
|
gokhlayeh@330
|
3072 fi
|
gokhlayeh@304
|
3073
|
gokhlayeh@330
|
3074 report step "Getting wok changes using hg"
|
gokhlayeh@330
|
3075 if [ -d .hg ]; then
|
gokhlayeh@330
|
3076 hg pull -u || exit 1
|
gokhlayeh@304
|
3077 else
|
gokhlayeh@330
|
3078 hg clone $HG_WOK . || exit 1
|
gokhlayeh@304
|
3079 fi
|
gokhlayeh@309
|
3080 report end-step
|
gokhlayeh@304
|
3081 [ -x /usr/bin/clean-chroot ] && clean-chroot
|
gokhlayeh@304
|
3082 else
|
gokhlayeh@309
|
3083 report step "Getting wok changes using tarball"
|
gokhlayeh@304
|
3084 { mkdir .tmp && cd .tmp
|
gokhlayeh@304
|
3085 wget "$TARBALL_WOK" &&
|
gokhlayeh@304
|
3086 case $TARBALL_WOK in
|
gokhlayeh@304
|
3087 *bz2) tar xjf *.bz2 -C wok; rm *.bz2;;
|
gokhlayeh@304
|
3088 *lzma) unlzma -c *.lzma | tar xf - -C wok; rm *.lzma ;;
|
gokhlayeh@304
|
3089 *gz) tar xzf *.gz -C wok; rm*.gz ;;
|
gokhlayeh@304
|
3090 esac &&
|
gokhlayeh@304
|
3091 rm -r $(ls -d $clean_wok/*) &&
|
gokhlayeh@304
|
3092 cp -a wok/* $clean_wok &&
|
gokhlayeh@304
|
3093 cd .. &&
|
gokhlayeh@304
|
3094 rm -r .tmp
|
gokhlayeh@304
|
3095 } || { echo "That's not cool: it fails!" >&2
|
gokhlayeh@309
|
3096 report end-step
|
gokhlayeh@304
|
3097 exit 1; }
|
gokhlayeh@309
|
3098 report end-step
|
gokhlayeh@304
|
3099 fi
|
pankso@106
|
3100 fi
|
gokhlayeh@309
|
3101 report step "Appending changes to wok"
|
gokhlayeh@304
|
3102
|
gokhlayeh@308
|
3103 # Handle removed files/dir.
|
gokhlayeh@308
|
3104 cd $WOK
|
gokhlayeh@313
|
3105 for dir in *; do
|
slaxemulator@329
|
3106 [ -d "$clean_wok/$dir" ] || rm -rf $dir
|
gokhlayeh@308
|
3107 done
|
gokhlayeh@308
|
3108 for file in */receipt */description.txt; do
|
slaxemulator@329
|
3109 [ -f "$clean_wok/$file" ] || rm -rf $file
|
gokhlayeh@308
|
3110 done
|
gokhlayeh@330
|
3111 for i in $(find */stuff 2>/dev/null); do
|
slaxemulator@329
|
3112 [ -e "$clean_wok/$i" ] || rm -rf $i
|
gokhlayeh@304
|
3113 done
|
gokhlayeh@304
|
3114
|
gokhlayeh@308
|
3115 cp -a $clean_wok/* $WOK
|
gokhlayeh@309
|
3116 report end-step
|
gokhlayeh@186
|
3117 ;;
|
pankso@108
|
3118 maintainers)
|
gokhlayeh@186
|
3119 get_tazwok_config
|
pankso@108
|
3120 echo ""
|
pankso@108
|
3121 echo "List of maintainers for: $WOK"
|
pankso@108
|
3122 echo "================================================================================"
|
pankso@108
|
3123 touch /tmp/slitaz-maintainers
|
pankso@108
|
3124 for pkg in $WOK/*
|
pankso@108
|
3125 do
|
pankso@108
|
3126 . $pkg/receipt
|
gokhlayeh@195
|
3127 if ! fgrep -q "$MAINTAINER" /tmp/slitaz-maintainers; then
|
pankso@108
|
3128 echo "$MAINTAINER" >> /tmp/slitaz-maintainers
|
pankso@108
|
3129 echo "$MAINTAINER"
|
pankso@108
|
3130 fi
|
pankso@108
|
3131 done
|
pankso@108
|
3132 echo "================================================================================"
|
pankso@108
|
3133 echo "Maintainers: `cat /tmp/slitaz-maintainers | wc -l`"
|
pankso@108
|
3134 echo ""
|
pankso@108
|
3135 # Remove tmp files
|
gokhlayeh@186
|
3136 rm -f /tmp/slitaz-maintainers
|
gokhlayeh@186
|
3137 ;;
|
pankso@107
|
3138 maintained-by)
|
paul@166
|
3139 # Search for packages maintained by a contributor.
|
gokhlayeh@186
|
3140 get_tazwok_config
|
pankso@107
|
3141 if [ ! -n "$2" ]; then
|
gokhlayeh@186
|
3142 echo "Specify a name or email of a maintainer." >&2
|
gokhlayeh@186
|
3143 exit 1
|
pankso@107
|
3144 fi
|
pankso@107
|
3145 echo "Maintainer packages"
|
pankso@107
|
3146 echo "================================================================================"
|
pankso@107
|
3147 for pkg in $WOK/*
|
pankso@107
|
3148 do
|
pankso@107
|
3149 . $pkg/receipt
|
gokhlayeh@195
|
3150 if echo "$MAINTAINER" | fgrep -q "$2"; then
|
pankso@107
|
3151 echo "$PACKAGE"
|
gokhlayeh@186
|
3152 packages=$(($PACKAGEs+1))
|
pankso@107
|
3153 fi
|
pankso@107
|
3154 done
|
pankso@107
|
3155 echo "================================================================================"
|
gokhlayeh@186
|
3156 echo "Packages maintained by $2: $PACKAGEs"
|
gokhlayeh@186
|
3157 echo ""
|
gokhlayeh@186
|
3158 ;;
|
gokhlayeh@268
|
3159 tags)
|
gokhlayeh@268
|
3160 get_tazwok_config
|
gokhlayeh@268
|
3161 echo -e "\n\033[1mTags list :\033[0m"
|
gokhlayeh@268
|
3162 horizontal_line
|
gokhlayeh@268
|
3163 cd $WOK
|
gokhlayeh@268
|
3164 for i in */receipt; do
|
gokhlayeh@268
|
3165 unset TAGS
|
gokhlayeh@268
|
3166 source $i
|
gokhlayeh@268
|
3167 for t in $TAGS; do
|
gokhlayeh@268
|
3168 grep -q ^$t$ $tmp/tags && continue
|
gokhlayeh@268
|
3169 echo $t | tee -a $tmp/tags
|
gokhlayeh@268
|
3170 done
|
gokhlayeh@268
|
3171 done
|
gokhlayeh@268
|
3172 horizontal_line
|
gokhlayeh@268
|
3173 echo "$(wc -l $tmp/tags | cut -f1 -d ' ') tags listed."
|
gokhlayeh@268
|
3174 ;;
|
erjo@159
|
3175 check-src)
|
erjo@159
|
3176 # Verify if upstream package is still available
|
erjo@159
|
3177 #
|
gokhlayeh@186
|
3178 get_tazwok_config
|
erjo@159
|
3179 check_for_package_on_cmdline
|
erjo@159
|
3180 check_for_receipt
|
gokhlayeh@186
|
3181 source_receipt
|
erjo@159
|
3182 check_src()
|
erjo@159
|
3183 {
|
erjo@159
|
3184 for url in $@; do
|
pascal@178
|
3185 busybox wget -s $url 2>/dev/null && break
|
erjo@159
|
3186 done
|
erjo@159
|
3187 }
|
gokhlayeh@186
|
3188 if [ "$WGET_URL" ];then
|
erjo@159
|
3189 echo -n "$PACKAGE : "
|
erjo@159
|
3190 check_src $WGET_URL
|
erjo@159
|
3191 status
|
erjo@159
|
3192 else
|
erjo@159
|
3193 echo "No tarball to check for $PACKAGE"
|
erjo@159
|
3194 fi
|
gokhlayeh@186
|
3195 ;;
|
gokhlayeh@186
|
3196 get-src)
|
gokhlayeh@186
|
3197 check_root
|
gokhlayeh@225
|
3198 get_options_list="target nounpack"
|
gokhlayeh@186
|
3199 get_tazwok_config
|
gokhlayeh@186
|
3200 check_for_package_on_cmdline
|
gokhlayeh@186
|
3201 check_for_receipt
|
gokhlayeh@186
|
3202 source_receipt
|
gokhlayeh@186
|
3203 if [ "$WGET_URL" ];then
|
gokhlayeh@186
|
3204 source_lib report
|
gokhlayeh@186
|
3205 report start
|
gokhlayeh@225
|
3206 check_for_tarball
|
gokhlayeh@186
|
3207 else
|
gokhlayeh@186
|
3208 echo "No tarball to download for $PACKAGE"
|
gokhlayeh@186
|
3209 fi
|
gokhlayeh@186
|
3210 ;;
|
gokhlayeh@204
|
3211 check-commit)
|
gokhlayeh@186
|
3212 check_root
|
gokhlayeh@204
|
3213 get_options_list="missing forced"
|
gokhlayeh@186
|
3214 get_tazwok_config
|
gokhlayeh@186
|
3215 source_lib report
|
gokhlayeh@186
|
3216 report start
|
gokhlayeh@204
|
3217 if [ "$forced" ]; then
|
gokhlayeh@204
|
3218 rm -f $WOK/*/md5
|
gokhlayeh@204
|
3219 unset forced
|
gokhlayeh@204
|
3220 fi
|
gokhlayeh@204
|
3221 if [ "$missing" ]; then
|
gokhlayeh@204
|
3222 pkg=$(ls -1 $WOK)
|
gokhlayeh@204
|
3223 else
|
gokhlayeh@204
|
3224 pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
|
gokhlayeh@204
|
3225 grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
|
gokhlayeh@204
|
3226 } | sort -u)"
|
gokhlayeh@204
|
3227 fi
|
gokhlayeh@186
|
3228 gen_cook_list
|
gokhlayeh@186
|
3229 ;;
|
gokhlayeh@186
|
3230 cook-commit)
|
gokhlayeh@186
|
3231 check_root
|
gokhlayeh@204
|
3232 get_options_list="missing forced"
|
gokhlayeh@186
|
3233 get_tazwok_config
|
gokhlayeh@186
|
3234 source_lib report
|
gokhlayeh@186
|
3235 report start
|
gokhlayeh@204
|
3236 if [ "$forced" ]; then
|
gokhlayeh@204
|
3237 rm -f $WOK/*/md5
|
gokhlayeh@204
|
3238 unset forced
|
gokhlayeh@204
|
3239 fi
|
gokhlayeh@204
|
3240 if [ "$missing" ]; then
|
gokhlayeh@204
|
3241 pkg=$(ls -1 $WOK)
|
gokhlayeh@204
|
3242 else
|
gokhlayeh@204
|
3243 pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
|
gokhlayeh@204
|
3244 grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
|
gokhlayeh@204
|
3245 } | sort -u)"
|
gokhlayeh@204
|
3246 fi
|
gokhlayeh@186
|
3247 gen_cook_list
|
gokhlayeh@186
|
3248 cook_list
|
gokhlayeh@186
|
3249 ;;
|
gokhlayeh@186
|
3250 cook-all)
|
gokhlayeh@186
|
3251 check_root
|
gokhlayeh@204
|
3252 get_options_list="forced missing"
|
gokhlayeh@186
|
3253 get_tazwok_config
|
gokhlayeh@186
|
3254 source_lib report
|
gokhlayeh@186
|
3255 report start
|
gokhlayeh@204
|
3256 if [ "$missing" ]; then
|
gokhlayeh@204
|
3257 pkg=$(ls -1 $WOK)
|
gokhlayeh@204
|
3258 else
|
gokhlayeh@204
|
3259 pkg="$({ grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt
|
gokhlayeh@204
|
3260 grep ^[a-zA-Z0-9] $INCOMING_REPOSITORY/packages.txt
|
gokhlayeh@204
|
3261 } | sort -u)"
|
gokhlayeh@204
|
3262 fi
|
gokhlayeh@204
|
3263 gen_cook_list
|
gokhlayeh@186
|
3264 cook_list
|
gokhlayeh@186
|
3265 ;;
|
gokhlayeh@186
|
3266 gen-wok-db)
|
gokhlayeh@186
|
3267 check_root
|
gokhlayeh@186
|
3268 get_tazwok_config
|
gokhlayeh@186
|
3269 source_lib report
|
gokhlayeh@186
|
3270 report start
|
gokhlayeh@204
|
3271 gen_wok_db
|
gokhlayeh@186
|
3272 ;;
|
gokhlayeh@186
|
3273 report)
|
gokhlayeh@186
|
3274 get_tazwok_config
|
gokhlayeh@186
|
3275 cd $PACKAGES_REPOSITORY
|
gokhlayeh@239
|
3276 if [ "$2" ]; then
|
gokhlayeh@239
|
3277 case $2 in
|
gokhlayeh@239
|
3278 commit|cooklist|incoming|broken|blocked)
|
gokhlayeh@239
|
3279 show="$2"
|
gokhlayeh@239
|
3280 ;;
|
gokhlayeh@239
|
3281 *)
|
gokhlayeh@239
|
3282 echo "usage : tazwok report [commit|cooklist|incoming|broken|blocked]" >&2
|
gokhlayeh@239
|
3283 exit 1
|
gokhlayeh@239
|
3284 ;;
|
gokhlayeh@239
|
3285 esac
|
gokhlayeh@239
|
3286 else
|
gokhlayeh@239
|
3287 show="commit cooklist incoming broken blocked"
|
gokhlayeh@239
|
3288 fi
|
gokhlayeh@239
|
3289 for i in $show; do
|
gokhlayeh@186
|
3290 if [ -s $i ]; then
|
gokhlayeh@239
|
3291 echo ""
|
gokhlayeh@239
|
3292 echo -e "\033[1m$i\033[0m"
|
gokhlayeh@239
|
3293 echo "================================================================================"
|
gokhlayeh@239
|
3294 cat $i
|
gokhlayeh@239
|
3295 echo "================================================================================"
|
gokhlayeh@239
|
3296 echo ""
|
gokhlayeh@186
|
3297 fi
|
gokhlayeh@186
|
3298 done
|
gokhlayeh@186
|
3299 ;;
|
gokhlayeh@186
|
3300 check-incoming)
|
gokhlayeh@186
|
3301 check_root
|
gokhlayeh@214
|
3302 get_options_list="forced"
|
gokhlayeh@186
|
3303 get_tazwok_config
|
gokhlayeh@186
|
3304 source_lib report
|
gokhlayeh@186
|
3305 report start
|
gokhlayeh@307
|
3306 [ -f $LOCAL_RESOSITORY/incoming ] && rm [ -f $LOCAL_REPOSITORY/incoming ]
|
gokhlayeh@307
|
3307 report step "Checking $INCOMING_REPOSITORY"
|
gokhlayeh@307
|
3308 report open-bloc
|
gokhlayeh@313
|
3309 [ -f $LOCAL_REPOSITORY/log/incoming.html ] && rm $LOCAL_REPOSITORY/log/incoming.html
|
gokhlayeh@307
|
3310 report sublog $LOCAL_REPOSITORY/log/incoming.html
|
gokhlayeh@352
|
3311 echo "incoming" > $LOCAL_REPOSITORY/log/package
|
gokhlayeh@186
|
3312 check_for_incoming
|
gokhlayeh@307
|
3313 report end-sublog
|
gokhlayeh@307
|
3314 report close-bloc
|
gokhlayeh@186
|
3315 ;;
|
gokhlayeh@190
|
3316 configure-chroot)
|
gokhlayeh@190
|
3317 check_root
|
gokhlayeh@190
|
3318 get_tazwok_config
|
gokhlayeh@190
|
3319 if [ -f /usr/bin/tazchroot ]; then
|
gokhlayeh@190
|
3320 cd $LOCAL_REPOSITORY
|
gokhlayeh@190
|
3321 configure_tazchroot
|
gokhlayeh@190
|
3322 else
|
gokhlayeh@190
|
3323 echo "The packages tazchroot need to be installed" >&2
|
gokhlayeh@190
|
3324 exit 1
|
gokhlayeh@190
|
3325 fi
|
gokhlayeh@190
|
3326 ;;
|
gokhlayeh@186
|
3327 chroot)
|
gokhlayeh@186
|
3328 check_root
|
gokhlayeh@186
|
3329 get_tazwok_config
|
gokhlayeh@186
|
3330 # Merge this and the other chroot function ?.
|
gokhlayeh@186
|
3331 if [ -f /usr/bin/tazchroot ]; then
|
gokhlayeh@186
|
3332 cd $LOCAL_REPOSITORY
|
gokhlayeh@186
|
3333 [ ! -f tazchroot.conf ] && configure_tazchroot
|
gokhlayeh@186
|
3334 tazchroot
|
gokhlayeh@186
|
3335 else
|
gokhlayeh@186
|
3336 echo "The packages tazchroot need to be installed" >&2
|
gokhlayeh@186
|
3337 exit 1
|
gokhlayeh@186
|
3338 fi
|
gokhlayeh@186
|
3339 ;;
|
gokhlayeh@186
|
3340 cook-toolchain)
|
gokhlayeh@186
|
3341 check_root
|
gokhlayeh@186
|
3342 get_tazwok_config
|
gokhlayeh@186
|
3343 echo -n "" > $PACKAGES_REPOSITORY/broken
|
gokhlayeh@186
|
3344 if [ -f /usr/bin/tazchroot ]; then
|
gokhlayeh@186
|
3345 cd $LOCAL_REPOSITORY
|
gokhlayeh@406
|
3346 [ -f tazchroot.conf ] || configure_tazchroot
|
gokhlayeh@406
|
3347
|
gokhlayeh@406
|
3348 # Plan to recook all packages.
|
gokhlayeh@406
|
3349 if tazchroot cook-toolchain; then
|
gokhlayeh@406
|
3350 source_lib report
|
gokhlayeh@406
|
3351 report start
|
gokhlayeh@406
|
3352 pkg="$(grep ^[a-zA-Z0-9] $PACKAGES_REPOSITORY/packages.txt \
|
gokhlayeh@406
|
3353 $INCOMING_REPOSITORY/packages.txt | sort -u)"
|
gokhlayeh@406
|
3354 forced=yes
|
gokhlayeh@406
|
3355 gen_cook_list
|
gokhlayeh@406
|
3356 fi
|
gokhlayeh@406
|
3357
|
gokhlayeh@406
|
3358 # Remove chroot where toolchain has been cooked.
|
gokhlayeh@406
|
3359 source $LOCAL_REPOSITORY/tazchroot.conf
|
gokhlayeh@186
|
3360 rm -r $LOCAL_REPOSITORY/chroot
|
gokhlayeh@406
|
3361
|
gokhlayeh@186
|
3362 else
|
gokhlayeh@406
|
3363 echo -e "\nThe package tazchroot need to be installed.\n" >&2
|
gokhlayeh@186
|
3364 exit 1
|
gokhlayeh@186
|
3365 fi
|
gokhlayeh@186
|
3366 ;;
|
gokhlayeh@235
|
3367 webserver)
|
gokhlayeh@235
|
3368 check_root
|
gokhlayeh@235
|
3369 get_tazwok_config
|
gokhlayeh@235
|
3370 if [ "$ARG" = on ]; then
|
gokhlayeh@235
|
3371 if [ "$WEBSERVER" ] && [ -f "$WEBSERVER/repositories.list" ] && \
|
gokhlayeh@235
|
3372 grep -q ^"${undigest:-$SLITAZ_VERSION}"$ $WEBSERVER/repositories.list; then
|
gokhlayeh@235
|
3373 echo "Webserver is already enabled at $WEBSERVER for ${undigest:-$SLITAZ_VERSION}." >&2
|
gokhlayeh@235
|
3374 exit 1
|
gokhlayeh@235
|
3375 fi
|
gokhlayeh@235
|
3376 if ! [ -f $LOCAL_REPOSITORY/tazchroot.conf ]; then
|
gokhlayeh@235
|
3377 tazwok configure-chroot ${undigest:+--undigest=$undigest} --SLITAZ_VERSION=$SLITAZ_VERSION --SLITAZ_DIR=$SLITAZ_DIR
|
gokhlayeh@235
|
3378 fi
|
gokhlayeh@235
|
3379 for pkg in php lighttpd; do
|
gokhlayeh@235
|
3380 [ -d $INSTALLED/$pkg ] || missing="$missing $pkg"
|
gokhlayeh@235
|
3381 done
|
gokhlayeh@235
|
3382 if [ "$missing" ]; then
|
gokhlayeh@235
|
3383 echo "You need to install those packages to start webserver: $missing." >&2
|
gokhlayeh@235
|
3384 exit 1
|
gokhlayeh@235
|
3385 fi
|
gokhlayeh@235
|
3386 if [ ! -f "$LOCAL_REPOSITORY/tazwok.conf" ]; then
|
gokhlayeh@235
|
3387 echo "Copying /etc/slitaz/tazwok.conf to $LOCAL_REPOSITORY/tazwok.conf: webserver is configured repository-by-repository."
|
gokhlayeh@235
|
3388 cp /etc/slitaz/tazwok.conf $LOCAL_REPOSITORY
|
gokhlayeh@235
|
3389 fi
|
gokhlayeh@235
|
3390 if ! [ "$WEBSERVER" ]; then
|
gokhlayeh@235
|
3391 echo -n "Where to store php pages (default: /var/www/vhosts/bb)? "
|
gokhlayeh@235
|
3392 read WEBSERVER
|
gokhlayeh@235
|
3393 [ "$WEBSERVER" ] || WEBSERVER="/var/www/vhosts/bb"
|
gokhlayeh@235
|
3394 fi
|
gokhlayeh@235
|
3395 if [ -f "$WEBSERVER/repositories.list" ] && \
|
gokhlayeh@235
|
3396 grep -q ^"${undigest:-$SLITAZ_VERSION}"$ $WEBSERVER/repositories.list; then
|
gokhlayeh@235
|
3397 echo "Webserver is already enabled at $WEBSERVER for ${undigest:-$SLITAZ_VERSION}." >&2
|
gokhlayeh@235
|
3398 exit 1
|
gokhlayeh@235
|
3399 fi
|
gokhlayeh@235
|
3400 mkdir -p $WEBSERVER
|
gokhlayeh@235
|
3401 echo "${undigest:-$SLITAZ_VERSION}" >> $WEBSERVER/repositories.list
|
gokhlayeh@267
|
3402 for file in index.php log.php download.php; do
|
gokhlayeh@235
|
3403 [ -f "$WEBSERVER/$file" ] || ln -s /usr/share/slitaz/web-bb/$file $WEBSERVER
|
gokhlayeh@235
|
3404 done
|
gokhlayeh@267
|
3405 for dir in $PACKAGES_REPOSITORY $INCOMING_REPOSITORY; do
|
gokhlayeh@267
|
3406 ln -s $dir $WEBSERVER/${undigest:-$SLITAZ_VERSION}-${dir##*/}
|
gokhlayeh@267
|
3407 done
|
gokhlayeh@235
|
3408 source $LOCAL_REPOSITORY/tazchroot.conf
|
gokhlayeh@235
|
3409 echo "<?php
|
gokhlayeh@235
|
3410
|
gokhlayeh@235
|
3411 // Web interface configuration
|
gokhlayeh@235
|
3412
|
gokhlayeh@235
|
3413 \$version=\"${undigest:-$SLITAZ_VERSION}\";
|
gokhlayeh@235
|
3414 \$chroot=\"$chroot_dir\";
|
pascal@360
|
3415 \$lockfile=\"\$chroot/proc/1/status\";
|
gokhlayeh@235
|
3416 \$db_dir=\"$PACKAGES_REPOSITORY\";
|
gokhlayeh@235
|
3417 \$log_dir=\"$LOCAL_REPOSITORY/log\";
|
gokhlayeh@235
|
3418 \$packages=\"$PACKAGES_REPOSITORY\";
|
gokhlayeh@235
|
3419 \$incoming=\"$INCOMING_REPOSITORY\";
|
gokhlayeh@251
|
3420 \$wok=\"$WOK\";
|
gokhlayeh@235
|
3421
|
gokhlayeh@235
|
3422 ?>" > $WEBSERVER/conf-${undigest:-$SLITAZ_VERSION}.php
|
gokhlayeh@235
|
3423 [ -L "$WEBSERVER/web" ] || ln -s /usr/share/slitaz/web $WEBSERVER
|
gokhlayeh@235
|
3424 echo "WEBSERVER=\"$WEBSERVER\"" >> $LOCAL_REPOSITORY/tazwok.conf
|
gokhlayeh@235
|
3425 if [ -L "$WEBSERVER/conf.php" ]; then
|
gokhlayeh@235
|
3426 echo "Do yo want to make ${undigest:-$SLITAZ_VERSION} the default page (y/N) ? "
|
gokhlayeh@235
|
3427 read answer
|
gokhlayeh@235
|
3428 if [ "$answer" = y ]; then
|
gokhlayeh@235
|
3429 rm $WEBSERVER/conf.php
|
gokhlayeh@235
|
3430 ln -s $WEBSERVER/conf-${undigest:-$SLITAZ_VERSION}.php $WEBSERVER/conf.php
|
gokhlayeh@235
|
3431 fi
|
gokhlayeh@235
|
3432 else
|
gokhlayeh@235
|
3433 ln -s $WEBSERVER/conf-${undigest:-$SLITAZ_VERSION}.php $WEBSERVER/conf.php
|
gokhlayeh@235
|
3434 fi
|
gokhlayeh@235
|
3435 elif [ "$ARG" = off ]; then
|
gokhlayeh@235
|
3436 if ! [ "$WEBSERVER" ]; then
|
gokhlayeh@235
|
3437 echo "No webserver running for ${undigest:-$SLITAZ_VERSION}" >&2
|
gokhlayeh@235
|
3438 exit 1
|
gokhlayeh@235
|
3439 fi
|
gokhlayeh@235
|
3440 sed '/^WEBSERVER/d' -i $LOCAL_REPOSITORY/tazwok.conf
|
gokhlayeh@235
|
3441 sed "/^${undigest:-$SLITAZ_VERSION}$/d" -i $WEBSERVER/repositories.list
|
gokhlayeh@235
|
3442 rm $WEBSERVER/conf-${undigest:-$SLITAZ_VERSION}.php
|
gokhlayeh@267
|
3443 for dir in $PACKAGES_REPOSITORY $INCOMING_REPOSITORY; do
|
gokhlayeh@267
|
3444 rm $WEBSERVER/${undigest:-$SLITAZ_VERSION}-${dir##*/}
|
gokhlayeh@267
|
3445 done
|
gokhlayeh@235
|
3446 if ! [ -s "$WEBSERVER/repositories.list" ]; then
|
gokhlayeh@235
|
3447 echo "$WEBSERVER/repositories.list is empty; tazwok doesn't remove the server automatically in case you have important stuff in it. If it's not the case, you can remove it using: rm -r $WEBSERVER"
|
gokhlayeh@235
|
3448 rm $WEBSERVER/conf.php
|
gokhlayeh@235
|
3449 elif [ "$(readlink $WEBSERVER/conf.php)" = "$WEBSERVER/conf-${undigest:-$SLITAZ_VERSION}.php" ]; then
|
gokhlayeh@235
|
3450 echo "${undigest:-$SLITAZ_VERSION} was the default version to use; switched to : $(sed 1!d $WEBSERVER/repositories.list)"
|
gokhlayeh@235
|
3451 rm $WEBSERVER/conf.php
|
gokhlayeh@235
|
3452 ln -s $WEBSERVER/conf-$(sed 1!d $WEBSERVER/repositories.list).php $WEBSERVER/conf.php
|
gokhlayeh@235
|
3453 fi
|
gokhlayeh@235
|
3454 else
|
gokhlayeh@235
|
3455 echo "Usage: tazwok webserver on/off" >&2
|
gokhlayeh@235
|
3456 exit 1
|
gokhlayeh@235
|
3457 fi
|
gokhlayeh@235
|
3458 ;;
|
pankso@354
|
3459 block)
|
pankso@354
|
3460 # Add a pkg name to the list of blocked packages.
|
gokhlayeh@367
|
3461 get_tazwok_config
|
gokhlayeh@367
|
3462 check_root
|
gokhlayeh@367
|
3463 check_for_package_on_cmdline
|
gokhlayeh@367
|
3464 if ! [ -f $WOK/$PACKAGE/receipt ]; then
|
gokhlayeh@367
|
3465 echo "Can't find $PACKAGE into wok." >&2
|
gokhlayeh@367
|
3466 echo ""
|
gokhlayeh@367
|
3467 exit 1
|
gokhlayeh@367
|
3468 fi
|
pankso@354
|
3469 echo ""
|
gokhlayeh@405
|
3470 if grep -qs "^$PACKAGE$" $blocked; then
|
gokhlayeh@367
|
3471 echo "$PACKAGE is already in the blocked packages list." >&2
|
gokhlayeh@367
|
3472 echo ""
|
gokhlayeh@367
|
3473 exit 1
|
pankso@354
|
3474 else
|
gokhlayeh@405
|
3475 echo -n "Adding $PACKAGE to : $blocked... "
|
gokhlayeh@405
|
3476 echo "$PACKAGE" >> $blocked
|
gokhlayeh@367
|
3477 status
|
gokhlayeh@405
|
3478 if grep -q "^$PACKAGE$" $cooklist; then
|
gokhlayeh@405
|
3479 echo -n "Removing $PACKAGE from : $cooklist... "
|
gokhlayeh@405
|
3480 sed -i /"^$PACKAGE$"/d $cooklist
|
gokhlayeh@367
|
3481 status
|
pankso@354
|
3482 fi
|
pankso@354
|
3483 fi
|
pankso@354
|
3484 echo "" ;;
|
pankso@354
|
3485 unblock)
|
pankso@354
|
3486 # Remove a pkg name from the list of blocked packages.
|
gokhlayeh@367
|
3487 get_tazwok_config
|
gokhlayeh@367
|
3488 check_root
|
gokhlayeh@367
|
3489 check_for_package_on_cmdline
|
gokhlayeh@367
|
3490 if ! [ -f $WOK/$PACKAGE/receipt ]; then
|
gokhlayeh@367
|
3491 echo "Can't find $PACKAGE into wok." >&2
|
gokhlayeh@367
|
3492 echo ""
|
gokhlayeh@367
|
3493 exit 1
|
gokhlayeh@367
|
3494 fi
|
pankso@354
|
3495 echo ""
|
gokhlayeh@405
|
3496 if grep -qs "^$PACKAGE$" $blocked; then
|
gokhlayeh@405
|
3497 echo -n "Removing $PACKAGE from : $blocked... "
|
gokhlayeh@405
|
3498 sed -i /"^$PACKAGE$"/d $blocked
|
gokhlayeh@405
|
3499 sed -i '/^$/d' $blocked
|
gokhlayeh@367
|
3500 status
|
pankso@354
|
3501 else
|
gokhlayeh@367
|
3502 echo "$PACKAGE is not in the blocked packages list." >&2
|
gokhlayeh@367
|
3503 echo ""
|
gokhlayeh@367
|
3504 exit 1
|
pankso@354
|
3505 fi
|
pankso@354
|
3506 echo "" ;;
|
pankso@7
|
3507 usage|*)
|
MikeDSmith25@82
|
3508 # Print usage also for all unknown commands.
|
pankso@7
|
3509 #
|
pankso@7
|
3510 usage
|
gokhlayeh@186
|
3511 ;;
|
pankso@7
|
3512 esac
|
pankso@7
|
3513
|
gokhlayeh@313
|
3514 report stop 2>/dev/null
|
pankso@7
|
3515 exit 0
|