Commit Graph

136 Commits

Author SHA1 Message Date
Daniel P. Berrangé
fe1f2bfbe3 bootstrap: annotate with info about desired replacement
Add a comment against each gnulib module suggesting strategy
for replacement.

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-03 15:42:13 +00:00
Daniel P. Berrangé
86d223a762 bootstrap: remove now unused gnulib modules
* canonicalize-lgpl: replaced by realpath()/g_canonicalize_filename()
* clock-gettime: replaced by g_get_(real|monotonic)_time
* dirname-lgpl: replaced by g_path_get_dirname()
* fclose: we aren't affected by any portability problems it fixes
* fdatasync: every platform we call fdatasync on has it present
* fsync: replaced by g_fsync()
* fnmatch: replaced by g_pattern_match()
* getcwd-lgpl: replaced by g_get_current_dir()
* gethostname: replaced by g_get_hostname()
* gettimeofday: replaced by g_get_(real|monotonic)_time
* setenv: replaced by g_setenv()
* strptime: replaced by GDateTime
* timegm: replaced by GDateTime
* unsetenv: replaced by g_unsetenv()

Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2020-01-03 15:42:13 +00:00
Pavel Hrdina
7a1e10de07 bootstrap.conf: drop usage of c-strcase gnulib module
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-12-10 14:08:55 +01:00
Pavel Hrdina
24f2314491 bootstrap.conf: drop usage of c-type gnulib module
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Cole Robinson <crobinso@redhat.com>
2019-12-10 13:49:24 +01:00
Ján Tomko
73197f9803 gnulib: remove mk*temp modules
After commits 4ac4773040 and
ef88698668, we use the GLib versions
of these functions.

Remove the corresponding gnulib modules.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2019-11-20 13:31:21 +01:00
Pavel Hrdina
f0da677956 bootstrap.conf: drop c-strcasestr gnulib module
Last usage was removed by commit
<41f88886198e231285cc813f8c0687c8ec5c9488> and commit
<0f4d31720430b4e3735064cc0d8f88a1a438e154> forgot to drop include.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Fabiano Fidêncio <fidencio@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-11-20 13:31:13 +01:00
Peter Krempa
2dbf7e2e6d gnulib: Remove use of 'strsep' module
We don't use strsep any more.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
2019-11-20 13:31:01 +01:00
Ján Tomko
dd01eb4fd1 bootstrap: remove regex module
Now that we use GRegex everywhere, there is no need for this module.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2019-11-20 13:30:55 +01:00
Pavel Hrdina
62aa66416a bootstrap.conf: remove usage of snprintf gnulib module
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-11-20 13:29:26 +01:00
Ján Tomko
6250accb8c gnulib: remove use of 'vsnprintf' module
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2019-11-20 13:29:06 +01:00
Ján Tomko
0ebe536144 gnulib: remove use of 'byteswap' module
Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
2019-11-20 13:29:00 +01:00
Peter Krempa
d7234fe317 gnulib: remove 'areadlink' module
Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-11-20 13:28:52 +01:00
Pavel Hrdina
f96395e78e build: mandate use of a build dir != src dir
Historically we've allowed builds in the main src dir, but meson does
not support this. Explicitly force separate build dir in autotools to
align with meson. We must re-enable dependency tracking which the RPM
%configure macro turns off. Without this, the build dir doesn't get
the source directory tree mirrored.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
2019-11-08 17:07:35 +01:00
Daniel P. Berrangé
9b80e0c12a util: drop support for stack traces with logging
The log filters have supported the use of a "+" before the source match
string to request that a stack trace be emitted for every log message:

  commit 548563956e
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Wed May 9 15:18:56 2012 +0100

    Allow stack traces to be included with log messages

    Sometimes it is useful to see the callpath for log messages.
    This change enhances the log filter syntax so that stack traces
    can be show by setting '1:+NAME' instead of '1:NAME'.

With the huge & ever increasing number of logging statements per file,
this will be incredibly verbose and have a major performance penalty.
This makes the feature impractical to use widely and as such it is not
worth the code maint cost.

Removing this seldom used feature allows us to drop the 'execinfo'
module in gnulib which provides the backtrace() function which doesn't
exist on non-Linux.

Users who want to get stack traces of parts of libvirt can use GDB,
or systemtap for live tracing with minimal perf impact.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-18 16:25:17 +01:00
Daniel P. Berrangé
27cb4c1a53 build: remove use of usleep gnulib module in favour of g_usleep
The usleep function was missing on older mingw versions, but we can rely
on it existing everywhere these days. It may only support times upto 1
second in duration though, so we'll prefer to use g_usleep instead.

The commandhelper program is not changed since that can't link to glib.
Fortunately it doesn't need to build on Windows platforms either.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-14 10:54:42 +01:00
Daniel P. Berrangé
c4d18e8b3e util: replace strerror/strerror_r with g_strerror
g_strerror is offers the safety/correctness benefits of strerror_r, with
the API design convenience of strerror.

Use of virStrerror should be eliminated through the codebase in favour
of g_strerror.

commandhelper.c is a special case as its a tiny single threaded test
program, not linked to glib, so it just uses traditional strerror().

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-14 10:54:42 +01:00
Daniel P. Berrangé
6c748c8e2d util: use glib base64 encoding/decoding APIs
Replace use of the gnulib base64 module with glib's own base64 API family.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-14 10:54:42 +01:00
Daniel P. Berrangé
bb9a1a14e2 util: use glib string allocation/formatting functions
Convert the string duplication APIs to use the g_strdup family of APIs.

We previously used the 'strdup-posix' gnulib module because mingw does
not set errno to ENOMEM on failure

We previously used the 'strndup' gnulib module because this function
does not exist on mingw.

We previously used the 'vasprintf' gnulib module because of many GNU
supported format specifiers not working on non-Linux platforms. glib's
own equivalent standardizes on GNU format specifiers too.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-14 10:54:42 +01:00
Daniel P. Berrangé
e85e34f3af util: use glib memory allocation functions
Convert the VIR_ALLOC family of APIs with use of the g_malloc family of
APIs. Use of VIR_ALLOC related functions should be incrementally phased
out over time, allowing return value checks to be dropped. Use of
VIR_FREE should be replaced with auto-cleanup whenever possible.

We previously used the 'calloc-posix' gnulib module because mingw does
not set errno to ENOMEM on failure.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-14 10:54:42 +01:00
Daniel P. Berrangé
56bd0665c7 build: import gnulib's syntax-check make rules
We're going to be eliminating autotools and gnulib, but we still wish to
have the 'make syntax-check' functionality.

This imports the minimal set of gnulib files required to keep this
working.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-09 13:36:29 +01:00
Daniel P. Berrangé
058269e41a build: remove the sched gnulib module
The 'sched' module provides a sched.h header file for platforms which
lack it. We already check for the functions we need in configure, and
protect the use of sched.h where relevant, so don't need the compat
header in libvirt.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 13:39:50 +01:00
Daniel P. Berrangé
735a05dddf build: drop the isatty gnulib module
The isatty gnulib module adds a fix for Win32 platforms where it doesn't
work correctly with character devices like NUL. This is not a compelling
enough problem for libvirt to be concerned with.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 13:39:46 +01:00
Daniel P. Berrangé
09fe607b4d build: drop the ldexp gnulib module
The ldexp gnulib module adds "-lm" to the $LIBS variable if-and-only-if
the ldexp() function require linking to libm. There is no harm in
linking to libm even if it isn't required for ldexp(), so simply drop
the gnulib module.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 13:39:43 +01:00
Daniel P. Berrangé
a605dde1f5 build: drop the ignore-value gnulib module
We don't need to care about very old GCC versions, so implementing the
ignore_value macro directly is not a significant burden.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 13:39:40 +01:00
Daniel P. Berrangé
d5d6dbcfb5 build: remove all gnulib bit manipulation modules
We're using gnulib to get ffs, ffsl, rotl32, count_one_bits,
and count_leading_zeros. Except for rotl32 they can all be
replaced with gcc/clangs builtins. rotl32 is a one-line
trivial function.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 13:39:26 +01:00
Daniel P. Berrangé
5c3575206e build: drop the pthread gnulib module
This was fixing a problem with old versions of mingw which had a
pthread.h that polluted the namespace with random symbols. This is no
longer relevant on our mingw platform targets.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
dcc0e54b25 build: drop the perror gnulib module
This fixes a problem on mingw where it doesn't know how to report
certain errnos defined by POSIX, but not used on Windows. These are
not a real problem for libvirt.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
019fc5c85b build: drop the gitlog-to-changelog gnulib module
The use of this script was discontinued when we stopped providing a full
ChangeLog in the dist with:

  commit ce97c33a79
  Author: Andrea Bolognani <abologna@redhat.com>
  Date:   Mon Apr 1 17:33:03 2019 +0200

    maint: Stop generating ChangeLog from git

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
93e22664bd build: drop the stdarg gnulib module
gnulib fixes a portability problem on AIX which is a platform we have
never targetted.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
80830cb34d Revert "build: use autobuild module to make build logs nicer"
This reverts commit 83aca30f1e.

While the motivation of the original commit is fine, we are intending to
drop autoconf in favour of meson, and similarly wish to drop use of
gnulib. Removing this feature is part of that conversion work.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
cc7cc5b092 util: drop the stpcpy gnulib module
stpcpy returns a pointer to the end of the string just copied
which in theory makes it easier to then copy another string
after it. We only use stpcpy in one place though and that
is trivially rewritten to avoid stpcpy with no loss in code
clarity or efficiency.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
a45fa8000a build: drop the mktempd gnulib module
The mktempd module in gnulib provides an equivalent to 'mktemp -d' on
platforms which lack this shell command. All platforms on which libvirt
runs the affected tests have 'mktemp -d' support, so the gnulib module
is not required.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
a88cfcf64f build: drop the inet_pton gnulib module
All use of this function was purged a long time ago in favour
of getaddrinfo

  commit a8ae7d19f4
  Author: Daniel P. Berrange <berrange@redhat.com>
  Date:   Thu Oct 21 11:13:05 2010 +0100

    Remove all use of inet_pton and inet_ntop

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
de3c1d2f53 build: drop the getopt-posix gnulib module
The getopt-posix module fixes a problem with optind being incorrectly
set after a failed option parse. It was also previously used to allow
the bhyve driver to access a private internal reentrant getopt impl.
None of this matters to libvirt code any more.

This partially reverts

  commit b436a8ae5c
  Author: Fabian Freyer <fabian.freyer@physik.tu-berlin.de>
  Date:   Thu Jun 9 00:50:35 2016 +0000

    gnulib: add getopt module

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-10-07 11:34:24 +01:00
Daniel P. Berrangé
ad6189389d gnulib: remove uneccessary func module
The gnulib 'func' modules provides portability to compilers which lack
the '__func__' symbol. We only care about GCC and CLang compilers so do
not need this compatibility code.

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-09-20 15:02:37 +01:00
Daniel P. Berrangé
b56ce7b85d gnulib: remove unused secure_getenv function replacement
We removed use of the secure_getenv recently in

  commit 2b0d597670
  Author: Daniel P. Berrangé <berrange@redhat.com>
  Date:   Thu Aug 1 13:35:56 2019 +0100

    util: get rid of virGetEnv{Allow,Block}SUID functions

Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2019-09-20 15:02:27 +01:00
Andrea Bolognani
ce97c33a79 maint: Stop generating ChangeLog from git
Our ChangeLog is generated by basically redirecting the output
of 'git log' into it so, as can be expected, it has only gotten
bigger as development has progressed. As of today, its size has
reached pretty much comical levels:

  $ du -sk ChangeLog
  11328 ChangeLog

All of that for information *literally nobody* cares about: end
users and distro maintainers have proper release notes lovingly
compiled for them, while developers peruse the history either by
calling 'git log' directly or through their favorite $EDITOR's
git integration.

Replacing the generated ChangeLog with a short message pointing
interested parties to the git repository does not only reduce
the size of the unpacked sources from 259904 KiB to 248576 KiB
(~4% saving): from a quick test on my laptop, doing so reduces
the size of the *compressed* release archive from 15140 KiB to
12364 KiB (~18% saving) and also takes the time needed to run
'make distcheck' down from 4:44 to 4:21 (~8% saving).

Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
2019-04-03 09:45:25 +02:00
Thomas Huth
70d9c1a768 bootstrap.conf: Fix LGPL information
The bootstrap.conf is licensed under the terms of the LGPL, but then
suggests to "See the GNU General Public License for more details".
That should be the "GNU Lesser General Public License" instead, of
course.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Ján Tomko <jtomko@redhat.com>
2019-01-25 14:04:19 +01:00
Simon Kobyda
e950310f14 vsh: Fix broken build on mingw
The function wcwidth() doesn't exist on mingw. However, it does exist in
gnulib, so we can rely on that.

Signed-off-by: Simon Kobyda <skobyda@redhat.com>
Reviewed-by: Erik Skultety <eskultet@redhat.com>
2018-08-28 08:31:32 +02:00
Michal Privoznik
60da4a1148 virrandom: Make virRandomBits better
Now that we have strong PRNG generator implemented in
virRandomBytes() let's use that instead of gnulib's random_r.

Problem with the latter is in way we seed it: current UNIX time
and libvirtd's PID are not that random as one might think.
Imagine two hosts booting at the same time. There's a fair chance
that those hosts spawn libvirtds at the same time and with the
same PID. This will result in both daemons generating the same
sequence of say MAC addresses [1].

1: https://www.redhat.com/archives/libvirt-users/2018-May/msg00097.html

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2018-06-05 10:31:19 +02:00
Ján Tomko
799011bbe7 vircrypto: Rely on GnuTLS for hash functions
Ditch the use of gnulib's digest functions in favor of GnuTLS,
which might be more likely to get FIPS-certified.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
2018-05-14 14:05:21 +02:00
Daniel P. Berrangé
c0a8ea450d po: provide custom make rules for po file management
Historically we have relied on autopoint/gettextize to install a
standard po/Makefile.in.in. There is very limited scope for customizing
this and it also causes a bunch of extra stuff to be pulled into
configure.ac which potentially clashes with gnulib. Writing make rules
for po file management is no more difficult than any other rules libvirt
has, so stop using autopoint/gettextize.

Reviewed-by: Ján Tomko <jtomko@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-19 10:35:58 +01:00
Ján Tomko
ad9e72f5fa hvsupport: use a regex instead of XML::XPath
When generating the hvsupport.html.in file, we parse the -api.xml
files generated by apibuild.py to know in which HTML file the API
function is.

Doing an XPath query for every single 'function' element in the
file is inefficient.

Since the XML file is generated by another of our build scripts
(apibuild.py, using Python's standard 'output.write' XML library),
just find the function name->file mapping by a regex upfront.

Also add a note about this next to the line that generates it
in apibuild.py and do not check if XML::XPath is installed in
bootstrap since we no longer use it.
2016-07-19 18:42:44 +02:00
Fabian Freyer
b436a8ae5c gnulib: add getopt module
Unconditionally use gnulib's getopt module. This is needed by the bhyve driver
to provide a reentrant interface for getopt.

Several gnulib headers rely on features.h being included by ctype.h to provide
__GNUC_PREREQ, but on systems without glibc, this is not provided. In these
cases __GNUC_PREREQ gets redefined to 0, which causes build errors from checks
in src/internal.h.
Therefore, define __GNUC_PREREQ as early as possible. config-post.h is probably
the first header that is included, before any other headers.
2016-07-10 15:39:44 -04:00
Michal Privoznik
b099aa88e9 build: use gnulib's unsetenv
Now that gnulib has lifted it's licensing of unsetenv, we should
use it. Just like we use its counterpart - setenv, already.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2016-05-28 23:13:26 +02:00
Michal Privoznik
713994bd5e bootstrap: Don't require python-config
We've split the python bindings a long time ago. However,
we are still requiring python-config (as an obfuscation to
python-devel). This does not make any sense. The only thing
we need is python, not python-devel.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
2015-08-06 14:35:14 +02:00
Jim Fehlig
d2f80a772f Revert "bootstrap.conf: add check for flex"
This reverts commit cab767831f.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
2015-01-12 10:14:30 -07:00
Pavel Hrdina
cab767831f bootstrap.conf: add check for flex
We need the flex to generate new xen_xl_disk parser.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2015-01-08 17:23:57 +01:00
Martin Kletzander
e9e5eee5a8 build: Move check for XML::XPath into bootstrap
The module XML::XPath is needed when building from git only (no need to
have it when building from tarball), so this patch moves the check from
specfile into bootstrap.conf.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
2014-12-09 08:23:21 +01:00
Pavel Hrdina
ff28ebf136 internal: add macro to round value to the next closest power of 2
There are two special cases, if the input number is 0 or the number is
larger then 2^31 (for 32bit unsigned int). For the special cases the
return value is 0 because they cannot be rounded.

Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
2014-11-24 22:05:55 +01:00