6927451 X gate build scripts & Makefiles need adjustments for hg master gate
authorAlan Coopersmith <Alan.Coopersmith@Sun.COM>
Wed, 17 Feb 2010 14:57:13 -0800
changeset 906 4c633d8c519b
parent 905 d2b59d5a79ed
child 907 3c35d611cdaa
6927451 X gate build scripts & Makefiles need adjustments for hg master gate
.hgignore
buildit
make_release_packages
newPkRev
open-src/common/Makefile.inc
open-src/common/set-elf-comments.pl
open-src/util/mdb-tools/src/package/XSERVERdebug/Makefile
packages/pkgversion
--- a/.hgignore	Wed Feb 17 12:30:44 2010 -0800
+++ b/.hgignore	Wed Feb 17 14:57:13 2010 -0800
@@ -6,14 +6,19 @@
 /build_core/
 /build_iso8859-\d*/
 # Skip downloaded tarballs
-open-src/tarballs/.*\.tar
+open-src/tarballs
 # Skip proto area and packages
 proto-.*
-# Skip build logs
-log/buildit-XW
+# Skip build logs & reports from build cron jobs
+^log/
+^report/
 # Skip other files built during the build
 open-src/data/smf-rbac/x11-server.xml
 # Skip emacs/patch backup files
 .*\~$
 # Skip Solaris make state files
 /\.make\.state
+# Skip directories used by gate hooks
+^public/
+# Skip webrevs generated by hg webrev
+^webrev/
--- a/buildit	Wed Feb 17 12:30:44 2010 -0800
+++ b/buildit	Wed Feb 17 14:57:13 2010 -0800
@@ -41,9 +41,8 @@
 MAKE_PKGS=0
 
 set -- $(getopt p $*)
-if [ $? != 0 ]
-then
-    echo USAGE: $0 [-p]
+if [ $? != 0 ] ; then
+    print -u2 USAGE: $0 [-p]
     exit 2
 fi
 
@@ -54,10 +53,9 @@
 done
 
 # Add /usr/bin to front of path in case user has /usr/gnu/bin default
-# Add /usr/sbin to path for dtrace
-# Add /usr/X11/bin to path for makedepend
+# Add /usr/sbin to path for dtrace (to build probes in X servers)
 
-PATH=/usr/bin:${PATH}:/usr/sbin:/usr/X11/bin
+PATH=/usr/bin:${PATH}:/usr/sbin
 export PATH
 
 [ -d log ] || mkdir log
@@ -65,14 +63,18 @@
 # Send all further output & errors to the log file
 exec > log/buildit-XW 2>&1
 
-echo "------------------------------------------------------------------------------"
-echo "Start time: "
-date
+# Find hg id and export it so set-elf-comments.pl doesn't have to re-run
+# for every module built
+export XBUILD_HG_ID="$(hg id)"
+
 START="$(perl -e 'print time')"
-echo "Building on: "
-uname -a
-echo "Using these compilers: "
-which cc gcc
+
+print "------------------------------------------------------------------------------"
+print "Building gate at hg id: ${XBUILD_HG_ID}"
+print -n "Start time: " ; date
+print -n "Building on: " ; uname -a
+print "Using these compilers: "
+whence cc gcc
 # Make sure Sun C compiler is at least version 5.9 (Studio 12)
 cc -V 2>&1 | perl -n -e 'if (($_ =~ m| C (\d+).(\d+)|)) { \
     print $_ ; print "*** Compiler too old!\n" if ( ($1 != 5) || ($2 < 9) ) }'
@@ -82,12 +84,9 @@
 export SUNW_NO_UPDATE_NOTIFY='true'
 export UT_NO_USAGE_TRACKING='1'
 
-echo "Using these environment variables: "
+print "Using these environment variables: "
 env
-echo "------------------------------------------------------------------------------"
-
-XMAKE="$(pwd)/open-src/util/build-tools/xmake"
-chmod +x ${XMAKE}
+print "------------------------------------------------------------------------------"
 
 MACH="$(uname -p)"
 if [ "${MACH}" = "i386" ]; then
@@ -96,22 +95,21 @@
     /bin/rm -rf proto-sun4-svr4
 fi
 
-chmod +x open-src/common/install-sh open-src/common/delibtoolize.pl
+XMAKE="$(pwd)/open-src/util/build-tools/xmake"
+
 cd open-src
-# Run as two steps to avoid race between cleaning & rebuilding
+# Run as two steps to avoid race between cleaning & rebuilding when
+# using parallel make
 ${XMAKE} -v -k clean 
 ${XMAKE} -v -k install
 cd ..
 
-echo ""
-date
-echo "\nFinished building the X Window System Consolidation for OpenSolaris.\n"
-echo ""
-echo "Finish time: "
-date
-perl -e '$runtime=time-$ARGV[0]; printf("Runtime: %d:%02d\n", $runtime/3600, ($runtime%3600)/60); ' "${START}"
+print "\nFinished building the X Window System Consolidation for OpenSolaris.\n"
+print -n "Finish time: " ; date
+perl -e '$runtime = time - $ARGV[0];
+	 printf("Runtime: %d:%02d\n", $runtime/3600, ($runtime%3600)/60); ' \
+	"${START}"
 
 if [ "${MAKE_PKGS}" = 1 ] ; then
-    chmod +x make_release_packages
     ./make_release_packages
 fi
--- a/make_release_packages	Wed Feb 17 12:30:44 2010 -0800
+++ b/make_release_packages	Wed Feb 17 14:57:13 2010 -0800
@@ -179,23 +179,21 @@
 
 cd ${PKG_SOURCE_DIR}
 
-# Get build version from pkgversion
-if [[ -f pkgversion ]] ; then
-    source ./pkgversion
-else
-    fatal_error "${PKG_SOURCE_DIR}/pkgversion not found.  Cannot continue."
+# Hardcode base package version for now, append OS version from uname
+XVERSION="6.9.0"
+OSVERSION="$(uname -r)"
+VERSION="${XVERSION}.${OSVERSION}"
+
+# Get build version from hg by searching for most recent tag matching nv_*
+BUILD_TAG="$(hg log | \
+	     perl -l -n -e 'if ($_ =~ m/^tag:\s+nv_(\d+)/) {print $1 ; exit}')"
+
+if [[ -z "${BUILD_TAG}" ]] ; then
+    fatal_error "BUILD_TAG could not be found from hg_log"
 fi
 
-if [[ -z "${VERSION}" ]] ; then
-    fatal_error "VERSION not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
-fi
-
-if [[ -z "${BUILD}" ]] ; then
-    fatal_error "BUILD not set in ${PKG_SOURCE_DIR}/pkgversion - run newPkRev"
-fi
-
-DECIMAL_BUILD=$(( ${BUILD} / 100.0 ))
-print "Building packages for X11 version ${VERSION} build ${DECIMAL_BUILD}"
+print "Building packages for X11 version ${VERSION} build ${BUILD_TAG}"
+BUILD=$(( ${BUILD_TAG} * 100 ))
 
 if [[ "${MACH}" = "sparc" ]]; then
     PROTODIR=${SOURCE_DIR}/proto-sun4-svr4
--- a/newPkRev	Wed Feb 17 12:30:44 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-#!/bin/sh
-#
-###########################################################################
-#
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
-#
-# Permission is hereby granted, free of charge, to any person obtaining a
-# copy of this software and associated documentation files (the
-# "Software"), to deal in the Software without restriction, including
-# without limitation the rights to use, copy, modify, merge, publish,
-# distribute, and/or sell copies of the Software, and to permit persons
-# to whom the Software is furnished to do so, provided that the above
-# copyright notice(s) and this permission notice appear in all copies of
-# the Software and that both the above copyright notice(s) and this
-# permission notice appear in supporting documentation.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
-# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL
-# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING
-# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
-# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-#
-# Except as contained in this notice, the name of a copyright holder
-# shall not be used in advertising or otherwise to promote the sale, use
-# or other dealings in this Software without prior written authorization
-# of the copyright holder.
-#
-###########################################################################
-#
-# ident "@(#)newPkRev 1.20     06/10/03 SMI"
-#
-
-if [ x${1}x = "xx" ] ; then
-	echo need a build number
-	exit
-fi
-
-# X11 version number 
-XVERSION="6.9.0"
-OSVERSION=`uname -r | awk -F. '{printf "%s.%s",$1,$2}'`
-VERSION="${XVERSION}.${OSVERSION}"
-
-sccs edit pkgversion
-echo VERSION=\"$VERSION\" > pkgversion
-echo BUILD=\"$1\" >> pkgversion
-sccs delget -y"VERSION=${VERSION}.${1}" pkgversion
-
--- a/open-src/common/Makefile.inc	Wed Feb 17 12:30:44 2010 -0800
+++ b/open-src/common/Makefile.inc	Wed Feb 17 14:57:13 2010 -0800
@@ -1,6 +1,6 @@
 # -*- Makefile -*- rules commonly shared among X consolidation open source dirs
 #
-# Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
@@ -488,7 +488,7 @@
 ELF_COMMENTS += $(DEBUG_ELF_COMMENTS)
 
 set-elf-comments: $(BUILD_TARGETS:set-elf-comments=)
-	$(TOP)/common/set-elf-comments.pl -B $(TOP)/../packages/pkgversion \
+	$(TOP)/common/set-elf-comments.pl -B 'hg id' \
 	 -M '$(ELF_COMMENTS)' $(SOURCE_DIR)
 
 
--- a/open-src/common/set-elf-comments.pl	Wed Feb 17 12:30:44 2010 -0800
+++ b/open-src/common/set-elf-comments.pl	Wed Feb 17 14:57:13 2010 -0800
@@ -1,6 +1,6 @@
 #! /usr/perl5/bin/perl
 #
-# Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2010 Sun Microsystems, Inc.  All rights reserved.
 #
 # Permission is hereby granted, free of charge, to any person obtaining a
 # copy of this software and associated documentation files (the
@@ -33,7 +33,12 @@
 #
 # Set version information in ELF files to give hints to help in troubleshooting
 #
-# Usage: set-elf-comments.pl -B <path/to/pkgversion> -M "module version" <path>
+# Usage: set-elf-comments.pl -B <pkgversion> -M "module version" <path>
+#  <pkgversion> may either be a path to a file containing BUILD="<version>"
+#   or the string "hg id" to get the version from the hg id output.
+#
+# If the XBUILD_HG_ID environment variable is set, it is used for the hg id
+# instead of forking a hg id process for every component in a full tree build
 #
 
 use strict;
@@ -56,18 +61,36 @@
 
 if (exists($opts{'B'})) {
   my $build_version_file = $opts{'B'};
-  open my $VERS, '<', $build_version_file
+
+  if ($build_version_file eq 'hg id') {
+    if (exists $ENV{'XBUILD_HG_ID'}) {
+      $build_info = $ENV{'XBUILD_HG_ID'};
+    } else {
+      open my $VERS, '-|', $build_version_file
+	or die "Can't run $build_version_file: $!\n";
+
+      while ($_ = <$VERS>) {
+	chomp($_);
+	if ($_ =~ m/\S+/) {
+	  $build_info = "hg: $_ - " . $build_info;
+	}
+      }
+      close $VERS;
+    }
+  } else {
+    open my $VERS, '<', $build_version_file
       or die "Can't open $build_version_file for reading: $!\n";
 
-  while ($_ = <$VERS>) {
-    if ($_ =~ m/^BUILD="(.*)"/) {
-      my $v = $1 / 100.0;
-      if ($v >= 1.0) {
-	$build_info = "build $v - " . $build_info;
+    while ($_ = <$VERS>) {
+      if ($_ =~ m/^BUILD="(.*)"/) {
+	my $v = $1 / 100.0;
+	if ($v >= 1.0) {
+	  $build_info = "build $v - " . $build_info;
+	}
       }
     }
+    close $VERS;
   }
-  close $VERS;
 }
 
 $module_version_info .= " ($build_info)";
--- a/open-src/util/mdb-tools/src/package/XSERVERdebug/Makefile	Wed Feb 17 12:30:44 2010 -0800
+++ b/open-src/util/mdb-tools/src/package/XSERVERdebug/Makefile	Wed Feb 17 14:57:13 2010 -0800
@@ -47,12 +47,13 @@
 
 install: all pkg
 
-PKGVERS=$(PKGDEFS)/pkgversion
-MACH:sh=uname -p
+MACH=$(TARGET_ARCH:-%=%)
 DATE:sh=date +0.%Y.%m.%d
-VERSIONCOMM=sed -n 's/VERSION=//p' $(PKGVERS)
-VERSION=$(VERSIONCOMM:sh)
-BUILDCOMM=sed -n 's/BUILD=//p' $(PKGVERS)
+OSVER:sh=uname -r
+VERSIONCOMM= sed -n 's/XORGSERVER_VERS=//p' $(TOP)/xserver/Makefile.inc 
+VERSION=$(VERSIONCOMM:sh).$(OSVER)
+BUILDCOMM=hg log | \
+	   perl -l -n -e 'if (m/^tag:\s+nv_(\d+)/) {print $$1 ; exit}'
 BUILD=$(BUILDCOMM:sh)
 
 PKGMK_VARS=plat=$(MACH) Xserver=$(Xserver)
--- a/packages/pkgversion	Wed Feb 17 12:30:44 2010 -0800
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,2 +0,0 @@
-VERSION="6.9.0.5.11"
-BUILD="0000"