* --no-same-permissions, should only be default for source archive extractions.

While installing; we want _the_ permissions that are specified in the .pisi packages.
This commit is contained in:
Faik Uygur
2006-08-30 12:56:54 +00:00
parent 6364704a92
commit 5cc4262b52
2 changed files with 7 additions and 3 deletions
+6 -2
View File
@@ -72,9 +72,10 @@ class ArchiveTar(ArchiveBase):
type. Provides access to tar, tar.gz and tar.bz2 files. type. Provides access to tar, tar.gz and tar.bz2 files.
This class provides the unpack magic for tar archives.""" This class provides the unpack magic for tar archives."""
def __init__(self, file_path, arch_type = "tar"): def __init__(self, file_path, arch_type = "tar", no_same_permissions = True):
super(ArchiveTar, self).__init__(file_path, arch_type) super(ArchiveTar, self).__init__(file_path, arch_type)
self.tar = None self.tar = None
self.no_same_permissions = no_same_permissions
def unpack(self, target_dir, clean_dir = False): def unpack(self, target_dir, clean_dir = False):
"""Unpack tar archive to a given target directory(target_dir).""" """Unpack tar archive to a given target directory(target_dir)."""
@@ -126,7 +127,10 @@ class ArchiveTar(ArchiveBase):
# tarfile.extract does not honor umask. It must be honored explicitly. # tarfile.extract does not honor umask. It must be honored explicitly.
# see --no-same-permissions option of tar(1), which is the deafult # see --no-same-permissions option of tar(1), which is the deafult
# behaviour. # behaviour.
if not os.path.islink(tarinfo.name): #
# Note: This is no good while installing a pisi package. Thats why
# this is optional.
if self.no_same_permissions and not os.path.islink(tarinfo.name):
os.chmod(tarinfo.name, tarinfo.mode & ~ctx.const.umask) os.chmod(tarinfo.name, tarinfo.mode & ~ctx.const.umask)
os.chdir(oldwd) os.chdir(oldwd)
+1 -1
View File
@@ -91,7 +91,7 @@ class Package:
def extract_install(self, outdir): def extract_install(self, outdir):
if self.impl.has_file(ctx.const.install_tar_lzma): if self.impl.has_file(ctx.const.install_tar_lzma):
self.extract_file(ctx.const.install_tar_lzma, ctx.config.tmp_dir()) self.extract_file(ctx.const.install_tar_lzma, ctx.config.tmp_dir())
tar = archive.ArchiveTar(join(ctx.config.tmp_dir(), ctx.const.install_tar_lzma), 'tarlzma') tar = archive.ArchiveTar(join(ctx.config.tmp_dir(), ctx.const.install_tar_lzma), 'tarlzma', False)
tar.unpack_dir(outdir) tar.unpack_dir(outdir)
else: else:
self.extract_dir_flat('install', outdir) self.extract_dir_flat('install', outdir)