5 #
6 # CDDL HEADER START
7 #
8 # The contents of this file are subject to the terms of the
9 # Common Development and Distribution License (the "License").
10 # You may not use this file except in compliance with the License.
11 #
12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 # or http://www.opensolaris.org/os/licensing.
14 # See the License for the specific language governing permissions
15 # and limitations under the License.
16 #
17 # When distributing Covered Code, include this CDDL HEADER in each
18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 # If applicable, add the following below this CDDL HEADER, with the
20 # fields enclosed by brackets "[]" replaced with your own identifying
21 # information: Portions Copyright [yyyy] [name of copyright owner]
22 #
23 # CDDL HEADER END
24 #
25 #pragma ident "%Z%%M% %I% %E% SMI"
26
27
28 #
29 # Generate a revision number for the sgs linker components, based
30 # on usr/src/cmd/sgs/packages/common/SUNWonld-README.
31 #
32 # usage: readme_revision [-d] [readme-file]
33 #
34 # This revision number used to be the SCCS revision id for that file,
35 # in the form 1.xxx (where xxx was the revision). There were two benefits:
36 #
37 # (1) You could examine the sccs revision log to determine the CR
38 # of the putback that created the revision.
39 # (2) The revisions were monotonically increasing.
40 #
41 # In order to remove the hard wired dependence on sccs, this script generates
42 # a replacement revision number, by returning the string '1.xxx', where
43 # xxx is an integer giving the number of unique CR lines found in the file.
44 # This means that the revision goes up by one for each CR we fix, which
45 # makes intutive sense, and is similar to the way the SCCS revision worked.
46 #
47 # If this is a debug/development build (-d option), then we include
48 # additional information at the end of the revision:
49 #
50 # - Workspace name
111 $cnt = 1000;
112
113 while ($_ = <FILE>) {
114 chomp $_;
115
116 # If the line starts with a number, it is taken as a CR.
117 if ($_ =~ /^(\d+)\s/) {
118 $cnt++;
119 $last_cr = $1;
120 }
121 }
122 close FILE;
123
124 # If this is a standard build, the revision # is all we want
125 if ($debug == 0) {
126 print "1.$cnt\n";
127 exit 0;
128 }
129
130 # For debug mode, add diagnostic data
131 #
132 ($wsname = $ENV{'CODEMGR_WS'}) ne '' || ($wsname = 'unknown');
133 @wsname = split /\//, $wsname;
134 $wsname = $wsname[$#wsname];
135
136 $date = `date +%m/%d/%y`;
137
138 print "1.$cnt:$wsname-$ENV{USER}-$last_cr-$date\n";
139
140 exit 0;
|
5 #
6 # CDDL HEADER START
7 #
8 # The contents of this file are subject to the terms of the
9 # Common Development and Distribution License (the "License").
10 # You may not use this file except in compliance with the License.
11 #
12 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
13 # or http://www.opensolaris.org/os/licensing.
14 # See the License for the specific language governing permissions
15 # and limitations under the License.
16 #
17 # When distributing Covered Code, include this CDDL HEADER in each
18 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
19 # If applicable, add the following below this CDDL HEADER, with the
20 # fields enclosed by brackets "[]" replaced with your own identifying
21 # information: Portions Copyright [yyyy] [name of copyright owner]
22 #
23 # CDDL HEADER END
24 #
25 #
26 # Generate a revision number for the sgs linker components, based
27 # on usr/src/cmd/sgs/tools/SUNWonld-README.
28 #
29 # usage: readme_revision [-d] [readme-file]
30 #
31 # This revision number used to be the SCCS revision id for that file,
32 # in the form 1.xxx (where xxx was the revision). There were two benefits:
33 #
34 # (1) You could examine the sccs revision log to determine the CR
35 # of the putback that created the revision.
36 # (2) The revisions were monotonically increasing.
37 #
38 # In order to remove the hard wired dependence on sccs, this script generates
39 # a replacement revision number, by returning the string '1.xxx', where
40 # xxx is an integer giving the number of unique CR lines found in the file.
41 # This means that the revision goes up by one for each CR we fix, which
42 # makes intutive sense, and is similar to the way the SCCS revision worked.
43 #
44 # If this is a debug/development build (-d option), then we include
45 # additional information at the end of the revision:
46 #
47 # - Workspace name
108 $cnt = 1000;
109
110 while ($_ = <FILE>) {
111 chomp $_;
112
113 # If the line starts with a number, it is taken as a CR.
114 if ($_ =~ /^(\d+)\s/) {
115 $cnt++;
116 $last_cr = $1;
117 }
118 }
119 close FILE;
120
121 # If this is a standard build, the revision # is all we want
122 if ($debug == 0) {
123 print "1.$cnt\n";
124 exit 0;
125 }
126
127 # For debug mode, add diagnostic data
128 ($wsname = $ENV{'CODEMGR_WS'}) ne '' || ($wsname = 'unknown');
129 @wsname = split /\//, $wsname;
130 $wsname = $wsname[$#wsname];
131
132 $date = `date +%m/%d/%y`;
133
134 print "1.$cnt:$wsname-$ENV{USER}-$last_cr-$date\n";
135
136 exit 0;
|