3f5a78
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
3f5a78
# Copyright (c) 2007 Hans de Goede <j.w.r.degoede@hhs>, the Fedora project.
3f5a78
#
3f5a78
# This file and all modifications and additions to the pristine
3f5a78
# package are under the same license as the package itself.
3f5a78
3f5a78
Name:           i2c-tools
3f5a78
Version:        4.3
c80abb
Release:        3%{?dist}
3f5a78
Summary:        A heterogeneous set of I2C tools for Linux
3f5a78
License:        GPLv2+
3f5a78
URL:            https://i2c.wiki.kernel.org/index.php/I2C_Tools
3f5a78
3f5a78
Source0:        https://www.kernel.org/pub/software/utils/i2c-tools/%{name}-%{version}.tar.xz
3f5a78
3f5a78
# for /etc/udev/makedev.d resp /usr/lib/modprobe.d ownership
3f5a78
Requires:       systemd-udev kmod
3f5a78
Requires:       libi2c%{?_isa} = %{version}-%{release}
3f5a78
BuildRequires:  gcc
3f5a78
BuildRequires:  make
3f5a78
BuildRequires:  perl-generators
3f5a78
BuildRequires:  python3-devel
3f5a78
ExcludeArch:    s390 s390x
3f5a78
Obsoletes:      i2c-tools-eepromer < 4.2-2
3f5a78
3f5a78
%description
3f5a78
This package contains a heterogeneous set of I2C tools for Linux: a bus
3f5a78
probing tool, a chip dumper, register-level access helpers, EEPROM
3f5a78
decoding scripts, and more.
3f5a78
3f5a78
3f5a78
%package -n python3-i2c-tools
3f5a78
Summary:        Python 3 bindings for Linux SMBus access through i2c-dev
3f5a78
License:        GPLv2
3f5a78
%{?python_provide:%python_provide python3-i2c-tools}
3f5a78
Requires:       libi2c%{?_isa} = %{version}-%{release}
3f5a78
%if %{without python2}
3f5a78
# Remove before F30
3f5a78
Obsoletes: %{name}-python < 4.0-4
3f5a78
# Remove before F31
3f5a78
Obsoletes: python2-i2c-tools < 4.0-5
3f5a78
%endif
3f5a78
3f5a78
%description -n python3-i2c-tools
3f5a78
Python 3 bindings for Linux SMBus access through i2c-dev
3f5a78
3f5a78
%package perl
3f5a78
Summary:        i2c tools written in Perl
3f5a78
License:        GPLv2+
3f5a78
Requires:       libi2c%{?_isa} = %{version}-%{release}
3f5a78
3f5a78
%description perl
3f5a78
A collection of tools written in perl for use with i2c devices.
3f5a78
3f5a78
%package -n libi2c
3f5a78
Summary:        I2C/SMBus bus access library
3f5a78
License:        LGPLv2+
3f5a78
3f5a78
%description -n libi2c
3f5a78
libi2c offers a way for applications to interact with the devices
3f5a78
connected to the I2C or SMBus buses of the system.
3f5a78
3f5a78
%package -n libi2c-devel
3f5a78
Summary:        Development files for the I2C library
3f5a78
License:        LGPLv2+
3f5a78
Requires:       libi2c%{?_isa} = %{version}-%{release}
3f5a78
# Remove in F30
3f5a78
Obsoletes:      i2c-tools-devel < 4.0-1
3f5a78
3f5a78
%description -n libi2c-devel
3f5a78
%{summary}.
3f5a78
3f5a78
%prep
3f5a78
%autosetup -p1
3f5a78
3f5a78
%build
3f5a78
make CFLAGS="$RPM_OPT_FLAGS" LDFLAGS="$RPM_LD_FLAGS" BUILD_STATIC_LIB=0 EXTRA=eeprog
3f5a78
pushd py-smbus
3f5a78
CFLAGS="$RPM_OPT_FLAGS -I../include" LDFLAGS="$RPM_LD_FLAGS" \
3f5a78
  %{__python3} setup.py build -b build-py3
3f5a78
popd
3f5a78
3f5a78
3f5a78
%install
3f5a78
make install DESTDIR=$RPM_BUILD_ROOT PREFIX=%{_prefix} BUILD_STATIC_LIB=0 \
3f5a78
  EXTRA=eeprog libdir=%{_libdir}
3f5a78
pushd py-smbus
3f5a78
%{__python3} setup.py build -b build-py3 install --skip-build --root=$RPM_BUILD_ROOT
3f5a78
popd
3f5a78
3f5a78
# cleanup
3f5a78
rm -f $RPM_BUILD_ROOT%{_bindir}/decode-edid.pl
3f5a78
# Remove unpleasant DDC tools.  KMS already exposes the EDID block in sysfs,
3f5a78
# and edid-decode is a more complete tool than decode-edid.
3f5a78
rm -f $RPM_BUILD_ROOT%{_bindir}/{ddcmon,decode-edid}
3f5a78
3f5a78
# for i2c-dev ondemand loading through kmod
3f5a78
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d 
3f5a78
echo "alias char-major-89-* i2c-dev" > \
3f5a78
  $RPM_BUILD_ROOT%{_prefix}/lib/modprobe.d/i2c-dev.conf
3f5a78
# for /dev/i2c-# creation (which are needed for kmod i2c-dev autoloading)
3f5a78
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d
3f5a78
for (( i = 0 ; i < 8 ; i++ )) do
3f5a78
  echo "i2c-$i" >> $RPM_BUILD_ROOT%{_sysconfdir}/udev/makedev.d/99-i2c-dev.nodes
3f5a78
done
3f5a78
3f5a78
# auto-load i2c-dev after reboot
3f5a78
mkdir -p $RPM_BUILD_ROOT%{_prefix}/lib/modules-load.d
3f5a78
echo 'i2c-dev' > $RPM_BUILD_ROOT%{_prefix}/lib/modules-load.d/%{name}.conf
3f5a78
3f5a78
3f5a78
%post
3f5a78
# load i2c-dev after the first install
3f5a78
if [ "$1" = 1 ] ; then
3f5a78
  /usr/sbin/modprobe i2c-dev
3f5a78
fi
3f5a78
exit 0
3f5a78
3f5a78
%ldconfig_post -n libi2c
3f5a78
%ldconfig_postun -n libi2c
3f5a78
3f5a78
3f5a78
%files
3f5a78
%license COPYING
3f5a78
%doc CHANGES README
3f5a78
%config(noreplace) %{_prefix}/lib/modprobe.d/i2c-dev.conf
3f5a78
%config(noreplace) %{_sysconfdir}/udev/makedev.d/99-i2c-dev.nodes
3f5a78
%{_sbindir}/i2c*
3f5a78
%{_sbindir}/eeprog
3f5a78
%exclude %{_sbindir}/i2c-stub*
3f5a78
%{_mandir}/man8/i2c*.8.*
3f5a78
%{_mandir}/man8/eeprog.8.*
3f5a78
%exclude %{_mandir}/man8/i2c-stub-from-dump.8.*
3f5a78
%{_prefix}/lib/modules-load.d/%{name}.conf
3f5a78
3f5a78
%files -n python3-i2c-tools
3f5a78
%doc py-smbus/README
3f5a78
%{python3_sitearch}/*
3f5a78
3f5a78
%files perl
3f5a78
%doc eeprom/README
3f5a78
%{_bindir}/decode-*
3f5a78
%{_sbindir}/i2c-stub*
3f5a78
%{_mandir}/man1/decode-*.1.*
3f5a78
%{_mandir}/man8/i2c-stub-from-dump.8.*
3f5a78
3f5a78
%files -n libi2c
3f5a78
%license COPYING.LGPL
3f5a78
%{_libdir}/libi2c.so.0*
3f5a78
3f5a78
%files -n libi2c-devel
3f5a78
%dir %{_includedir}/i2c
3f5a78
%{_includedir}/i2c/smbus.h
3f5a78
%{_libdir}/libi2c.so
3f5a78
%{_mandir}/man3/libi2c.3.*
3f5a78
3f5a78
%changelog
c80abb
* Thu Jun 30 2022 Jan Zerdik <jzerdik@redhat.com> - 4.3-3
c80abb
- Rebuilt
c80abb
- Resolves: rhbz#2072719
c80abb
3f5a78
* Mon Aug 09 2021 Mohan Boddu <mboddu@redhat.com> - 4.3-2
3f5a78
- Rebuilt for IMA sigs, glibc 2.34, aarch64 flags
3f5a78
  Related: rhbz#1991688
3f5a78
3f5a78
* Tue Aug 03 2021 Artem Egorenkov <aegorenk@redhat.com> - 4.3-1
3f5a78
- Version 4.3
3f5a78
- Resolves: rhbz#1989260
3f5a78
3f5a78
* Fri Apr 16 2021 Mohan Boddu <mboddu@redhat.com> - 4.2-4
3f5a78
- Rebuilt for RHEL 9 BETA on Apr 15th 2021. Related: rhbz#1947937
3f5a78
3f5a78
* Tue Jan 26 2021 Fedora Release Engineering <releng@fedoraproject.org> - 4.2-3
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild
3f5a78
3f5a78
* Sat Jan 16 2021 Peter Robinson <pbrobinson@fedoraproject.org> - 4.2-2
3f5a78
- Move eeprog to i2c-tools (shouldn't have been in eepromer sub package)
3f5a78
- Drop/obsolete eepromer subpackage, deprecated for 6 years
3f5a78
- Drop python2 conditionals
3f5a78
- Minor cleanups
3f5a78
3f5a78
* Thu Jan 07 2021 Artem Egorenkov <aegorenk@redhat.com> - 4.2-1
3f5a78
- Version 4.2
3f5a78
3f5a78
* Tue Jul 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-6
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
3f5a78
3f5a78
* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 4.1-5
3f5a78
- Rebuilt for Python 3.9
3f5a78
3f5a78
* Wed Jan 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-4
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
3f5a78
3f5a78
* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 4.1-3
3f5a78
- Rebuilt for Python 3.8
3f5a78
3f5a78
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.1-2
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
3f5a78
3f5a78
* Mon Feb  4 2019 Peter Robinson <pbrobinson@fedoraproject.org> 4.1-1
3f5a78
- Version 4.1
3f5a78
3f5a78
* Fri Feb 01 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-13
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
3f5a78
3f5a78
* Thu Nov 15 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-12
3f5a78
- Ship modprobe.d files in /usr/lib/modprobe.d (rhbz#1195285)
3f5a78
3f5a78
* Mon Aug 13 2018 Peter Robinson <pbrobinson@fedoraproject.org> 4.0-11
3f5a78
- Add requires on libi2c NVR
3f5a78
- Minor spec cleanups, use %%license
3f5a78
3f5a78
* Fri Aug 03 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-10
3f5a78
- Add upstream patch fixing libi2c license headers
3f5a78
3f5a78
* Tue Jul 31 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-9
3f5a78
- Corrected the License tags
3f5a78
3f5a78
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-8
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
3f5a78
3f5a78
* Fri Jun 29 2018 Adam Jackson <ajax@redhat.com> - 4.0-7
3f5a78
- Use ldconfig scriptlets
3f5a78
3f5a78
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 4.0-6
3f5a78
- Rebuilt for Python 3.7
3f5a78
3f5a78
* Thu Mar 22 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-5
3f5a78
- Don't build Python 2 subpackage on EL > 7 and Fedora > 28
3f5a78
3f5a78
* Mon Feb 19 2018 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-4
3f5a78
- Add gcc to BuildRequires
3f5a78
3f5a78
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.0-3
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
3f5a78
3f5a78
* Thu Feb  1 2018 Florian Weimer <fweimer@redhat.com> - 4.0-2
3f5a78
- Build with linker flags from redhat-rpm-config
3f5a78
3f5a78
* Tue Nov 21 2017 Ondřej Lysoněk <olysonek@redhat.com> - 4.0-1
3f5a78
- New version
3f5a78
- Dropped i2c-tools-devel, introduced libi2c, libi2c-devel
3f5a78
3f5a78
* Sat Oct 7 2017 Troy Curtis, Jr <troycurtisjr@gmail.com> - 3.1.2-7
3f5a78
- Add Python3 subpackage.
3f5a78
3f5a78
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.1.2-6
3f5a78
- Add Provides for the old name without %%_isa
3f5a78
3f5a78
* Sat Aug 19 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 3.1.2-5
3f5a78
- Python 2 binary package renamed to python2-i2c-tools
3f5a78
  See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3
3f5a78
3f5a78
* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.2-4
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
3f5a78
3f5a78
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.2-3
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
3f5a78
3f5a78
* Thu Jul 20 2017 Ondřej Lysoněk <olysonek@redhat.com> - 3.1.2-2
3f5a78
- Provide i2c-dev.h in /usr/include/i2c-tools/
3f5a78
- Resolves: rhbz#1288823
3f5a78
- Dropped Group: tags as per https://fedoraproject.org/wiki/Packaging:Guidelines#Tags_and_Sections
3f5a78
3f5a78
* Wed Jul 19 2017 Ondřej Lysoněk <olysonek@redhat.com> - 3.1.2-1
3f5a78
- New version
3f5a78
- Updated upstream and source code URL
3f5a78
- Dropped patches accepted by upstream
3f5a78
3f5a78
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-18
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
3f5a78
3f5a78
* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-17
3f5a78
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages
3f5a78
3f5a78
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.1.0-16
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
3f5a78
3f5a78
* Thu Oct 08 2015 Jaromir Capik <jcapik@redhat.com> - 3.1.0-15
3f5a78
- Adding i2c-dev auto-load in th %%post and modules-load.d (#913203)
3f5a78
3f5a78
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-14
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
3f5a78
3f5a78
* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-13
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
3f5a78
3f5a78
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-12
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
3f5a78
3f5a78
* Wed Oct 9  2013 Peter Robinson <pbrobinson@fedoraproject.org> 3.1.0-11
3f5a78
- Split out perl tools to a separate subpackage
3f5a78
3f5a78
* Fri Oct 04 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-10
3f5a78
- Making the decode-* man pages installable with Makefile
3f5a78
3f5a78
* Thu Oct 03 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-9
3f5a78
- Introducing man pages for decode-* binaries
3f5a78
- Cleaning the spec
3f5a78
3f5a78
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-8
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
3f5a78
3f5a78
* Wed Jul 17 2013 Petr Pisar <ppisar@redhat.com> - 3.1.0-7
3f5a78
- Perl 5.18 rebuild
3f5a78
3f5a78
* Wed Jul 03 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-6
3f5a78
- Installing the man pages and putting them in the files section
3f5a78
3f5a78
* Wed Jul 03 2013 Jaromir Capik <jcapik@redhat.com> - 3.1.0-5
3f5a78
- Introducing man pages for binaries in the eepromer subpackage
3f5a78
- Introducing -r switch in the i2cset help
3f5a78
3f5a78
* Sat Jun  1 2013 Henrik Nordstrom <henrik@henriknordstrom.net> - 3.1.0-4
3f5a78
- Package python interface
3f5a78
3f5a78
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-3
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
3f5a78
3f5a78
* Thu Jul 19 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.1.0-2
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
3f5a78
3f5a78
* Mon Feb 20 2012 Adam Jackson <ajax@redhat.com> 3.1.0-1
3f5a78
- i2c-tools 3.1.0
3f5a78
3f5a78
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.3-2
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
3f5a78
3f5a78
* Tue Jul 05 2011 Adam Jackson <ajax@redhat.com> 3.0.3-1
3f5a78
- i2c-tools 3.0.3
3f5a78
3f5a78
* Wed Feb 09 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.2-5
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
3f5a78
3f5a78
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.2-4
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
3f5a78
3f5a78
* Mon Apr 13 2009 Adam Jackson <ajax@redhat.com> 3.0.2-3
3f5a78
- mv /etc/modprobe.d/i2c-dev /etc/modprobe.d/i2c-dev.conf (#495455)
3f5a78
3f5a78
* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.0.2-2
3f5a78
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild
3f5a78
3f5a78
* Thu Dec 11 2008 Adam Jackson <ajax@redhat.com> 3.0.2-1
3f5a78
- i2c-tools 3.0.2
3f5a78
3f5a78
* Wed Mar  5 2008 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-3
3f5a78
- Change /dev/i2c-# creation from /lib/udev/devices to /etc/udev/makedev.d
3f5a78
  usage
3f5a78
- Add an /etc/modprobe.d/i2c-dev file to work around bug 380971
3f5a78
3f5a78
* Tue Feb 19 2008 Fedora Release Engineering <rel-eng@fedoraproject.org> - 3.0.0-2
3f5a78
- Autorebuild for GCC 4.3
3f5a78
3f5a78
* Tue Nov 13 2007 Hans de Goede <j.w.r.degoede@hhs.nl> 3.0.0-1
3f5a78
- Initial Fedora package, based on Suse specfile
3f5a78
3f5a78
* Mon Oct 15 2007 - jdelvare@suse.de
3f5a78
- Initial release.