SolarisPackageDirBundle.py revision 1765
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# CDDL HEADER START
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# The contents of this file are subject to the terms of the
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# Common Development and Distribution License (the "License").
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# You may not use this file except in compliance with the License.
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# See the License for the specific language governing permissions
0cb2e8eb55e70f8ebe1e8349bdf49e4cbe5d8834Timo Sirainen# and limitations under the License.
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# When distributing Covered Code, include this CDDL HEADER in each
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# If applicable, add the following below this CDDL HEADER, with the
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# fields enclosed by brackets "[]" replaced with your own identifying
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# information: Portions Copyright [yyyy] [name of copyright owner]
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# CDDL HEADER END
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# Use is subject to license terms.
022412398e56a8f31ef111cfd7271498d64af9a9Timo Sirainen # Want to access the manifest as a dict.
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainen fpath = os.path.join(self.filename, "archive", klass)
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen # We accept either bz2 or 7zip'd files
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen # Remove BASEDIR from the path. The extra work is because if
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen # BASEDIR is not empty (non-"/"), then we probably need to strip
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen # an extra slash from the beginning of the path, but if BASEDIR
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen # is "" ("/" in the pkginfo file), then we don't need to do
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen # anything extra.
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen # Just do the files that remain. Only regular file
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen # types end up compressed; so skip them and only them.
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen # Files with special characters in their names may not
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen # end up in the faspac archive, so we still need to emit
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen # the ones that aren't.
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen if p.type in "fev" and p.klass in faspac and \
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen # These are the only valid file types in SysV packages
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen act = self.action(p, os.path.join(self.filename,
a2637488c8d514ec1ac3914811deee814f9761b3Timo Sirainen a = self.action(p, os.path.join(self.filename,
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen # If any one of the mode, owner, or group is "?", then we're
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen # clearly not capable of delivering the object correctly, so
299183fbb6ec5d0828a0880da372540421ac4665Timo Sirainen if mapline.type in "fevdx" and (mapline.mode == "?" or
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen mapline.owner == "?" or mapline.group == "?"):
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen timestamp=misc.time_to_timestamp(int(mapline.modtime)))
2e937ed8585299b2e879a28314902a5f644813d2Timo Sirainen a.attrs["preserve"] = preserve_dict[mapline.klass]
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen # for editable files, map klass onto IPS names; if match
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen # fails, make sure we at least preserve file
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen preserve=preserve_dict.get(mapline.klass, "true")
4d25408732be27e91f0430f71e87242760c2517cTimo Sirainen return file.FileAction(data, mode=mapline.mode,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen timestamp=misc.time_to_timestamp(int(mapline.modtime)))
4d25408732be27e91f0430f71e87242760c2517cTimo Sirainen return directory.DirectoryAction(mode=mapline.mode,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen return hardlink.HardLinkAction(path=mapline.pathname,
1e76a5b92f9d82d557f81f080f3dfad1c9d8f200Timo Sirainen elif mapline.type == "i" and mapline.pathname == "copyright":
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen return unknown.UnknownAction(path=mapline.pathname)
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen if os.path.isfile(os.path.join(filename, "pkginfo")) and \