changeset 8900:63ad1133d0ed

fix & simplify fix_depends pkg.m
author Jaroslav Hajek <highegg@gmail.com>
date Mon, 02 Mar 2009 13:00:59 +0100
parents 4ab9654eceac
children 821f0242e8c1
files scripts/ChangeLog scripts/pkg/pkg.m
diffstat 2 files changed, 8 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog	Mon Mar 02 12:12:29 2009 +0100
+++ b/scripts/ChangeLog	Mon Mar 02 13:00:59 2009 +0100
@@ -1,3 +1,7 @@
+2009-03-02  Jaroslav Hajek  <highegg@gmail.com>
+
+	* pkg/pkg.m (fix_depends): Fix & simplify splitting the string.
+
 2009-03-02  Thorsten Meyer  <thorsten.meyier@gmx.de>
 
 	* set/complement.m, set/union.m: Remove reference to deprecated
--- a/scripts/pkg/pkg.m	Mon Mar 02 12:12:29 2009 +0100
+++ b/scripts/pkg/pkg.m	Mon Mar 02 13:00:59 2009 +0100
@@ -1696,23 +1696,16 @@
     if (length (lpar) == 1 && length (rpar) == 1)
       package = tolower (strip (dep(1:lpar-1)));
       sub = dep(lpar(1)+1:rpar(1)-1);
-      parts = split_by (sub, " ");
-      idx = [];
-      for r = 1:size (parts, 1)
-	if (length (parts{r}) > 0)
-	  idx(end+1) = r;
-	endif
-      endfor
-
-      if (length (idx) != 2)
+      parts = strsplit (sub, " ", true);
+      if (length (parts) != 2)
 	error ("incorrect syntax for dependency `%s' in the DESCRIPTION file\n",
 	       dep);
       endif
-      operator = parts{idx(1)};
+      operator = parts{1};
       if (! any (strcmp (operator, {">", ">=", "<=", "<", "=="})))
 	error ("unsupported operator: %s", operator);
       endif
-      version  = fix_version (parts{idx(2)});
+      version  = fix_version (parts{2});
 
   ## If no version is specified for the dependency
   ## we say that the version should be greater than