From 7a9ba73da3e5cdc8b13b39f081e2a7108e2f3d89 Mon Sep 17 00:00:00 2001 From: Dan Radez Date: Wed, 19 Apr 2017 13:52:23 -0400 Subject: [PATCH] Adding rpmlint to the build - updating syntax to meet rpmlint standards Change-Id: I056b7600df0f4383b97c67e705bc0b749b4c1633 Signed-off-by: Dan Radez --- build/Makefile | 28 +++++++++----- build/rpm_specs/networking-vpp.spec | 6 +-- build/rpm_specs/opnfv-apex-common.spec | 4 +- build/rpm_specs/opnfv-apex-onos.spec | 4 +- build/rpm_specs/opnfv-apex-release.spec | 4 +- build/rpm_specs/opnfv-apex-undercloud.spec | 4 +- build/rpm_specs/opnfv-apex.spec | 6 ++- build/rpm_specs/quagga.spec | 62 ++++++++++++++---------------- ci/test.sh | 3 +- 9 files changed, 67 insertions(+), 54 deletions(-) diff --git a/build/Makefile b/build/Makefile index 51cb3e47..2e1da051 100644 --- a/build/Makefile +++ b/build/Makefile @@ -68,7 +68,7 @@ $(BUILD_DIR)/opnfv-apex-release.tar.gz: .PHONY: release-rpm-check release-rpm-check: $(BUILD_DIR)/opnfv-apex-release.tar.gz - rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-release.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-release.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" .PHONY: release-rpm release-rpm: $(BUILD_DIR)/opnfv-apex-release.tar.gz $(RPMREL) @@ -76,14 +76,14 @@ release-rpm: $(BUILD_DIR)/opnfv-apex-release.tar.gz $(RPMREL) $(RPMREL): @echo "Building the Apex Release RPM" # build the release RPM - rpmbuild --clean -ba rpm_specs/opnfv-apex-release.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -ba rpm_specs/opnfv-apex-release.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" $(BUILD_DIR)/opnfv-apex-common.tar.gz: pushd ../ && git archive --format=tar.gz --prefix=opnfv-apex-common-$(RPMVERS)/ HEAD > $(BUILD_DIR)/opnfv-apex-common.tar.gz .PHONY: common-rpm-check common-rpm-check: $(BUILD_DIR)/opnfv-apex-common.tar.gz - rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-common.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-common.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" .PHONY: common-rpm common-rpm: $(BUILD_DIR)/opnfv-apex-common.tar.gz $(RPMCOM) @@ -91,7 +91,7 @@ common-rpm: $(BUILD_DIR)/opnfv-apex-common.tar.gz $(RPMCOM) $(RPMCOM): @echo "Building the Apex Common RPM" # build the common RPM - rpmbuild --clean -ba rpm_specs/opnfv-apex-common.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -ba rpm_specs/opnfv-apex-common.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" ################## # PYTHON TESTS # @@ -125,6 +125,14 @@ python-pep8-check: yamllint: @echo "Running yamllint against all .yaml files" cd ../ && yamllint $(shell cd ../ && git ls-tree -r HEAD --name-only | grep 'yaml$$') +############# +# RPMLINT # +############# + +.PHONY: rpmlint +rpmlint: + @echo "Running rpmlint against all RPM spec files" + rpmlint rpm_specs/*.spec ################## # NETWORKING-VPP # @@ -162,14 +170,14 @@ $(BUILD_DIR)/opnfv-apex-undercloud.tar.gz: $(BUILD_DIR)/undercloud.qcow2 .PHONY: undercloud-rpm-check undercloud-rpm-check: $(BUILD_DIR)/opnfv-apex-undercloud.tar.gz - rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-undercloud.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-undercloud.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" .PHONY: undercloud-rpm undercloud-rpm: $(BUILD_DIR)/opnfv-apex-undercloud.tar.gz $(RPMUDR) $(RPMUDR): @echo "Building the Apex Undercloud RPM" - rpmbuild --clean -ba rpm_specs/opnfv-apex-undercloud.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -ba rpm_specs/opnfv-apex-undercloud.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" ############### # OVERCLOUD # @@ -198,7 +206,7 @@ $(BUILD_DIR)/opnfv-apex.tar.gz: $(BUILD_DIR)/overcloud-full-opendaylight.qcow2 .PHONY: opendaylight-rpm-check opendaylight-rpm-check: $(BUILD_DIR)/opnfv-apex.tar.gz - rpmbuild --clean -bi -bl rpm_specs/opnfv-apex.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -bi -bl rpm_specs/opnfv-apex.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" .PHONY: opendaylight-rpm opendaylight-rpm: $(BUILD_DIR)/opnfv-apex.tar.gz $(RPMODL) @@ -206,7 +214,7 @@ opendaylight-rpm: $(BUILD_DIR)/opnfv-apex.tar.gz $(RPMODL) $(RPMODL): @echo "Building the Apex OpenDaylight RPM" # build the overcloud RPM - rpmbuild --clean -ba rpm_specs/opnfv-apex.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -ba rpm_specs/opnfv-apex.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" ############### # ONOS # @@ -224,7 +232,7 @@ $(BUILD_DIR)/opnfv-apex-onos.tar.gz: $(BUILD_DIR)/overcloud-full-onos.qcow2 .PHONY: onos-rpm-check onos-rpm-check: $(BUILD_DIR)/opnfv-apex-onos.tar.gz - rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-onos.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -bi -bl rpm_specs/opnfv-apex-onos.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" .PHONY: onos-rpm onos-rpm: $(BUILD_DIR)/opnfv-apex-onos.tar.gz $(RPMONO) @@ -232,7 +240,7 @@ onos-rpm: $(BUILD_DIR)/opnfv-apex-onos.tar.gz $(RPMONO) $(RPMONO): @echo "Building the Apex ONOS RPM" # build the overcloud RPM - rpmbuild --clean -ba rpm_specs/opnfv-apex-onos.spec $(RPM_DIR_ARGS) -D "release $(shell echo $(RELEASE) | tr -d '_-')" + rpmbuild --clean -ba rpm_specs/opnfv-apex-onos.spec $(RPM_DIR_ARGS) -D "_release $(shell echo $(RELEASE) | tr -d '_-')" ############### # ISO # diff --git a/build/rpm_specs/networking-vpp.spec b/build/rpm_specs/networking-vpp.spec index 97668c8c..4211f94a 100644 --- a/build/rpm_specs/networking-vpp.spec +++ b/build/rpm_specs/networking-vpp.spec @@ -39,12 +39,12 @@ EOF %install python setup.py install -O1 --root=%{buildroot} --record=INSTALLED_FILES -mkdir -p %{buildroot}/usr/lib/systemd/system -install %{_builddir}/neutron-vpp-agent.service %{buildroot}/usr/lib/systemd/system +mkdir -p %{buildroot}%{_libdir}/systemd/system +install %{_builddir}/neutron-vpp-agent.service %{buildroot}%{_unitdir} %clean rm -rf %{buildroot} %files -f INSTALLED_FILES %defattr(-,root,root) -%attr(644,root,root) /usr/lib/systemd/system/neutron-vpp-agent.service +%attr(644,root,root) %{_unitdir}/neutron-vpp-agent.service diff --git a/build/rpm_specs/opnfv-apex-common.spec b/build/rpm_specs/opnfv-apex-common.spec index 39c822b6..97a44779 100644 --- a/build/rpm_specs/opnfv-apex-common.spec +++ b/build/rpm_specs/opnfv-apex-common.spec @@ -1,6 +1,6 @@ Name: opnfv-apex-common Version: 5.0 -Release: %{release} +Release: %{_release} Summary: Scripts for OPNFV deployment using RDO Manager Group: System Environment @@ -169,7 +169,7 @@ install config/inventory/pod_example_settings.yaml %{buildroot}%{_docdir}/opnfv/ - rename all odl_l3 scenario files to odl * Thu Mar 23 2017 Tim Rozet - 4.0-8 - Adds os-odl_l3-ovs-ha and noha scenarios -* Mon Mar 12 2017 Feng Pan - 4.0-7 +* Sun Mar 12 2017 Feng Pan - 4.0-7 - Add os-nosdn-fdio-ha.yaml * Fri Mar 10 2017 Feng Pan - 4.0-6 - Add os-odl_l3-fdio-noha.yaml and os-odl_l3-fdio-ha.yaml diff --git a/build/rpm_specs/opnfv-apex-onos.spec b/build/rpm_specs/opnfv-apex-onos.spec index af18ccc2..9a0ba571 100644 --- a/build/rpm_specs/opnfv-apex-onos.spec +++ b/build/rpm_specs/opnfv-apex-onos.spec @@ -1,6 +1,6 @@ Name: opnfv-apex-onos Version: 5.0 -Release: %{release} +Release: %{_release} Summary: Overcloud Disk images for OPNFV Apex ONOS deployment Group: System Environment @@ -19,6 +19,8 @@ https://wiki.opnfv.org/apex %prep %setup -q +%build + %install mkdir -p %{buildroot}%{_var}/opt/opnfv/images/ install build/overcloud-full-onos.qcow2 %{buildroot}%{_var}/opt/opnfv/images/ diff --git a/build/rpm_specs/opnfv-apex-release.spec b/build/rpm_specs/opnfv-apex-release.spec index 5f84a4fc..27040cf3 100644 --- a/build/rpm_specs/opnfv-apex-release.spec +++ b/build/rpm_specs/opnfv-apex-release.spec @@ -1,6 +1,6 @@ Name: opnfv-apex-release Version: euphrates -Release: %{release} +Release: %{_release} Summary: RPM Release file Group: System Environment @@ -17,6 +17,8 @@ RPM Release file that provides a yum repo file to install OPNFV Apex %prep %setup -q +%build + %install mkdir -p %{buildroot}%{_sysconfdir}/yum.repos.d/ install config/yum.repos.d/opnfv-apex.repo %{buildroot}%{_sysconfdir}/yum.repos.d/ diff --git a/build/rpm_specs/opnfv-apex-undercloud.spec b/build/rpm_specs/opnfv-apex-undercloud.spec index 93fc6e0d..339fff69 100644 --- a/build/rpm_specs/opnfv-apex-undercloud.spec +++ b/build/rpm_specs/opnfv-apex-undercloud.spec @@ -1,6 +1,6 @@ Name: opnfv-apex-undercloud Version: 5.0 -Release: %{release} +Release: %{_release} Summary: Scripts and Disk images to launch the Undercloud for OPNFV Apex Group: System Environment @@ -19,6 +19,8 @@ https://wiki.opnfv.org/apex %prep %setup -q +%build + %install mkdir -p %{buildroot}%{_var}/opt/opnfv/images/ mkdir -p %{buildroot}%{_var}/opt/opnfv/nics/ diff --git a/build/rpm_specs/opnfv-apex.spec b/build/rpm_specs/opnfv-apex.spec index 450044c0..04ae5058 100644 --- a/build/rpm_specs/opnfv-apex.spec +++ b/build/rpm_specs/opnfv-apex.spec @@ -1,6 +1,6 @@ Name: opnfv-apex Version: 5.0 -Release: %{release} +Release: %{_release} Summary: Overcloud Disk images for OPNFV Apex OpenDaylight deployment Group: System Environment @@ -8,7 +8,7 @@ License: Apache 2.0 URL: https://gerrit.opnfv.org/gerrit/apex.git Source0: opnfv-apex.tar.gz -Provides: opnfv-apex-sdn +Provides: opnfv-apex-sdn BuildArch: noarch Requires: opnfv-apex-common opnfv-apex-undercloud @@ -19,6 +19,8 @@ https://wiki.opnfv.org/apex %prep %setup -q +%build + %install mkdir -p %{buildroot}%{_var}/opt/opnfv/images/ install build/overcloud-full-opendaylight.qcow2 %{buildroot}%{_var}/opt/opnfv/images/ diff --git a/build/rpm_specs/quagga.spec b/build/rpm_specs/quagga.spec index c129e0a2..9a85e9df 100644 --- a/build/rpm_specs/quagga.spec +++ b/build/rpm_specs/quagga.spec @@ -15,7 +15,7 @@ %{!?with_tcp_zebra: %global with_tcp_zebra 0 } %{!?with_vtysh: %global with_vtysh 1 } %{!?with_pam: %global with_pam 1 } -%{!?with_ospfclient: %global with_ospfclient 1 } +%{!?with_ospfclient: %global with_ospfclient 1 } %{!?with_ospfapi: %global with_ospfapi 1 } %{!?with_irdp: %global with_irdp 1 } %{!?with_rtadv: %global with_rtadv 1 } @@ -25,8 +25,8 @@ %{!?with_multipath: %global with_multipath 64 } %{!?quagga_user: %global quagga_user quagga } %{!?vty_group: %global vty_group quaggavt } -%{!?with_fpm: %global with_fpm 0 } -%{!?with_watchquagga: %global with_watchquagga 1 } +%{!?with_fpm: %global with_fpm 0 } +%{!?with_watchquagga: %global with_watchquagga 1 } # path defines %define _sysconfdir /etc/quagga @@ -40,8 +40,8 @@ #### Version String tweak # Remove invalid characters form version string and replace with _ -%{expand: %%define rpmversion %(echo '1.1.0-dev' | tr [:blank:]- _ )} -%define quaggaversion 1.1.0-dev +%{expand: %%global rpmversion %(echo '1.1.0-dev' | tr [:blank:]- _ )} +%define quaggaversion 1.1.0-dev #### Check version of texi2html # Old versions don't support "--number-footnotes" option. @@ -67,9 +67,9 @@ %endif # misc internal defines -%{!?quagga_uid: %define quagga_uid 92 } -%{!?quagga_gid: %define quagga_gid 92 } -%{!?vty_gid: %define vty_gid 85 } +%{!?quagga_uid: %global quagga_uid 92 } +%{!?quagga_gid: %global quagga_gid 92 } +%{!?vty_gid: %global vty_gid 85 } %define daemon_list zebra ripd ospfd bgpd @@ -82,13 +82,13 @@ %endif %if %{with_pimd} -%define daemon_pimd pimd +%define daemon_pimd pimd %else %define daemon_pimd "" %endif %if %{with_watchquagga} -%define daemon_watchquagga watchquagga +%define daemon_watchquagga watchquagga %else %define daemon_watchquagga "" %endif @@ -99,7 +99,7 @@ %{!?keep_build: %global keep_build 0 } #release sub-revision (the two digits after the CONFDATE) -%{!?release_rev: %define release_rev 01 } +%{!?release_rev: %global release_rev 01 } Summary: Routing daemon Name: quagga @@ -170,12 +170,12 @@ The quagga-devel package contains the header and object files neccessary for developing OSPF-API and quagga applications. %prep -%setup -q -n quagga-%{quaggaversion} +%setup -q -n quagga-%{quaggaversion} %build # For standard gcc verbosity, uncomment these lines: -#CFLAGS="%{optflags} -Wall -Wsign-compare -Wpointer-arith" +#CFLAGS="% {optflags} -Wall -Wsign-compare -Wpointer-arith" #CFLAGS="${CFLAGS} -Wbad-function-cast -Wwrite-strings" # For ultra gcc verbosity, uncomment these lines also: @@ -251,22 +251,18 @@ developing OSPF-API and quagga applications. --disable-watchquagga \ %endif --enable-gcc-rdynamic \ - --with-ccapnproto \ - --with-zeromq + --with-ccapnproto \ + --with-zeromq make %{?_smp_mflags} MAKEINFO="makeinfo --no-split" pushd doc -%if %{texi2htmlversion} < 5 -texi2html --number-sections quagga.texi -%else texi2html --number-footnotes --number-sections quagga.texi -%endif popd %install mkdir -p %{buildroot}/etc/{quagga,sysconfig,logrotate.d,pam.d} \ - %{buildroot}/var/log/quagga %{buildroot}%{_infodir} + %{buildroot}/var/log/quagga %{buildroot}%{_infodir} make DESTDIR=%{buildroot} INSTALL="install -p" CP="cp -p" install install %{SOURCE1} %{buildroot}/etc/quagga/bgpd.conf @@ -314,7 +310,7 @@ if getent group %quagga_user >/dev/null; then : ; else \ /usr/sbin/groupadd -g %quagga_gid %quagga_user > /dev/null || : ; \ fi if getent passwd %quagga_user >/dev/null ; then : ; else \ - /usr/sbin/useradd -u %quagga_uid -g %quagga_gid \ + /usr/sbin/useradd -u %{quagga_uid} -g %quagga_gid \ -M -r -s /sbin/nologin -c "Quagga routing suite" \ -d %_localstatedir %quagga_user 2> /dev/null || : ; \ fi @@ -333,21 +329,21 @@ zebra_spec_add_service () fi } -zebra_spec_add_service zebrasrv 2600/tcp "zebra service" -zebra_spec_add_service zebra 2601/tcp "zebra vty" -zebra_spec_add_service ripd 2602/tcp "RIPd vty" -zebra_spec_add_service ripngd 2603/tcp "RIPngd vty" -zebra_spec_add_service ospfd 2604/tcp "OSPFd vty" -zebra_spec_add_service bgpd 2605/tcp "BGPd vty" -zebra_spec_add_service ospf6d 2606/tcp "OSPF6d vty" +zebra_spec_add_service zebrasrv 2600/tcp "zebra service" +zebra_spec_add_service zebra 2601/tcp "zebra vty" +zebra_spec_add_service ripd 2602/tcp "RIPd vty" +zebra_spec_add_service ripngd 2603/tcp "RIPngd vty" +zebra_spec_add_service ospfd 2604/tcp "OSPFd vty" +zebra_spec_add_service bgpd 2605/tcp "BGPd vty" +zebra_spec_add_service ospf6d 2606/tcp "OSPF6d vty" %if %{with_ospfapi} -zebra_spec_add_service ospfapi 2607/tcp "OSPF-API" +zebra_spec_add_service ospfapi 2607/tcp "OSPF-API" %endif %if %{with_isisd} -zebra_spec_add_service isisd 2608/tcp "ISISd vty" +zebra_spec_add_service isisd 2608/tcp "ISISd vty" %endif %if %{with_pimd} -zebra_spec_add_service pimd 2611/tcp "PIMd vty" +zebra_spec_add_service pimd 2611/tcp "PIMd vty" %endif %if "%{initsystem}" == "systemd" @@ -479,7 +475,7 @@ fi ## if [ "$1" = "0" ]; then for daemon in %all_daemons ; do - /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 + /etc/rc.d/init.d/${daemon} stop >/dev/null 2>&1 /sbin/chkconfig --del ${daemon} done fi @@ -579,7 +575,7 @@ rm -rf %{buildroot} %endif %changelog -* Thu Feb 11 2016 Paul Jakma - %{version} +* Thu Feb 11 2016 Paul Jakma - remove with_ipv6 conditionals, always build v6 - Fix UTF-8 char in spec changelog - remove quagga.pam.stack, long deprecated. diff --git a/ci/test.sh b/ci/test.sh index c1e99344..72de24e8 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -11,7 +11,7 @@ set -e # Make sure python dependencies are installed -for pkg in yamllint iproute epel-release python34-devel python34-nose python34-PyYAML python-pep8 python34-mock python34-pip; do +for pkg in yamllint rpmlint iproute epel-release python34-devel python34-nose python34-PyYAML python-pep8 python34-mock python34-pip; do if ! rpm -q ${pkg} > /dev/null; then if ! sudo yum install -y ${pkg}; then echo "Failed to install ${pkg} package..." @@ -24,6 +24,7 @@ done if ! python3 -c "import coverage" &> /dev/null; then sudo pip3.4 coverage; fi pushd ../build/ > /dev/null +make rpmlint make python-pep8-check make yamllint make python-tests -- 2.16.6