[jhbuild/external-deps] warn user about missing permissions to install packages



commit bfcbe7bc013e89cd643f779720a75a70efbe2bf9
Author: Frédéric Péters <fpeters 0d be>
Date:   Tue Jun 9 21:29:44 2009 +0200

    warn user about missing permissions to install packages
---
 jhbuild/utils/systempackages.py |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/jhbuild/utils/systempackages.py b/jhbuild/utils/systempackages.py
index ef01861..5533e10 100644
--- a/jhbuild/utils/systempackages.py
+++ b/jhbuild/utils/systempackages.py
@@ -25,6 +25,8 @@ import os
 from jhbuild.modtypes import MetaModule
 from jhbuild.versioncontrol.tarball import TarballBranch
 
+from jhbuild.errors import FatalError
+
 class SystemPackages(object):
 
     def __init__(self, config):
@@ -123,7 +125,10 @@ class DebianPackages(SystemPackages):
         cache = apt.Cache()
         for name in names:
             cache[name].markInstall()
-        cache.commit(fetchprogress, installprogress)
+        try:
+            cache.commit(fetchprogress, installprogress)
+        except apt.cache.LockFailedException:
+            raise FatalError(_('Cannot install system packages, are you root?'))
         cache.open(apt.progress.OpProgress())
 
     def remove(self, names):



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]