Name:           netcf
Version:        0.2.8
Release:        17
Summary:        Cross-platform network configuration library
License:        LGPLv2+
URL:            https://pagure.io/netcf
Source0:        https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz

Patch0000:      0000-netcf-call-aug_load-at-most-once-per-second.patch
Patch0001:      0001-netcf-optimize-aug_match-query-for-all-ifcfg-files-related.patch
Patch0002:      0002-netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch
Patch0003:      0003-netcf-Properly-classify-bond-devices-with-no-slaves.patch
Patch0004:      Fix-memory-leak-in-aug-match-mac.patch

BuildRequires:  autoconf automake augeas-devel gcc git gettext-devel libnl3-devel libtool
BuildRequires:  libxml2-devel libxslt-devel perl-podlators readline-devel systemd /usr/bin/pod2man

Requires:       bridge-utils systemd

Provides:       bundled(gnulib)  %{name}-libs = %{version}-%{release}
Obsoletes:      %{name}-libs = %{version}-%{release}

%description
netcf is a cross-platform network configuration library.
It takes the description of a network interface in its own
platform-independent format and adapts the local system's network
configuration to provide that interface.And The libraries for %{name}.

%package        devel
Summary:        Development files and Header files for %{name}
Requires:       pkgconfig  %{name} = %{version}-%{release}

%description    devel
The devel for %{name}

%package_help

%prep
%autosetup -n %{name}-%{version} -p1 -S git

%build
autoreconf -if

%configure --with-sysinit=systemd --with-driver=redhat
%make_build

%install
make install DESTDIR=$RPM_BUILD_ROOT SYSTEMD_UNIT_DIR=%{_unitdir} INSTALL="%{__install} -p"
%delete_la

%check
make check

%preun
%systemd_preun netcf-transaction.service

%post
/sbin/ldconfig
%systemd_post netcf-transaction.service
/bin/systemctl --no-reload enable netcf-transaction.service >/dev/null 2>&1 || :

%postun
/sbin/ldconfig
%systemd_postun netcf-transaction.service

%files
%defattr(-,root,root)
%license COPYING
%{_bindir}/ncftool
%{_datadir}/netcf
%{_libdir}/*.so.*
%{_unitdir}/netcf-transaction.service
%attr(0755, root, root) %{_libexecdir}/netcf-transaction.sh

%files devel
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/libnetcf.a
%{_libdir}/pkgconfig/netcf.pc

%files help
%defattr(-,root,root)
%{_mandir}/man1/ncftool.1*

%changelog
* Sat Jan 11 2020 openEuler Buildteam <buildteam@openeuler.org> - 0.2.8-17
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Fix memory leak in aug_match_mac()

* Fri Oct 25 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.2.8-16
- Type:enhancement
- Id:NA
- SUG:NA
- DESC:add network driver that caused failure of build

* Mon Oct 21 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.2.8-15
- Type:enhancement
- Id:NA
- SUG:NA
- DESC:modify the location of COPYING

* Wed Oct 09 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.2.8-14
- Type:enhancement
- ID:NA
- SUG:NA
- DESC:add COPYING

* Tue Sep 24 2019 wangli <wangli221@huawei.com> - 0.2.8-13
- Type:Enhance
- ID:NA
- SUG:NA
- DESC: openEuler Debranding

* Thu Sep 05 2019 wangli <wangli221@huawei.com> - 0.2.8-12
- Type:Enhance
- ID:NA
- SUG:NA
- DESC: openEuler Debranding

* Wed Aug 14 2019 openEuler Buildteam <buildteam@openeuler.org> - 0.2.8-11 
- Package init

* Thu Aug 1 2019 luochunsheng <luochunsheng@huawei.com> - 0.2.8-10.h1
- Type:Enhance
- ID:NA
- SUG:NA
- DESC: openEuler Debranding

* Fri Jul 13 2018 luochunsheng <luochunsheng@huawei.com> - 0.2.8-10
- Package  Initialization
