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