From 391c2fb0b20a5c3f616f1added9072288beb1e64 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=2E=C3=87a=C4=9Flar=20Onur?= Date: Wed, 5 Oct 2005 11:56:43 +0000 Subject: [PATCH] =?UTF-8?q?Numeric=20sa=C3=A7mal=C4=B1klara=20babay...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pisi/actionsapi/shelltools.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pisi/actionsapi/shelltools.py b/pisi/actionsapi/shelltools.py index 7aee30a6..f3ac3144 100644 --- a/pisi/actionsapi/shelltools.py +++ b/pisi/actionsapi/shelltools.py @@ -14,6 +14,7 @@ import os import glob import shutil +import pwd import gettext __trans = gettext.translation('pisi', fallback=True) @@ -61,11 +62,11 @@ def chmod(sourceFile, mode = 0755): else: ctx.ui.error(_(' ActionsAPI [chmod]: File %s doesn\'t exists.') % (file)) -def chown(sourceFile, uid = 0, gid = 0): - '''change the owner and group id of sourceFile to the numeric uid and gid''' +def chown(sourceFile, uid = "root", gid = "root"): + '''change the owner and group id of sourceFile to uid and gid''' if can_access_file(sourceFile): try: - os.chown(sourceFile, uid, gid) + os.chown(sourceFile, pwd.getpwnam(uid)[2], pwd.getpwnam(gid)[3]) except OSError: ctx.ui.error(_(' ActionsAPI [chown]: Operation not permitted: %s (uid: %s, gid: %s)') \ % (sourceFile, uid, gid))