6915602 onbld python modules should install into python version specific directories
--- a/usr/src/Makefile.master Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/Makefile.master Thu Apr 22 10:13:38 2010 -0700
@@ -176,7 +176,9 @@
XREF= $(ONBLD_TOOLS)/bin/xref
FIND= /usr/bin/find
PERL= /usr/bin/perl
-PYTHON= /usr/bin/python2.4
+PYTHON_24= /usr/bin/python2.4
+PYTHON_26= /usr/bin/python2.6
+PYTHON= $(PYTHON_24)
SORT= /usr/bin/sort
TOUCH= /usr/bin/touch
WC= /usr/bin/wc
--- a/usr/src/pkg/manifests/developer-build-onbld.mf Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/pkg/manifests/developer-build-onbld.mf Thu Apr 22 10:13:38 2010 -0700
@@ -48,11 +48,16 @@
dir path=opt/onbld/lib
dir path=opt/onbld/lib/$(ARCH)
dir path=opt/onbld/lib/perl
-dir path=opt/onbld/lib/python
-dir path=opt/onbld/lib/python/onbld
-dir path=opt/onbld/lib/python/onbld/Checks
-dir path=opt/onbld/lib/python/onbld/Scm
-dir path=opt/onbld/lib/python/onbld/hgext
+dir path=opt/onbld/lib/python2.4
+dir path=opt/onbld/lib/python2.4/onbld
+dir path=opt/onbld/lib/python2.4/onbld/Checks
+dir path=opt/onbld/lib/python2.4/onbld/Scm
+dir path=opt/onbld/lib/python2.4/onbld/hgext
+dir path=opt/onbld/lib/python2.6
+dir path=opt/onbld/lib/python2.6/onbld
+dir path=opt/onbld/lib/python2.6/onbld/Checks
+dir path=opt/onbld/lib/python2.6/onbld/Scm
+dir path=opt/onbld/lib/python2.6/onbld/hgext
dir path=opt/onbld/man
dir path=opt/onbld/man/man1
dir path=opt/onbld/man/sman1
@@ -158,46 +163,84 @@
file path=opt/onbld/gk/gen_make.machines mode=0755
file path=opt/onbld/lib/$(ARCH)/libdwarf.so.1
file path=opt/onbld/lib/perl/onbld_elfmod.pm
-file path=opt/onbld/lib/python/onbld/Checks/CStyle.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/CStyle.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Cddl.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Cddl.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/CmtBlk.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/CmtBlk.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Comments.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Comments.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Copyright.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Copyright.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/DbLookups.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/DbLookups.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/HdrChk.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/HdrChk.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/JStyle.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/JStyle.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Keywords.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Keywords.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Mapfile.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Mapfile.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/ProcessCheck.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/ProcessCheck.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Rti.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/Rti.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/__init__.py mode=0444
-file path=opt/onbld/lib/python/onbld/Checks/__init__.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/Backup.py mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/Backup.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/Version.py mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/Version.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/WorkSpace.py mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/WorkSpace.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/__init__.py mode=0444
-file path=opt/onbld/lib/python/onbld/Scm/__init__.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/__init__.py mode=0444
-file path=opt/onbld/lib/python/onbld/__init__.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/hgext/__init__.py mode=0444
-file path=opt/onbld/lib/python/onbld/hgext/__init__.pyc mode=0444
-file path=opt/onbld/lib/python/onbld/hgext/cdm.py mode=0444
-file path=opt/onbld/lib/python/onbld/hgext/cdm.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/CStyle.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/CStyle.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Cddl.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Cddl.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/CmtBlk.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/CmtBlk.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Comments.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Comments.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Copyright.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Copyright.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/DbLookups.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/DbLookups.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/HdrChk.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/HdrChk.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/JStyle.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/JStyle.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Keywords.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Keywords.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Mapfile.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Mapfile.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/ProcessCheck.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/ProcessCheck.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Rti.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/Rti.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/__init__.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Checks/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/Backup.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/Backup.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/Version.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/Version.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/WorkSpace.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/WorkSpace.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/__init__.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/Scm/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/__init__.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/hgext/__init__.py mode=0444
+file path=opt/onbld/lib/python2.4/onbld/hgext/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.4/onbld/hgext/cdm.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/CStyle.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/CStyle.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Cddl.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Cddl.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/CmtBlk.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/CmtBlk.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Comments.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Comments.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Copyright.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Copyright.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/DbLookups.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/DbLookups.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/HdrChk.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/HdrChk.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/JStyle.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/JStyle.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Keywords.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Keywords.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Mapfile.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Mapfile.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/ProcessCheck.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/ProcessCheck.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Rti.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/Rti.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/__init__.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Checks/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/Backup.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/Backup.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/Version.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/Version.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/WorkSpace.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/WorkSpace.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/__init__.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/Scm/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/__init__.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/hgext/__init__.py mode=0444
+file path=opt/onbld/lib/python2.6/onbld/hgext/__init__.pyc mode=0444
+file path=opt/onbld/lib/python2.6/onbld/hgext/cdm.py mode=0444
file path=opt/onbld/man/man1/Install.1
file path=opt/onbld/man/man1/bldenv.1
file path=opt/onbld/man/man1/bringovercheck.1
@@ -246,3 +289,4 @@
license tools/ctf/dwarf/THIRDPARTYLICENSE \
license=tools/ctf/dwarf/THIRDPARTYLICENSE
license tools/onbld/THIRDPARTYLICENSE license=tools/onbld/THIRDPARTYLICENSE
+link path=opt/onbld/lib/python target=python2.4
--- a/usr/src/tools/Makefile Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/Makefile Thu Apr 22 10:13:38 2010 -0700
@@ -20,8 +20,7 @@
#
#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
#
include ../Makefile.master
@@ -93,11 +92,16 @@
$(ROOTONBLD)/lib \
$(ROOTONBLD)/lib/$(MACH) \
$(ROOTONBLD)/lib/perl \
- $(ROOTONBLD)/lib/python \
- $(ROOTONBLD)/lib/python/onbld \
- $(ROOTONBLD)/lib/python/onbld/Checks \
- $(ROOTONBLD)/lib/python/onbld/hgext \
- $(ROOTONBLD)/lib/python/onbld/Scm \
+ $(ROOTONBLD)/lib/python2.4 \
+ $(ROOTONBLD)/lib/python2.4/onbld \
+ $(ROOTONBLD)/lib/python2.4/onbld/Checks \
+ $(ROOTONBLD)/lib/python2.4/onbld/hgext \
+ $(ROOTONBLD)/lib/python2.4/onbld/Scm \
+ $(ROOTONBLD)/lib/python2.6 \
+ $(ROOTONBLD)/lib/python2.6/onbld \
+ $(ROOTONBLD)/lib/python2.6/onbld/Checks \
+ $(ROOTONBLD)/lib/python2.6/onbld/hgext \
+ $(ROOTONBLD)/lib/python2.6/onbld/Scm \
$(ROOTONBLD)/env \
$(ROOTONBLD)/etc \
$(ROOTONBLD)/etc/exception_lists \
@@ -138,10 +142,13 @@
$(SUBDIRS) $(CLOSED_SUBDIRS): $(BOOT_SUBDIRS)
-$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) FRC
+$(BOOT_SUBDIRS) $(SUBDIRS): $$(DOROOTDIRS) $(ROOTONBLDLIBPY) FRC
@cd $@; pwd; $(MAKE) $(TARGET)
$(ROOTDIRS):
$(INS.dir)
+$(ROOTONBLDLIBPY): $(ROOTDIRS)
+ $(RM) -r $@; $(SYMLINK) python2.4 $@
+
FRC:
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/usr/src/tools/Makefile.python Thu Apr 22 10:13:38 2010 -0700
@@ -0,0 +1,107 @@
+#
+# CDDL HEADER START
+#
+# The contents of this file are subject to the terms of the
+# Common Development and Distribution License (the "License").
+# You may not use this file except in compliance with the License.
+#
+# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+# or http://www.opensolaris.org/os/licensing.
+# See the License for the specific language governing permissions
+# and limitations under the License.
+#
+# When distributing Covered Code, include this CDDL HEADER in each
+# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+# If applicable, add the following below this CDDL HEADER, with the
+# fields enclosed by brackets "[]" replaced with your own identifying
+# information: Portions Copyright [yyyy] [name of copyright owner]
+#
+# CDDL HEADER END
+#
+
+#
+# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+#
+
+#
+# This Makefile provides a framework for building the onbld python
+# modules with multiple versions of python.
+#
+# It expects as input:
+#
+# PYSRCS - List of python source files, these are also delivered as
+# build product.
+#
+# PYOBJS - List of compiled python (.pyc) files, with no directory prefix
+#
+# PYTOPDIR - Absolute (including $(ROOT)) path to which files will
+# be installed, up until the version specific component.
+#
+# PYMODDIR - Relative path to which files will be installed, below
+# the version specific component.
+#
+# For example, to install to /opt/onbld/lib/onbld/python*/bar/
+#
+# PYTOPDIR = $(ROOTONBLDLIB)
+# PYMODDIR = bar
+#
+#
+# It provides as output:
+#
+# ROOTPYFILES - The list of $(ROOT)-relative paths to which python
+# source and binary files will be installed. Your
+# Makefile's 'install' target should depend upon
+# this.
+#
+# PYVERSOBJS - The list of paths to compiled python build products,
+# including their subdirectory.
+#
+# pyclobber - A target on which 'clobber' should depend, which
+# removes the per-version python directories and the
+# output within them.
+#
+
+PYFILES = $(PYSRCS) $(PYOBJS)
+
+ROOTPYDIR_24 = $(PYTOPDIR)/python2.4/$(PYMODDIR)
+ROOTPYFILES_24 = $(PYFILES:%=$(ROOTPYDIR_24)/%)
+
+ROOTPYDIR_26 = $(PYTOPDIR)/python2.6/$(PYMODDIR)
+ROOTPYFILES_26 = $(PYFILES:%=$(ROOTPYDIR_26)/%)
+
+ROOTPYFILES = $(ROOTPYFILES_24) $(ROOTPYFILES_26)
+$(ROOTPYFILES) := FILEMODE = 0444
+
+PYVERSDIRS = python2.4 python2.6
+
+PY24OBJS = $(PYOBJS:%=python2.4/%)
+$(PY24OBJS) := PYTHON = $(PYTHON_24)
+
+PY26OBJS = $(PYOBJS:%=python2.6/%)
+$(PY26OBJS) := PYTHON = $(PYTHON_26)
+
+PYVERSOBJS = $(PY24OBJS) $(PY26OBJS)
+
+CLOBBERFILES += $(PYVERSOBJS)
+CLOBBERDIRS += $(PYVERSDIRS)
+
+.KEEP_STATE:
+
+python2.4/%.pyc python2.6/%.pyc: %.py
+ @[ -d $(@D) ] || mkdir $(@D)
+ $(RM) $@
+ $(PYTHON) -mpy_compile $<
+ $(MV) $(*).pyc $@
+
+$(ROOTPYDIR_24)/%.pyc: python2.4/%.pyc
+ $(INS.pyfile)
+
+$(ROOTPYDIR_26)/%.pyc: python2.6/%.pyc
+ $(INS.pyfile)
+
+$(ROOTPYDIR_24)/%.py $(ROOTPYDIR_26)/%.py: %.py
+ $(INS.pyfile)
+
+pyclobber:
+ $(RM) $(CLOBBERFILES)
+ $(RM) -rf $(CLOBBERDIRS)
--- a/usr/src/tools/Makefile.tools Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/Makefile.tools Thu Apr 22 10:13:38 2010 -0700
@@ -19,8 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
#
# Definitions common to tool source.
#
@@ -28,8 +27,6 @@
FILEMODE= 0555
-CLOBBERFILES += $(PYOBJS)
-
TOOLS= $(SRC)/tools
TOOLS_PROTO= $(TOOLS)/proto/root_$(MACH)-nd
ROOTOPT= $(TOOLS_PROTO)/opt
@@ -41,6 +38,8 @@
ROOTONBLDLIBMACH= $(ROOTONBLD)/lib/$(MACH)
ROOTONBLDLIBPERL= $(ROOTONBLD)/lib/perl
ROOTONBLDLIBPY= $(ROOTONBLD)/lib/python
+ROOTONBLDLIBPY_24= $(ROOTONBLD)/lib/python2.4
+ROOTONBLDLIBPY_26= $(ROOTONBLD)/lib/python2.6
ROOTONBLDENV= $(ROOTONBLD)/env
ROOTONBLDGK= $(ROOTONBLD)/gk
ROOTONBLDMAN= $(ROOTONBLD)/man
--- a/usr/src/tools/README.tools Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/README.tools Thu Apr 22 10:13:38 2010 -0700
@@ -19,8 +19,7 @@
# CDDL HEADER END
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
This directory contains the tools used to do a full build of the
@@ -56,12 +55,19 @@
/opt/onbld/lib
libraries used by the build tools.
-/opt/onbld/lib/python
+/opt/onbld/lib/python<version>/
python modules used by the build tools.
-/opt/onbld/lib/python/onbld/hgext
+/opt/onbld/lib/python<version>/onbld/hgext
Mercurial extensions.
+/opt/onbld/lib/python/
+ symlink to the modules directory of the currently preferred
+ python version. This exists to retain compatibility both for
+ tools expecting only one supported version of python, and for
+ user .hgrc files that expect to find cdm.py in
+ /opt/onbld/lib/python/onbld/hgext.
+
/opt/onbld/man
rudimentary man pages for some of the tools.
--- a/usr/src/tools/onbld/Checks/Makefile Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/onbld/Checks/Makefile Thu Apr 22 10:13:38 2010 -0700
@@ -20,14 +20,13 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
include $(SRC)/Makefile.master
include ../../Makefile.tools
-PYSRCS= \
+PYSRCS = \
CStyle.py \
Cddl.py \
CmtBlk.py \
@@ -42,22 +41,16 @@
Rti.py \
__init__.py
-PYOBJS = $(PYSRCS:%.py=%.pyc)
-
-PYFILES= $(PYSRCS) $(PYOBJS)
+PYOBJS = $(PYSRCS:%.py=%.pyc)
+PYTOPDIR = $(ROOTONBLDLIB)
+PYMODDIR = onbld/Checks
-ROOTONBLDCHECKSFILES= $(PYFILES:%=$(ROOTONBLDLIBPY)/onbld/Checks/%)
-$(ROOTONBLDCHECKSFILES) := FILEMODE = 0444
+include ../../Makefile.python
-.KEEP_STATE:
+all: $(PYVERSOJBS)
-all: $(PYOBJS)
-
-install: $(ROOTONBLDCHECKSFILES)
+install: all $(ROOTPYFILES)
clean:
-$(ROOTONBLDLIBPY)/onbld/Checks/%: %
- $(INS.pyfile)
-
-include ../../Makefile.targ
+clobber: clean pyclobber
--- a/usr/src/tools/onbld/Makefile Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/onbld/Makefile Thu Apr 22 10:13:38 2010 -0700
@@ -20,8 +20,7 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
include $(SRC)/Makefile.master
@@ -32,41 +31,37 @@
hgext \
Scm
-PYSRCS= \
+PYSRCS = \
__init__.py
-PYOBJS= $(PYSRCS:%.py=%.pyc)
+PYOBJS = $(PYSRCS:%.py=%.pyc)
+PYTOPDIR = $(ROOTONBLDLIB)
+PYMODDIR = onbld
-PYFILES= $(PYSRCS) $(PYOBJS)
-
-all := TARGET = all
+all := TARGET = all
install := TARGET = install
-clean := TARGET = clean
+clean := TARGET = clean
clobber := TARGET = clobber
-ROOTONBLDBASEFILES= $(PYFILES:%=$(ROOTONBLDLIBPY)/onbld/%)
-$(ROOTONBLDBASEFILES) := FILEMODE = 0444
-
CLOBBERFILES += THIRDPARTYLICENSE
+include ../Makefile.python
+
.KEEP_STATE:
-all: $(PYOBJS) $(SUBDIRS) THIRDPARTYLICENSE
+all: $(PYVERSOBJS) $(SUBDIRS) THIRDPARTYLICENSE
+
+install: all $(ROOTPYFILES) $(SUBDIRS)
-install: all $(ROOTONBLDBASEFILES) $(SUBDIRS)
+clean: $(SUBDIRS)
-clean clobber: $(SUBDIRS)
+clobber: clean pyclobber $(SUBDIRS)
THIRDPARTYLICENSE: $(SRC)/pkg/license_files/lic_GPLv2
$(RM) $@
$(CAT) $? > $@
-$(ROOTONBLDLIBPY)/onbld/%: %
- $(INS.pyfile)
-
$(SUBDIRS): FRC
@cd $@; pwd; $(MAKE) $(TARGET)
FRC:
-
-include ../Makefile.targ
--- a/usr/src/tools/onbld/Scm/Makefile Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/onbld/Scm/Makefile Thu Apr 22 10:13:38 2010 -0700
@@ -20,36 +20,28 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
include $(SRC)/Makefile.master
include ../../Makefile.tools
-PYSRCS= \
+PYSRCS = \
__init__.py \
Backup.py \
Version.py \
WorkSpace.py
-PYOBJS = $(PYSRCS:%.py=%.pyc)
-
-PYFILES = $(PYSRCS) $(PYOBJS)
-
-ROOTONBLDSCMFILES= $(PYFILES:%=$(ROOTONBLDLIBPY)/onbld/Scm/%)
+PYOBJS = $(PYSRCS:%.py=%.pyc)
+PYTOPDIR = $(ROOTONBLDLIB)
+PYMODDIR = onbld/Scm
-$(ROOTONBLDSCMFILES) := FILEMODE = 0444
-
-.KEEP_STATE:
+include ../../Makefile.python
-all: $(PYOBJS)
+all: $(PYVERSOBJS)
-install: all .WAIT $(ROOTONBLDSCMFILES)
+install: all $(ROOTPYFILES)
clean:
-$(ROOTONBLDLIBPY)/onbld/Scm/%: %
- $(INS.pyfile)
-
-include ../../Makefile.targ
+clobber: clean pyclobber
--- a/usr/src/tools/onbld/hgext/Makefile Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/onbld/hgext/Makefile Thu Apr 22 10:13:38 2010 -0700
@@ -20,34 +20,39 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
include $(SRC)/Makefile.master
include ../../Makefile.tools
-PYSRCS= \
+PYSRCS = \
__init__.py \
cdm.py
-PYOBJS = $(PYSRCS:%.py=%.pyc)
-
-PYFILES = $(PYSRCS) $(PYOBJS)
-
-ROOTONBLDHGEXTFILES= $(PYFILES:%=$(ROOTONBLDLIBPY)/onbld/hgext/%)
+#
+# We deliver .pyc files specific to the python version, with the
+# exception of cdm.pyc, which we don't deliver at all.
+#
+# An exception to this is cdm.py, which is typically loaded using an
+# extension path in an .hgrc. This path might refer to a Python
+# version that's different from the one Mercurial is using. If we
+# delivered a cdm.pyc, differing Pythons running Mercurial could cause
+# it to be overwritten, causing packaging noise. Logic within cdm.py
+# causes modules loaded from there to be those built by the correct
+# version of Python.
+#
+PYSRC2 = $(PYSRCS:cdm.py=)
+PYOBJS = $(PYSRC2:%.py=%.pyc)
+PYTOPDIR = $(ROOTONBLDLIB)
+PYMODDIR = onbld/hgext
-$(ROOTONBLDHGEXTFILES) := FILEMODE = 0444
-
-.KEEP_STATE:
+include ../../Makefile.python
-all: $(PYOBJS)
+all: $(PYVERSOBJS)
-install: all .WAIT $(ROOTONBLDHGEXTFILES)
+install: all $(ROOTPYFILES)
clean:
-$(ROOTONBLDLIBPY)/onbld/hgext/%: %
- $(INS.pyfile)
-
-include ../../Makefile.targ
+clobber: clean pyclobber
--- a/usr/src/tools/onbld/hgext/cdm.py Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/onbld/hgext/cdm.py Thu Apr 22 10:13:38 2010 -0700
@@ -14,8 +14,7 @@
#
#
-# Copyright 2010 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
'''OpenSolaris workspace extensions for mercurial
@@ -31,15 +30,28 @@
Collapse all your changes into a single changeset - recommit'''
-#
-# NB: This assumes the normal directory structure, with this
-# extension 2 levels below .../lib/python.
-#
-# If you change that, change this
-#
import atexit, os, stat, sys, termios
-sys.path.insert(1, "%s/../../" % os.path.dirname(__file__))
+#
+# Adjust the load path based on the location of cdm.py and the version
+# of python into which it is being loaded. This assumes the normal
+# onbld directory structure, where cdm.py is in
+# lib/python(version)?/onbld/hgext/. If that changes so too must
+# this.
+#
+# This and the case below are not equivalent. In this case we may be
+# loading a cdm.py in python2.X/ via the lib/python/ symlink but need
+# python2.Y in sys.path.
+#
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "..", "..",
+ "python%d.%d" % sys.version_info[:2]))
+
+#
+# Add the relative path from cdm.py to usr/src/tools to the load path,
+# such that a cdm.py loaded from the source tree uses the modules also
+# within the source tree.
+#
+sys.path.insert(2, os.path.join(os.path.dirname(__file__), "..", ".."))
from onbld.Scm import Version
from mercurial import util
--- a/usr/src/tools/scripts/cddlchk.py Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/scripts/cddlchk.py Thu Apr 22 10:13:38 2010 -0700
@@ -21,8 +21,7 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
#
@@ -31,8 +30,11 @@
import sys, os, getopt, fnmatch
-sys.path.append(os.path.join(os.path.dirname(__file__), '../lib/python'))
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
+ "python%d.%d" % sys.version_info[:2]))
+
+# Allow running from the source tree, using the modules in the source tree
+sys.path.insert(2, os.path.join(os.path.dirname(__file__), '..'))
from onbld.Checks.Cddl import cddlchk
--- a/usr/src/tools/scripts/copyrightchk.py Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/scripts/copyrightchk.py Thu Apr 22 10:13:38 2010 -0700
@@ -21,8 +21,7 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
#
@@ -31,8 +30,11 @@
import sys, os
-sys.path.append(os.path.join(os.path.dirname(__file__), '../lib/python'))
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
+ "python%d.%d" % sys.version_info[:2]))
+
+# Allow running from the source tree, using the modules in the source tree
+sys.path.insert(2, os.path.join(os.path.dirname(__file__), '..'))
from onbld.Checks.Copyright import copyright
--- a/usr/src/tools/scripts/hdrchk.py Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/scripts/hdrchk.py Thu Apr 22 10:13:38 2010 -0700
@@ -21,8 +21,7 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
#
@@ -31,8 +30,11 @@
import sys, os, getopt
-sys.path.append(os.path.join(os.path.dirname(__file__), '../lib/python'))
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
+ "python%d.%d" % sys.version_info[:2]))
+
+# Allow running from the source tree, using the modules in the source tree
+sys.path.insert(2, os.path.join(os.path.dirname(__file__), '..'))
from onbld.Checks.HdrChk import hdrchk
--- a/usr/src/tools/scripts/hg-active.py Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/scripts/hg-active.py Thu Apr 22 10:13:38 2010 -0700
@@ -15,8 +15,7 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
'''
@@ -28,8 +27,12 @@
# NB: This assumes the normal onbld directory structure
#
import sys, os
-sys.path.insert(1, "%s/../lib/python" % os.path.dirname(__file__))
-sys.path.insert(1, "%s/.." % os.path.dirname(__file__))
+
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
+ "python%d.%d" % sys.version_info[:2]))
+
+# Allow running from the source tree, using the modules in the source tree
+sys.path.insert(2, os.path.join(os.path.dirname(__file__), ".."))
from onbld.Scm import Version
--- a/usr/src/tools/scripts/mapfilechk.py Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/scripts/mapfilechk.py Thu Apr 22 10:13:38 2010 -0700
@@ -21,8 +21,7 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
#
@@ -31,8 +30,11 @@
import sys, os, getopt, fnmatch
-sys.path.append(os.path.join(os.path.dirname(__file__), '../lib/python'))
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
+ "python%d.%d" % sys.version_info[:2]))
+
+# Allow running from the source tree, using the modules in the source tree
+sys.path.insert(2, os.path.join(os.path.dirname(__file__), '..'))
from onbld.Checks.Mapfile import mapfilechk
--- a/usr/src/tools/scripts/rtichk.py Thu Apr 22 13:45:43 2010 +0100
+++ b/usr/src/tools/scripts/rtichk.py Thu Apr 22 10:13:38 2010 -0700
@@ -21,8 +21,7 @@
#
#
-# Copyright 2009 Sun Microsystems, Inc. All rights reserved.
-# Use is subject to license terms.
+# Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
#
#
@@ -31,8 +30,11 @@
import sys, os, getopt
-sys.path.append(os.path.join(os.path.dirname(__file__), '../lib/python'))
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", "lib",
+ "python%d.%d" % sys.version_info[:2]))
+
+# Allow running from the source tree, using the modules in the source tree
+sys.path.insert(2, os.path.join(os.path.dirname(__file__), '..'))
from onbld.Checks.Rti import rti