This page is meant to organize and report the efforts to improve pkg.m
- 1 Participants
- 2 Parsing arguments passed to pkg
- 3 Desired features
- 3.1 Reverse autoload function
- 3.2 Option update should behave as option install
- 3.3 Integrate generate_html into Octave-core
- 3.4 Keep sources in installed packages
- 3.5 Remove -global and -local flags
- 3.6 Allow packages to deprecate functions
- 3.7 Resolve packages dependencies automatically. Download and install
- 3.8 Allow download and install of multiple versions of the same package
- 3.9 Make pkg.m more verbose by default
- 3.10 Support for more than one src directory(?)
- 3.11 Accept make flags
- 3.12 Remove auto option
- 3.13 Allow installation from given url
- 3.14 Add where is functionality
If you want to participate add your signature, your IRC nick or your sourceforge username.
Clone Carnë's repositoryEdit
Parsing arguments passed to pkgEdit
One of the most intimidating parts of pkg.m is the monstrous way the parsing of arguments is done. The current mayhem is probably due to the natural evolution of the code. the method use to parse the arguments is based on a flag system.
We started cleaning up the parsing of options to give some structure and make pkg.m easy to extend in the future. For this we focus on encapsulation.
Definitions of actions, targets and modifiersEdit
A typical call to pkg looks like
pkg install -forge pkg1 pkg2 pkg3 -j4
We can identify three types of input arguments
- Action: install
- Modifiers: -forge, -j4
- Targets: pkg1, pkg2, pk3
So far we have defined them as follows
- Action: The first input argument and can't start with a hyphen.
- Modifier: Must start with a hyphen.
- Target: Anything that is not an action nor a modifier
Each action has its own set of valid modifiers and behaves accordingly, that is the function pkg does not parse targets nor modifiers. Therefore the rôle of the main function pkg is to call the right action once general sanity checks have been performed.
The particular implementation of this dispatch behavior was source of some discussion.
- Using structure
- One way of implementing the dispatch is using structures with fieldnames equal to the action and containing a function handle. Here is an example.
- Some people do not like this because they consider it a weird use of a structure.
- Using feval
- Another way of doing it (and the implemented as of revision 2c16a852bae9 in carandraug's repository) is building a string of the function to call and use feval. Here the example
- Using objects
- Where we have an action class with fields valid_modifiers and method parse_modfiers. All _pkg actions inherit the general valid_modifiers and extend them with their own, as well as overloading the parser_modifier method. This gives the maximum flexibility, but since is too much of a change we haven't code it.
The action functions have the suffix _pkg in their names. These functions should contain a cell of valid modifiers if they accept any. The function parse_target_modifier is called to check the validity of the modifiers and to separate them from targets. The cell of valid modifiers can contain regular expressions. This is required since we want to accept modifiers compatible with make flags (such as -jX for parallel compilation).
We are trying to avoid global variables at all cost. Everytime a read-only value is needed in several functions, we create a helper function that returns the value.
We have to see how we are going to solve the issue with actions like 'global_list' (deprecated, now called 'global_db') that can change the pointer to the file containing the package database.
Reverse autoload functionEdit
Though is not related with pkg.m, the function autoload can simplify considerably the PKG_* scripts. The idea is to give generate a function that reverses autoload.
Option update should behave as option installEdit
- It should parse a list of packages and maybe the same flags as install
- It should not stop updating if a package is not found (i.e. user local package, not in Forge).
- KaKiLa 04:42, 1 November 2012 (PDT)
Integrate generate_html into Octave-coreEdit
- The system used to generate pakage releases should be more closely integrated with the package manager
- Maybe a "pkg release" command possibly with "pkg release -binary" option would be a good interface
Keep sources in installed packagesEdit
- "pkg rebuild" should re-generate any .oct files, this would be useful when an Octave update breaks the API
Remove -global and -local flagsEdit
- Those flags are have shaky functionality so they should disappear
- Carnë has already a changeset for this
Allow packages to deprecate functionsEdit
- Create a system that allows packages to deprecate functions as in core. Possibilities are:
- Get pkg to accept a deprecated directory inside the package and add it to the search path. Functions in those directories would have to be treated the same as the ones inside the core deprecated
- PKG_ADD can be used to hack this. Package developers would still have to actually write the warnings on the function code but this would allow to have the functions in a separate directory so they don't foget to remove them on the next release
- The package developer can also use something like Make to create a normal package from something that actually had a more complex structure, inclusive deprecated directories
Resolve packages dependencies automatically. Download and installEdit
- Get pkg to resolve dependencies automatically by downloading and installing them too.
Allow download and install of multiple versions of the same packageEdit
Make pkg.m more verbose by defaultEdit
- make the package just a bit more verbose by default
Support for more than one src directory(?)Edit
Accept make flagsEdit
- make pkg able to supply extra configure and make flags, useful for distributions, including -j for make
Remove auto optionEdit
Allow installation from given urlEdit
- Accept -url <url> to install files and packages directly from the web
Add where is functionalityEdit
pkg describe pkg_name gives useful information. But we should allow for more direct queries like
pkg whereis function_namelist the installed packages (loaded or not) that have a function matching the name function_name.
pkg whereis -forge function_namelist all forge packages that have a function matching the name function_name.