apjanke / octave-packajoozle

A just-for-fun reworking of GNU Octave's `pkg` tool
GNU General Public License v3.0
4 stars 1 forks source link

pkj shows lots of nonexistent old paths #59

Open cbm755 opened 5 years ago

cbm755 commented 5 years ago
>>> pkj list
PackageName        | Version | Place  | InstallationDir                                
-------------------+---------+--------+------------------------------------------------
bsltl              | 1.1.1   | user   | ~/octave/bsltl-1.1.1                           
control            | 3.1.0   | user   | ~/octave/control-3.1.0                         
doctest            | 0.6.1   | user   | ~/.octaveflatpak/doctest-0.6.1                 
doctest            | 0.7.0   | custom | ~/.local/share/octpkgs/6.0.0/doctest-0.7.0     
general            | 2.1.0   | user   | ~/octave/general-2.1.0                         
generate_html      | 0.3.1   | user   | ~/octave/generate_html-0.3.1                   
instrument-control | 0.3.1   | user   | ~/octave/instrument-control-0.3.1              
interval           | 3.2.0   | user   | ~/octave/interval-3.2.0                        
io                 | 2.4.12  | custom | ~/.local/share/octpkgs/6.0.0/io-2.4.12         
io                 | 2.4.7   | user   | ~/octave/io-2.4.7                              
miscellaneous      | 1.2.1   | user   | ~/octave/miscellaneous-1.2.1                   
optim              | 1.6.0   | user   | ~/.octaveflatpak/optim-1.6.0                   
optim              | 1.6.0   | custom | ~/.local/share/octpkgs/6.0.0/optim-1.6.0       
packajoozle *      | 0.0.0+  | custom | ~/.local/share/octpkgs/6.0.0/packajoozle-0.0.0+
signal             | 1.4.0   | user   | ~/octave/signal-1.4.0                          
specfun            | 1.1.0   | user   | ~/octave/specfun-1.1.0                         
splines            | 1.3.2   | user   | ~/octave/splines-1.3.2                         
statistics         | 1.4.0   | user   | ~/.octaveflatpak/statistics-1.4.0              
statistics         | 1.4.0   | custom | ~/.local/share/octpkgs/6.0.0/statistics-1.4.0  
struct             | 1.0.16  | user   | ~/.octaveflatpak/struct-1.0.16                 
struct             | 1.0.16  | custom | ~/.local/share/octpkgs/6.0.0/struct-1.0.16     
symbolic           | 2.7.1   | user   | ~/.octaveflatpak/symbolic-2.7.1                
symbolic           | 2.7.1   | custom | ~/.local/share/octpkgs/6.0.0/symbolic-2.7.1    
testify            | 0.1.0   | user   | ~/octave/testify-0.1.0                         
zeromq             | 1.1.0   | user   | ~/octave/zeromq-1.1.0                          

Many of those InstallationDirs are nonexistent, leftover from before I changed all my prefix stuff to put my packages in version-specific subdirs of .local/share... Not sure where pkj is finding this stuff: pkg list does not show them.

apjanke commented 5 years ago

What do you get for pkj world? That will show you all the InstallationDirs and their associated index files. I suspect that what's happening is that the index file from your old default location is still around, and pkj is picking that up, whereas pkg is using only the index file for your new custom location.

Perhaps when the user has a custom prefix set, that should de-activate the default user location in pkj's view of the world. Or perhaps a custom prefix should just change the path that the user location uses, instead of introducing a new custom location.

cbm755 commented 5 years ago
>>> pkj world
packajoozle.internal.InstallWorld: user, global, custom (default=custom)
  user:
    prefix: /home/cbm/octave
    arch_prefix: /home/cbm/octave
    index_file: /home/cbm/.octave_packages
    default package_list_var_name: local_packages
    actual package_list_var_name: local_packages
  global:
    prefix: /home/cbm/.octavehg/share/octave/packages
    arch_prefix: /home/cbm/.octavehg/lib/octave/packages
    index_file: /home/cbm/.octavehg/share/octave/octave_packages
    default package_list_var_name: global_packages
    actual package_list_var_name: global_packages
  custom:
    prefix: /home/cbm/.local/share/octpkgs/6.0.0
    arch_prefix: /home/cbm/.local/share/octpkgs/6.0.0
    index_file: /home/cbm/.local/share/octpkgs/6.0.0/octave_packages
    default package_list_var_name: local_packages
    actual package_list_var_name: local_packages

I certainly don't expect /home/cbm/octave to appear there. But maybe my customization are incorrect somehow:

%% I want to store my packages in version-specific dirs
tmp_pkg_path = fullfile(getenv('HOME'), '.local/share/octpkgs/', ver('octave').Version);
mkdir(tmp_pkg_path);  % oct 6 needs this?
pkg('prefix', tmp_pkg_path, tmp_pkg_path);
pkg('local_list', fullfile(tmp_pkg_path, 'octave_packages'));
clear tmp_pkg_path
apjanke commented 5 years ago

I certainly don't expect /home/cbm/octave to appear there. But maybe my customization are incorrect somehow

No, your customizations are fine; it's probably Packajoozle that needs to change to match your expectations.

Right now, if a user customizes their pkg prefix, Packajoozle views that as a third, new prefix/place:

This is in line with Packajoozle's support for arbitrary additional installation places. But doesn't seem to be in line with pkg's behavior, or user expectations.

It sounds to me like a customized pkg prefix should not be treated as a new third place, but rather should be treated as an alteration of where the user place lives on disk. That way, stuff left in the old default user place will not show up in list output, and won't be involved in dependency resolution: only octave sessions that are using the default user location will see it. Does that sound better to you?