octave-maintainers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Build failure [Re: Octave 2.9.11 available for ftp]


From: David Bateman
Subject: Re: Build failure [Re: Octave 2.9.11 available for ftp]
Date: Tue, 22 May 2007 21:20:14 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

John W. Eaton wrote:
> On 22-May-2007, David Bateman wrote:
> 
> | I think I found a bug in pkg.m that is causing some of the octave-forge
> | packages not to build.. Can you give me a few hours..
> 
> Yes.
> 
> jwe
> 

Ok, then consider the attached patch, that allows the fixed package to
be installed again, and fixes a couple of other minor issues.

D.

Index: scripts/pkg/pkg.m
===================================================================
RCS file: /usr/local/cvsroot/octave/scripts/pkg/pkg.m,v
retrieving revision 1.45
diff -u -r1.45 pkg.m
--- scripts/pkg/pkg.m   21 May 2007 21:05:54 -0000      1.45
+++ scripts/pkg/pkg.m   22 May 2007 19:12:01 -0000
@@ -492,7 +492,7 @@
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
-    error (lasterr()(8:end));
+    rethrow (lasterror ());
   end_try_catch
 
   ## Check dependencies
@@ -536,7 +536,7 @@
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
-    error (lasterr()(8:end));
+    rethrow (lasterror ());
   end_try_catch
 
   ## Uninstall the packages that will be replaced
@@ -550,7 +550,7 @@
     for i = 1:length (tmpdirs)
       rm_rf (tmpdirs{i});
     endfor
-    error (lasterr()(8:end));
+    rethrow (lasterror ());
   end_try_catch
 
   ## Install each package
@@ -571,13 +571,14 @@
     for i = 1:length (descriptions)
       rm_rf (descriptions{i}.dir);
     endfor
-    error (lasterr()(8:end));
+    rethrow (lasterror ());
   end_try_catch
 
   ## Check if the installed directory is empty. If it is remove it
   ## from the list
   for i = length (descriptions):-1:1
     if (dirempty (descriptions{i}.dir, {"packinfo", "doc"}))
+      warning ("package %s is empty\n", descriptions{i}.name);
       rm_rf (descriptions{i}.dir);
       descriptions(i) = [];
     endif
@@ -665,7 +666,7 @@
   if (length (delete_idx) != length (pkgnames))
     if (global_install)
       ## Try again for a locally installed package
-      installed_packages = local_packages
+      installed_packages = local_packages;
 
       num_packages = length (installed_packages);
       delete_idx = [];
@@ -677,11 +678,11 @@
       endfor
       if (length (delete_idx) != length (pkgnames))
        ## XXX: We should have a better error message
-       error ("some of the packages you want to uninstall are not installed");
+       warning ("some of the packages you want to uninstall are not 
installed");
       endif
     else
       ## XXX: We should have a better error message
-      error ("some of the packages you want to uninstall are not installed.");
+      warning ("some of the packages you want to uninstall are not 
installed.");
     endif
   endif
 
@@ -834,8 +835,8 @@
     files = fullfile (src, "FILES");
     instdir = fullfile (packdir, "inst");
     archdir = fullfile (packdir, "inst", getarch ());
+    ## Get file names
     if (exist (files, "file"))
-      ## Get file names
       [fid, msg] = fopen (files, "r");
       if (fid < 0)
        error ("couldn't open %s: %s", files, msg);
@@ -845,29 +846,24 @@
       if (filenames(end) == "\n")
        filenames(end) = [];
       endif
-      ## Copy the files
-      fn = split_by (filenames, "\n");
+      filenames = split_by (filenames, "\n");
       delete_idx =  [];
-      for i = 1:length (fn)
-       if (! all (isspace (fn{i})))
-         fn{i} = fullfile (src, fn{i});
+      for i = 1:length (filenames)
+       if (! all (isspace (filenames{i})))
+         filenames{i} = fullfile (src, filenames{i});
        else
          delete_idx(end+1) = i;
        endif
       endfor
-      fn(delete_idx) = [];
-      filenames = sprintf ("%s ", fn{:});
-
-      filenames = split_by (filenames, " ");
+      filenames(delete_idx) = [];
+      idx1 = cellfun ("isempty", regexp (filenames, '^.*\.mex'));
+      idx2 = cellfun ("isempty", regexp (filenames, '^.*\.oct'));
+      mex = filenames;
+      mex(idx1 != 0) = [];
+      oct = filenames;
+      oct(idx2 != 0) = [];
       archindependent = filenames;
-      mex = regexp (filenames, '^.*\.mex');
-      archindependent(cellfun ("isempty", mex) == 0) = [];
-      mex (cellfun ("isempty", mex)) = [];
-      mex = cellfun (@(x) x(1), mex);
-      oct = regexp (filenames, '^.*\.oct');
-      archindependent(cellfun ("isempty", oct) == 0) = [];
-      oct (cellfun ("isempty", oct)) = [];
-      oct = cellfun (@(x) x(1), oct);
+      archindependent(idx1 == 0 | idx2 == 0) = [];
       archdependent = [oct, mex];
     else
       m = dir (fullfile (src, "*.m"));
@@ -895,8 +891,11 @@
       archindependent = split_by (archindependent, " ");
     endif
 
+    ## Copy the files
     if (! all (isspace (filenames)))
-       mkdir (instdir);
+       if (! exist (instdir, "dir")) 
+         mkdir (instdir);
+       endif
        if (! all (isspace (archindependent)))
          if (verbose)
            printf ("copyfile");
@@ -915,7 +914,9 @@
            printf (" %s", archdependent{:});
            printf (" %s\n", archdir);
          endif
-         mkdir (archdir);
+         if (! exist (archdir, "dir")) 
+           mkdir (archdir);
+         endif
          [status, output] = copyfile (archdependent, archdir);
          if (status != 1)
            rm_rf (desc.dir);
2007-05-22  David Bateman  <address@hidden>

        * pkg/pkg.m: Use rethrow(lasterror()) throughout rather than
        error(lasterr()(8:end)).
        (pkg:install): Warning for empty packages being removed. Suppress
        spurious output. Warning rather than error for uninstalled a
        package that is not installed to avoid RPM issue.
        (pkg:configure_make): Fix for parsing of src/FILES. Don't create
        inst or architecture dependent directory if it exists

reply via email to

[Prev in Thread] Current Thread [Next in Thread]