author | Ali Bahrami <Ali.Bahrami@Sun.COM> |
Tue, 10 Feb 2009 09:38:02 -0700 | |
changeset 8744 | 03d5725cda56 |
parent 7078 | 935563142864 |
permissions | -rw-r--r-- |
7078 | 1 |
#! /usr/bin/python |
2 |
||
3 |
CDDL = ''' |
|
4 |
CDDL HEADER START |
|
5 |
||
6 |
The contents of this file are subject to the terms of the |
|
7 |
Common Development and Distribution License (the "License"). |
|
8 |
You may not use this file except in compliance with the License. |
|
9 |
||
10 |
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
|
11 |
or http://www.opensolaris.org/os/licensing. |
|
12 |
See the License for the specific language governing permissions |
|
13 |
and limitations under the License. |
|
14 |
||
15 |
When distributing Covered Code, include this CDDL HEADER in each |
|
16 |
file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
|
17 |
If applicable, add the following below this CDDL HEADER, with the |
|
18 |
fields enclosed by brackets "[]" replaced with your own identifying |
|
19 |
information: Portions Copyright [yyyy] [name of copyright owner] |
|
20 |
||
21 |
CDDL HEADER END |
|
22 |
''' |
|
23 |
||
24 |
# |
|
8744
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
25 |
# Copyright 2009 Sun Microsystems, Inc. All rights reserved. |
7078 | 26 |
# Use is subject to license terms. |
27 |
# |
|
28 |
||
29 |
# |
|
8744
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
30 |
# Check that source files contain a valid CDDL block |
7078 | 31 |
# |
32 |
||
8744
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
33 |
import sys, CmtBlk |
7078 | 34 |
|
8744
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
35 |
# scmtest has a test for cddlchk that depends on the variable |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
36 |
# Cddl.CmntChrs. However, that variable has been refactored into |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
37 |
# CmtBlk. The following line preserves the original interface |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
38 |
# from the Cddl module, and allows existing programs that assume |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
39 |
# Cddl.CmntChrs exists to continue working. |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
40 |
# |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
41 |
CmntChrs = CmtBlk.CmntChrs |
7078 | 42 |
|
8744
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
43 |
# The CDDL string above contains the block guards so that the text will |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
44 |
# be tested by cddlchk. However, we don't want to include the initial |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
45 |
# \n or the block guards in the text passed in. |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
46 |
# |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
47 |
CDDL = CDDL.splitlines()[3:-2] |
7078 | 48 |
|
49 |
def cddlchk(fh, filename=None, lenient=False, verbose=False, output=sys.stderr): |
|
8744
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
50 |
return CmtBlk.cmtblkchk(fh, 'CDDL', CDDL, filename=filename, |
03d5725cda56
6798660 Cadmium .NOT file processing problem with CWD relative file paths
Ali Bahrami <Ali.Bahrami@Sun.COM>
parents:
7078
diff
changeset
|
51 |
lenient=lenient, verbose=verbose, output=output) |