summaryrefslogtreecommitdiffstats
path: root/atoms_cc
diff options
context:
space:
mode:
authorSimon Lipp <simon.lipp@scilab.org>2008-07-07 16:02:18 +0000
committerSimon Lipp <simon.lipp@scilab.org>2008-07-07 16:02:18 +0000
commit7b644653f536c25fd99bb1ebaffc0653e4ee9fe5 (patch)
tree09e4a8b3385d064a607f5dd299bfb27d29364a75 /atoms_cc
parentfef92222ef4c0c79f74a89f72d03fb6d903a9e8a (diff)
downloadscilab-7b644653f536c25fd99bb1ebaffc0653e4ee9fe5.zip
scilab-7b644653f536c25fd99bb1ebaffc0653e4ee9fe5.tar.gz
atoms_cc/buildtoolbox.pl: support '<=' and '=' operators for dependencies versions
Diffstat (limited to 'atoms_cc')
-rwxr-xr-xatoms_cc/buildtoolbox.pl25
1 files changed, 16 insertions, 9 deletions
diff --git a/atoms_cc/buildtoolbox.pl b/atoms_cc/buildtoolbox.pl
index e07e810..df9267e 100755
--- a/atoms_cc/buildtoolbox.pl
+++ b/atoms_cc/buildtoolbox.pl
@@ -510,8 +510,8 @@ sub stage_tbdeps {
510 # Make a hash depname => depvers 510 # Make a hash depname => depvers
511 @depsarray = split(/\s*,\s*/, $desc{"Depends"} || ""); 511 @depsarray = split(/\s*,\s*/, $desc{"Depends"} || "");
512 foreach (@depsarray) { 512 foreach (@depsarray) {
513 if(/^(\S+?)\s*\([<>]=\s*([^)]+)\)$/) { # toolbox-name (version-comparator version) 513 if(/^(\S+?)\s*\(([<>]?=)\s*([^)]+)\)$/) { # toolbox-name (version-comparator version)
514 $deps{$1} = $2; 514 $deps{$1} = "$2$3";
515 } 515 }
516 else { 516 else {
517 $deps{$_} = "*"; 517 $deps{$_} = "*";
@@ -521,9 +521,7 @@ sub stage_tbdeps {
521 common_log("Dependencies: " . join(",", map { "$_ $deps{$_}" } keys %deps)); 521 common_log("Dependencies: " . join(",", map { "$_ $deps{$_}" } keys %deps));
522 522
523 # Install dependencies 523 # Install dependencies
524 # fixme: we always install the last version, but some packages 524 close(common_exec_scilab("installToolbox('$_',1,'$deps{$_}')")) foreach(keys %deps);
525 # needs some versions... at most. Need to deal with that.
526 close(common_exec_scilab("installToolbox('$_')")) foreach(keys %deps);
527 525
528 # Find toolboxes directory 526 # Find toolboxes directory
529 $fd = common_exec_scilab("printf('path: %s\\n', cd(atomsToolboxDirectory()))"); 527 $fd = common_exec_scilab("printf('path: %s\\n', cd(atomsToolboxDirectory()))");
@@ -555,10 +553,19 @@ sub stage_tbdeps {
555 my %desc2 = read_description($fd); 553 my %desc2 = read_description($fd);
556 close $fd; 554 close $fd;
557 555
558 # fixme: we only check wether neededVersion <= installedVersion 556 $deps{$dep} =~ /^([<>]?=)(.+)$/;
559 # Others tests (=, <=) are still to be implemented 557
560 if(compare_versions($deps{$dep}, $desc2{"Version"}) == 1) { 558 # You can see this as "installed_version - required_version"
561 common_die("We need \"$dep\" >= $deps{$dep}, but version $desc2{Version} installed"); 559 my $cmp = compare_versions($desc2{"Version"}, $2);
560
561 if($1 eq ">=" && $cmp == -1) { # <=> !($cmp >= 0) <=> !(installed >= required)
562 common_die("We need \"$2\" >= $1, but version $desc2{Version} installed");
563 }
564 elsif($1 eq "=" && $cmp != 0) {
565 common_die("We need \"$2\" == $1, but version $desc2{Version} installed");
566 }
567 elsif($cmp == 1) { # <=> !($cmp <= 0) <=> !(installed <= required)
568 common_die("We need \"$2\" <= $1, but version $desc2{Version} installed");
562 } 569 }
563 } 570 }
564 571