Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Licenses and Intel Copyrights + add verification #230

Merged
merged 9 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .checkpatch.conf
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@
--ignore PREFER_DEFINED_ATTRIBUTE_MACRO
--ignore COMPLEX_MACRO
--ignore LONG_LINE_STRING
--ignore EMBEDDED_FILENAME
File renamed without changes.
5 changes: 0 additions & 5 deletions tests/install_ubuntu_packages.sh → .github/configure_apt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,3 @@ echo "Detected VERSION_CODENAME: $VERSION_CODENAME"
# Add ubuntu repository
sudo add-apt-repository "deb [arch=amd64] http://archive.ubuntu.com/ubuntu $VERSION_CODENAME \
main universe"
# Install gcc
sudo apt-get update && sudo apt-get install gcc-$1 g++-$1
# Install dependencies
sudo apt-get install pkg-config automake autoconf autoconf-archive make libsgutils2-dev \
libudev-dev libpci-dev check devscripts
9 changes: 9 additions & 0 deletions .github/install_debs_compilation.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/bash

# Install gcc
if [ -z "$1" ]; then
sudo apt-get update && sudo apt-get install gcc-$1 g++-$1
fi
# Install dependencies
sudo apt-get install pkg-config automake autoconf autoconf-archive make libsgutils2-dev \
libudev-dev libpci-dev check devscripts
105 changes: 27 additions & 78 deletions .github/workflows/review.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name: review
on: [pull_request]
env:
cflags: -Werror
cflags: -Werror
permissions: read-all
jobs:
checkpatch:
name: checkpatch review
commits_review:
name: Commits review
runs-on: ubuntu-latest
steps:
- name: 'Calculate PR commits + 1'
Expand All @@ -16,78 +16,27 @@ jobs:
fetch-depth: ${{ env.PR_FETCH_DEPTH }}
- name: Run checkpatch review
uses: webispy/checkpatch-action@v9
make:
name: Compilation test with gcc
strategy:
matrix:
gcc-version: [7, 8, 9, 10, 11, 12, 13]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repository and install dependencies'
run: tests/install_ubuntu_packages.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations with library disabled'
run: . ./autogen.sh && ./configure CFLAGS=${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
- name: "Clean before retest with library enabled"
run: make clean
- name: 'Generate compiling configurations with library enabled'
run: . tests/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
clangcompile:
name: Compilation test with clang
strategy:
matrix:
gcc-version: [12]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repository and install dependencies'
run: tests/install_ubuntu_packages.sh ${{ matrix.gcc-version }}
- name: 'Install clang'
run: sudo apt-get install clang
- name: 'Generate compiling configurations'
run: . tests/build_configure.sh ${{ env.cflags }} clang
- name: 'Make'
run: V=1 make -j$(nproc)
tests:
name: Run tests
strategy:
matrix:
gcc-version: [12]
python-version: ["3.7"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repository and install dependencies'
run: tests/install_ubuntu_packages.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations'
run: . tests/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run tests using pytest
run: |
# Run only non-hardware dependent tests
pytest --ledctl-binary=src/ledctl/ledctl
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Get modified files
id: changed-files
uses: tj-actions/changed-files@v44
with:
files_ignore: |
.checkpatch.conf
.github/**
.gitignore
*.md
autogen.sh
pytest.ini
*.yapf
COPYING*
- name: Run license review
env:
ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }}
run: |
for FILE in ${ALL_CHANGED_FILES}; do
python3.11 ./tests/licensing.py --file ${FILE} --log-level=INFO
done
84 changes: 84 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: test
on: [pull_request]
env:
cflags: -Werror
permissions: read-all
jobs:
make:
name: Compilation test with gcc
strategy:
matrix:
gcc-version: [7, 8, 9, 10, 11, 12, 13]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repositories'
run: .github/configure_apt.sh
- name: 'Install building dependencies'
run: .github/install_debs_compilation.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations with library disabled'
run: . ./autogen.sh && ./configure CFLAGS=${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
- name: "Clean before retest with library enabled"
run: make clean
- name: 'Generate compiling configurations with library enabled'
run: . .github/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: 'Hardening check: ledmon'
run: hardening-check src/ledmon/ledmon
- name: 'Hardening check: ledctl'
run: hardening-check src/ledctl/ledctl
- name: 'Check public symbol visibility'
run: tests/check_symbol_visibility.sh
clangcompile:
name: Compilation test with clang
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repositories'
run: .github/configure_apt.sh
- name: 'Install building dependencies'
run: .github/install_debs_compilation.sh
- name: 'Install clang'
run: sudo apt-get install clang
- name: 'Generate compiling configurations'
run: .github/build_configure.sh ${{ env.cflags }} clang
- name: 'Make'
run: V=1 make -j$(nproc)
tests:
name: Run tests
strategy:
matrix:
gcc-version: [12]
python-version: ["3.7"]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: 'Add ubuntu repositories'
run: .github/configure_apt.sh
- name: 'Install building dependencies'
run: .github/install_debs_compilation.sh ${{ matrix.gcc-version }}
- name: 'Generate compiling configurations'
run: .github/build_configure.sh ${{ env.cflags }}
- name: 'Make'
run: CC=gcc-${{ matrix.gcc-version }} CXX=g++-${{ matrix.gcc-version }} && V=1 make -j$(nproc)
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install pytest
- name: Run tests using pytest
run: |
# Run only non-hardware dependent tests
pytest --ledctl-binary=src/ledctl/ledctl
21 changes: 21 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Header and Copyrights

Verification of License and Copyrights is automated on Github by
[Licensing test](https://github.com/intel/ledmon/blob/main/tests/licensing.py).

The rules for Licenses and Copyrights:
- Preferred comment mark should be used for file type. Please prefer to test or other files for
examples. For `.c` and `.h` files, it is `//`.
- [SPDX Licenses](https://spdx.org/licenses/) must be used:
- It must be on first or in third line (only if interpreter is defined);
- Verification script contains set of allowed licenses for directories to avoid legal issues.
If you need to honour other license type, test must be extended.
- Immediately after SPDX header Copyright lines may come. There are multiple Copyrights lines
allowed.
- Only Intel copyright must follow strict style check.
- The block must be ended by empty line.

# Coding

Commits must pass kernel [Checkpatch](https://docs.kernel.org/dev-tools/checkpatch.html). There are
some excludes and it is automatically tested on Github.
18 changes: 2 additions & 16 deletions Makefile.am
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
#
# Intel(R) Enclosure LED Utilities
# Copyright (C) 2009-2024 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2009 Intel Corporation.

ACLOCAL_AMFLAGS = -I m4

Expand Down
21 changes: 2 additions & 19 deletions config/config.h
Original file line number Diff line number Diff line change
@@ -1,22 +1,5 @@
/*
* Intel(R) Enclosure LED Utilities
* Copyright (C) 2022-2023 Intel Corporation.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
// SPDX-License-Identifier: LGPL-2.1-or-later
// Copyright (C) 2022 Intel Corporation.
mtkaczyk marked this conversation as resolved.
Show resolved Hide resolved

#ifndef _CONFIG_H_INCLUDED_
#define _CONFIG_H_INCLUDED_
Expand Down
4 changes: 2 additions & 2 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later
mtkaczyk marked this conversation as resolved.
Show resolved Hide resolved

AC_PREREQ([2.69])

Expand All @@ -20,8 +21,7 @@ AM_PROG_AR
LT_INIT

# Checks for programs.

AX_CHECK_PROG([gcc])
AC_PROG_CC[gcc clang]
AX_CHECK_PROG([make])


Expand Down
21 changes: 4 additions & 17 deletions doc/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,20 +1,7 @@
#
# Intel(R) Enclosure LED Utilities
# Copyright (C) 2009-2023 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
#
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2009 Intel Corporation.

# Intel(R) Enclosure LED Utilities

CLEANFILES = ledmon.conf.gz ledmon.gz ledctl.gz
EXTRA_DIST = ledmon.conf.pod ledmon.pod ledctl.pod
Expand Down
22 changes: 5 additions & 17 deletions doc/ledctl.pod
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
#
# Intel(R) Enclosure LED Utilities
# Copyright (C) 2009-2024 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
#
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2009 Intel Corporation.

# Intel(R) Enclosure LED Utilities

=head1 NAME

ledctl - Intel(R) LED control application for a storage enclosures.
Expand Down
22 changes: 5 additions & 17 deletions doc/ledmon.conf.pod
Original file line number Diff line number Diff line change
@@ -1,20 +1,8 @@
#
# Intel(R) Enclosure LED Utilities
# Copyright (C) 2009-2024 Intel Corporation.
#
# This program is free software; you can redistribute it and/or modify it
# under the terms and conditions of the GNU General Public License,
# version 2, as published by the Free Software Foundation.
#
# This program is distributed in the hope it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
#
# SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 2009 Intel Corporation.

# Intel(R) Enclosure LED Utilities

=head1 NAME

ledmon.conf - Configuration file for Intel(R) Enclosure LED Utilities.
Expand Down
Loading