File: netcf.spec.in

package info (click to toggle)
netcf 1%3A0.2.8-1.1
  • links: PTS
  • area: main
  • in suites: bullseye
  • size: 7,172 kB
  • sloc: ansic: 44,029; sh: 13,424; xml: 1,039; makefile: 248
file content (332 lines) | stat: -rw-r--r-- 10,116 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
Name:           netcf
Version:        @VERSION@
Release:        1%{?dist}%{?extra_release}
Summary:        Cross-platform network configuration library

Group:          System Environment/Libraries
License:        LGPLv2+
URL:            https://fedorahosted.org/netcf/
Source0:        https://fedorahosted.org/released/%{name}/%{name}-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

# Patches
# One patch per line, in this format:
# Patch001: file1.patch
# Patch002: file2.patch
# ...
#
# The patches will automatically be put into the build source tree
# during the %prep stage (using git, which is now required for an rpm
# build)
#

# Default to skipping autoreconf.  Distros can change just this one
# line (or provide a command-line override) if they backport any
# patches that touch configure.ac or Makefile.am.
%{!?enable_autotools:%define enable_autotools 0}

# git is used to build a source tree with patches applied (see the
# %prep section)
BuildRequires: git

# Fedora 20 / RHEL-7 are where netcf first uses systemd. Although earlier
# Fedora has systemd, netcf still used sysvinit there.
%if 0%{?fedora} >= 20 || 0%{?rhel} >= 7
    %define with_systemd 1
%else
    %define with_systemd 0
%endif

%if %{with_systemd}
BuildRequires: systemd
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%endif
%if 0%{?enable_autotools}
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: gettext-devel
BuildRequires: libtool
BuildRequires: /usr/bin/pod2man
%endif

BuildRequires:  readline-devel augeas-devel >= 0.5.2
BuildRequires:  libxml2-devel libxslt-devel

# force the --with-libnl1 option on F17/RHEL6 and earlier
%if (0%{?fedora} && 0%{?fedora} < 18) || (0%{?rhel} && 0%{?rhel} < 7)
%define with_libnl1 1
%else
%define with_libnl1 0
%endif

# require libnl3 on F18/RHEL7 and later
%if 0%{?fedora} >= 18 || 0%{?rhel} >= 7
BuildRequires:  libnl3-devel
%else
BuildRequires:  libnl-devel
%endif

Requires:       %{name}-libs = %{version}-%{release}

Provides: bundled(gnulib)

%description
Netcf is a library used to modify the network configuration of a
system. Network configurations are expressed in a platform-independent
XML format, which netcf translates into changes to the system's
'native' network configuration files.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries
Requires:       %{name}-libs = %{version}-%{release}
Requires:       pkgconfig

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package        libs
Summary:        Libraries for %{name}
Group:          System Environment/Libraries

# bridge-utils is needed because /sbin/ifup calls brctl
# if you create a bridge device
Requires:       bridge-utils

%description    libs
The libraries for %{name}.

%prep
%setup -q

# Patches have to be stored in a temporary file because RPM has
# a limit on the length of the result of any macro expansion;
# if the string is longer, it's silently cropped
%{lua:
    tmp = os.tmpname();
    f = io.open(tmp, "w+");
    count = 0;
    for i, p in ipairs(patches) do
        f:write(p.."\n");
        count = count + 1;
    end;
    f:close();
    print("PATCHCOUNT="..count.."\n")
    print("PATCHLIST="..tmp.."\n")
}

git init -q
git config user.name rpm-build
git config user.email rpm-build
git config gc.auto 0
git add .
git commit -q -a --author 'rpm-build <rpm-build>' \
           -m '%{name}-%{version} base'

COUNT=$(grep '\.patch$' $PATCHLIST | wc -l)
if [ $COUNT -ne $PATCHCOUNT ]; then
    echo "Found $COUNT patches in $PATCHLIST, expected $PATCHCOUNT"
    exit 1
fi
if [ $COUNT -gt 0 ]; then
    xargs git am <$PATCHLIST || exit 1
fi
echo "Applied $COUNT patches"
rm -f $PATCHLIST


%build
%if %{with_libnl1}
%define _with_libnl1 --with-libnl1
%endif
%if %{with_systemd}
    %define sysinit --with-sysinit=systemd
%else
    %define sysinit --with-sysinit=initscripts
%endif


%if 0%{?enable_autotools}
 autoreconf -if
%endif

%configure --disable-static \
           %{?_with_libnl1} \
           %{sysinit}
make %{?_smp_mflags}

%install
make install DESTDIR=$RPM_BUILD_ROOT SYSTEMD_UNIT_DIR=%{_unitdir} \
     INSTALL="%{__install} -p"
find $RPM_BUILD_ROOT -name '*.la' -delete

%preun libs

%if %{with_systemd}
    %systemd_preun netcf-transaction.service
%else
if [ $1 = 0 ]; then
    /sbin/chkconfig --del netcf-transaction
fi
%endif

%post libs

/sbin/ldconfig
%if %{with_systemd}
    %systemd_post netcf-transaction.service
    /bin/systemctl --no-reload enable netcf-transaction.service >/dev/null 2>&1 || :
%else
/sbin/chkconfig --add netcf-transaction
%endif

%postun libs

/sbin/ldconfig
%if %{with_systemd}
    %systemd_postun netcf-transaction.service
%endif

%files
%{_bindir}/ncftool
%{_mandir}/man1/ncftool.1*

%files libs
%{_datadir}/netcf
%{_libdir}/*.so.*
%if %{with_systemd}
%{_unitdir}/netcf-transaction.service
%else
%{_sysconfdir}/rc.d/init.d/netcf-transaction
%endif
%attr(0755, root, root) %{_libexecdir}/netcf-transaction.sh
%doc AUTHORS COPYING NEWS

%files devel
%doc
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/netcf.pc

%changelog
* Wed Apr 08 2015 Laine Stump <laine@redhat.com> - 0.2.8-1
 - Fix build on systems with newer libnl3 that doesn't
   #include <linux/if.h>

* Fri Apr 03 2015 Laine Stump <laine@redhat.com> - 0.2.7-1
 - resolve CVE-2014-8119
 - support multiple IPv4 addresses in interface config (redhat driver)
 - allow static IPv4 config simultaneous with DHCPv4 (redhat driver)
 - recognize IPADDR0/NETMASK0/PREFIX0
 - remove extra quotes from IPV6ADDR_SECONDARIES (redhat+suse drivers)
 - miscellaneous systemd service fixes
 - use git to apply patches in rpm specfile

* Fri Aug 22 2014 Laine Stump <laine@redhat.com> - 0.2.6-1
 - allow interleaved elements in interface XML schema
 - allow <link> element in vlan and bond interfaces

* Wed Aug 20 2014 Laine Stump <laine@redhat.com> - 0.2.5-1
 - report link state/speed in interface status
 - change DHCPv6 to DHCPV6C in ifcfg files
 - max vlan id is 4095, not 4096

* Wed May 14 2014 Laine Stump <laine@redhat.com> - 0.2.4-1
 - wait for IFF_UP and IFF_RUNNING after calling ifup
 - don't require IFF_RUNNING for bridge devices
 - avoid memory leak in debian when listing interfaces
 - avoid use of uninitialized data when getting mac address
   (fixes https://bugzilla.redhat.com/show_bug.cgi?id=1046594 )
 - limit interface names to IFNAMSIZ-1 characters in length
 - support systemd for netcf-transaction

* Fri Dec 21 2012 Laine Stump <laine@redhat.com> - 0.2.3-1
- eliminate calls to nl_cache_mngt_provide(), to avoid
  non-threadsafe code in libnl (and because it isn't needed
  anyway) (This non-threadsafe code could lead to a segfault)
- portability fixes for FreeBSD
- fix bug when a config file has two config parameters with
  identical names
- add HACKING document
- always bail immediately if get_augeas fails (doing otherwise
  could lead to a segfault)

* Sat Aug 25 2012 Laine Stump <laine@redhat.com> - 0.2.2-1
- specfile: require libnl3-devel for rpm builds on Fedora 18+ and
  RHEL7+. Likewise, force libnl1 for F17- and RHEL6.x-, even if
  libnl3-devel is installed.

* Fri Aug 10 2012 Laine Stump <laine@redhat.com> - 0.2.1-1
- update gnulib to fix broken build on systems with nwer glibc (which no
  longer provides gets()).
- add ncftool manpage
- interfaces are only "active" if both UP and RUNNING.

* Fri Jul 20 2012 Laine Stump <laine@redhat.com> - 0.2.0-1
- add support for Ubuntu, debian, and Suse Linux. Also an
  unfinished port for MS Windows.
- added support for libnl-3 (which is incompatible with libnl-1 -
  netcf will use whichever is available, preferring libnl-3 unless
  told otherwise during configure stage)
- add "bundled(gnulib)" to specfile to indicate that we use a local
  copy of gnulib sources (used by Fedora/RHEL when determining the scope
  of security bugs).
- Fix ipcalc_netmask, which was trimming off the last digit in
  character representations of full-length netmasks (all 4 octets
  having 3 chars each)
- other minor bugfixes

* Tue Jul 26 2011 Laine Stump <laine@redhat.com> - 0.1.9-1
- always add <bridge> element to bridge, even if there is no physdev present
- don't log error if interface isn't found in kernel during status report
- allow building with C++
- update gnulib

* Fri Jun  3 2011 Laine Stump <laine@redhat.com> - 0.1.8-1
- new transactional change APIs: ncf_change_(begin|commit|rollback)
- add stdout/stderr to error text when an external program fails
- make error reporting of failed execs more exact/correct
- add "--system" to autogen.sh - sets all directories for standard system
  install.
- change sysconfdir and localstatedir during config if basedir is /usr.
- Remove unnecessary "Requires" of libxml2 and augeas from pkgconfig file
  to pulling in extra packages when building an application that uses netcf.
- Reorganize code to simplify porting to other platforms.

* Fri Sep 24 2010 Laine Stump <laine@redhat.com> - 0.1.7-1
- remove code that modifies iptables config for bridges
- register gnulib as a proper submodule
- don't delete physical interface config when defining a vlan
- properly handle quoted entries in sysconfig files.
- make miimon/arpmon optional

* Fri Apr 16 2010 Laine Stump <laine@redhat.com> - 0.1.6-1
- New version

* Mon Nov 30 2009 David Lutterkort <lutter@redhat.com> - 0.1.5-1
- New version

* Thu Nov  5 2009 David Lutterkort <lutter@redhat.com> - 0.1.4-1
- New version

* Tue Oct 27 2009 David Lutterkort <lutter@redhat.com> - 0.1.3-1
- New version

* Fri Sep 25 2009 David Lutterkort <lutter@redhat.com> - 0.1.2-1
- New Version

* Wed Sep 16 2009 David Lutterkort <lutter@redhat.com> - 0.1.1-1
- New Version

* Mon Jul 13 2009 David Lutterkort <lutter@redhat.com> - 0.1.0-1
- BR on augeas-0.5.2
- Drop explicit requires for augeas-libs

* Wed Apr 15 2009 David Lutterkort <lutter@redhat.com> - 0.0.2-1
- Updates acording to Fedora review

* Fri Feb 27 2009 David Lutterkort <lutter@redhat.com> - 0.0.1-1
- Initial specfile