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