Skip to content

Commit fec1a70

Browse files
committed
use depsort.py tool to order the module compilation.
It's work magically, that's soooooo great!
1 parent 0fdf735 commit fec1a70

File tree

5 files changed

+25
-29
lines changed

5 files changed

+25
-29
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,7 @@ testsuite
1414
#ECLIPSE + PYDEV
1515
.project
1616
.pydevproject
17+
18+
.deps
19+
20+
.optional-deps

distribute.sh

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,12 @@ function in_array() {
360360
function run_source_modules() {
361361
needed=($MODULES)
362362
declare -a processed
363-
order=()
363+
364+
fn_deps='.deps'
365+
fn_optional_deps='.optional-deps'
366+
367+
> $fn_deps
368+
> $fn_optional_deps
364369

365370
while [ ${#needed[*]} -ne 0 ]; do
366371

@@ -379,12 +384,6 @@ function run_source_modules() {
379384
# add this module as done
380385
processed=( ${processed[@]} $module )
381386

382-
# append our module at the end only if we are not exist yet
383-
in_array $module "${order[@]}"
384-
if [ $? -eq 255 ]; then
385-
order=( ${order[@]} $module )
386-
fi
387-
388387
# read recipe
389388
debug "Read $module recipe"
390389
recipe=$RECIPES_PATH/$module/recipe.sh
@@ -397,33 +396,25 @@ function run_source_modules() {
397396
# append current module deps to the needed
398397
deps=$(echo \$"{DEPS_$module[@]}")
399398
eval deps=($deps)
399+
optional_deps=$(echo \$"{DEPS_OPTIONAL_$module[@]}")
400+
eval optional_deps=($optional_deps)
400401
if [ ${#deps[*]} -gt 0 ]; then
401402
debug "Module $module depend on" ${deps[@]}
402403
needed=( ${needed[@]} ${deps[@]} )
403-
404-
# for every deps, check if it's already added to order
405-
# if not, add the deps before ourself
406-
debug "Dependency order is ${order[@]} (current)"
407-
for dep in "${deps[@]}"; do
408-
#debug "Check if $dep is in order"
409-
in_array $dep "${order[@]}"
410-
if [ $? -eq 255 ]; then
411-
#debug "missing $dep in order"
412-
# deps not found in order
413-
# add it before ourself
414-
in_array $module "${order[@]}"
415-
index=$?
416-
#debug "our $module index is $index"
417-
order=(${order[@]:0:$index} $dep ${order[@]:$index})
418-
#debug "new order is ${order[@]}"
419-
fi
420-
done
421-
debug "Dependency order is ${order[@]} (computed)"
404+
echo $module ${deps[@]} >> $fn_deps
405+
else
406+
echo $module >> $fn_deps
407+
fi
408+
if [ ${#optional_deps[*]} -gt 0 ]; then
409+
echo $module ${optional_deps[@]} >> $fn_optional_deps
422410
fi
423411
done
424412

425-
MODULES="${order[@]}"
426-
info="Modules changed to $MODULES"
413+
MODULES="$(python tools/depsort.py --optional $fn_optional_deps < $fn_deps)"
414+
415+
info "Modules changed to $MODULES"
416+
417+
exit 1
427418
}
428419

429420
function run_get_packages() {

recipes/audiostream/recipe.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
VERSION_audiostream=
44
URL_audiostream=https://github.com/kivy/audiostream/zipball/master/audiostream.zip
5-
DEPS_audiostream=(python sdl)
5+
DEPS_audiostream=(python sdl pyjnius)
66
MD5_audiostream=
77
BUILD_audiostream=$BUILD_PATH/audiostream/audiostream
88
RECIPE_audiostream=$RECIPES_PATH/audiostream

recipes/python/recipe.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
VERSION_python=2.7.2
44
DEPS_python=(hostpython)
5+
DEPS_OPTIONAL_python=(openssl sqlite3)
56
URL_python=http://python.org/ftp/python/$VERSION_python/Python-$VERSION_python.tar.bz2
67
MD5_python=ba7b2f11ffdbf195ee0d111b9455a5bd
78

File renamed without changes.

0 commit comments

Comments
 (0)