Blob Blame History Raw
Name:       csmock
Version:    1.4.0
Release:    1%{?dist}
Summary:    A mock wrapper for Static Analysis tools

Group:      Development/Tools
License:    GPLv3+
URL:        https://git.fedorahosted.org/cgit/csmock.git
Source0:    https://git.fedorahosted.org/cgit/csmock.git/snapshot/csmock-%{version}.tar.xz

BuildRequires: help2man
BuildRequires: python-devel
%if !(0%{?fedora} >= 19 || 0%{?rhel} >= 7)
BuildRequires: python-argparse
%endif

Requires: csmock-common
Requires: csmock-plugin-clang
Requires: csmock-plugin-cppcheck

BuildArch: noarch

%description
This is a metapackage pulling in csmock-common and basic csmock plug-ins.

%package -n csmock-common
Summary: Core of csmock (a mock wrapper for Static Analysis tools)
Requires: csdiff
Requires: cswrap >= 1.0.4
Requires: mock
Requires: rpm-build

%description -n csmock-common
This package contains the csmock tool that allows to scan SRPMs by Static
Analysis tools in a fully automated way.

%package -n csmock-plugin-clang
Summary: csmock plug-in providing the support for Clang
Requires: csclng
Requires: csmock-common

%description -n csmock-plugin-clang
This package contains the clang plug-in for csmock.

%package -n csmock-plugin-cppcheck
Summary: csmock plug-in providing the support for Cppcheck
Requires: cscppc >= 1.0.4
Requires: csmock-common

%description -n csmock-plugin-cppcheck
This package contains the cppcheck plug-in for csmock.

%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%endif

%prep
%setup -q

%build
mkdir -p bin man

# embed VERSION and PLUGIN_DIR version into the scripts
install -p -m0755 cov-{diff,mock}build bin/
sed -e 's/rpm -qf .SELF/echo %{version}/' -i bin/cov-{diff,mock}build
sed -e 's/@VERSION@/%{name}-%{version}-%{release}/' \
    -e 's|@PLUGIN_DIR@|%{python2_sitelib}/csmock/plugins|' \
    -i py/csmock

help2man --no-info --section 1 --name \
    "DEPRECATED - please use csmock instead!" \
    bin/cov-mockbuild > man/cov-mockbuild.1

help2man --no-info --section 1 --name \
    "DEPRECATED - please use 'csmock --diff-patches' instead!" \
    bin/cov-diffbuild > man/cov-diffbuild.1

help2man --no-info --section 1 --name \
    "run static analysis of the given SRPM using mock" \
    py/csmock > man/csmock.1

%install
install -m0755 -d \
    "$RPM_BUILD_ROOT%{_bindir}" \
    "$RPM_BUILD_ROOT%{_mandir}/man1" \
    "$RPM_BUILD_ROOT%{_datadir}/csmock" \
    "$RPM_BUILD_ROOT%{_datadir}/csmock/scripts" \
    "$RPM_BUILD_ROOT%{python2_sitelib}/" \
    "$RPM_BUILD_ROOT%{python2_sitelib}/csmock" \
    "$RPM_BUILD_ROOT%{python2_sitelib}/csmock/plugins"

install -p -m0755 \
    cov-{diff,mock}build rpmbuild-rawbuild py/csmock \
    "$RPM_BUILD_ROOT%{_bindir}"

install -p -m0644 man/{csmock,cov-{diff,mock}build}.1 "$RPM_BUILD_ROOT%{_mandir}/man1/"

install -p -m0644 cov_checker_map.txt "$RPM_BUILD_ROOT%{_datadir}/csmock/cwe-map.csv"

install -p -m0644 py/plugins/*.py \
    "$RPM_BUILD_ROOT%{python2_sitelib}/csmock/plugins"

install -p -m0755 scripts/*.sh \
    "$RPM_BUILD_ROOT%{_datadir}/csmock/scripts"

# needed to create the csmock RPM
%files

%files -n csmock-common
%{_bindir}/cov-diffbuild
%{_bindir}/cov-mockbuild
%{_bindir}/csmock
%{_bindir}/rpmbuild-rawbuild
%{_mandir}/man1/cov-diffbuild.1*
%{_mandir}/man1/cov-mockbuild.1*
%{_mandir}/man1/csmock.1*
%{_datadir}/csmock/cwe-map.csv
%{_datadir}/csmock/scripts/patch-rawbuild.sh
%{python2_sitelib}/csmock/plugins/gcc.py*
%doc COPYING

%files -n csmock-plugin-clang
%{python2_sitelib}/csmock/plugins/clang.py*

%files -n csmock-plugin-cppcheck
%{python2_sitelib}/csmock/plugins/cppcheck.py*

%changelog
* Wed Sep 03 2014 Kamil Dudka <kdudka@redhat.com> 1.4.0-1
- update to latest upstream

* Wed Aug 20 2014 Kamil Dudka <kdudka@redhat.com> 1.3.2-1
- update to latest upstream

* Fri Aug 01 2014 Kamil Dudka <kdudka@redhat.com> 1.3.1-1
- update to latest upstream
- install plug-ins to %%{python2_sitelib} instead of %%{python_sitearch}

* Thu Jul 17 2014 Kamil Dudka <kdudka@redhat.com> 1.2.3-1
- update to latest upstream

* Fri Jul 04 2014 Kamil Dudka <kdudka@redhat.com> 1.2.2-1
- update to latest upstream

* Thu Jun 19 2014 Kamil Dudka <kdudka@redhat.com> 1.1.1-1
- update to latest upstream

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.7-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Apr 16 2014 Kamil Dudka <kdudka@redhat.com> 1.0.7-1
- update to latest upstream

* Tue Feb 25 2014 Kamil Dudka <kdudka@redhat.com> 1.0.3-2
- further spec file improvements per Fedora Review Request (#1066029)

* Mon Feb 24 2014 Kamil Dudka <kdudka@redhat.com> 1.0.3-1
- update to new upstream release
- abandon RHEL-5 compatibility per Fedora Review Request (#1066029)

* Wed Feb 19 2014 Kamil Dudka <kdudka@redhat.com> 1.0.2-1
- packaged for Fedora