Blame SPECS/i2c-tools.spec

b67a0f
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
b67a0f
# Copyright (c) 2007 Hans de Goede <j.w.r.degoede@hhs>, the Fedora project.
b67a0f
#
b67a0f
# This file and all modifications and additions to the pristine
b67a0f
# package are under the same license as the package itself.
b67a0f
b67a0f
%if 0%{?rhel} > 7 || 0%{?fedora} > 28
b67a0f
%bcond_with python2
b67a0f
%else
b67a0f
%bcond_without python2
b67a0f
%endif
b67a0f
b67a0f
Name:           i2c-tools
b67a0f
Version:        4.0
b67a0f
Release:        12%{?dist}
b67a0f
Summary:        A heterogeneous set of I2C tools for Linux
b67a0f
License:        GPLv2+
b67a0f
URL:            https://i2c.wiki.kernel.org/index.php/I2C_Tools
b67a0f
Source0:        https://www.kernel.org/pub/software/utils/i2c-tools/%{name}-%{version}.tar.xz
b67a0f
# Upstream patch
b67a0f
Patch0:         0001-i2c-tools-i2cbusses-Avoid-buffer-overflows-in-sysfs-.patch
b67a0f
# Upstream patch
b67a0f
Patch1:         0002-tools-i2cbusses-Check-the-return-value-of-snprintf.patch
b67a0f
# Upstream patch
b67a0f
Patch2:         0003-py-smbus-Fix-FSF-address-in-smbusmodule.c.patch
b67a0f
# Upstream patch fixing license headers of libi2c
b67a0f
Patch3:         0001-libi2c-Mention-the-correct-license-in-source-files.patch
b67a0f
b67a0f
# for /etc/udev/makedev.d resp /usr/lib/modprobe.d ownership
b67a0f
Requires:       udev module-init-tools
b67a0f
Requires:       libi2c%{?_isa} = %{version}-%{release}
b67a0f
BuildRequires:  perl-generators
b67a0f
%if %{with python2}
b67a0f
BuildRequires:  python2-devel
b67a0f
%endif
b67a0f
BuildRequires:  python3-devel
b67a0f
BuildRequires:  gcc
b67a0f
ExcludeArch:    s390 s390x
b67a0f
b67a0f
%description
b67a0f
This package contains a heterogeneous set of I2C tools for Linux: a bus
b67a0f
probing tool, a chip dumper, register-level access helpers, EEPROM
b67a0f
decoding scripts, and more.
b67a0f
b67a0f
b67a0f
%package eepromer
b67a0f
Summary:        Programs for reading / writing i2c / smbus eeproms
b67a0f
Requires:       libi2c%{?_isa} = %{version}-%{release}
b67a0f
# For the device nodes
b67a0f
Requires:       %{name} = %{version}-%{release}
b67a0f
# /usr/sbin/eeprom is Public Domain, the rest is GPLv2+
b67a0f
License:        GPLv2+ and Public Domain
b67a0f
b67a0f
%description eepromer
b67a0f
Programs for reading / writing i2c / smbus eeproms. Notice that writing the
b67a0f
eeproms in your system is very dangerous and is likely to render your system
b67a0f
unusable. Do not install, let alone use this, unless you really, _really_ know
b67a0f
what you are doing.
b67a0f
b67a0f
%if %{with python2}
b67a0f
%package -n python2-i2c-tools
b67a0f
%{?python_provide:%python_provide python2-i2c-tools}
b67a0f
Requires:       libi2c%{?_isa} = %{version}-%{release}
b67a0f
# Remove before F30
b67a0f
Provides: %{name}-python = %{version}-%{release}
b67a0f
Provides: %{name}-python%{?_isa} = %{version}-%{release}
b67a0f
Obsoletes: %{name}-python < 4.0-4
b67a0f
Summary:        Python 2 bindings for Linux SMBus access through i2c-dev
b67a0f
License:        GPLv2
b67a0f
b67a0f
%description -n python2-i2c-tools
b67a0f
Python 2 bindings for Linux SMBus access through i2c-dev
b67a0f
%endif
b67a0f
b67a0f
%package -n python3-i2c-tools
b67a0f
%{?python_provide:%python_provide python3-i2c-tools}
b67a0f
Requires:       libi2c%{?_isa} = %{version}-%{release}
b67a0f
%if %{without python2}
b67a0f
# Remove before F30
b67a0f
Obsoletes: %{name}-python < 4.0-4
b67a0f
# Remove before F31
b67a0f
Obsoletes: python2-i2c-tools < 4.0-5
b67a0f
%endif
b67a0f
Summary:        Python 3 bindings for Linux SMBus access through i2c-dev
b67a0f
License:        GPLv2
b67a0f
b67a0f
%description -n python3-i2c-tools
b67a0f
Python 3 bindings for Linux SMBus access through i2c-dev
b67a0f
b67a0f
%package perl
b67a0f
Summary:        i2c tools written in Perl
b67a0f
License:        GPLv2+
b67a0f
Requires:       libi2c%{?_isa} = %{version}-%{release}
b67a0f
b67a0f
%description perl
b67a0f
A collection of tools written in perl for use with i2c devices.
b67a0f
b67a0f
%package -n libi2c
b67a0f
Summary:        I2C/SMBus bus access library
b67a0f
License:        LGPLv2+
b67a0f
b67a0f
%description -n libi2c
b67a0f
libi2c offers a way for applications to interact with the devices
b67a0f
connected to the I2C or SMBus buses of the system.
b67a0f
b67a0f
%package -n libi2c-devel
b67a0f
Summary:        Development files for the I2C library
b67a0f
License:        LGPLv2+
b67a0f
Requires:       libi2c%{?_isa} = %{version}-%{release}
b67a0f
# Remove in F30
b67a0f
Obsoletes:      i2c-tools-devel < 4.0-1
b67a0f
b67a0f
%description -n libi2c-devel
b67a0f
%{summary}.
b67a0f
b67a0f
%prep
b67a0f
%setup -q
b67a0f
%patch0 -p1
b67a0f
%patch1 -p1
b67a0f
%patch2 -p1
b67a0f
%patch3 -p1
b67a0f
b67a0f
%build
b67a0f
make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" BUILD_STATIC_LIB=0 EXTRA=eeprog
b67a0f
pushd eepromer
b67a0f
make CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS"
b67a0f
popd
b67a0f
pushd py-smbus
b67a0f
%if %{with python2}
b67a0f
CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS" \
b67a0f
  %{__python2} setup.py build -b build-py2
b67a0f
%endif
b67a0f
CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS" \
b67a0f
  %{__python3} setup.py build -b build-py3
b67a0f
popd
b67a0f
b67a0f
b67a0f
%install
b67a0f
make install DESTDIR=$RPM_BUILD_ROOT prefix=%{_prefix} BUILD_STATIC_LIB=0 \
b67a0f
  EXTRA=eeprog libdir=%{_libdir}
b67a0f
install -m 755 eepromer/{eepromer,eeprom} \
b67a0f
  $RPM_BUILD_ROOT%{_sbindir}
b67a0f
install -m 644 eepromer/{eepromer,eeprom}.8 \
b67a0f
  $RPM_BUILD_ROOT%{_mandir}/man8
b67a0f
pushd py-smbus
b67a0f
%if %{with python2}
b67a0f
%{__python2} setup.py build -b build-py2 install --skip-build --root=$RPM_BUILD_ROOT
b67a0f
%endif
b67a0f
%{__python3} setup.py build -b build-py3 install --skip-build --root=$RPM_BUILD_ROOT
b67a0f
popd
b67a0f
# cleanup
b67a0f
rm -f $RPM_BUILD_ROOT%{_bindir}/decode-edid.pl
b67a0f
# Remove unpleasant DDC tools.  KMS already exposes the EDID block in sysfs,
b67a0f
# and edid-decode is a more complete tool than decode-edid.
b67a0f
rm -f $RPM_BUILD_ROOT%{_bindir}/{ddcmon,decode-edid}
b67a0f
# for i2c-dev ondemand loading through kmod
b67a0f
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d
b67a0f
echo "alias char-major-89-* i2c-dev" > \
b67a0f
  $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d/i2c-dev.conf
b67a0f
# for /dev/i2c-# creation (which are needed for kmod i2c-dev autoloading)
b67a0f
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d
b67a0f
for (( i = 0 ; i < 8 ; i++ )) do
b67a0f
  echo "i2c-$i" >> $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d/99-i2c-dev.nodes
b67a0f
done
b67a0f
b67a0f
# auto-load i2c-dev after reboot
b67a0f
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modules-load.d
b67a0f
echo 'i2c-dev' > $RPM_BUILD_ROOT%{_prefix}/lib/modules-load.d/%{name}.conf
b67a0f
b67a0f
b67a0f
%post
b67a0f
# load i2c-dev after the first install
b67a0f
if [ "$1" = 1 ] ; then
b67a0f
  /usr/sbin/modprobe i2c-dev
b67a0f
fi
b67a0f
exit 0
b67a0f
b67a0f
%ldconfig_post -n libi2c
b67a0f
%ldconfig_postun -n libi2c
b67a0f
b67a0f
b67a0f
%files
b67a0f
%doc CHANGES COPYING README
b67a0f
%config(noreplace) %{_prefix}/lib/modprobe.d/i2c-dev.conf
b67a0f
%config(noreplace) %{_sysconfdir}/udev/makedev.d/99-i2c-dev.nodes
b67a0f
%{_sbindir}/*
b67a0f
%exclude %{_sbindir}/eepro*
b67a0f
%exclude %{_sbindir}/i2c-stub*
b67a0f
%{_mandir}/man8/*.8.gz
b67a0f
%exclude %{_mandir}/man8/eepro*
b67a0f
%exclude %{_mandir}/man8/i2c-stub-from-dump.8.gz
b67a0f
%{_prefix}/lib/modules-load.d/%{name}.conf
b67a0f
b67a0f
%files eepromer
b67a0f
%doc eepromer/README*
b67a0f
%doc eeprog/README.eeprog
b67a0f
%{_sbindir}/eepro*
b67a0f
%{_mandir}/man8/eepro*.8.gz
b67a0f
b67a0f
%if %{with python2}
b67a0f
%files -n python2-i2c-tools
b67a0f
%doc py-smbus/README
b67a0f
%{python2_sitearch}/*
b67a0f
%endif
b67a0f
b67a0f
%files -n python3-i2c-tools
b67a0f
%doc py-smbus/README
b67a0f
%{python3_sitearch}/*
b67a0f
b67a0f
%files perl
b67a0f
%doc eeprom/README
b67a0f
%{_bindir}/decode-*
b67a0f
%{_sbindir}/i2c-stub*
b67a0f
%{_mandir}/man1/decode-*.1.gz
b67a0f
%{_mandir}/man8/i2c-stub-from-dump.8.gz
b67a0f
b67a0f
%files -n libi2c
b67a0f
%doc COPYING.LGPL
b67a0f
%{_libdir}/libi2c.so.*
b67a0f
b67a0f
%files -n libi2c-devel
b67a0f
%dir %{_includedir}/i2c
b67a0f
%{_includedir}/i2c/smbus.h
b67a0f
%{_libdir}/libi2c.so
b67a0f
b67a0f
b67a0f
%changelog
b67a0f
* Wed Dec 05 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-12
b67a0f
- Use versioned dependency on libi2c in subpackages
b67a0f
- Resolves: rhbz#1650317
b67a0f
b67a0f
* Thu Nov 15 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-11
b67a0f
- Ship modprobe.d files in /usr/lib/modprobe.d
b67a0f
- Resolves: rhbz#1649735
b67a0f
b67a0f
* Fri Aug 03 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-10
b67a0f
- Add upstream patch fixing libi2c license headers
b67a0f
b67a0f
* Tue Jul 31 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-9
b67a0f
- Corrected the License tags
b67a0f
b67a0f
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-8
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
b67a0f
b67a0f
* Fri Jun 29 2018 Adam Jackson <ajax@redhat.com> - 4.0-7
b67a0f
- Use ldconfig scriptlets
b67a0f
b67a0f
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 4.0-6
b67a0f
- Rebuilt for Python 3.7
b67a0f
b67a0f
* Thu Mar 22 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-5
b67a0f
- Don't build Python 2 subpackage on EL > 7 and Fedora > 28
b67a0f
b67a0f
* Mon Feb 19 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-4
b67a0f
- Add gcc to BuildRequires
b67a0f
b67a0f
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-3
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
b67a0f
b67a0f
* Thu Feb  1 2018 Florian Weimer <fweimer@redhat.com> - 4.0-2
b67a0f
- Build with linker flags from redhat-rpm-config
b67a0f
b67a0f
* Tue Nov 21 2017 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-1
b67a0f
- New version
b67a0f
- Dropped i2c-tools-devel, introduced libi2c, libi2c-devel
b67a0f
b67a0f
* Sat Oct 7 2017 Troy Curtis, Jr <troycurtisjr@gmail.com> - 3.1.2-7
b67a0f
- Add Python3 subpackage.
b67a0f
b67a0f
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.1.2-6
b67a0f
- Add Provides for the old name without %%_isa
b67a0f
b67a0f
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.1.2-5
b67a0f
- Python 2 binary package renamed to python2-i2c-tools
b67a0f
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
b67a0f
b67a0f
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.2-4
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
b67a0f
b67a0f
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.2-3
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
b67a0f
b67a0f
* Thu Jul 20 2017 Ondřej Lysoněk <olysonek@redhat.com> - 3.1.2-2
b67a0f
- Provide i2c-dev.h in /usr/include/i2c-tools/
b67a0f
- Resolves: rhbz#1288823
b67a0f
- Dropped Group: tags as per https://fedoraproject.org/wiki/Packaging:Guidelines#Tags_and_Sections
b67a0f
b67a0f
* Wed Jul 19 2017 Ondřej Lysoněk <olysonek@redhat.com> - 3.1.2-1
b67a0f
- New version
b67a0f
- Updated upstream and source code URL
b67a0f
- Dropped patches accepted by upstream
b67a0f
b67a0f
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-18
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
b67a0f
b67a0f
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-17
b67a0f
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
b67a0f
b67a0f
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-16
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
b67a0f
b67a0f
* Thu Oct 08 2015 Jaromir Capik <jcapik@redhat.com> - 3.1.0-15
b67a0f
- Adding i2c-dev auto-load in th %%post and modules-load.d (#913203)
b67a0f
b67a0f
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-14
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
b67a0f
b67a0f
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-13
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
b67a0f
b67a0f
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-12
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
b67a0f
b67a0f
* Wed Oct 9  2013 Peter Robinson <pbrobinson@fedoraproject.org> 3.1.0-11
b67a0f
- Split out perl tools to a separate subpackage
b67a0f
b67a0f
* Fri Oct 04 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-10
b67a0f
- Making the decode-* man pages installable with Makefile
b67a0f
b67a0f
* Thu Oct 03 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-9
b67a0f
- Introducing man pages for decode-* binaries
b67a0f
- Cleaning the spec
b67a0f
b67a0f
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-8
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
b67a0f
b67a0f
* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 3.1.0-7
b67a0f
- Perl 5.18 rebuild
b67a0f
b67a0f
* Wed Jul 03 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-6
b67a0f
- Installing the man pages and putting them in the files section
b67a0f
b67a0f
* Wed Jul 03 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-5
b67a0f
- Introducing man pages for binaries in the eepromer subpackage
b67a0f
- Introducing -r switch in the i2cset help
b67a0f
b67a0f
* Sat Jun  1 2013 Henrik Nordstrom <henrik@henriknordstrom.net> - 3.1.0-4
b67a0f
- Package python interface
b67a0f
b67a0f
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-3
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
b67a0f
b67a0f
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-2
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
b67a0f
b67a0f
* Mon Feb 20 2012 Adam Jackson <ajax@redhat.com> 3.1.0-1
b67a0f
- i2c-tools 3.1.0
b67a0f
b67a0f
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.3-2
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
b67a0f
b67a0f
* Tue Jul 05 2011 Adam Jackson <ajax@redhat.com> 3.0.3-1
b67a0f
- i2c-tools 3.0.3
b67a0f
b67a0f
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.2-5
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
b67a0f
b67a0f
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.2-4
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
b67a0f
b67a0f
* Mon Apr 13 2009 Adam Jackson <ajax@redhat.com> 3.0.2-3
b67a0f
- mv /etc/modprobe.d/i2c-dev /etc/modprobe.d/i2c-dev.conf (#495455)
b67a0f
b67a0f
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.2-2
b67a0f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
b67a0f
b67a0f
* Thu Dec 11 2008 Adam Jackson <ajax@redhat.com> 3.0.2-1
b67a0f
- i2c-tools 3.0.2
b67a0f
b67a0f
* Wed Mar  5 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-3
b67a0f
- Change /dev/i2c-# creation from /lib/udev/devices to /etc/udev/makedev.d
b67a0f
  usage
b67a0f
- Add an /etc/modprobe.d/i2c-dev file to work around bug 380971
b67a0f
b67a0f
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 3.0.0-2
b67a0f
- Autorebuild for GCC 4.3
b67a0f
b67a0f
* Tue Nov 13 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-1
b67a0f
- Initial Fedora package, based on Suse specfile
b67a0f
b67a0f
* Mon Oct 15 2007 - jdelvare@suse.de
b67a0f
- Initial release.