Browse Source

Tox: add tox job and requirements to improve specfiles

This is a tox job to scan the RPM specfiles and do some
initial sanity checks and use the OpenDev Spec-Cleaner tool, this
is not a 'linter' per-se, but will output a diff of recommended
changes for the specfile.

Initial disable cleaning our default CentOS specfiles since we
know they need work, we can enable this later.

This uses the speclint script in starlingx/integ a proposed
by the Depends-On.

The recommended guildline for openSUSE is located here:
https://en.opensuse.org/openSUSE:Specfile_guidelines

Fix up fm-rest-api opensuse specfile

Depends-On: https://review.opendev.org/664995
Change-Id: I46da780a667569a9dccedd551d955c983e9601cd
Signed-off-by: Saul Wold <sgw@linux.intel.com>
changes/57/659157/11
Saul Wold 2 years ago
parent
commit
91af45019b
5 changed files with 38 additions and 4 deletions
  1. +11
    -0
      .zuul.yaml
  2. +2
    -0
      bindep.txt
  3. +3
    -3
      fm-rest-api/opensuse/fm-rest-api.spec
  4. +1
    -0
      test-requirements.txt
  5. +21
    -1
      tox.ini

+ 11
- 0
.zuul.yaml View File

@ -11,6 +11,8 @@
- openstack-tox-linters
- openstack-tox-pep8
- stx-fault-build
- flock-check-packaging:
voting: false
gate:
jobs:
- build-openstack-api-ref
@ -56,3 +58,12 @@
fault: https://opendev.org/starlingx/fault
integ: https://opendev.org/starlingx/integ
update: https://opendev.org/starlingx/update
- job:
name: flock-check-packaging
parent: tox
description: Sanity check RPM spec files
required-projects:
- name: starlingx/integ
vars:
tox_envlist: rpm-packaging-lint

+ 2
- 0
bindep.txt View File

@ -0,0 +1,2 @@
diffutils
rpm

+ 3
- 3
fm-rest-api/opensuse/fm-rest-api.spec View File

@ -6,16 +6,16 @@ License: Apache-2.0
Group: Development/Tools/Other
URL: https://opendev.org/starlingx/fault
Source0: %{name}-%{version}.tar.xz
BuildRequires: python2-oslo.config
BuildRequires: insserv-compat
BuildRequires: python-oslo.db
BuildRequires: python2-oslo.log
BuildRequires: python-oslo.messaging
BuildRequires: python-oslo.middleware
BuildRequires: python-setuptools
BuildRequires: python2-oslo.config
BuildRequires: python2-oslo.log
BuildRequires: python2-pip
BuildRequires: systemd
BuildRequires: systemd-rpm-macros
BuildRequires: insserv-compat
Requires: python-eventlet
Requires: python-paste
Requires: python-webob


+ 1
- 0
test-requirements.txt View File

@ -2,3 +2,4 @@ hacking!=0.13.0,<0.14,>=0.12.0
bashate >= 0.2
PyYAML >= 3.1.0
yamllint >= 0.5.2
spec_cleaner>=1.0.9

+ 21
- 1
tox.ini View File

@ -1,5 +1,5 @@
[tox]
envlist = linters,pep8
envlist = linters,pep8,rpm-packaging-lint
minversion = 2.3
skipsdist = True
@ -11,6 +11,26 @@ setenv = VIRTUAL_ENV={envdir}
OS_TEST_TIMEOUT=60
deps = -r{toxinidir}/test-requirements.txt
[testenv:rpm-packaging-lint]
basepython = python3
setenv =
VIRTUAL_ENV={envdir}
LC_ALL=en_US.utf-8
install_command = pip install -U \
-c{env:UPPER_CONSTRAINTS_FILE:https://opendev.org/openstack/requirements/raw/branch/stable/stein/upper-constraints.txt} \
{opts} {packages}
deps = -r{toxinidir}/test-requirements.txt
whitelist_externals = bash
commands =
bash -c 'if [ -d {toxinidir}/../integ ]; then integdir={toxinidir}/../integ; \
else integdir={toxinidir}/../stx-integ; \
fi; \
find . \
-not \( -type d -name .?\* -prune \) \
-not \( -type d -name centos -prune \) \
-type f -name \*.spec \
-print0 | xargs -0 $integdir/tools/spec-tools/speclint.sh'
[testenv:linters]
basepython = python3
whitelist_externals = bash


Loading…
Cancel
Save