Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Check license and modify incorrect license

jingjingpiggy/copyright

Repository files navigation

#
#  Copyright (C) 2016 Intel Corporation
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

The check copyright scripts can deal with the file format as: .h, .c,
.cc, .cpp, .java, .json, .txt, .py, .am, .sh, .mk, Makefile, .xml,
README.

The scripts will get Intel info from HEAD patch, then scan and check
copyright in files based on the author/committer email and time from
the info; update copyright in files if necessary.

Script Briefing
===============
    * run_check_update_copyright.sh: provides help and collect correct
      args to check_update_copyright.py

    * check_update_copyright.py: parses info from HEAD patch of git
      tree, gets email and time as checking value if author or
      committers are from Intel. Then scan files based on the checking
      value, OR update the files by passing corresponding <cmd> to
      update.sh

    * update.sh: does the update action.
        1). No copyright section in file: add copyright section and
            insert intel copyright;
        2). No intel copyright in copyright section: insert intel
            copyright;
        3). Time of intel copyright is outdated: update time.

    * copyright_*_tempate: three templates('*', '#', '<!-- -->') are
      for files which donot contain copyright sections.

Install dependency packages
===========================
In Ubuntu 14.04 distro:
    sudo apt-get install git-buildpackage
    sudo apt-get install librpm3

Note: As far as I know, the package git-buildpackage only maintained
      in Ubuntu source, so this script doesn't work in other popular
      rpm installed distros(as Opensuse, Fedora, Centos and Redhat).

Using Guide
===========
Example:

    In the tools/copyright/ directory:
    ::

        ./run_check_update_copyright.sh -h

        Usage: -s/--scan [-f/--fix] dir_path
            dir_path:  absolute or relative path of directory to check
            -s|--scan  scan copyright in files
            -f|--fix   fix the copyright in files

    ::

        ./run_check_update_copyright.sh -s ../test/

        Path: /home/*/tools/test
        ../test/c.cpp
        ../test/a.py
        ../test/b.sh
        ../test/Makefile
        ../test/new/a.cpp

    ::

        ./run_check_update_copyright.sh -f ../test/

        Path: /home/*/tools/test
        Update ../test/c.cpp done.
        Update ../test/a.py done.
        Update ../test/b.sh done.
        Update ../test/Makefile done.
        Update ../test/new/a.cpp done.

    ::

        ./run_check_update_copyright.sh -s ../test/

        Path: /home/*/tools/test
        No copyright in files need to be updated.

About

Check license and modify incorrect license

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published