Blob Blame Raw
%define         crda_version    3.18
%define         regdb_version   2018.05.31

%global         _firmwarepath	/usr/lib/firmware

Name:           crda
Version:        %{crda_version}_%{regdb_version}
Release:        5%{?dist}
Summary:        Regulatory compliance daemon for 802.11 wireless networking

License:        ISC
URL:            http://wireless.kernel.org/en/developers/Regulatory/CRDA

BuildRequires:  kernel-headers >= 2.6.27
BuildRequires:  libnl3-devel
BuildRequires:  libgcrypt-devel
BuildRequires:  pkgconfig python2 m2crypto python2-future python2-attrs
BuildRequires:  openssl
BuildRequires:  gcc systemd-devel

Requires:       udev, iw
Requires:       systemd >= 190

Source0:        http://www.kernel.org/pub/software/network/crda/crda-%{crda_version}.tar.xz
Source1:        http://www.kernel.org/pub/software/network/wireless-regdb/wireless-regdb-%{regdb_version}.tar.xz
Source2:        setregdomain
Source3:        setregdomain.1

# Add udev rule to call setregdomain on wireless device add
Patch0:         regulatory-rules-setregdomain.patch
# Do not call ldconfig in crda Makefile
Patch1:         crda-remove-ldconfig.patch
# Apply ldflags to libreg
Patch2:         crda-ldflags.patch
# Specify python version in shebang line for .py files
Patch3:         crda-python-version.patch
Patch4:         wireless-regdb-python-version.patch


%description
CRDA acts as the udev helper for communication between the kernel
and userspace for regulatory compliance. It relies on nl80211
for communication. CRDA is intended to be run only through udev
communication from the kernel.


%package devel
Summary:        Header files for use with libreg. 


%description devel
Header files to make use of libreg for accessing regulatory info.


%prep
%setup -q -c
%setup -q -T -D -a 1

%patch0 -p1 -b .setregdomain

cd crda-%{crda_version}
%patch1 -p1 -b .ldconfig-remove
%patch2 -p2 -b .ldflags
%patch3 -p1 -b .python
cd ../wireless-regdb-%{regdb_version}
%patch4 -p2 -b .python

# Preserve original regulatory.db signature for firmware-like load by kernel
#    This is an intermediate measure. Ultimately the crda package should
#    simply be replaced by a new firmware-like wireless-regdb package.
cp -a regulatory.db.p7s regulatory.db.p7s.orig


%build
export CFLAGS="%{optflags} -Wno-error=unused-const-variable"
export LDFLAGS="%{?__global_ldflags}"

# Use our own signing key to generate regulatory.bin
cd wireless-regdb-%{regdb_version}

make %{?_smp_mflags} maintainer-clean
make %{?_smp_mflags} REGDB_PRIVKEY=key.priv.pem REGDB_PUBKEY=key.pub.pem \
	FIRMWARE_PATH=%{_firmwarepath}

# Restore original regulatory.db signature for firmware-like load by kernel
cp -a regulatory.db.p7s.orig regulatory.db.p7s

# Build CRDA using the new key and regulatory.bin from above
cd ../crda-%{crda_version}
cp ../wireless-regdb-%{regdb_version}/key.pub.pem pubkeys

make %{?_smp_mflags} SBINDIR=%{_sbindir}/ LIBDIR=%{_libdir}/ \
	REG_BIN=../wireless-regdb-%{regdb_version}/regulatory.bin


%install
rm -rf %{buildroot}

cd crda-%{crda_version}
cp LICENSE LICENSE.crda
cp README README.crda
make install DESTDIR=%{buildroot} MANDIR=%{_mandir}/ \
	SBINDIR=%{_sbindir}/ LIBDIR=%{_libdir}/
mkdir -p %{buildroot}/%{_udevrulesdir}
mv %{buildroot}/lib/udev/rules.d/* %{buildroot}/%{_udevrulesdir}

cd ../wireless-regdb-%{regdb_version}
cp LICENSE LICENSE.wireless-regdb
cp README README.wireless-regdb
make install DESTDIR=%{buildroot} MANDIR=%{_mandir} \
	FIRMWARE_PATH=%{_firmwarepath}

install -D -pm 0755 %SOURCE2 %{buildroot}%{_sbindir}
install -D -pm 0644 %SOURCE3 %{buildroot}%{_mandir}/man1/setregdomain.1


%ldconfig_scriptlets


%files
%{_sbindir}/%{name}
%{_sbindir}/regdbdump
%{_sbindir}/setregdomain
%{_libdir}/libreg.so
%{_udevrulesdir}/85-regulatory.rules
# location of database is hardcoded to /usr/lib/%%{name}
/usr/lib/%{name}
%{_firmwarepath}/regulatory.db
%{_firmwarepath}/regulatory.db.p7s
%{_mandir}/man1/setregdomain.1*
%{_mandir}/man5/regulatory.bin.5*
%{_mandir}/man5/regulatory.db.5*
%{_mandir}/man8/crda.8*
%{_mandir}/man8/regdbdump.8*
%license crda-%{crda_version}/LICENSE.crda
%license wireless-regdb-%{regdb_version}/LICENSE.wireless-regdb
%doc crda-%{crda_version}/README.crda
%doc wireless-regdb-%{regdb_version}/README.wireless-regdb


%files devel
%{_includedir}/reglib/nl80211.h
%{_includedir}/reglib/regdb.h
%{_includedir}/reglib/reglib.h



%changelog
* Thu Jul 19 2018 John W. Linville <linville@redhat.com> - 3.18_2018.05.31-5
- Add previously unnecessary BuildRequires for gcc
- Add previously unnecessary BuildRequires for systemd-devel

* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.18_2018.05.31-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Thu Jul 05 2018 John W. Linville <linville@redhat.com> - 3.18_2018.05.31-2
- Preserve original regulatory.db.p7s for firmware-like loading by kernel
- Remove patch to ensure rebuild of regulatory.db after signature regeneration
- Add another python2-related build fix

* Tue May 29 2018 John W. Linville <linville@redhat.com> - 3.18_2018.05.31-1
- Update wireless-regdb to version 2018.05.31
- Update URL for package header

* Tue May 29 2018 John W. Linville <linville@redhat.com> - 3.18_2018.05.09-1
- Update wireless-regdb to version 2018.05.09
- Ensure rebuild of regulatory.db after signature regeneration
- Add some python2-related build fixes

* Mon Apr 30 2018 John W. Linville <linville@redhat.com> - 3.18_2017.12.23-1
- Update wireless-regdb to version 2017.12.23
- Install regulatory.db into firmware directory for loading by kernel itself
- Use macro for accessing udev rules directory

* Thu Mar 15 2018 Iryna Shcherbina <ishcherb@redhat.com> - 3.18_2016.02.08-8
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.18_2016.02.08-7
- Escape macros in %%changelog

* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.18_2016.02.08-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Sat Feb 03 2018 Igor Gnatenko <ignatenkobrain@fedoraproject.org> - 3.18_2016.02.08-5
- Switch to %%ldconfig_scriptlets

* Wed Aug 02 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.18_2016.02.08-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild

* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.18_2016.02.08-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.18_2016.02.08-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Tue Feb 09 2016 John W. Linville <linville@redhat.com> - 3.18_2016.02.08-1
- Update wireless-regdb to version 2016.02.08
- Do not treat unused-const-variable warnings as errors

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 3.18_2015.10.22-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Nov  3 2015 John W. Linville <linville@redhat.com> - 3.18_2015.10.22-1
- Update wireless-regdb to version 2015.10.22
- Fix some whitespace damage in spec file

* Fri Aug 14 2015 Adam Jackson <ajax@redhat.com> 3.18_2015.04.06-3
- Pass rpm's ldflags through to fix hardening

* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.18_2015.04.06-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Tue Apr 21 2015 John W. Linville <linville@redhat.com> - 3.18_2015.04.06-1
- Update wireless-regdb to version 2015.04.06

* Fri Mar 20 2015 John W. Linville <linville@redhat.com> - 3.18_2015.03.13-1
- Update wireless-regdb to version 2015.03.13

* Wed Feb  4 2015 John W. Linville <linville@redhat.com> - 3.18_2015.01.30-3
- Use %%license instead of %%doc for file containing license information
- Add %%license entry for wireless-regdb
- Correct NVR info at end of previous changelog entry

* Mon Feb  2 2015 John W. Linville <linville@redhat.com> - 3.18_2015.01.30-2
- Update crda to version 3.18
- Update wireless-regdb to version 2015.01.30
- Drop patch to add DESTDIR in install rules for libreg in crda Makefile

* Tue Nov 25 2014 John W. Linville <linville@redhat.com> - 3.13_2014.11.18-1
- Update wireless-regdb to version 2014.11.18

* Mon Oct 27 2014 John W. Linville <linville@redhat.com> - 3.13_2014.10.07-1
- Update wireless-regdb to version 2014.10.07
- Update copyright dates in setregdomain

* Sat Aug 16 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 3.13_2014.06.13-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Fri Jun 13 2014 John W. Linville <linville@redhat.com> - 3.13_2014.06.13-1
- Update wireless-regdb to version 2014.06.13

* Fri Jun  6 2014 John W. Linville <linville@redhat.com> - 3.13_2014.06.02-1
- Add logger commands to setregdomain to make it more communicative
- Update wireless-regdb to version 2014.06.02

* Fri Feb 28 2014 John W. Linville <linville@redhat.com> - 3.13_2013.11.27-2
- Accomodate relative pathnames in the symlink for /etc/localtime

* Fri Feb 14 2014 John W. Linville <linville@redhat.com> - 3.13_2013.11.27-1
- Update crda to version 3.13
- Remove obsolete patch for regdbdump to display DFS region
- Add patch to use DESTDIR rule for crda libreg installation
- Add patch to avoid calling ldconfig from crda Makefile
- Remove PREFIX='' lines from make commands
- Use SBINDIR and LIBDIR definitions in make commands

* Thu Jan 23 2014 John W. Linville <linville@redhat.com> - 1.1.3_2013.11.27-3
- Correct a typo in setregdomain

* Fri Jan 17 2014 John W. Linville <linville@redhat.com> - 1.1.3_2013.11.27-2
- Add patch for regdbdump to display DFS region

* Mon Dec  2 2013 John W. Linville <linville@redhat.com> - 1.1.3_2013.11.27-1
- Update wireless-regdb to version 2013.11.27

* Fri Nov 22 2013 Xose Vazquez Perez <xose.vazquez@gmail.com> - 1.1.3_2013.02.13-5
- fixed wrong dates
- link with libnl3
- new home for sources

* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.3_2013.02.13-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild

* Wed Apr  3 2013 John W. Linville <linville@redhat.com> - 1.1.3_2013.02.13-3
- setregdomain: remove sed and awk calls
- setregdomain: reimplement COUNTRY assignment with shell function

* Fri Mar  1 2013 John W. Linville <linville@redhat.com> - 1.1.3_2013.02.13-2
- Bump release to prevent upgrade issues from F17...oops!

* Wed Feb 13 2013 John W. Linville <linville@redhat.com> - 1.1.3_2013.02.13-1
- Update wireless-regdb to version 2013.02.13

* Tue Feb 12 2013 John W. Linville <linville@redhat.com> - 1.1.3_2013.02.12-1
- Update wireless-regdb to version 2013.02.12

* Fri Jan 25 2013 John W. Linville <linville@redhat.com> - 1.1.3_2013.01.11-2
- Update setregdomain to determine timezone info from /etc/timezone

* Fri Jan 25 2013 John W. Linville <linville@redhat.com> - 1.1.3_2013.01.11-1
- Update crda to version 1.1.3
- Update wireless-regdb to version 2013.01.11

* Fri Aug 10 2012 John W. Linville <linville@redhat.com>
- Add BuildRequires for openssl

* Wed Jul 18 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2_2011.04.28-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild

* Thu Jan 12 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.2_2011.04.28-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

* Thu Aug 11 2011 John W. Linville <linville@redhat.com> 1.1.2_2011.04.28-1
- Update crda to version 1.1.2
- Update wireless-regdb to version 2011.04.28 
- Fix mis-numbered version comment in changelog for Nov 23 2010

* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.1_2010.11.22-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild

* Tue Nov 23 2010 John W. Linville <linville@redhat.com> 1.1.1_2010.11.22-1
- Update wireless-regdb to version 2010.11.22 

* Thu Feb 25 2010 John W. Linville <linville@redhat.com> 1.1.1_2009.11.25-3
- Correct license tag from BSD to ISC
- Comment purpose of regulatory-rules-setregdomain.patch
- Add copyright and license statement to setregdomain
- Add comment for why /lib is hardcoded in files section
- Reformat Dec 21 2009 changelog entry so rpmlint stops complaining

* Tue Jan 26 2010 John W. Linville <linville@redhat.com> 1.1.1_2009.11.25-2
- Change RPM_OPT_FLAGS to optflags
- Leave man page compression to rpmbuild
- Correct date in previous changelog entry

* Tue Jan 26 2010 John W. Linville <linville@redhat.com> 1.1.1_2009.11.25-1
- Update for crda version 1.1.1

* Mon Dec 21 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.11.25-5
- Remove unnecessary explicit Requries for libgcrypt and libnl -- oops!

* Mon Dec 21 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.11.25-4
- Add libgcrypt and libnl to Requires

* Mon Dec 21 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.11.25-3
- Add man page for setregdomain (from Andrew Hecox <ahecox@redhat.com>)
- Change $RPM_BUILD_ROOT to buildroot

* Fri Dec 18 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.11.25-2
- Specify path to iw in setregdomain

* Wed Dec  2 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.11.25-1
- Update wireless-regdb to version 2009.11.25 

* Wed Nov 11 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.11.10-1
- Update wireless-regdb to version 2009.11.10 

* Thu Oct  1 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.09.08-3
- Move regdb to /lib/crda to facilitate /usr mounted over wireless network

* Wed Sep  9 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.09.08-2
- Use kernel-headers instead of kernel-devel

* Wed Sep  9 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.09.08-1
- Update wireless-regdb to version 2009.09.08 
- Start resetting release number with version updates

* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1.0_2009.04.17-12
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

* Wed May 13 2009 John W. Linville <linville@redhat.com> 1.1.0_2009.04.17-11
- Update crda version to version 1.1.0
- Update wireless-regdb to version 2009.04.17 

* Fri Apr 17 2009 John W. Linville <linville@redhat.com> 1.0.1_2009.04.16-10
- Update wireless-regdb version to pick-up recent updates and fixes (#496392)

* Tue Mar 31 2009 John W. Linville <linville@redhat.com> 1.0.1_2009.03.09-9
- Add Requires line for iw package (#492762)
- Update setregdomain script to correctly check if COUNTRY is set

* Thu Mar 19 2009 John W. Linville <linville@redhat.com> 1.0.1_2009.03.09-8
- Add setregdomain script to set regulatory domain based on timezone
- Expand 85-regulatory.rules to invoke setregdomain script on device add

* Tue Mar 10 2009 John W. Linville <linville@redhat.com> 1.0.1_2009.03.09-7
- Update wireless-regdb version to pick-up recent updates and fixes (#489560)

* Tue Feb 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.0.1_2009.01.30-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild

* Mon Feb 16 2009 John W. Linville <linville@redhat.com> 1.0.1_2009.01.30-5
- Recognize regulatory.bin files signed with the upstream key (#484982)

* Tue Feb 03 2009 John W. Linville <linville@redhat.com> 1.0.1_2009.01.30-4
- Change version to reflect new wireless-regdb upstream release practices
- Update wireless-regdb version to pick-up recent updates and fixes (#483816)

* Tue Jan 27 2009 John W. Linville <linville@redhat.com> 1.0.1_2009_01_15-3
- Update for CRDA verion 1.0.1
- Account for lack of "v" in upstream release tarball naming
- Add patch to let wireless-regdb install w/o being root

* Thu Jan 22 2009 John W. Linville <linville@redhat.com> v0.9.5_2009_01_15-2
- Revamp based on package review comments

* Tue Jan 20 2009 John W. Linville <linville@redhat.com> v0.9.5_2009_01_15-1
- Initial build