[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: OctavePackaging
From: |
David Bateman |
Subject: |
Re: OctavePackaging |
Date: |
Fri, 11 May 2007 23:47:08 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
David Bateman wrote:
> Quentin Spencer wrote:
>> John W. Eaton wrote:
>>> On 11-May-2007, David Bateman wrote:
>>>
>>> | What about something like the attached patch to pkg.m. If adds the
>>> | features discussed in the previous e-mail.. I hope this is
>>> sufficient to
>>> | address your needs..
>>>
>>> If you think we can come to an agreement about what changes are needed
>>> for pkg.m within a few days, then I'll hold 2.9.11 until it is ready.
>>> If it will take much longer than that, then I'll go ahead with 2.9.11
>>> now.
>>>
>> I think this was mentioned before, but I thought I'd bring it up again
>> (without having spent any significant time actually testing it). Someone
>> suggested a verbose option for pkg so that compilation is not done
>> silently. I would want the Fedora octave packaging scripts to use such
>> an option in case something fails when submitted to a remote build queue
>> to make debugging easier.
>>
>> Quentin
>>
>
> Want to propose a patch :-)
>
Ok, I added to my previous patch a "-verbose" that at the moment only
does something for the install stage.
John, independent of the fedora/debian issues, this patch should
probably be applied as the architecture dependent directories will be
useful in the case of user installed packages on network disks
Also I modified the getarch function to be
function arch = getarch ()
persistent _arch = [octave_config_info("canonical_host_type"), "-", ...
octave_config_info("api_version")];
arch = _arch;
endfunction
So that the architecture includes the api version so different versions
of octave on the same platform are handled..
D.
*** ./scripts/pkg/pkg.m.orig31 2007-04-11 10:39:45.000000000 +0200
--- ./scripts/pkg/pkg.m 2007-05-11 23:32:40.846310343 +0200
***************
*** 44,49 ****
--- 44,52 ----
## If @var{option} is @code{-auto} the package manager will
## automatically load the installed package when starting Octave,
## even if the package requests that it isn't.
+ ##
+ ## Final if @var{option} is @code{-verbose} the package manager will
+ ## print the output of all of the commands that are performed
## @item uninstall
## Uninstall named packages. For example,
## @example
***************
*** 152,157 ****
--- 155,161 ----
deps = true;
auto = 0;
action = "none";
+ verbose = false;
for i = 1:length (varargin)
switch (varargin{i})
case "-nodeps"
***************
*** 160,165 ****
--- 164,171 ----
auto = -1;
case "-auto"
auto = 1;
+ case "-verbose"
+ verbose = true;
case {"list", "install", "uninstall", "load", "unload", ...
"prefix", "local_list", "global_list"}
action = varargin{i};
***************
*** 186,198 ****
if (length (files) == 0)
error ("you must specify at least one filename when calling 'pkg
install'");
endif
! install (files, deps, auto, prefix, local_list, global_list);
case "uninstall"
if (length (files) == 0)
error ("you must specify at least one package when calling 'pkg
uninstall'");
endif
! uninstall (files, deps, local_list, global_list);
case "load"
if (length (files) == 0)
--- 192,204 ----
if (length (files) == 0)
error ("you must specify at least one filename when calling 'pkg
install'");
endif
! install (files, deps, auto, prefix, verbose, local_list, global_list);
case "uninstall"
if (length (files) == 0)
error ("you must specify at least one package when calling 'pkg
uninstall'");
endif
! uninstall (files, deps, verbose, local_list, global_list);
case "load"
if (length (files) == 0)
***************
*** 260,266 ****
endif
endfunction
! function install (files, handle_deps, autoload, prefix, local_list,
global_list)
global_install = issuperuser ();
# Check that the directory in prefix exist. If it doesn't: create it!
--- 266,272 ----
endif
endfunction
! function install (files, handle_deps, autoload, prefix, verbose, local_list,
global_list)
global_install = issuperuser ();
# Check that the directory in prefix exist. If it doesn't: create it!
***************
*** 390,396 ****
desc = descriptions{i};
pdir = packdirs{i};
prepare_installation (desc, pdir);
! configure_make (desc, pdir);
endfor
catch
## Something went wrong, delete tmpdirs
--- 396,402 ----
desc = descriptions{i};
pdir = packdirs{i};
prepare_installation (desc, pdir);
! configure_make (desc, pdir, verbose);
endfor
catch
## Something went wrong, delete tmpdirs
***************
*** 403,409 ****
## Uninstall the packages that will be replaced
try
for i = packages_to_uninstall
! uninstall ({installed_packages{i}.name}, false, local_list,
global_list);
endfor
catch
--- 409,415 ----
## Uninstall the packages that will be replaced
try
for i = packages_to_uninstall
! uninstall ({installed_packages{i}.name}, false, verbose, local_list,
global_list);
endfor
catch
***************
*** 489,504 ****
## Add the newly installed packages to the path, so the user
## can begin usings them.
if (length (descriptions) > 0)
! dirs = cell (1, length (descriptions));
for i = 1:length (descriptions)
! dirs{i} = descriptions{i}.dir;
endfor
addpath (dirs{:});
endif
endfunction
! function uninstall (pkgnames, handle_deps, local_list, global_list)
## Get the list of installed packages
[local_packages, global_packages] = installed_packages(local_list,
global_list);
--- 495,514 ----
## Add the newly installed packages to the path, so the user
## can begin usings them.
+ arch = getarch();
if (length (descriptions) > 0)
! dirs = {};
for i = 1:length (descriptions)
! dirs{end + 1} = descriptions{i}.dir;
! if (exist (fullfile (descriptions{i}.dir, arch), "dir"))
! dirs{end + 1} = fullfile (descriptions{i}.dir, arch);
! endif
endfor
addpath (dirs{:});
endif
endfunction
! function uninstall (pkgnames, handle_deps, verbose, local_list, global_list)
## Get the list of installed packages
[local_packages, global_packages] = installed_packages(local_list,
global_list);
***************
*** 573,592 ****
desc = installed_packages{i};
## If an 'on_uninstall.m' exist, call it!
if (exist (fullfile (desc.dir, "packinfo", "on_uninstall.m"), "file"))
! try
! wd = pwd ();
! cd (fullfile(desc.dir, "packinfo"));
! on_uninstall (desc);
! cd (wd);
! catch
! ## XXX: Should this rather be an error?
! warning ("the 'on_uninstall' script retsurned the following error: %s",
! lasterr ());
! cd (wd);
! end_try_catch
endif
## Do the actual deletion
rmpath (desc.dir);
if (exist (desc.dir, "dir"))
[status, msg] = rm_rf (desc.dir);
if (status != 1)
--- 583,598 ----
desc = installed_packages{i};
## If an 'on_uninstall.m' exist, call it!
if (exist (fullfile (desc.dir, "packinfo", "on_uninstall.m"), "file"))
! wd = pwd ();
! cd (fullfile(desc.dir, "packinfo"));
! on_uninstall (desc);
! cd (wd);
endif
## Do the actual deletion
rmpath (desc.dir);
+ if (exist (fullfile (desc.dir, getarch()), "dir"))
+ rmpath (fullfile (desc.dir, getarch ()));
+ endif
if (exist (desc.dir, "dir"))
[status, msg] = rm_rf (desc.dir);
if (status != 1)
***************
*** 647,653 ****
endif
endfunction
! function configure_make (desc, packdir)
## Perform ./configure, make, make install in "src"
if (exist (fullfile (packdir, "src"), "dir"))
src = fullfile (packdir, "src");
--- 653,659 ----
endif
endfunction
! function configure_make (desc, packdir, verbose)
## Perform ./configure, make, make install in "src"
if (exist (fullfile (packdir, "src"), "dir"))
src = fullfile (packdir, "src");
***************
*** 655,660 ****
--- 661,669 ----
if (exist (fullfile (src, "configure"), "file"))
[status, output] = system (strcat ("cd ", src, "; ./configure
--prefix=",
desc.dir));
+ if (verbose)
+ printf("%s", output);
+ endif
if (status != 0)
rm_rf (desc.dir);
error ("the configure script returned the following error: %s", output);
***************
*** 665,685 ****
if (exist (fullfile (src, "Makefile"), "file"))
[status, output] = system (strcat ("export INSTALLDIR=", desc.dir,
"; make -C ", src));
if (status != 0)
rm_rf (desc.dir);
error ("'make' returned the following error: %s", output);
endif
%# make install
%[status, output] = system(["export INSTALLDIR=" desc.dir "; make
install -C " src]);
%if (status != 0)
% rm_rf(desc.dir);
% error("'make install' returned the following error: %s", output);
%endif
endif
! ## Copy files to "inst" (this is instead of 'make install')
files = fullfile (src, "FILES");
instdir = fullfile (packdir, "inst");
if (exist (files, "file"))
## Get file names
[fid, msg] = fopen (files, "r");
--- 674,701 ----
if (exist (fullfile (src, "Makefile"), "file"))
[status, output] = system (strcat ("export INSTALLDIR=", desc.dir,
"; make -C ", src));
+ if (verbose)
+ printf("%s", output);
+ endif
if (status != 0)
rm_rf (desc.dir);
error ("'make' returned the following error: %s", output);
endif
%# make install
%[status, output] = system(["export INSTALLDIR=" desc.dir "; make
install -C " src]);
+ %if (verbose)
+ % printf("%s", output);
+ %endif
%if (status != 0)
% rm_rf(desc.dir);
% error("'make install' returned the following error: %s", output);
%endif
endif
! ## Copy files to "inst" and "inst/arch" (this is instead of 'make
install')
files = fullfile (src, "FILES");
instdir = fullfile (packdir, "inst");
+ archdir = fullfile (packdir, "inst", getarch ());
if (exist (files, "file"))
## Get file names
[fid, msg] = fopen (files, "r");
***************
*** 703,732 ****
endfor
fn(delete_idx) = [];
filenames = sprintf ("%s ", fn{:});
else
m = dir (fullfile (src, "*.m"));
oct = dir (fullfile (src, "*.oct"));
mex = dir (fullfile (src, "*.mex"));
filenames = "";
if (length (m) > 0)
filenames = sprintf (fullfile (src, "%s "), m.name);
endif
if (length (oct) > 0)
filenames = [filenames, " ", sprintf(fullfile(src, "%s "), oct.name)];
endif
if (length (mex) > 0)
filenames = [filenames, " ", sprintf(fullfile(src, "%s "), mex.name)];
endif
endif
- filenames = split_by (filenames, " ");
if (! all (isspace (filenames)))
mkdir (instdir);
! [status, output] = copyfile (filenames, instdir);
! if (status != 1)
rm_rf (desc.dir);
error ("Couldn't copy files from 'src' to 'inst': %s", output);
! endif
endif
endif
endfunction
--- 719,779 ----
endfor
fn(delete_idx) = [];
filenames = sprintf ("%s ", fn{:});
+
+ filenames = split_by (filenames, " ");
+ 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);
+ archdependent = [oct, mex];
else
m = dir (fullfile (src, "*.m"));
oct = dir (fullfile (src, "*.oct"));
mex = dir (fullfile (src, "*.mex"));
+ archdependent = "";
+ archindependent = "";
filenames = "";
if (length (m) > 0)
filenames = sprintf (fullfile (src, "%s "), m.name);
+ archindependent = sprintf (fullfile (src, "%s "), m.name);
endif
if (length (oct) > 0)
filenames = [filenames, " ", sprintf(fullfile(src, "%s "), oct.name)];
+ archdependent = [archdependent, " ", ...
+ sprintf(fullfile(src, "%s "), oct.name)];
endif
if (length (mex) > 0)
filenames = [filenames, " ", sprintf(fullfile(src, "%s "), mex.name)];
+ archdependent = [archdependent, " ", ...
+ sprintf(fullfile(src, "%s "), mex.name)];
endif
+ filenames = split_by (filenames, " ");
+ archdependent = split_by (archdependent, " ");
+ archindependent = split_by (archindependent, " ");
endif
if (! all (isspace (filenames)))
mkdir (instdir);
! if (! all (isspace (archindependent)))
! [status, output] = copyfile (archindependent, instdir);
! if (status != 1)
rm_rf (desc.dir);
error ("Couldn't copy files from 'src' to 'inst': %s", output);
! endif
! endif
! if (! all (isspace (archdependent)))
! mkdir (archdir);
! [status, output] = copyfile (archdependent, archdir);
! if (status != 1)
! rm_rf (desc.dir);
! error ("Couldn't copy files from 'src' to 'inst': %s", output);
! endif
! endif
endif
endif
endfunction
***************
*** 1296,1301 ****
--- 1343,1362 ----
dirs = unique(dirs);
endif
+ ## Check for architecture dependent directories
+ arch = getarch();
+ archdirs = {};
+ for i = 1:length (dirs)
+ tmpdir = fullfile (dirs{i}, arch);
+ if (exist (tmpdir, "dir"))
+ archdirs{end + 1} = dirs{i};
+ archdirs{end + 1} = tmpdir;
+ endif
+ endfor
+ if (length (archdirs) > 0)
+ dirs = archdirs;
+ endif
+
## Load the packages
if (length (dirs) > 0)
addpath (dirs{:});
***************
*** 1339,1344 ****
--- 1400,1419 ----
endfor
endif
+ ## Check for architecture dependent directories
+ arch = getarch();
+ archdirs = {};
+ for i = 1:length (dirs)
+ tmpdir = fullfile (dirs{i}, arch);
+ if (exist (tmpdir, "dir"))
+ archdirs{end + 1} = dirs{i};
+ archdirs{end + 1} = tmpdir;
+ endif
+ endfor
+ if (length (archdirs) > 0)
+ dirs = archdirs;
+ endif
+
## Unload the packages
for i = 1:length (dirs)
d = dirs{i};
***************
*** 1388,1390 ****
--- 1463,1470 ----
endfor
emp = true;
endfunction
+
+ function arch = getarch ()
+ persistent _arch = octave_config_info ("canonical_host_type");
+ arch = _arch;
+ endfunction
- Re: OctavePackaging, David Bateman, 2007/05/11
- Re: OctavePackaging, David Bateman, 2007/05/11
- Re: OctavePackaging, John W. Eaton, 2007/05/11
- Re: OctavePackaging, John W. Eaton, 2007/05/11
- Re: OctavePackaging, David Bateman, 2007/05/11
- Re: OctavePackaging, Quentin Spencer, 2007/05/11
- Re: OctavePackaging, David Bateman, 2007/05/11
- Re: OctavePackaging,
David Bateman <=
- Re: OctavePackaging, John W. Eaton, 2007/05/11
- Re: OctavePackaging, David Bateman, 2007/05/12
- Re: OctavePackaging, Thomas Weber, 2007/05/14
- Re: OctavePackaging, Rafael Laboissiere, 2007/05/11
- Re: OctavePackaging, David Bateman, 2007/05/11
- Re: OctavePackaging, Rafael Laboissiere, 2007/05/11
- Re: OctavePackaging, David Bateman, 2007/05/12
- Re: OctavePackaging, Daniel J Sebald, 2007/05/12
- Re: OctavePackaging, Søren Hauberg, 2007/05/12
- Re: OctavePackaging, Thomas Weber, 2007/05/14