Interactive port command for GSOC
juliuscanute at gmail.com
Sun Mar 27 08:15:57 PDT 2011
I am interested in working on "Interactive port command", I gathered some ideas regarding the same by going through macports source, as well as by going through some of the tickets that were filed . I also wanted your feedback to improve the idea further.
1)If user enters a wrong action, instead of printing the message unrecognized action, either list of actions could be shown to the user to select one from it(based upon some closest matches we get towards an action ex:using editdistance) or, get the port to interactive mode.
2)If user executes port command without sudo instead of printing the following error message.
"Error: Insufficient privileges to write to MacPorts install prefix"
We can ask the user to enter the root password and proceed there-afterwards.
3)If search for a port that user wants to install is not found. Instead of printing out the message portname not found. We can search for ports that will match the users interest based upon the query and print them out.
4)If *source* could not be fetched from a particular url, and it fails with the following error "Fetching failed" for a particular package, but user is sure that same source is present somewhere other that one mentioned in the PortFile. An prompt could be made to the user to ask him to enter the url manually.
5)When a user is behind proxy and rsync method of syncing does not work. We can prompt the user to choose his method of syncing the port tree. Which will do the configuration for the user automatically, for which user has to do things manually now.
6)I am sorry for this suggestion. How about if a download failed due to "403 Forbidden" message trying to download in chunks of smaller size by specifying the range parameter of curl, which again can be got(range) through the interactive prompt (Well in my university there is a restriction on the maximum file size which i can download in a single shot to 15mb, but per day i can use up to 2GB. Well at-least if curl could be configured to download a file in chunks it will reduce burden for people like me to write manual scripts. )
7)If build process failed user can try other options to build based upon the variants, user could be prompted to select a variant for that package.
There are few commonly occurring errors which i think could be added to interactive prompt:
8)Basically we can ask user to take certain actions based upon suggestion from the interactive prompt. Standard workarounds are also given in the site. We can guide users to take action based upon that.
8.1)man port fails with error message
8.2)port fails with: Image error: /opt/local/bin/a2p…
8.3)A command failed to run with a message referring to libpng12.0.dylib
8.4)A port failed to build with a message referring to 1/lib: No such file or directory
9)This is the error which i am getting rite now when i run the command below(a ticket was also filed for this some time back):
sudo port upgrade all
Error: 2Pong is not installed
In such kind of situations "interactive port command" could be designed in such a way that it either asks the user to install 2Pong and proceed, or appropriate function calls could be called to make sure that this does not happen.
10)This is the error which i get when executing the command below(a ticket was also filed for this some time back):
port uninstall installed
Error: port uninstall failed: Please uninstall the ports that depend on bison first.
Dealing with these sort of errors interactively.
For resolving this kind of situation we can get the dependents of bison, then ask the user to decide wether he wants to remove the dependents or not.
If you find something is not the rite way of doing it, or if you have your own suggestions that could improve it further do let me know.
More information about the macports-dev