Add owner and group attributes to AdditionalFile tag.

example:

<AdditionalFiles>
    <AdditionalFile owner="apache" group="apache" permission="0644" target="/etc/apache.conf">apache.conf</AdditionalFile>
</AdditionalFiles>
This commit is contained in:
Faik Uygur
2006-12-06 12:40:30 +00:00
parent 05716580d6
commit b08bca74b5
2 changed files with 14 additions and 1 deletions
+12
View File
@@ -18,6 +18,8 @@ import glob
from copy import deepcopy
from os.path import basename, dirname
from stat import S_IMODE
from pwd import getpwnam
from grp import getgrnam
import gettext
__trans = gettext.translation('pisi', fallback=True)
@@ -786,6 +788,16 @@ class Builder:
if afile.permission:
# mode is octal!
os.chmod(dest, int(afile.permission, 8))
if afile.owner:
try:
os.chown(dest, getpwnam(afile.owner)[2], -1)
except KeyError:
ctx.ui.warning(_("No user named '%s' found on the system") % afile.owner)
if afile.group:
try:
os.chown(dest, -1, getgrnam(afile.group)[2])
except KeyError:
ctx.ui.warning(_("No group named '%s' found on the system") % afile.group)
os.chdir(c)
ctx.ui.action(_("** Building package %s") % package.name);
+2 -1
View File
@@ -55,6 +55,8 @@ class AdditionalFile:
s_Filename = [autoxml.String, autoxml.mandatory]
a_target = [autoxml.String, autoxml.mandatory]
a_permission = [autoxml.String, autoxml.optional]
a_owner = [autoxml.String, autoxml.optional]
a_group = [autoxml.String, autoxml.optional]
def __str__(self):
s = "%s -> %s " % (self.filename, self.target)
@@ -62,7 +64,6 @@ class AdditionalFile:
s += '(%s)' % self.permission
return s
class Patch:
s_Filename = [autoxml.String, autoxml.mandatory]