Mercurial > hg > octave-lojdl
changeset 7632:d6e63a15cc75
Allow installation of already extracted packages
* * *
* * *
author | Thomas Weber <thomas.weber.mail@gmail.com> |
---|---|
date | Mon, 24 Mar 2008 18:14:18 -0400 |
parents | b2a5cda5c549 |
children | ba15376ddfe1 |
files | scripts/ChangeLog scripts/pkg/pkg.m |
diffstat | 2 files changed, 49 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/scripts/ChangeLog +++ b/scripts/ChangeLog @@ -1,3 +1,7 @@ +2008-03-24 Thomas Weber <thomas.weber.mail@gmail.com> + + * pkg/pkg.m: Allow installation of already extracted packages. + 2008-03-24 David Bateman <dbateman@free.fr> * general/idivide.m: New function.
--- a/scripts/pkg/pkg.m +++ b/scripts/pkg/pkg.m @@ -599,45 +599,54 @@ if (length (dirlist) > 3) error ("bundles of packages are not allowed") endif + endif - ## the two first entries of dirlist are "." and ".." - for k = 3:length (dirlist) - packdir = fullfile (tmpdir, dirlist{k}); - packdirs{end+1} = packdir; - - ## Make sure the package contains necessary files - verify_directory (packdir); + ## The filename pointed to an uncompressed package to begin with + if (exist (tgz, "dir")) + dirlist = {".", "..", tgz}; + endif - ## Read the DESCRIPTION file - filename = fullfile (packdir, "DESCRIPTION"); - desc = get_description (filename); - - ## Verify that package name corresponds with filename - [dummy, nm] = fileparts (tgz); - if ((length (nm) >= length (desc.name)) - && ! strcmp (desc.name, nm(1:length(desc.name)))) - error ("package name '%s' doesn't correspond to its filename '%s'", - desc.name, nm); + if (exist (tgz, "file") || exist (tgz, "dir")) + ## the two first entries of dirlist are "." and ".." + if (exist (tgz, "file")) + packdir = fullfile (tmpdir, dirlist{3}); + else + packdir = fullfile (pwd(), dirlist{3}); + endif + packdirs{end+1} = packdir; + + ## Make sure the package contains necessary files + verify_directory (packdir); + + ## Read the DESCRIPTION file + filename = fullfile (packdir, "DESCRIPTION"); + desc = get_description (filename); + + ## Verify that package name corresponds with filename + [dummy, nm] = fileparts (tgz); + if ((length (nm) >= length (desc.name)) + && ! strcmp (desc.name, nm(1:length(desc.name)))) + error ("package name '%s' doesn't correspond to its filename '%s'", + desc.name, nm); + endif + + ## Set default installation directory + desc.dir = fullfile (prefix, cstrcat (desc.name, "-", desc.version)); + + ## Set default architectire dependent installation directory + desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-", + desc.version)); + + ## Save desc + descriptions{end+1} = desc; + + ## Are any of the new packages already installed? + ## If so we'll remove the old version. + for j = 1:length (packages) + if (strcmp (packages{j}.name, desc.name)) + packages_to_uninstall(end+1) = j; endif - - ## Set default installation directory - desc.dir = fullfile (prefix, cstrcat (desc.name, "-", desc.version)); - - ## Set default architectire dependent installation directory - desc.archprefix = fullfile (archprefix, cstrcat (desc.name, "-", - desc.version)); - - ## Save desc - descriptions{end+1} = desc; - - ## Are any of the new packages already installed? - ## If so we'll remove the old version. - for j = 1:length (packages) - if (strcmp (packages{j}.name, desc.name)) - packages_to_uninstall(end+1) = j; - endif - endfor - endfor + endfor endif endfor catch