wiki:SummerOfCode2014_interactive

Use Cases Implemented

Uninstall when port has dependents

Desc: When uninstalling a port, if the port has dependents ask the user for confirmation before uninstalling.

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 yes/no question is right for such a case.

Example-

$> port uninstall foobar
The following ports will break:
 brofoo @0.19.1_0
 foobro @2.2.6_0
Continue? [y/N]: y
Warning: Uninstall forced.  Proceeding despite dependencies.
--->  Deactivating foobar @1.14_0
--->  Cleaning foobar
--->  Uninstalling foobar @1.14_0
--->  Cleaning foobar
$>

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 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.

Example-

$> port uninstall —-follow-dependencies foobar
The following packages will be uninstalled:
  foobar @0.0.1 +xzy
  barfoo @0.0.2 +xzy
  foba @0.1
Continue? [Y/n]: Y 
---> 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.1 +xyz
  (3) foobar @0.0.3
Enter a space separated string of choices to select the ports to uninstall: 1 3
---> Uninstalling foobar @0.0.1 +xzy
---> Uninstalling foobar @0.0.3
$>

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:
  foobar @0.0.1 +xzy
  foobar @0.0.2 +xzy
  foobar @0.1
Type a number to select the variant to activate: 2
---> foobar @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: A list of ports that will be rebuilt along with some detail(not sure) about the linking errors. If the user chooses to answer no, display the message "You can always run 'port rev-upgrade' later to fix this".

Question type: A yes/no question seems to handle the situation well. The whole list will be rebuilt as asking for each port might break the process of rev-upgrade.

Example-

$> port rev-upgrade
The following ports will be rebuilt:
  boofar @0.0.1 +xzy
  barfoo @0.0.2 +xzy
  foba @0.1
Continue? [Y/n]: Y
---> Rebuilding boofar @0.0.1 +xzy
---> Rebuilding barfoo @0.0.2 +xzy
---> Rebuilding foba @0.1 
$>

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:
  boofar @0.0.1 +xzy
  barfoo @0.0.2 +xzy
  foba @0.1
Continue? [Y/n]: Y
---> Installing boofar @0.0.1 +xzy
---> Installing barfoo @0.0.2 +xzy
---> Installing foba @0.1
---> Installing foobar
$>

Other 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 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:
  boofar @0.0.1 +xzy
  barfoo @0.0.2 +xzy
  foba @0.1
Do you want to deactivate all of them and reactivate after the install? [y/N]: y 
---> Deactivating build conflicts
The following dependencies of foobar will be installed:
  farfar @0.0.1 +xzy
  booboo @0.0.2 +xzy
  bafo @0.1
Continue? [y/N]: y
---> Installing farfar @0.0.1 +xzy
---> Installing booboo @0.0.2 +xzy
---> Installing bafo @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 question is an interaction that makes sense here. This question will be triggered whenever the activation process hits a conflicting file. A yestoall option will make it possible to present the complete list and ask the user only once. 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? [y/N/y_to_all]: y
---> Overwriting foo.con
——-> foobar activated
$>

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 yes/no 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 +quartz' requires 'barfoo +quartz' but 'barfoo' is installed.
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 +quartz? [Y/n]: Y
---> Installing barfoo @1.0.1 +xzy
——-> Installing foobar
$>

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
Enter a space separated string of choices to select the ports to uninstall: 1
---> Installing foobar @0.0.1 +xzy
$>

Sudo

Desc: When a command is entered that requires elevated privileges and user has failed to provide them, ask the user if they wish to run the command as su.

Message: A message explaining that the command requires to be run "sudo" prefixed.

Question type: A yes/no question asking if the user wants to give sudo permission or not.

Example-

$> port install foobar
Note: 'Install' action requires elevated privileges.
Do you wish to run this as sudo? [Y/n]: y
---> Installing foobar @0.0.1 
$>

Last modified 10 years ago Last modified on Aug 14, 2014, 10:28:32 PM