[Piuparts-commits] rev 455 - in trunk: . debian

Holger Levsen holger at alioth.debian.org
Tue Aug 4 10:55:42 UTC 2009


Author: holger
Date: 2009-08-04 10:55:42 +0000 (Tue, 04 Aug 2009)
New Revision: 455

Modified:
   trunk/debian/changelog
   trunk/piuparts.py
Log:
  - fail gracefully if piuparts is run as non-root user. Thanks to Ignace
    Mouzannar for the patch. (Closes: #538273)

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2009-08-04 10:50:10 UTC (rev 454)
+++ trunk/debian/changelog	2009-08-04 10:55:42 UTC (rev 455)
@@ -28,8 +28,10 @@
     - add advice how to read the logfile to the top of the logfiles produced.
     - add "FAIL: " to logging output for seven more failure types, so that it
       becomes easier to group failure causes.
-    - allow the user to stop piuparts with control-C. Thanks to Carl Chenet for
+    - allow piuparts to be stopped with control-C. Thanks to Carl Chenet for
       the patch. (Closes: #523958)
+    - fail gracefully if piuparts is run as non-root user. Thanks to Ignace
+      Mouzannar for the patch. (Closes: #538273)
   * piupartslib/packagesdb.py:
     - change the test whether a package is testable to check whether the 
       package is of priority "required", and not whether it's "Essential".

Modified: trunk/piuparts.py
===================================================================
--- trunk/piuparts.py	2009-08-04 10:50:10 UTC (rev 454)
+++ trunk/piuparts.py	2009-08-04 10:55:42 UTC (rev 455)
@@ -2022,6 +2022,11 @@
 
 
 if __name__ == "__main__":
+    # check if user has root privileges
+    if os.getuid():
+        print 'You need to be root to use piuparts.'
+        sys.exit(0)
+
     try:
         if sys.argv[1:] == ["unittest"]:
             del sys.argv[1]




More information about the Piuparts-commits mailing list