Augeas >= 1.0.0 is now required.

This commit is contained in:
Richard W.M. Jones
2013-06-18 14:39:55 +01:00
parent 2ee4d5e059
commit 2c4e7ad135
4 changed files with 11 additions and 49 deletions

4
README
View File

@@ -100,6 +100,8 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| libxml2 | | R | Popular XML library. |
+--------------+-------------+---+-----------------------------------------+
| augeas | 1.0.0 | R | |
+--------------+-------------+---+-----------------------------------------+
| po4a | |R/O| Required if compiling from git. |
| | | | Optional if compiling from tarball. |
| | | | For localizing man pages. |
@@ -120,8 +122,6 @@ The full requirements are described below.
| libselinux | | O | Used by the libvirt backend to securely |
| | | | confine the appliance (sVirt). |
+--------------+-------------+---+-----------------------------------------+
| augeas | 0.5.0 | O | To inspect configuration of Linux guests.
+--------------+-------------+---+-----------------------------------------+
| db utils | | O | db_dump, db_load etc. Usually found in |
| | | | a package called db-utils, db4-utils, |
| | | | db4.X-utils, Berkeley DB utils, etc. |

View File

@@ -550,19 +550,6 @@ AM_CONDITIONAL([HAVE_XDR_U_INT64_T],
AM_CONDITIONAL([HAVE_XDR_UINT64_T],
[test "x$ac_cv_search_xdr_uint64_t" != "xno"])
dnl Check for Augeas (optional).
PKG_CHECK_MODULES([AUGEAS],[augeas],[
AC_SUBST([AUGEAS_CFLAGS])
AC_SUBST([AUGEAS_LIBS])
AC_DEFINE([HAVE_AUGEAS],[1],[Define to 1 if you have Augeas.])
old_LIBS="$LIBS"
LIBS="$LIBS $AUGEAS_LIBS"
dnl Check for functions not available in earlier versions of Augeas.
AC_CHECK_FUNCS([aug_load aug_defvar aug_defnode])
LIBS="$old_LIBS"
],[AC_MSG_WARN([augeas not found, some core features will be disabled])])
dnl Check for libselinux (optional).
AC_CHECK_HEADERS([selinux/selinux.h])
AC_CHECK_LIB([selinux],[setexeccon],[
@@ -816,6 +803,9 @@ AS_IF([test "x$with_readline" != xno],[
dnl Check for PCRE (required)
PKG_CHECK_MODULES([PCRE], [libpcre])
dnl Check for Augeas >= 1.0.0 (required).
PKG_CHECK_MODULES([AUGEAS],[augeas >= 1.0.0])
dnl libmagic (highly recommended)
AC_CHECK_LIB([magic],[magic_file],[
AC_CHECK_HEADER([magic.h],[

View File

@@ -23,15 +23,18 @@
#include <string.h>
#include <unistd.h>
#ifdef HAVE_AUGEAS
#include <augeas.h>
#endif
#include "daemon.h"
#include "actions.h"
#include "optgroups.h"
#ifdef HAVE_AUGEAS
int
optgroup_augeas_available (void)
{
return 1;
}
/* The Augeas handle. We maintain a single handle per daemon, which
* is all that is necessary and reduces the complexity of the API
* considerably.
@@ -58,12 +61,6 @@ aug_finalize (void)
} \
while (0)
int
optgroup_augeas_available (void)
{
return 1;
}
/* We need to rewrite the root path so it is based at /sysroot. */
int
do_aug_init (const char *root, int flags)
@@ -105,7 +102,6 @@ do_aug_close (void)
int
do_aug_defvar (const char *name, const char *expr)
{
#ifdef HAVE_AUG_DEFVAR
int r;
NEED_AUG (-1);
@@ -116,16 +112,11 @@ do_aug_defvar (const char *name, const char *expr)
return -1;
}
return r;
#else
reply_with_error ("function not available");
return -1;
#endif
}
guestfs_int_int_bool *
do_aug_defnode (const char *name, const char *expr, const char *val)
{
#ifdef HAVE_AUG_DEFNODE
guestfs_int_int_bool *r;
int i, created;
@@ -147,10 +138,6 @@ do_aug_defnode (const char *name, const char *expr, const char *val)
r->b = created;
return r;
#else
reply_with_error ("function not available");
return NULL;
#endif
}
char *
@@ -317,7 +304,6 @@ do_aug_save (void)
int
do_aug_load (void)
{
#ifdef HAVE_AUG_LOAD
NEED_AUG (-1);
if (aug_load (aug) == -1) {
@@ -326,10 +312,6 @@ do_aug_load (void)
}
return 0;
#else
reply_with_error ("function not available");
return -1;
#endif
}
/* Simpler version of aug-match, which also sorts the output. */
@@ -375,9 +357,3 @@ do_aug_ls (const char *path)
sort_strings (matches, count_strings ((void *) matches));
return matches; /* Caller frees. */
}
#else /* !HAVE_AUGEAS */
OPTGROUP_AUGEAS_NOT_AVAILABLE
#endif

View File

@@ -1525,10 +1525,6 @@ inspect_with_augeas (guestfs_h *g, struct inspect_fs *fs,
}
}
/* If !feature_available (g, "augeas") then the next call will fail.
* Arguably we might want to fall back to a non-Augeas method in
* this case.
*/
if (guestfs_aug_init (g, "/", 16|32) == -1)
return -1;