6417313 *bringovercheck* needs better timestamp resolution
authorsommerfe
Fri, 28 Apr 2006 15:45:12 -0700
changeset 1905 5c7b771e6ed0
parent 1904 ee9cf333dd16
child 1906 a885e6f62cd6
6417313 *bringovercheck* needs better timestamp resolution 6418037 don't use sccscheck for tools build 6418599 absolute tools path for "sccscheck" breaks builds when you mix ws with nightly -t
usr/src/Makefile.noget
usr/src/tools/Makefile.tools
usr/src/tools/scripts/bringovercheck.sh
--- a/usr/src/Makefile.noget	Fri Apr 28 15:41:51 2006 -0700
+++ b/usr/src/Makefile.noget	Fri Apr 28 15:45:12 2006 -0700
@@ -29,9 +29,25 @@
 #
 # Makefile.noget: disable automated "sccs get" which causes us no end
 # of trouble in as many different ways as possible.
-#
-SCCSCHECK=$(ONBLD_TOOLS)/bin/sccscheck
-GET=$(ONBLD_TOOLS)/bin/sccscheck
+# 
+# Ordinarily, we'd say "$(ONBLD_TOOLS)/bin/sccscheck" here, but make
+# has special knowledge of SCCS and will refuse to run an SCCS rule if
+# the target is a writeable file, for fear that it will be destroying
+# your edits in progress.  But with .KEEP_STATE enabled, any change to
+# the command which would have been used to "build" the source file
+# forces the command to be re-run.  So if your effective ONBLD_TOOLS
+# changes (for instance, if you do a nightly -t to populate a
+# workspace, and then "ws" into it to check out a file and then do
+# some selective builds, make will notice the change in the full path
+# of the "sccscheck" command, will seek to re-run it, and abort the
+# build because the checked-out file is writeable.  So instead, by
+# default, we just use whichever sccscheck happens to be first in
+# $PATH and hope for the best.  Those who don't entirely trust this
+# are of course welcome to consistently set SCCSCHECK in their
+# environment to override this.
+# 
+SCCSCHECK=sccscheck
+GET=sccscheck
 
 # Deliberately sabotage other attempts to use "sccs get" from makefiles,
 # with flags known not to be accepted by "sccs get" or "get", 
--- a/usr/src/tools/Makefile.tools	Fri Apr 28 15:41:51 2006 -0700
+++ b/usr/src/tools/Makefile.tools	Fri Apr 28 15:45:12 2006 -0700
@@ -2,9 +2,8 @@
 # CDDL HEADER START
 #
 # The contents of this file are subject to the terms of the
-# Common Development and Distribution License, Version 1.0 only
-# (the "License").  You may not use this file except in compliance
-# with the License.
+# 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.
@@ -20,7 +19,7 @@
 # CDDL HEADER END
 #
 #
-# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+# Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
 # ident	"%Z%%M%	%I%	%E% SMI"
@@ -66,6 +65,9 @@
 ROOTONBLDMAN1FILES=	$(MAN1FILES:%=$(ROOTONBLDMAN1)/%)
 ROOTONBLDABIAUDITFILES=	$(ABI_AUDITFILES:%=$(ROOTONBLDETCABI)/%)
 
+# Break a chicken-and-egg dependency cycle for the tools build
+SCCSCHECK=@echo would sccscheck
+
 $(ROOTONBLDETCABI)/%: %
 	$(INS.file)
 
--- a/usr/src/tools/scripts/bringovercheck.sh	Fri Apr 28 15:41:51 2006 -0700
+++ b/usr/src/tools/scripts/bringovercheck.sh	Fri Apr 28 15:45:12 2006 -0700
@@ -35,6 +35,20 @@
 
 PATH=/usr/bin:/usr/ccs/bin
 
+# yield an exit status and no other output
+# /dev/null redirection guards against noise in the event that neither $1
+# nor $2 exist
+isnewer() {
+	[ "$1" -nt "$2" ] && return 0
+	[ "$1" -ot "$2" ] && return 1
+	left=$(/bin/ls -E "$1" 2>/dev/null | awk '{print $7}')
+	left=${left##*.}
+	right=$(/bin/ls -E "$2" 2>/dev/null | awk '{print $7}')
+	right=${right##*.}
+	[ -z "$left" -o -z "$right" -o "$left" -gt "$right" ] && return 0
+	return 1
+}
+
 if [ $# -ne 1 ]; then
 	echo "Usage: $0 workspace" 1>&2
 	exit 1
@@ -55,14 +69,15 @@
 fi
 
 cd ${CODEMGR_WS} &&
+tail +2 Codemgr_wsdata/nametable | 
 while read file etc; do
     	file="./$file"
 	sfile="${file%/*}/SCCS/s.${file##*/}"
-	if [ "$sfile" -nt "$file" ]; then
+	if isnewer "$sfile" "$file"; then
 	    	ls -E "$sfile"
 		ls -E "$file" 
 		echo "reget $file:"
 		# -G needed so file doesn't land in working dir.
 		sccs get -G "$file" "$file"
 	fi
-done < Codemgr_wsdata/nametable
+done