Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7178241

Basic script for JDK source code legal headers conformance verification

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: infrastructure
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b44
    • CPU:
      generic
    • OS:
      generic

      Description

      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.
      ###

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              mbykov Misha Bykov (Inactive)
              Reporter:
              mbykov Misha Bykov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: