ff66b3
Name:           netcf
ff66b3
Version:        0.2.8
46e910
Release:        12%{?dist}%{?extra_release}
ff66b3
Summary:        Cross-platform network configuration library
ff66b3
ff66b3
Group:          System Environment/Libraries
ff66b3
License:        LGPLv2+
ff66b3
URL:            https://fedorahosted.org/netcf/
ff66b3
Source0:        https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
ff66b3
ff66b3
# Patches
ff66b3
# One patch per line, in this format:
ff66b3
# Patch001: file1.patch
ff66b3
# Patch002: file2.patch
ff66b3
# ...
ff66b3
#
ff66b3
# The patches will automatically be put into the build source tree
ff66b3
# during the %prep stage (using git, which is now required for an rpm
ff66b3
# build)
ff66b3
#
ff66b3
Patch001: netcf-call-aug_load-at-most-once-per-second.patch
ff66b3
Patch002: netcf-optimize-aug_match-query-for-all-ifcfg-files-related.patch
ff66b3
Patch003: netcf-linux-include-bond-element-for-bonds-with-no-slaves.patch 
ff66b3
Patch004: netcf-Properly-classify-bond-devices-with-no-slaves.patch 
46e910
Patch005: netcf-Fix-memory-leak-in-aug_match_mac.patch
46e910
Patch006: netcf-remove-unused-variable-in-aug_match_mac.patch
46e910
Patch007: netcf-Make-the-empty-body-of-for-loops-more-obvious.patch
46e910
Patch008: netcf-slience-a-false-Coverity-report.patch
ff66b3
ff66b3
# Default to skipping autoreconf.  Distros can change just this one
ff66b3
# line (or provide a command-line override) if they backport any
ff66b3
# patches that touch configure.ac or Makefile.am.
ff66b3
%{!?enable_autotools:%define enable_autotools 0}
ff66b3
ff66b3
# git is used to build a source tree with patches applied (see the
ff66b3
# %prep section)
ff66b3
BuildRequires: git
ff66b3
ff66b3
# Fedora 20 / RHEL-7 are where netcf first uses systemd. Although earlier
ff66b3
# Fedora has systemd, netcf still used sysvinit there.
ff66b3
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
ff66b3
    %define with_systemd 1
ff66b3
%else
ff66b3
    %define with_systemd 0
ff66b3
%endif
ff66b3
ff66b3
%if %{with_systemd}
ff66b3
BuildRequires: systemd
ff66b3
Requires(post): systemd
ff66b3
Requires(preun): systemd
ff66b3
Requires(postun): systemd
ff66b3
%endif
ff66b3
%if 0%{?enable_autotools}
ff66b3
BuildRequires: autoconf
ff66b3
BuildRequires: automake
ff66b3
BuildRequires: gettext-devel
ff66b3
BuildRequires: libtool
ff66b3
BuildRequires: /usr/bin/pod2man
ff66b3
%endif
ff66b3
ff66b3
BuildRequires:  readline-devel augeas-devel >= 0.5.2
ff66b3
BuildRequires:  libxml2-devel libxslt-devel
ff66b3
ff66b3
# force the --with-libnl1 option on F17/RHEL6 and earlier
ff66b3
%if (0%{?fedora} && 0%{?fedora} < 18) || (0%{?rhel} && 0%{?rhel} < 7)
ff66b3
%define with_libnl1 1
ff66b3
%else
ff66b3
%define with_libnl1 0
ff66b3
%endif
ff66b3
ff66b3
# require libnl3 on F18/RHEL7 and later
ff66b3
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
ff66b3
BuildRequires:  libnl3-devel
ff66b3
%else
ff66b3
BuildRequires:  libnl-devel
ff66b3
%endif
ff66b3
ff66b3
Requires:       %{name}-libs = %{version}-%{release}
ff66b3
ff66b3
Provides: bundled(gnulib)
ff66b3
ff66b3
%description
ff66b3
Netcf is a library used to modify the network configuration of a
ff66b3
system. Network configurations are expressed in a platform-independent
ff66b3
XML format, which netcf translates into changes to the system's
ff66b3
'native' network configuration files.
ff66b3
ff66b3
%package        devel
ff66b3
Summary:        Development files for %{name}
ff66b3
Group:          Development/Libraries
ff66b3
Requires:       %{name}-libs = %{version}-%{release}
ff66b3
Requires:       pkgconfig
ff66b3
ff66b3
%description    devel
ff66b3
The %{name}-devel package contains libraries and header files for
ff66b3
developing applications that use %{name}.
ff66b3
ff66b3
%package        libs
ff66b3
Summary:        Libraries for %{name}
ff66b3
Group:          System Environment/Libraries
ff66b3
ff66b3
%description    libs
ff66b3
The libraries for %{name}.
ff66b3
ff66b3
%prep
ff66b3
%setup -q
ff66b3
ff66b3
# Patches have to be stored in a temporary file because RPM has
ff66b3
# a limit on the length of the result of any macro expansion;
ff66b3
# if the string is longer, it's silently cropped
ff66b3
%{lua:
ff66b3
    tmp = os.tmpname();
ff66b3
    f = io.open(tmp, "w+");
ff66b3
    count = 0;
ff66b3
    for i, p in ipairs(patches) do
ff66b3
        f:write(p.."\n");
ff66b3
        count = count + 1;
ff66b3
    end;
ff66b3
    f:close();
ff66b3
    print("PATCHCOUNT="..count.."\n")
ff66b3
    print("PATCHLIST="..tmp.."\n")
ff66b3
}
ff66b3
ff66b3
git init -q
ff66b3
git config user.name rpm-build
ff66b3
git config user.email rpm-build
ff66b3
git config gc.auto 0
ff66b3
git add .
ff66b3
git commit -q -a --author 'rpm-build <rpm-build>' \
ff66b3
           -m '%{name}-%{version} base'
ff66b3
ff66b3
COUNT=$(grep '\.patch$' $PATCHLIST | wc -l)
ff66b3
if [ $COUNT -ne $PATCHCOUNT ]; then
ff66b3
    echo "Found $COUNT patches in $PATCHLIST, expected $PATCHCOUNT"
ff66b3
    exit 1
ff66b3
fi
ff66b3
if [ $COUNT -gt 0 ]; then
ff66b3
    xargs git am <$PATCHLIST || exit 1
ff66b3
fi
ff66b3
echo "Applied $COUNT patches"
ff66b3
rm -f $PATCHLIST
ff66b3
ff66b3
ff66b3
%build
ff66b3
%if %{with_libnl1}
ff66b3
%define _with_libnl1 --with-libnl1
ff66b3
%endif
ff66b3
%if %{with_systemd}
ff66b3
    %define sysinit --with-sysinit=systemd
ff66b3
%else
ff66b3
    %define sysinit --with-sysinit=initscripts
ff66b3
%endif
ff66b3
ff66b3
ff66b3
%if 0%{?enable_autotools}
ff66b3
 autoreconf -if
ff66b3
%endif
ff66b3
ff66b3
%configure --disable-static \
ff66b3
           %{?_with_libnl1} \
ff66b3
           %{sysinit}
ff66b3
make %{?_smp_mflags}
ff66b3
ff66b3
%install
ff66b3
make install DESTDIR=$RPM_BUILD_ROOT SYSTEMD_UNIT_DIR=%{_unitdir} \
ff66b3
     INSTALL="%{__install} -p"
ff66b3
find $RPM_BUILD_ROOT -name '*.la' -delete
ff66b3
ff66b3
%preun libs
ff66b3
ff66b3
%if %{with_systemd}
ff66b3
    %systemd_preun netcf-transaction.service
ff66b3
%else
ff66b3
if [ $1 = 0 ]; then
ff66b3
    /sbin/chkconfig --del netcf-transaction
ff66b3
fi
ff66b3
%endif
ff66b3
ff66b3
%post libs
ff66b3
ff66b3
/sbin/ldconfig
ff66b3
%if %{with_systemd}
ff66b3
    %systemd_post netcf-transaction.service
ff66b3
    /bin/systemctl --no-reload enable netcf-transaction.service >/dev/null 2>&1 || :
ff66b3
%else
ff66b3
/sbin/chkconfig --add netcf-transaction
ff66b3
%endif
ff66b3
ff66b3
%postun libs
ff66b3
ff66b3
/sbin/ldconfig
ff66b3
%if %{with_systemd}
ff66b3
    %systemd_postun netcf-transaction.service
ff66b3
%endif
ff66b3
ff66b3
%files
ff66b3
%{_bindir}/ncftool
ff66b3
%{_mandir}/man1/ncftool.1*
ff66b3
ff66b3
%files libs
ff66b3
%{_datadir}/netcf
ff66b3
%{_libdir}/*.so.*
ff66b3
%if %{with_systemd}
ff66b3
%{_unitdir}/netcf-transaction.service
ff66b3
%else
ff66b3
%{_sysconfdir}/rc.d/init.d/netcf-transaction
ff66b3
%endif
ff66b3
%attr(0755, root, root) %{_libexecdir}/netcf-transaction.sh
ff66b3
%doc AUTHORS COPYING NEWS
ff66b3
ff66b3
%files devel
ff66b3
%doc
ff66b3
%{_includedir}/*
ff66b3
%{_libdir}/*.so
ff66b3
%{_libdir}/pkgconfig/netcf.pc
ff66b3
ff66b3
%changelog
46e910
* Fri Aug 09 2019 Laine Stump <laine@redhat.com> - 0.2.8-12
46e910
- Resolves: rhbz#1602628
46e910
46e910
* Fri Jun 28 2019 Danilo de Paula <ddepaula@redhat.com> - 0.2.8-11
46e910
- Rebuild all virt packages to fix RHEL's upgrade path
46e910
- Resolves: rhbz#1695587
46e910
  (Ensure modular RPM upgrade path)
46e910
ff66b3
* Mon Jul 30 2018 Eric Garver <egarver@redhat.com> - 0.2.8-10
ff66b3
- Remove artificial dependency on bridge-utils. rhbz #1605333
ff66b3
ff66b3
* Thu Feb 08 2018 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.8-9
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
ff66b3
ff66b3
* Thu Aug 03 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.8-8
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Binutils_Mass_Rebuild
ff66b3
ff66b3
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.8-7
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
ff66b3
ff66b3
* Fri Feb 10 2017 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.8-6
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild
ff66b3
ff66b3
* Thu Jan 12 2017 Igor Gnatenko <ignatenko@redhat.com> - 0.2.8-5
ff66b3
- Rebuild for readline 7.x
ff66b3
ff66b3
* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 0.2.8-4
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild
ff66b3
ff66b3
* Wed Oct 14 2015 Laine Stump <laine@redhat.com>
ff66b3
 - Improve performance with large number of interfaces
ff66b3
   (Bug 1268384, Bug 1271341)
ff66b3
 - recognize bond devices with no slaves
ff66b3
ff66b3
* Wed Jun 17 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.8-2
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild
ff66b3
ff66b3
* Wed Apr 08 2015 Laine Stump <laine@redhat.com> - 0.2.8-1
ff66b3
 - rebase to netcf-0.2.8
ff66b3
 - Fix build on systems with newer libnl3 that doesn't
ff66b3
   #include <linux/if.h>
ff66b3
ff66b3
* Mon Apr 06 2015 Laine Stump <laine@redhat.com> - 0.2.7-1
ff66b3
 - rebase to netcf-0.2.7
ff66b3
 - resolve CVE-2014-8119
ff66b3
 - support multiple IPv4 addresses in interface config (redhat driver)
ff66b3
 - allow static IPv4 config simultaneous with DHCPv4 (redhat driver)
ff66b3
 - recognize IPADDR0/NETMASK0/PREFIX0
ff66b3
 - remove extra quotes from IPV6ADDR_SECONDARIES (redhat+suse drivers)
ff66b3
 - miscellaneous systemd service fixes
ff66b3
 - use git to apply patches in rpm specfile
ff66b3
 - revert the 0.2.6-2 specfile patch mentioned below (now fixed properly)
ff66b3
ff66b3
* Thu Jan  8 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 0.2.6-2
ff66b3
- do not write to the console (#1135744)
ff66b3
ff66b3
* Fri Aug 22 2014 Laine Stump <laine@redhat.com> - 0.2.6-1
ff66b3
 - allow interleaved elements in interface XML schema
ff66b3
 - allow <link> element in vlan and bond interfaces
ff66b3
ff66b3
* Wed Aug 20 2014 Laine Stump <laine@redhat.com> - 0.2.5-1
ff66b3
 - report link state/speed in interface status
ff66b3
 - change DHCPv6 to DHCPV6C in ifcfg files
ff66b3
 - max vlan id is 4095, not 4096
ff66b3
ff66b3
* Sun Aug 17 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.4-3
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
ff66b3
ff66b3
* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.4-2
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
ff66b3
ff66b3
* Wed May 14 2014 Laine Stump <laine@redhat.com> - 0.2.4-1
ff66b3
 - wait for IFF_UP and IFF_RUNNING after calling ifup
ff66b3
 - don't require IFF_RUNNING for bridge devices
ff66b3
 - avoid memory leak in debian when listing interfaces
ff66b3
 - avoid use of uninitialized data when getting mac address
ff66b3
   (fixes https://bugzilla.redhat.com/show_bug.cgi?id=1046594 )
ff66b3
 - limit interface names to IFNAMSIZ-1 characters in length
ff66b3
 - support systemd for netcf-transaction
ff66b3
ff66b3
* Sat May 03 2014 Cole Robinson <crobinso@redhat.com> - 0.2.3-7
ff66b3
- Fix reading bridge stp value (bz #1031053)
ff66b3
ff66b3
* Thu Apr 24 2014 Tomáš Mráz <tmraz@redhat.com> - 0.2.3-6
ff66b3
- Rebuild for new libgcrypt
ff66b3
ff66b3
* Sat Aug 03 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.3-5
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
ff66b3
ff66b3
* Thu Feb 14 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.3-4
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_19_Mass_Rebuild
ff66b3
ff66b3
* Sun Jan 20 2013 Richard W.M. Jones <rjones@redhat.com> - 0.2.3-3
ff66b3
- Rebuild for libnl soname breakage (RHBZ#901569).
ff66b3
ff66b3
* Fri Jan 18 2013 Daniel P. Berrange <berrange@redhat.com> - 0.2.3-2
ff66b3
- Rebuild for libnl3 soname change
ff66b3
ff66b3
* Fri Dec 21 2012 Laine Stump <laine@redhat.com> - 0.2.3-1
ff66b3
- Rebase to netcf-0.2.3
ff66b3
- eliminate calls to nl_cache_mngt_provide(), to avoid
ff66b3
  non-threadsafe code in libnl (and because it isn't needed
ff66b3
  anyway) (This non-threadsafe code could lead to a segfault)
ff66b3
- portability fixes for FreeBSD
ff66b3
- fix bug when a config file has two config parameters with
ff66b3
  identical names
ff66b3
- add HACKING document
ff66b3
- always bail immediately if get_augeas fails (doing otherwise
ff66b3
  could lead to a segfault)
ff66b3
ff66b3
* Sat Aug 25 2012 Laine Stump <laine@redhat.com> - 0.2.2-1
ff66b3
- Rebase to netcf-0.2.2
ff66b3
- specfile: require libnl3-devel for rpm builds on Fedora 18+ and
ff66b3
  RHEL7+. Likewise, force libnl1 for F17- and RHEL6.x-, even if
ff66b3
  libnl3-devel is installed.
ff66b3
ff66b3
* Fri Aug 10 2012 Laine Stump <laine@redhat.com> - 0.2.1-1
ff66b3
- Rebase to netcf-0.2.1
ff66b3
- update gnulib to fix broken build on systems with nwer glibc (which no
ff66b3
  longer provides gets()).
ff66b3
- add ncftool manpage
ff66b3
- interfaces are only "active" if both UP and RUNNING.
ff66b3
- add "bundled(gnulib)" to specfile to indicate that we use a local
ff66b3
  copy of gnulib sources (used by Fedora/RHEL when determining the scope
ff66b3
  of security bugs).
ff66b3
- Fix ipcalc_netmask, which was trimming off the last digit in
ff66b3
  character representations of full-length netmasks (all 4 octets
ff66b3
  having 3 chars each)
ff66b3
- other minor bugfixes
ff66b3
ff66b3
* Fri Jul 20 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.9-3
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
ff66b3
ff66b3
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.9-2
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
ff66b3
ff66b3
* Tue Jul 26 2011 Laine Stump <laine@redhat.com> - 0.1.9-1
ff66b3
- Rebase to netcf-0.1.9
ff66b3
- always add <bridge> element to bridge, even if there is no physdev present
ff66b3
- don't log error if interface isn't found in kernel during status report
ff66b3
- allow building with C++
ff66b3
- update gnulib
ff66b3
ff66b3
* Tue Jun 21 2011 Laine Stump <laine@redhat.com> - 0.1.8-1
ff66b3
- Rebase to netcf-0.1.8
ff66b3
- new transactional change APIs: ncf_change_(begin|commit|rollback)
ff66b3
- add stdout/stderr to error text when an external program fails
ff66b3
- make error reporting of failed execs more exact/correct
ff66b3
- Remove unnecessary "Requires" of libxml2 and augeas from pkgconfig file
ff66b3
  to pulling in extra packages when building an application that uses netcf.
ff66b3
ff66b3
* Tue Feb 08 2011 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.7-2
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
ff66b3
ff66b3
* Mon Sep 27 2010 Laine Stump <laine@redhat.com> - 0.1.7-1
ff66b3
- New version
ff66b3
ff66b3
* Tue Apr 20 2010 Laine Stump <laine@redhat.com> - 0.1.6-1
ff66b3
- New version
ff66b3
- Remove patch n0001-src-dutil.c-add-missing-includes-for-stat.patch,
ff66b3
  included upstream
ff66b3
ff66b3
* Mon Feb 15 2010 David Lutterkort <lutter@redhat.com> - 0.1.5-2
ff66b3
- patch1: add missing includes for stat in dutil.c
ff66b3
ff66b3
* Mon Nov 30 2009 David Lutterkort <lutter@redhat.com> - 0.1.5-1
ff66b3
- New version
ff66b3
ff66b3
* Thu Nov  5 2009 David Lutterkort <lutter@redhat.com> - 0.1.4-1
ff66b3
- New version
ff66b3
ff66b3
* Tue Oct 27 2009 David Lutterkort <lutter@redhat.com> - 0.1.3-1
ff66b3
- New version
ff66b3
ff66b3
* Fri Sep 25 2009 David Lutterkort <lutter@redhat.com> - 0.1.2-1
ff66b3
- New Version
ff66b3
ff66b3
* Wed Sep 16 2009 David Lutterkort <lutter@redhat.com> - 0.1.1-1
ff66b3
- Remove patch netcf-0.1.0-fix-initialization-of-libxslt.patch,
ff66b3
  included upstream
ff66b3
ff66b3
* Tue Sep 15 2009 Mark McLoughlin <markmc@redhat.com> - 0.1.0-3
ff66b3
- Fix libvirtd segfault caused by libxslt init issue (#523382)
ff66b3
ff66b3
* Sat Jul 25 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.1.0-2
ff66b3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild
ff66b3
ff66b3
* Mon Jul 13 2009 David Lutterkort <lutter@redhat.com> - 0.1.0-1
ff66b3
- BR on augeas-0.5.2
ff66b3
- Drop explicit requires for augeas-libs
ff66b3
ff66b3
* Wed Apr 15 2009 David Lutterkort <lutter@redhat.com> - 0.0.2-1
ff66b3
- Updates acording to Fedora review
ff66b3
ff66b3
* Fri Feb 27 2009 David Lutterkort <lutter@redhat.com> - 0.0.1-1
ff66b3
- Initial specfile