[Aptitude-devel] aptitude: cmdline actions ignoring -o options

Daniel Hartwig mandyke at gmail.com
Sun Jan 22 07:12:10 UTC 2012


On 17 December 2011 13:08, Daniel Hartwig <mandyke at gmail.com> wrote:
>
>  i. Modify the order of things above so that the state variables are
>    set *after* processing the command line options, which means
>    changing the options of 3a. to modify aptcfg instead of these
>    variables.
>
>    This fixes the immediate problem of -o options being ignored.
>
> ii. Investigate how many of these state variables are really needed
>    and migrate most of them to having each action refer to aptcfg
>    directly.  Some points worth considering:
>
>    - the curses ui dynamically updates aptcfg and the state variables
>      must be updated accordingly (duplicated effort and storage =
>      error prone; though I assume this is handled by registering
>      signals)
>
>    - there is a lot of passing of the state variables to various
>      functions, which makes invoking them hairy.  Each function knows
>      which config options it is interested and could *probably* just
>      extract these from aptcfg as appropriate.
>
>    - if there are config options which are parsed in to a data
>      structure, this can be handled in a similar fashion to apt-pkg's
>      handling of, e.g., acquire::compressiontypes (see
>      apt-pkg/aptconfiguration.cc)
>
>

I have just pushed a new branch--wip-cmdline--which is a start at
implementing the above ideas.

Command-line argument parsing uses the same CommandLine class from
apt-pkg as the APT tools.  Dispatch to the various 'cmdline_foo'
actions is also handled by that class with each function having a
very simple signature and accessing aptcfg directly for any
settings required.

This means aptitude now more closely follows the APT tools in the
semantics of argument parsing, and some bugs related to that can
be closed on this branch.


With these first two commits I have attempted as much as possible
to retain existing behaviour.  The next step is an audit and
further refactoring of the various command-line actions, followed
by some bug fixing.

If anyone has a chance to take a look at this, any feedback would
be appreciated.


Regards



More information about the Aptitude-devel mailing list