SolarisPackageDirBundle.py revision 443
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 2008 Sun Microsystems, Inc. All rights reserved.
f16c114c20bbd7d292d93415d1e56c8dd6abd3e7Timo Sirainen# Use is subject to license terms.
8fcff4c5b52f24d9c681805fdf06b486f1d0fcbeTimo Sirainen # Want to access the manifest as a dict.
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainen # Remove BASEDIR from the path. The extra work is because if
98c1cf256927e254f0c092acd2ddcd7ea50bd009Timo Sirainen # BASEDIR is not empty (non-"/"), then we probably need to strip
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen # an extra slash from the beginning of the path, but if BASEDIR
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen # is "" ("/" in the pkginfo file), then we don't need to do
02b79f9c2636da1829eee5b92753602bba8b67edTimo Sirainen # anything extra.
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainen # Just do the files that remain. Only regular file
8d80659e504ffb34bb0c6a633184fece35751b18Timo Sirainen # types end up compressed; so skip them and only them.
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen # Files with special characters in their names may not
39775ad03c459efe64cce924658da5094ba417e1Timo Sirainen # end up in the faspac archive, so we still need to emit
39775ad03c459efe64cce924658da5094ba417e1Timo Sirainen # the ones that aren't.
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen if p.type in "fev" and p.klass in faspac and \
84e1634acc701d14e358e27f1beff5ad74f5004aTimo Sirainen # These are the only valid file types in SysV packages
445f9e31c6c3aa6c0a72be8565da8f6e594d24fbTimo Sirainen yield self.action(p, os.path.join(self.filename,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen yield self.action(p, os.path.join(self.filename,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen return file.FileAction(data, mode=mapline.mode,
dda2c506c8fc8ac2f88272de4523ded42baa0aa0Timo Sirainen timestamp=misc.time_to_timestamp(int(mapline.modtime)))
9e59a1f3f095b3099478562cf3f3970a24736970Timo Sirainen return directory.DirectoryAction(mode=mapline.mode,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen return hardlink.HardLinkAction(path=mapline.pathname,
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen elif mapline.type == "i" and mapline.pathname == "copyright":
313fe89df4d91cd0cd7f3558dc6d7fd21ad39eeeTimo Sirainen return unknown.UnknownAction(path=mapline.pathname)
4d25408732be27e91f0430f71e87242760c2517cTimo Sirainen if os.path.isfile(os.path.join(filename, "pkginfo")) and \