Blame SPECS/i2c-tools.spec

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