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