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