2nd try: please, review the script for JDK license headers verification
Misha Bykov
misha.bykov at oracle.com
Mon Jun 4 23:53:58 UTC 2012
Please, review the webrev is located at:
http://cr.openjdk.java.net/~mbykov/lic_check/webrev.00/
INTRO
It's recommended for a developer, when he introduced or modified source
code files, to check whether a license header is precisely correct for
every modified file.
The new script allows a JDK developer to check if the specified license
header for a given file (or a set of files) matches the right header
template.
NAME
lic_check.sh - JDK source code legal headers conformance verification
SYNOPSIS
lic_check.sh [-gpl] or [-gplcp] or [-bsd] file(s)
DESCRIPTION
The script for OpenJDK distribution to verify legal notices in a
particular source file or a set of files.
The script must be located in the directory:
$ROOT/make/scripts
It uses templates from:
$ROOT/make/templates
The successful output example:
###
### Checking copyright notice in the file: filename.java
###
No differences encountered
SUCCESS: The license header for filename.java has been verified.
The unsuccessful output example if Oracle copyright string is missing or
copyright years are not correct :
###
### Checking copyright notice in the file: filename.java
###
ERROR: Copyright string is not correct or missing in filename.java.
If the copyright string is correct, but the license header is not
correct, the script should produce the
"diff" output between a template in $ROOT/make/templates and the license
header from the given file.
HOW TO TEST
1. Place the script into $ROOT/make/scripts in JDK8 source repository
(otherwise it will not find $ROOT/make/templates and produce an error).
2. cd to the directory with the files to check license headers
3. $ROOT/make/scripts/lic_check.sh [-gpl] or [-gplcp] or [-bsd] filename(s)
SUCCESS EXAMPLE
% ./lic_check.sh -gpl update_copyright_year.sh
### Checking copyright notice in the file: update_copyright_year.sh
###
No differences encountered
SUCCESS: The license header for
jdk8/make/scripts/update_copyright_year.sh has been verified.
###
FAILURE EXAMPLE
% ./lic_check.sh -gpl hgforest.sh
### Checking copyright notice in the file: hgforest.sh
###
*** /tmp/source_file.9122 Mon Jun 4 17:44:11 2012
--- jdk8/make/scripts/./../templates/gpl-header Wed Apr 11 08:53:09 2012
***************
*** 1,7 ****
Copyright (c) %YEARS% Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
! This code is free software; you can redistribute it and/or modify itX
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
--- 1,7 ----
Copyright (c) %YEARS% Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
! This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.
ERROR: License header is not correct in
/java/jle_build/headers/jdk8/make/scripts/hgforest.sh
See diffs above.
###
NEXT STEPS
In the future, this script will be used by special scripts to allow
headers verification in the whole OpenJDK source code base.
More information about the build-dev
mailing list