octave-maintainers
[Top][All Lists]
Advanced

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

Re: How to change the autoload status of a single package?


From: David Bateman
Subject: Re: How to change the autoload status of a single package?
Date: Sat, 26 May 2007 23:55:20 +0200
User-agent: Thunderbird 1.5.0.7 (X11/20060921)

Michael Goffioul wrote:
> On 5/26/07, David Bateman <address@hidden> wrote:
>> This is in fact very strange. The call to pkg:rebuild is
>>
>>      if (global_install)
>>        global_packages = rebuild (prefix, global_list, files, auto,
>> verbose);
>>        save (global_list, "global_packages");
>>        local_packages = global_packages;
>>      else
>>        local_packages = rebuild (prefix, local_list, files, auto,
>> verbose);
>>        save (local_list, "local_packages");
>>      endif
>>
>> So if a global installation is detected, the global_list is passed as
>> the local_list to installed_packages, and then all following operations
>> in pkg:rebuild are on the global packages. The new structure is then
>> saved to the correct file immediately on returning from pkg:rebuild.
>> This is why I want local_list==global_list for this call, as it avoided
>> some code duplication. It also appears to work fine for me both as a
>> normal and as a superuser (global install) under linux..
>>
>> Did you set the prefix for use the "-local" or "-global" flags? Sorry I
>> can't duplicate this, so can't fix it..
> 
> I didn't set any flag. IMO, the problem is not there. As I'm under Windows,
> all operations are done as superuser; hence pkg::rebuild gets called with
> global_list. Then installed_package gets called with twice global_list
> (around
> line 316). In pkg::installed_package, the first operation (~line 1383)
> 
> local_packages = load (local_list).local_packages;
> 
> sets local_packages to {}, because the packages contained in local_list
> (which is actually global_list) are global; so the field "local_packages"
> of the loaded structure is empty. Then the piece of code (~line 1388)
> 
> if (strcmp(local_list, global_list))
>  global_packages = {};
> else
>  global_packages = load (global_list).global_packages;
> endif
> 
> will set global_packages to {} as well, as pkg::installed_packages got
> called with twice the same argument; hence local_list==global_list.
> In the end, installed_packages returns {}.
> 
> Michael.
> 

Michael,

Of course you are right, The code at the moment read,

  try
    local_packages = load (local_list).local_packages;
  catch
    local_packages = {};
  end_try_catch
  try
    if (strcmp(local_list, global_list))
      global_packages = {};
    else
      global_packages = load (global_list).global_packages;
    endif
  catch
    global_packages = {};
  end_try_catch

and should probably read

  try
    local_packages = load (local_list).local_packages;
  catch
    local_packages = {};
  end_try_catch
  try
    global_packages = load (global_list).global_packages;
  catch
    global_packages = {};
  end_try_catch


as it did before. You can't mix up the global and local lists in the way
I did..

I'll include this in the patch I'm working on (that equally includes
your other fix) and submit it soon.

Cheers
David


reply via email to

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