octave-maintainers
[Top][All Lists]
Advanced

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

Re: packaging system


From: Stefan van der Walt
Subject: Re: packaging system
Date: Wed, 22 Jun 2005 14:03:00 +0200
User-agent: Mutt/1.5.6+20040907i

On Wed, Jun 22, 2005 at 12:30:49PM +0200, David Bateman wrote:
> 
> Also, only checks against the installed packages are performed.. What I 
> see as an extention is to create a complete dependency table of all of 
> the installed packages, with a function like
>
> function dependency_table = installed_dependencies (prefix, 
> installed_packages)
>  count = 0;
>  for i = 1:length(installed_packages.name)
>    desc = get_description ([prefix, installed_packages.name{i}]);
>    verify_description (desc);
>    for j = 1:length(desc.keywords)
>      if (strcmp(desc.keywords{j}, "DEPENDS"))
>         deps = parse_dependencies ( desc.values{i});
>         if (iscell (deps))
>           for k = 1:length(deps)
>              count++;
>              dependency_table.name{count} = installed_packages.name{i};
>              dependency_table.version{count} = 
> installed_packages.version{i};
>              dependency_table.package{count} = deps.package{k};
>              dependency_table.operator{count} = deps.operator{k};
>              dependency_table.dversion{count} = deps.version{k};
>         endif
>      endif
>    endfor
>  endfor
> endfunction

I like your idea.  Wouldn't it be easier to implement it as some sort
of tree structure, instead of a flat one?  Unfortunately, we don't
have python's dictionaries, but maybe we can do something similar in
Octave like

function [value, idx] = search(dict, key)
    value = [];
    for idx = 1:rows(dict)
        if strcmp(dict(idx,1), key)
            value = dict{idx,2};
            return;
        endif
    endfor
    idx = 0;
endfunction

function d = dict(d, key, new_value)
    if (nargin == 0)
        d = cell(0,2);
        return
    endif

    [value, idx] = search(d, key);
    if (idx == 0)
        idx = rows(d)+1;
    endif
    
    d(idx, 1) = key;
    d(idx, 2) = new_value;
    
endfunction


> then have three other function, one to remove a package, one to add a 
> package to the table and another to validate the dependency table,
> like

...

> Ok, none of the above code is checked as I wrote it straight into my 
> e-mail client, but at least it gives an idea of what I'm thinking 
> about.. Including allowing cell-arrays to install/uninstall, it 
> addresses the issues of circular dependencies and dependencies on 
> uninstalling...

Fortunately, the inmind-Octave-parser is pretty flexible :)

Regards
Stéfan



reply via email to

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