[MacPorts] SummerOfCode2014_interactive added

MacPorts noreply at macports.org
Wed May 28 12:40:28 PDT 2014


Page "SummerOfCode2014_interactive" was added by shasha at macports.org
Content:
-------8<------8<------8<------8<------8<------8<------8<------8<--------

= Interactivity Use Cases =

=== Build-time dependencies ===
Desc: While installing a port if it conflicts with something already installed, ask the user for permission to deactivate the installed ones and reactivate after the build.

Message: A list of all the conflicts will be shown and the user asked if they want to deactivate all or abort.

Question type: A yes/no or continue/abort question is sufficient for this case. The user can either choose to deactivate all and continue with the build or abort. It is not necessary to give a multiple choice question for this use case.

Example-
{{{ 
$> port install foobar
The following packages conflict with the build of foobar:
  (1) boofar @0.0.1 +xzy
  (2) barfoo @0.0.2 +xzy
  (3) foba @0.1
Do you wish to deactivate all of them and reactivate after the install?
Press (1) to continue and (0) to abort: 1
---> Deactivating build conflicts
The following dependencies of foobar will be installed:
  (1) boofar @0.0.1 +xzy
  (2) barfoo @0.0.2 +xzy
  (3) foba @0.1
Press (1) to continue and (0) to abort: 1
---> Installing boofar @0.0.1 +xzy
---> Installing barfoo @0.0.2 +xzy
---> Installing foba @0.1
---> Installing foobar
——-> Reactivating build conflict packages
$> 
}}}


=== File conflicts on Activation ===
Desc: When a port is installed/activated, if the files written by the port already exist ask the user for permission before overwriting.

Message: A frightful message making it clear that the correct response is usually ‘no’. The name of the file being overwritten.

Question type: A yes/no or continue/abort question is an interaction that makes sense here. This question will be triggered whenever the activation process hits a conflicting file, so a yestoall option might also be desirable.  It is also to be kept in mind that files overwritten only affect the port being activated.

Example-
{{{
$> port activate foobar
The file foo.con already exists.
Warning: Overwriting of files is not recommended. It may lead to errors.
Do you wish to overwrite foo.con?
Press (1) to continue and (0) to abort: 1
---> Overwriting foo.con
——-> foobar activated
$>
}}}


=== Apt-get like behaviour ===
Desc: When installing a port, list all the dependencies and ask the user for confirmation just like apt-get does.

Message: A list of all the dependencies.

Question type: A continue/abort question to give the options of continuing with the installation or aborting it. This could even use a 10s timeout, giving an option to abort during the timeout and continuing automatically after the time is out.

Example-
{{{
$> port install foobar
The following dependencies of foobar will be installed:
  (1) boofar @0.0.1 +xzy
  (2) barfoo @0.0.2 +xzy
  (3) foba @0.1
Press (1) to continue and (0) to abort: 1
---> Installing boofar @0.0.1 +xzy
---> Installing barfoo @0.0.2 +xzy
---> Installing foba @0.1
---> Installing foobar
$>
}}}

=== Dependents getting broken ===
Desc: When uninstalling a port, if ports that depend on it are getting broken
ask the user for confirmation.

Message: A warning message making it clear that some other ports are getting broken. A list of all those ports will be displayed.

Question type: A continue/abort question is right for such a case. 

Example-
{{{
$> port uninstall foobar
The following dependents of foobar will be broken:
  (1) boofar @0.0.1 +xzy
  (2) barfoo @0.0.2 +xzy
  (3) foba @0.1
Press (1) to continue and (0) to abort: 1
---> Unstalling foobar
$>
}}}

=== Variant specific dependency ===
Desc: When installing a port that requires a dependency to have a certain variant, but this variant is not set. Ask the user if it should reinstall the dependency with that variant.

Message: A warning message explaining that reinstalling with a specific variant could break any already-installed dependents that relied on the previously-selected variants.

Question type: A continue/abort question is suitable here. The correct variant will be selected and installed automatically so no need to provide options. 

Example-
{{{
$> port install foobar
The package foobar requires barfoo @1.0.1.
Currently set version of barfoo: barfoo @0.0.1
Warning: Reinstalling with a specific variant could break any already-installed dependents that relied on the previously-selected variants.
Do you wish to install barfoo @1.0.1?
Press (1) to continue and (0) to abort: 1
---> Installing barfoo @1.0.1 +xzy
——-> Installing foobar
$>
}}}

=== Ambiguous activate ===
Desc: When port activate command is run ambiguously, give a list of ports to the user to choose from.

Message: A list of all the port versions/variants of the port name given.

Question type: A single choice question having multiple options is what is required in this case. The user is asked to choose one of the options.

Example-
{{{
$> port activate foobar
The following variants of foobar exist:
  (1) foobar @0.0.1 +xzy
  (2) barfoo @0.0.2 +xzy
  (3) foba @0.1
Type a number to select the variant to activate: 2
---> barfoo @0.0.2 +xzy activated.
$>
}}}

=== Rebuilding in rev-upgrade ===
Desc: Before rebuilding any port in rev-upgrade the user will be asked for confirmation.

Message: The port name that will be rebuilt along with some detail(not sure) about the linking errors.

Question type: A yes/no question seems to handle the situation well but if many ports have to be rebuilt a yestoall option also makes sense. A yestoall option can be implemented as a separate flag for rev-upgrade(may be).

Example-
{{{
$> port rev-upgrade
The package foobar @0.0.1 was found broken. Do you wish to rebuild it?
Press (1) to continue and (0) to abort: 1
---> Rebuilding foobar @0.0.1 +xzy
The package barfoo @0.0.2 was found broken. Do you wish to rebuild it?
Press (1) to continue and (0) to abort: 1
---> Rebuilding barfoo @0.0.2 +xzy
$>
}}}

=== Uninstall using -—follow-dependencies ===
Desc: When a user uninstalls using the flag —-follow-dependencies, ask for confirmation.

Message: A list of all the dependencies that will be uninstalled will be displayed.

Question type: A continue/abort ie. yes/no question makes sense here. The user will confirm the uninstall action or have a chance of aborting. A timeout can be used here too but it will not be very practical.

Example-
{{{
$> port uninstall —follow-dependencies foobar
The following packages will be uninstalled:
  (1) foobar @0.0.1 +xzy
  (2) barfoo @0.0.2 +xzy
  (3) foba @0.1
Press (1) to continue and (0) to abort: 1
---> Uninstalling foobar @0.0.1 +xzy
---> Uninstalling barfoo @0.0.2 +xzy
——-> Uninstalling foba @0.1
$>
}}}

=== Ambiguous uninstall ===
Desc: When uninstalling a port if the user supplies an ambiguous name, list all the variants and ask to select the ones that should be uninstalled.

Message: A list of all variants related to the ambiguous name provided.

Question type: A multiple choice question is what is required in this case. The user will be able to select the ones they want to uninstall. The selected options may be highlighted. Then pressing enter proceeds with the uninstall.

Example-
{{{
$> port uninstall foobar
"foobar" is ambiguous. Which of the following ports do you want to uninstall?
  (1) foobar @0.0.1 +xzy
  (2) foobar @0.0.2 +xzy
  (3) foobar @0.0.3
 Type a number to select a port to uninstall or press enter to uninstall the ports currently selected: 1
 Selecting foobar @0.0.1 +xzy.
 *(1) foobar @0.0.1 +xzy
  (2) foobar @0.0.2 +xzy
  (3) foobar @0.0.3
 Type a number to select a port to uninstall or press enter to uninstall the ports currently selected: 3
 Selecting foobar @0.0.3.
 *(1) foobar @0.0.1 +xzy
  (2) foobar @0.0.2 +xzy
 *(3) foobar @0.0.3
 Type a number to select a port to uninstall or press enter to uninstall the ports currently selected:
---> Uninstalling foobar @0.0.1 +xzy
---> Uninstalling foobar @0.0.3
$>
}}}

=== Choose variants interactively ===
Desc: When installing a port the user can be given a list of all the variants of the port they wish to install and they can select them interactively.

Message: A list of all the variants to choose from.

Question type: A multiple choice question where the user can select the options they want. Then pressing enter proceeds with the install.   

Example-
{{{
$> port install foobar
"foobar" has many variants. Which of the following variants do you want to install?
  (1) foobar @0.0.1 +xzy
  (2) foobar @0.0.2 +xzy
  (3) foobar @0.0.3
 Type a number to select a variant to install or press enter to install the variants currently selected: 1
 Selecting foobar @0.0.1 +xzy.
 *(1) foobar @0.0.1 +xzy
  (2) foobar @0.0.2 +xzy
  (3) foobar @0.0.3
 Type a number to select a variant to install or press enter to install the variants currently selected: 
---> Installing foobar @0.0.1 +xzy
$>
}}}

= Implementation Details =

=== ui_* calls ===
ui_yesorno: deals with all the continue/abort type questions

ui_onechoice: deals with all the single choice selection questions

ui_manychoice: deals with questions that offer many more than one selections

ui_timeout: deals with questions that may have better functionality with timeouts

=== Parameters ===
qid: This parameter is most important as it will enable the port client to identify the question and print the correct interactivity case.
(Incomplete)
-------8<------8<------8<------8<------8<------8<------8<------8<--------

--
Page URL: <https://trac.macports.org/wiki/SummerOfCode2014_interactive>
MacPorts <http://www.macports.org/>
Ports system for OS X

This is an automated message. Someone added your email address to be
notified of changes on 'SummerOfCode2014_interactive' page.
If it was not you, please report to .


More information about the macports-changes mailing list