Bugzilla – Bug 1637
bake calling apt-get for unprivileged user
Last modified: 2013-04-29 02:54:18 UTC
The RC1 candidate, running on an Ubuntu 10.04 LTS machine with ./bake.py configure -e ns-3.17 ./bake.py download -vv and which doesn't have qt installed, yields: >> Downloading qt4 - apt-get -y install qt4-dev-tools dir=/home/buildslave/scratch/ns-allinone-3.17.rc1/bake/source E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied) E: Unable to lock the administration directory (/var/lib/dpkg/), are you root? >> Download qt4 - Problem Self installation problem for module: "qt4", Probably either you need super user rights to install the packet,or that the module is not present on your package management databases. Try calling bake with the --sudo option and/or review your library database to add "qt4-dev-tools" More information from the module: "Didn't find QT 4, download and install it from http://qt.nokia.com/downloads/" > Problem: Unmet dependency on module: qt4. Bake will continue since this module is not in the critical path. For more information call bake with -vv. bake then proceeds to download netanim despite missing dependency >> Downloading netanim-3.103 - >> Download netanim-3.103 - OK ----- this is related to the discussion on the list, whether bake should be installing system packages. If we keep this type of functionality that bake can install system packages, I would suggest that bake be enhanced to detect whether it is running as a privileged user before trying to call apt-get, and also verify that the user has explicitly requested this behavior (via --enable-sudo or some other command line argument such as "--install-missing-packages"). It also seems to me that packages should be separately classified as either system installs or source installs, and that we "Download ..." only source installs. If a prerequisite is missing, should the downstream package be downloaded? Or should this be instead something like ">> Suppressing netanim-3.103 download due to missing prerequisite: qt"
I'd like to suggest the following behavior for ns-3.17: If qt is missing, an error message is generated during the download step, such as: Warning: missing qt4 dependency try 'sudo apt-get install qt4-dev-tools' or otherwise install qt4 netanim-3.103 will not be built until this is resolved However, netanim-3.103 still proceeds to download. If the user notices this, and installs the missing package before calling 'bake.py build', then I think the build should proceed as if there were no original error. If the user doesn't notice this, and tries to build, again a similar warning is printed out when it comes time to build netanim, but the build proceeds to ns-3.17. Set the exit code to an error value when these warnings are raised, so we can test for this behavior in our regression scripts. Comments on this plan?
As a paleative fix I added a try to install false for qt (changeset 213). The new behaviour can be implemented in the future.
Now to install any system dependency module the user needs to explicitly ask for --sudo, independently if the module asks to install or not. (changeset 230)