From: Hilko Bengen Date: Sun, 7 Jan 2024 18:10:21 +0000 (+0100) Subject: New upstream version 1.52.0 X-Git-Tag: archive/raspbian/1.52.3-1+rpi1^2^2^2^2~6^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=f51ac7861bbf7c8c4b69124861d4da6a32b65281;p=guestfs-tools.git New upstream version 1.52.0 --- diff --git a/.gitignore b/.gitignore index da2a026..c0ca330 100644 --- a/.gitignore +++ b/.gitignore @@ -30,7 +30,6 @@ Makefile.in /bash/virt-cat /bash/virt-customize /bash/virt-df -/bash/virt-dib /bash/virt-diff /bash/virt-drivers /bash/virt-edit @@ -95,10 +94,8 @@ Makefile.in /customize/test-settings-*.sh /customize/virt-customize /df/virt-df -/dib/.depend -/dib/output_format_*.mli -/dib/virt-dib /drivers/.depend +/drivers/hwdata_config.ml /drivers/virt-drivers /diff/virt-diff /edit/virt-edit diff --git a/Makefile.am b/Makefile.am index 311789e..ca1fc03 100644 --- a/Makefile.am +++ b/Makefile.am @@ -60,7 +60,6 @@ SUBDIRS += get-kernel SUBDIRS += resize SUBDIRS += sparsify SUBDIRS += sysprep -SUBDIRS += dib endif # bash-completion @@ -121,7 +120,7 @@ po/POTFILES: configure.ac po/POTFILES-ml: configure.ac rm -f $@ $@-t cd $(srcdir); \ - find builder common/ml* customize dib drivers get-kernel resize sparsify sysprep -name '*.ml' | \ + find builder common/ml* customize drivers get-kernel resize sparsify sysprep -name '*.ml' | \ grep -v '^builder/templates/' | \ grep -v '^common/mlv2v/' | \ grep -v -E '.*_tests\.ml$$' | \ diff --git a/Makefile.in b/Makefile.in index c4aceb8..706fc95 100644 --- a/Makefile.in +++ b/Makefile.in @@ -134,8 +134,7 @@ host_triplet = @host@ # OCaml tools. Note 'common/ml*' and 'customize' contain shared code # used by other OCaml tools, so these must come first. @HAVE_OCAML_TRUE@am__append_3 = customize builder builder/templates \ -@HAVE_OCAML_TRUE@ drivers get-kernel resize sparsify sysprep \ -@HAVE_OCAML_TRUE@ dib +@HAVE_OCAML_TRUE@ drivers get-kernel resize sparsify sysprep # Perl tools. @HAVE_TOOLS_TRUE@am__append_4 = win-reg @@ -434,7 +433,7 @@ DIST_SUBDIRS = gnulib/lib common/utils common/structs \ common/mlvisit common/mlxml common/mltools common/mldrivers \ common/mlcustomize test-data align cat diff df edit format \ inspector make-fs customize builder builder/templates drivers \ - get-kernel resize sparsify sysprep dib bash win-reg docs po \ + get-kernel resize sparsify sysprep bash win-reg docs po \ po-docs am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \ $(srcdir)/config.sh.in $(srcdir)/ocaml-dep.sh.in \ @@ -536,6 +535,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -686,6 +686,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ @@ -1487,7 +1489,7 @@ po/POTFILES: configure.ac po/POTFILES-ml: configure.ac rm -f $@ $@-t cd $(srcdir); \ - find builder common/ml* customize dib drivers get-kernel resize sparsify sysprep -name '*.ml' | \ + find builder common/ml* customize drivers get-kernel resize sparsify sysprep -name '*.ml' | \ grep -v '^builder/templates/' | \ grep -v '^common/mlv2v/' | \ grep -v -E '.*_tests\.ml$$' | \ diff --git a/README b/README index 47a4783..2148f90 100644 --- a/README +++ b/README @@ -5,7 +5,7 @@ images. For more information see the home page: For discussion, development, patches, etc. please use the mailing list: - http://www.redhat.com/mailman/listinfo/libguestfs + https://lists.libguestfs.org Copyright (C) 2009-2023 Red Hat Inc. diff --git a/aclocal.m4 b/aclocal.m4 index 7add24f..ea7165c 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -20,8 +20,82 @@ You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) -# gettext.m4 serial 72 (gettext-0.21.1) -dnl Copyright (C) 1995-2014, 2016, 2018-2020 Free Software Foundation, Inc. +# build-to-host.m4 serial 1 +dnl Copyright (C) 2023 Free Software Foundation, Inc. +dnl This file is free software; the Free Software Foundation +dnl gives unlimited permission to copy and/or distribute it, +dnl with or without modifications, as long as this notice is preserved. + +dnl Written by Bruno Haible. + +dnl When the build environment ($build_os) is different from the target runtime +dnl environment ($host_os), file names may need to be converted from the build +dnl environment syntax to the target runtime environment syntax. This is +dnl because the Makefiles are executed (mostly) by build environment tools and +dnl therefore expect file names in build environment syntax, whereas the runtime +dnl expects file names in target runtime environment syntax. +dnl +dnl For example, if $build_os = cygwin and $host_os = mingw32, filenames need +dnl be converted from Cygwin syntax to native Windows syntax: +dnl /cygdrive/c/foo/bar -> C:\foo\bar +dnl /usr/local/share -> C:\cygwin64\usr\local\share +dnl +dnl gl_BUILD_TO_HOST([somedir]) +dnl This macro takes as input an AC_SUBSTed variable 'somedir', which must +dnl already have its final value assigned, and produces two additional +dnl AC_SUBSTed variables 'somedir_c' and 'somedir_c_make', that designate the +dnl same file name value, just in different syntax: +dnl - somedir_c is the file name in target runtime environment syntax, +dnl as a C string (starting and ending with a double-quote, +dnl and with escaped backslashes and double-quotes in +dnl between). +dnl - somedir_c_make is the same thing, escaped for use in a Makefile. + +AC_DEFUN([gl_BUILD_TO_HOST], +[ + AC_REQUIRE([AC_CANONICAL_BUILD]) + AC_REQUIRE([AC_CANONICAL_HOST]) + AC_REQUIRE([gl_BUILD_TO_HOST_INIT]) + + dnl Define somedir_c. + gl_final_[$1]="$[$1]" + dnl Translate it from build syntax to host syntax. + case "$build_os" in + cygwin*) + case "$host_os" in + mingw*) + gl_final_[$1]=`cygpath -w "$gl_final_[$1]"` ;; + esac + ;; + esac + dnl Convert it to C string syntax. + [$1]_c=`echo "$gl_final_[$1]" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes"` + [$1]_c='"'"$[$1]_c"'"' + AC_SUBST([$1_c]) + + dnl Define somedir_c_make. + [$1]_c_make=`echo "$[$1]_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2"` + dnl Use the substituted somedir variable, when possible, so that the user + dnl may adjust somedir a posteriori when there are no special characters. + if test "$[$1]_c_make" = '\"'"${gl_final_[$1]}"'\"'; then + [$1]_c_make='\"$([$1])\"' + fi + AC_SUBST([$1_c_make]) +]) + +dnl Some initializations for gl_BUILD_TO_HOST. +AC_DEFUN([gl_BUILD_TO_HOST_INIT], +[ + gl_sed_double_backslashes='s/\\/\\\\/g' + gl_sed_escape_doublequotes='s/"/\\"/g' +changequote(,)dnl + gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" +changequote([,])dnl + gl_sed_escape_for_make_2='s,\$,\\$$,g' +]) + +# gettext.m4 serial 77 (gettext-0.22) +dnl Copyright (C) 1995-2014, 2016, 2018-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -42,11 +116,13 @@ dnl Bruno Haible , 2000-2006, 2008-2010. dnl Macro to add for using GNU gettext. dnl Usage: AM_GNU_GETTEXT([INTLSYMBOL], [NEEDSYMBOL], [INTLDIR]). -dnl INTLSYMBOL must be one of 'external', 'use-libtool'. -dnl INTLSYMBOL should be 'external' for packages other than GNU gettext, and -dnl 'use-libtool' for the packages 'gettext-runtime' and 'gettext-tools'. -dnl If INTLSYMBOL is 'use-libtool', then a libtool library -dnl $(top_builddir)/intl/libintl.la will be created (shared and/or static, +dnl INTLSYMBOL must be one of 'external', 'use-libtool', 'here'. +dnl INTLSYMBOL should be 'external' for packages other than GNU gettext. +dnl It should be 'use-libtool' for the packages 'gettext-runtime' and +dnl 'gettext-tools'. +dnl It should be 'here' for the package 'gettext-runtime/intl'. +dnl If INTLSYMBOL is 'here', then a libtool library +dnl $(top_builddir)/libintl.la will be created (shared and/or static, dnl depending on --{enable,disable}-{shared,static} and on the presence of dnl AM-DISABLE-SHARED). dnl If NEEDSYMBOL is specified and is 'need-ngettext', then GNU gettext @@ -77,24 +153,21 @@ dnl AC_DEFUN([AM_GNU_GETTEXT], [ dnl Argument checking. - m4_if([$1], [], , [m4_if([$1], [external], , [m4_if([$1], [use-libtool], , + m4_if([$1], [], , [m4_if([$1], [external], , [m4_if([$1], [use-libtool], , [m4_if([$1], [here], , [errprint([ERROR: invalid first argument to AM_GNU_GETTEXT -])])])]) +])])])])]) m4_if(m4_if([$1], [], [old])[]m4_if([$1], [no-libtool], [old]), [old], [errprint([ERROR: Use of AM_GNU_GETTEXT without [external] argument is no longer supported. ])]) m4_if([$2], [], , [m4_if([$2], [need-ngettext], , [m4_if([$2], [need-formatstring-macros], , [errprint([ERROR: invalid second argument to AM_GNU_GETTEXT ])])])]) - define([gt_included_intl], - m4_if([$1], [external], [no], [yes])) + define([gt_building_libintl_in_same_build_tree], + m4_if([$1], [use-libtool], [yes], [m4_if([$1], [here], [yes], [no])])) gt_NEEDS_INIT AM_GNU_GETTEXT_NEED([$2]) AC_REQUIRE([AM_PO_SUBDIRS])dnl - m4_if(gt_included_intl, yes, [ - AC_REQUIRE([AM_INTL_SUBDIR])dnl - ]) dnl Prerequisites of AC_LIB_LINKFLAGS_BODY. AC_REQUIRE([AC_LIB_PREPARE_PREFIX]) @@ -104,13 +177,13 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl Ideally we would do this search only after the dnl if test "$USE_NLS" = "yes"; then dnl if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then - dnl tests. But if configure.in invokes AM_ICONV after AM_GNU_GETTEXT + dnl tests. But if configure.ac invokes AM_ICONV after AM_GNU_GETTEXT dnl the configure script would need to contain the same shell code dnl again, outside any 'if'. There are two solutions: dnl - Invoke AM_ICONV_LINKFLAGS_BODY here, outside any 'if'. dnl - Control the expansions in more detail using AC_PROVIDE_IFELSE. dnl Since AC_PROVIDE_IFELSE is not documented, we avoid it. - m4_if(gt_included_intl, yes, , [ + m4_if(gt_building_libintl_in_same_build_tree, yes, , [ AC_REQUIRE([AM_ICONV_LINKFLAGS_BODY]) ]) @@ -120,8 +193,7 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl Set USE_NLS. AC_REQUIRE([AM_NLS]) - m4_if(gt_included_intl, yes, [ - BUILD_INCLUDED_LIBINTL=no + m4_if(gt_building_libintl_in_same_build_tree, yes, [ USE_INCLUDED_LIBINTL=no ]) LIBINTL= @@ -140,7 +212,7 @@ AC_DEFUN([AM_GNU_GETTEXT], dnl If we use NLS figure out what method if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no - m4_if(gt_included_intl, yes, [ + m4_if(gt_building_libintl_in_same_build_tree, yes, [ AC_MSG_CHECKING([whether included gettext is requested]) AC_ARG_WITH([included-gettext], [ --with-included-gettext use the GNU gettext library included here], @@ -196,7 +268,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then dnl Sometimes libintl requires libiconv, so first search for libiconv. - m4_if(gt_included_intl, yes, , [ + m4_if(gt_building_libintl_in_same_build_tree, yes, , [ AM_ICONV_LINK ]) dnl Search for libintl and define LIBINTL, LTLIBINTL and INCINTL @@ -274,7 +346,8 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ - && test "$PACKAGE" != gettext-tools; }; then + && test "$PACKAGE" != gettext-tools \ + && test "$PACKAGE" != libintl; }; then gt_use_preinstalled_gnugettext=yes else dnl Reset the values set by searching for libintl. @@ -283,7 +356,7 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION INCINTL= fi - m4_if(gt_included_intl, yes, [ + m4_if(gt_building_libintl_in_same_build_tree, yes, [ if test "$gt_use_preinstalled_gnugettext" != "yes"; then dnl GNU gettext is not found in the C library. dnl Fall back on included GNU gettext library. @@ -293,7 +366,6 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION if test "$nls_cv_use_gnu_gettext" = "yes"; then dnl Mark actions used to generate GNU NLS library. - BUILD_INCLUDED_LIBINTL=yes USE_INCLUDED_LIBINTL=yes LIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LIBICONV $LIBTHREAD" LTLIBINTL="m4_if([$3],[],\${top_builddir}/intl,[$3])/libintl.la $LTLIBICONV $LTLIBTHREAD" @@ -363,25 +435,39 @@ return * gettext ("")$gt_expression_test_code + __GNU_GETTEXT_SYMBOL_EXPRESSION POSUB=po fi - m4_if(gt_included_intl, yes, [ - dnl In GNU gettext we have to set BUILD_INCLUDED_LIBINTL to 'yes' - dnl because some of the testsuite requires it. - BUILD_INCLUDED_LIBINTL=yes - + m4_if(gt_building_libintl_in_same_build_tree, yes, [ dnl Make all variables we use known to autoconf. - AC_SUBST([BUILD_INCLUDED_LIBINTL]) AC_SUBST([USE_INCLUDED_LIBINTL]) AC_SUBST([CATOBJEXT]) ]) - dnl For backward compatibility. Some Makefiles may be using this. - INTLLIBS="$LIBINTL" - AC_SUBST([INTLLIBS]) + m4_if(gt_building_libintl_in_same_build_tree, yes, [], [ + dnl For backward compatibility. Some Makefiles may be using this. + INTLLIBS="$LIBINTL" + AC_SUBST([INTLLIBS]) + ]) dnl Make all documented variables known to autoconf. AC_SUBST([LIBINTL]) AC_SUBST([LTLIBINTL]) AC_SUBST([POSUB]) + + dnl Define localedir_c and localedir_c_make. + dnl Find the final value of localedir. + gt_save_prefix="${prefix}" + gt_save_datarootdir="${datarootdir}" + gt_save_localedir="${localedir}" + dnl Unfortunately, prefix gets only finally determined at the end of + dnl configure. + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval localedir="$localedir" + gl_BUILD_TO_HOST([localedir]) + localedir="${gt_save_localedir}" + datarootdir="${gt_save_datarootdir}" + prefix="${gt_save_prefix}" ]) @@ -408,7 +494,7 @@ dnl Usage: AM_GNU_GETTEXT_REQUIRE_VERSION([gettext-version]) AC_DEFUN([AM_GNU_GETTEXT_REQUIRE_VERSION], []) # host-cpu-c-abi.m4 serial 15 -dnl Copyright (C) 2002-2022 Free Software Foundation, Inc. +dnl Copyright (C) 2002-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1086,8 +1172,8 @@ changequote([,])dnl HOST_CPU_C_ABI_32BIT="$gl_cv_host_cpu_c_abi_32bit" ]) -# iconv.m4 serial 24 -dnl Copyright (C) 2000-2002, 2007-2014, 2016-2022 Free Software Foundation, +# iconv.m4 serial 26 +dnl Copyright (C) 2000-2002, 2007-2014, 2016-2023 Free Software Foundation, dnl Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -1322,12 +1408,6 @@ AC_DEFUN([AM_ICONV_LINK], dnl Define AM_ICONV using AC_DEFUN_ONCE, in order to avoid warnings like dnl "warning: AC_REQUIRE: `AM_ICONV' was expanded before it was required". -dnl This is tricky because of the way 'aclocal' is implemented: -dnl - It requires defining an auxiliary macro whose name ends in AC_DEFUN. -dnl Otherwise aclocal's initial scan pass would miss the macro definition. -dnl - It requires a line break inside the AC_DEFUN_ONCE and AC_DEFUN expansions. -dnl Otherwise aclocal would emit many "Use of uninitialized value $1" -dnl warnings. AC_DEFUN_ONCE([AM_ICONV], [ AM_ICONV_LINK @@ -1368,10 +1448,26 @@ size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, si ICONV_CONST="const" fi ]) + + dnl A summary result, for those packages which want to print a summary at the + dnl end of the configuration. + if test "$am_func_iconv" = yes; then + if test -n "$LIBICONV"; then + am_cv_func_iconv_summary='yes, in libiconv' + else + am_cv_func_iconv_summary='yes, in libc' + fi + else + if test "$am_cv_func_iconv" = yes; then + am_cv_func_iconv_summary='not working, consider installing GNU libiconv' + else + am_cv_func_iconv_summary='no, consider installing GNU libiconv' + fi + fi ]) # intlmacosx.m4 serial 8 (gettext-0.20.2) -dnl Copyright (C) 2004-2014, 2016, 2019-2022 Free Software Foundation, Inc. +dnl Copyright (C) 2004-2014, 2016, 2019-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1436,8 +1532,8 @@ AC_DEFUN([gt_INTL_MACOSX], AC_SUBST([INTL_MACOSX_LIBS]) ]) -# lib-ld.m4 serial 10 -dnl Copyright (C) 1996-2003, 2009-2022 Free Software Foundation, Inc. +# lib-ld.m4 serial 11 +dnl Copyright (C) 1996-2003, 2009-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1467,7 +1563,7 @@ AC_DEFUN([AC_LIB_PROG_LD], AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_ARG_WITH([gnu-ld], - [AS_HELP_STRING([--with-gnu-ld], + [AS_HELP_STRING([[--with-gnu-ld]], [assume the C compiler uses GNU ld [default=no]])], [test "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl @@ -1606,7 +1702,7 @@ AC_LIB_PROG_LD_GNU ]) # lib-link.m4 serial 33 -dnl Copyright (C) 2001-2022 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -1831,7 +1927,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_BODY], additional_libdir3= fi dnl Search the library and its dependencies in $additional_libdir and - dnl $LDFLAGS. Using breadth-first-seach. + dnl $LDFLAGS. Use breadth-first search. LIB[]NAME= LTLIB[]NAME= INC[]NAME= @@ -2420,7 +2516,7 @@ AC_DEFUN([AC_LIB_LINKFLAGS_FROM_LIBS], ]) # lib-prefix.m4 serial 20 -dnl Copyright (C) 2001-2005, 2008-2022 Free Software Foundation, Inc. +dnl Copyright (C) 2001-2005, 2008-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. @@ -2744,7 +2840,7 @@ changequote([,])dnl ]) # nls.m4 serial 6 (gettext-0.20.2) -dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2022 Free +dnl Copyright (C) 1995-2003, 2005-2006, 2008-2014, 2016, 2019-2023 Free dnl Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -2776,8 +2872,8 @@ AC_DEFUN([AM_NLS], AC_SUBST([USE_NLS]) ]) -# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- -# serial 11 (pkg-config-0.29.1) +# pkg.m4 - Macros to locate and use pkg-config. -*- Autoconf -*- +# serial 12 (pkg-config-0.29.2) dnl Copyright © 2004 Scott James Remnant . dnl Copyright © 2012-2015 Dan Nicholson @@ -2819,7 +2915,7 @@ dnl dnl See the "Since" comment for each macro you use to see what version dnl of the macros you require. m4_defun([PKG_PREREQ], -[m4_define([PKG_MACROS_VERSION], [0.29.1]) +[m4_define([PKG_MACROS_VERSION], [0.29.2]) m4_if(m4_version_compare(PKG_MACROS_VERSION, [$1]), -1, [m4_fatal([pkg.m4 version $1 or higher is required but ]PKG_MACROS_VERSION[ found])]) ])dnl PKG_PREREQ @@ -2864,7 +2960,7 @@ dnl Check to see whether a particular set of modules exists. Similar to dnl PKG_CHECK_MODULES(), but does not set variables or print errors. dnl dnl Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG]) -dnl only at the first occurence in configure.ac, so if the first place +dnl only at the first occurrence in configure.ac, so if the first place dnl it's called might be skipped (such as if it is within an "if", you dnl have to call PKG_CHECK_EXISTS manually AC_DEFUN([PKG_CHECK_EXISTS], @@ -2920,7 +3016,7 @@ AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no -AC_MSG_CHECKING([for $1]) +AC_MSG_CHECKING([for $2]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) @@ -2930,17 +3026,17 @@ and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then - AC_MSG_RESULT([no]) + AC_MSG_RESULT([no]) _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then - $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` - else - $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` + $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "$2" 2>&1` + else + $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "$2" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD + # Put the nasty error message in config.log where it belongs + echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD - m4_default([$4], [AC_MSG_ERROR( + m4_default([$4], [AC_MSG_ERROR( [Package requirements ($2) were not met: $$1_PKG_ERRORS @@ -2951,8 +3047,8 @@ installed software in a non-standard prefix. _PKG_TEXT])[]dnl ]) elif test $pkg_failed = untried; then - AC_MSG_RESULT([no]) - m4_default([$4], [AC_MSG_FAILURE( + AC_MSG_RESULT([no]) + m4_default([$4], [AC_MSG_FAILURE( [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. @@ -2962,10 +3058,10 @@ _PKG_TEXT To get pkg-config, see .])[]dnl ]) else - $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS - $1[]_LIBS=$pkg_cv_[]$1[]_LIBS + $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS + $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) - $3 + $3 fi[]dnl ])dnl PKG_CHECK_MODULES @@ -3576,7 +3672,7 @@ AC_DEFUN([AM_XGETTEXT_OPTION], ]) # progtest.m4 serial 9 (gettext-0.21.1) -dnl Copyright (C) 1996-2003, 2005, 2008-2022 Free Software Foundation, Inc. +dnl Copyright (C) 1996-2003, 2005, 2008-2023 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, dnl with or without modifications, as long as this notice is preserved. diff --git a/align/Makefile.in b/align/Makefile.in index 3ea557d..8abb0b6 100644 --- a/align/Makefile.in +++ b/align/Makefile.in @@ -498,6 +498,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -648,6 +649,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/bash/Makefile.am b/bash/Makefile.am index 000fab5..9a63736 100644 --- a/bash/Makefile.am +++ b/bash/Makefile.am @@ -28,7 +28,6 @@ symlinks = \ virt-customize \ virt-diff \ virt-df \ - virt-dib \ virt-drivers \ virt-edit \ virt-filesystems \ @@ -55,7 +54,7 @@ CLEANFILES += \ # common options like -d is handled by this common script. However # this script cannot deal with commands that use --ro/--rw # (eg. virt-rescue). Those tools have to be handled individually. -virt-builder virt-cat virt-customize virt-df virt-dib virt-diff virt-drivers \ +virt-builder virt-cat virt-customize virt-df virt-diff virt-drivers \ virt-edit virt-filesystems virt-format virt-get-kernel virt-inspector \ virt-log virt-ls \ virt-resize virt-sparsify virt-sysprep \ diff --git a/bash/Makefile.in b/bash/Makefile.in index 2a15273..8f05013 100644 --- a/bash/Makefile.in +++ b/bash/Makefile.in @@ -429,6 +429,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -579,6 +580,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ @@ -677,7 +680,6 @@ symlinks = \ virt-customize \ virt-diff \ virt-df \ - virt-dib \ virt-drivers \ virt-edit \ virt-filesystems \ @@ -1136,7 +1138,7 @@ export TEST_FUNCTIONS := \ # common options like -d is handled by this common script. However # this script cannot deal with commands that use --ro/--rw # (eg. virt-rescue). Those tools have to be handled individually. -virt-builder virt-cat virt-customize virt-df virt-dib virt-diff virt-drivers \ +virt-builder virt-cat virt-customize virt-df virt-diff virt-drivers \ virt-edit virt-filesystems virt-format virt-get-kernel virt-inspector \ virt-log virt-ls \ virt-resize virt-sparsify virt-sysprep \ diff --git a/bash/virt-alignment-scan b/bash/virt-alignment-scan index b93a001..bb9a71e 100644 --- a/bash/virt-alignment-scan +++ b/bash/virt-alignment-scan @@ -109,12 +109,6 @@ _virt_customize () } && complete -o default -F _virt_customize virt-customize -_virt_dib () -{ - _guestfs_virttools "virt-dib" 0 -} && -complete -o default -F _virt_dib virt-dib - _virt_df () { _guestfs_virttools "virt-df" 1 diff --git a/bugs-in-changelog.sh b/bugs-in-changelog.sh index 2428c3f..3f057a4 100755 --- a/bugs-in-changelog.sh +++ b/bugs-in-changelog.sh @@ -31,7 +31,7 @@ fi # Comma-separated list of Bugzilla IDs. bugids=$( git log "$1" | - egrep -io 'RHBZ#[0-9]+|https?://bugzilla.redhat.com/[a-z\.\?/_=]*[0-9]+' | + grep -Eio 'RHBZ#[0-9]+|https?://bugzilla.redhat.com/[a-z\.\?/_=]*[0-9]+' | sed 's/^[^0-9]*//' | sort -u | tr '\n' ',' | diff --git a/builder/Makefile.in b/builder/Makefile.in index 305a73b..c24dda6 100644 --- a/builder/Makefile.in +++ b/builder/Makefile.in @@ -590,6 +590,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -740,6 +741,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/builder/builder.ml b/builder/builder.ml index 15ece4e..bd44556 100644 --- a/builder/builder.ml +++ b/builder/builder.ml @@ -815,8 +815,8 @@ let main () = delete_output_file := false; (* Print the stats calculated above. *) - Pervasives.flush Pervasives.stdout; - Pervasives.flush Pervasives.stderr; + Stdlib.flush Stdlib.stdout; + Stdlib.flush Stdlib.stderr; Option.iter print_string stats diff --git a/builder/downloader.ml b/builder/downloader.ml index 184c298..2343e82 100644 --- a/builder/downloader.ml +++ b/builder/downloader.ml @@ -95,7 +95,6 @@ and download_to t ?(progress_bar = false) ~proxy uri filename = | _ -> let common_args = [ "location", None; (* Follow 3xx redirects. *) - "url", Some uri; (* URI to download. *) ] in let quiet_args = [ "silent", None; "show-error", None ] in @@ -110,7 +109,7 @@ and download_to t ?(progress_bar = false) ~proxy uri filename = "write-out", Some "%{http_code}" (* HTTP status code to stdout. *) ]; - Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args in + Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args uri in let lines = Curl.run curl_h in if List.length lines < 1 then @@ -136,7 +135,7 @@ and download_to t ?(progress_bar = false) ~proxy uri filename = else List.push_back_list curl_args quiet_args ); - Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args in + Curl.create ~curl:t.curl ~tmpdir:t.tmpdir !curl_args uri in ignore (Curl.run curl_h) ); diff --git a/builder/index_parser.ml b/builder/index_parser.ml index 1c5bc26..3e19e48 100644 --- a/builder/index_parser.ml +++ b/builder/index_parser.ml @@ -246,7 +246,7 @@ let get_index ~downloader ~sigchecker ?(template = false) if verbose () then ( printf "index file (%s) after parsing (C parser):\n" uri; - List.iter (Index.print_entry Pervasives.stdout) entries + List.iter (Index.print_entry Stdlib.stdout) entries ); entries diff --git a/builder/repository_main.ml b/builder/repository_main.ml index 3a5714a..4a75675 100644 --- a/builder/repository_main.ml +++ b/builder/repository_main.ml @@ -551,14 +551,14 @@ let main () = | Some gpgkey -> message (f_"Signing index with the GPG key %s") gpgkey; let cmd = sprintf "%s --armor --output %s --export %s" - (quote (cmdline.gpg // "index.gpg")) - (quote tmprepo) (quote gpgkey) in + (quote cmdline.gpg) + (quote (tmprepo // "index.gpg")) (quote gpgkey) in if shell_command cmd <> 0 then error (f_"failed to export the GPG key %s") gpgkey; let cmd = sprintf "%s --armor --default-key %s --clearsign %s" (quote cmdline.gpg) (quote gpgkey) - (quote (tmprepo // "index" )) in + (quote (tmprepo // "index")) in if shell_command cmd <> 0 then error (f_"failed to sign index"); ); diff --git a/builder/simplestreams_parser.ml b/builder/simplestreams_parser.ml index 70b4482..fe0afde 100644 --- a/builder/simplestreams_parser.ml +++ b/builder/simplestreams_parser.ml @@ -149,6 +149,6 @@ let get_index ~downloader ~sigchecker { Sources.uri; proxy } = let entries = List.flatten (List.map scan_product_list downloads) in if verbose () then ( printf "simplestreams tree (%s) after parsing:\n" uri; - List.iter (Index.print_entry Pervasives.stdout) entries + List.iter (Index.print_entry Stdlib.stdout) entries ); entries diff --git a/builder/templates/Makefile.in b/builder/templates/Makefile.in index d0cb030..360cada 100644 --- a/builder/templates/Makefile.in +++ b/builder/templates/Makefile.in @@ -430,6 +430,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -580,6 +581,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/builder/templates/debian-12.index-fragment b/builder/templates/debian-12.index-fragment new file mode 100644 index 0000000..a28d12f --- /dev/null +++ b/builder/templates/debian-12.index-fragment @@ -0,0 +1,24 @@ +[debian-12] +name=Debian 12 (bookworm) +osinfo=debian12 +arch=x86_64 +file=debian-12.xz +checksum[sha512]=f1c58b53b7d25691ccbd2c3eb97f692985e8a035247dee3ed8e024bbae64574620ace75dbb57207064739f5e4b317c6ad6d6d518d777c719441b06b1634fe07e +format=raw +size=6442450944 +compressed_size=275642276 +expand=/dev/sda1 +notes=Debian 12 (bookworm) + + This is a minimal Debian install. + + This image is so very minimal that it only includes an ssh server + This image does not contain SSH host keys. To regenerate them use: + + --firstboot-command "dpkg-reconfigure openssh-server" + + This template was generated by a script in the libguestfs source tree: + builder/templates/make-template.ml + Associated files used to prepare this template can be found in the + same directory. + diff --git a/builder/templates/debian-12.virt-install-cmd b/builder/templates/debian-12.virt-install-cmd new file mode 100644 index 0000000..72fbb57 --- /dev/null +++ b/builder/templates/debian-12.virt-install-cmd @@ -0,0 +1,20 @@ +# This is the virt-install command which was used to create +# the virt-builder template 'debian-12' +# NB: This file is generated for documentation purposes ONLY! +# This script was never run, and is not intended to be run. + +'virt-install' \ + '--transient' \ + '--name=tmp-3x44r0p1' \ + '--ram=4096' \ + '--arch=x86_64' \ + '--cpu=host' \ + '--vcpus=4' \ + '--os-variant=debian8' \ + '--initrd-inject=/tmp/csgljpjq.tmp/preseed.cfg' \ + '--extra-args=auto mirror/http/proxy= console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ + '--disk=/home/rjones/d/guestfs-tools/builder/templates/tmp-3x44r0p1.img,size=6,format=raw' \ + '--location=http://deb.debian.org/debian/dists/bookworm/main/installer-amd64' \ + '--serial=pty' \ + '--nographics' + diff --git a/builder/templates/fedora-38-aarch64.index-fragment b/builder/templates/fedora-38-aarch64.index-fragment new file mode 100644 index 0000000..31bbfbc --- /dev/null +++ b/builder/templates/fedora-38-aarch64.index-fragment @@ -0,0 +1,25 @@ +[fedora-38] +name=Fedora® 38 Server (aarch64) +osinfo=fedora38 +arch=aarch64 +file=fedora-38-aarch64.xz +checksum[sha512]=eeb4bf2f82625c1a5c14b17a016e325534049b070c2f03c164e81e64a0187aae79bced4ee9e25aab9f55389eb7cd5d4538b2610dc7461b317de2685fe8680fba +format=raw +size=6442450944 +compressed_size=680892008 +expand=/dev/sda3 +notes=Fedora® 38 Server (aarch64) + + This Fedora image contains only unmodified @Core group packages. + + Fedora and the Infinity design logo are trademarks of Red Hat, Inc. + Source and further information is available from http://fedoraproject.org/ + + You will need to use the associated UEFI NVRAM variables file: + http://libguestfs.org/download/builder/fedora-38-aarch64-nvram.xz + + This template was generated by a script in the libguestfs source tree: + builder/templates/make-template.ml + Associated files used to prepare this template can be found in the + same directory. + diff --git a/builder/templates/fedora-38-aarch64.ks b/builder/templates/fedora-38-aarch64.ks new file mode 100644 index 0000000..d322d23 --- /dev/null +++ b/builder/templates/fedora-38-aarch64.ks @@ -0,0 +1,37 @@ +# Kickstart file for fedora-38-aarch64 +# Generated by libguestfs.git/builder/templates/make-template.ml + +text +reboot +lang en_US.UTF-8 +keyboard us +network --bootproto dhcp +rootpw builder +firewall --enabled --ssh +timezone --utc America/New_York +selinux --enforcing + +bootloader --location=mbr --append="console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH" + + +zerombr +clearpart --all --initlabel --disklabel=gpt +autopart --type=plain + +# Halt the system once configuration has finished. +poweroff + +%packages +@core +%end + +%post +# Ensure the installation is up-to-date. +dnf -y --best upgrade +# This required otherwise the kernel will not be bootable, see +# https://bugzilla.redhat.com/show_bug.cgi?id=1911177 +# https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24 +grub2-mkconfig -o '/etc/grub2-efi.cfg' +%end + +# EOF diff --git a/builder/templates/fedora-38-aarch64.virt-install-cmd b/builder/templates/fedora-38-aarch64.virt-install-cmd new file mode 100644 index 0000000..8462bb4 --- /dev/null +++ b/builder/templates/fedora-38-aarch64.virt-install-cmd @@ -0,0 +1,20 @@ +# This is the virt-install command which was used to create +# the virt-builder template 'fedora-38-aarch64' +# NB: This file is generated for documentation purposes ONLY! +# This script was never run, and is not intended to be run. + +'virt-install' \ + '--transient' \ + '--name=tmp-nlo8d7hr' \ + '--ram=4096' \ + '--arch=aarch64' \ + '--vcpus=1' \ + '--os-variant=fedora34' \ + '--boot' 'loader=/usr/share/edk2/aarch64/QEMU_EFI-pflash.raw,loader_ro=yes,loader_type=pflash,nvram=/home/rjones/d/guestfs-tools/builder/templates/tmp-nlo8d7hr.vars' \ + '--initrd-inject=fedora-38-aarch64.ks' \ + '--extra-args=inst.ks=file:/fedora-38-aarch64.ks console=ttyAMA0 earlyprintk=pl011,0x9000000 ignore_loglevel no_timer_check printk.time=1 rd_NO_PLYMOUTH' \ + '--disk=/home/rjones/d/guestfs-tools/builder/templates/tmp-nlo8d7hr.img,size=6,format=raw' \ + '--location=https://lon.mirror.rackspace.com/fedora/releases/38/Server/aarch64/os/' \ + '--serial=pty' \ + '--nographics' + diff --git a/builder/templates/fedora-38.index-fragment b/builder/templates/fedora-38.index-fragment new file mode 100644 index 0000000..436c44f --- /dev/null +++ b/builder/templates/fedora-38.index-fragment @@ -0,0 +1,22 @@ +[fedora-38] +name=Fedora® 38 Server +osinfo=fedora38 +arch=x86_64 +file=fedora-38.xz +checksum[sha512]=e9746d591730b5aa3996d3f6c960c086ed238f433c5a65f6ade4d40cd674d9aef390804a37fd70f2e933bcb0ac4a99fa646cb13db9e9608877807a02fe101776 +format=raw +size=6442450944 +compressed_size=687953248 +expand=/dev/sda3 +notes=Fedora® 38 Server + + This Fedora image contains only unmodified @Core group packages. + + Fedora and the Infinity design logo are trademarks of Red Hat, Inc. + Source and further information is available from http://fedoraproject.org/ + + This template was generated by a script in the libguestfs source tree: + builder/templates/make-template.ml + Associated files used to prepare this template can be found in the + same directory. + diff --git a/builder/templates/fedora-38.ks b/builder/templates/fedora-38.ks new file mode 100644 index 0000000..5692e78 --- /dev/null +++ b/builder/templates/fedora-38.ks @@ -0,0 +1,48 @@ +# Kickstart file for fedora-38 +# Generated by libguestfs.git/builder/templates/make-template.ml + +text +reboot +lang en_US.UTF-8 +keyboard us +network --bootproto dhcp +rootpw builder +firewall --enabled --ssh +timezone --utc America/New_York +selinux --enforcing + +bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" + + +zerombr +clearpart --all --initlabel --disklabel=gpt +autopart --type=plain + +# Halt the system once configuration has finished. +poweroff + +%packages +@core +%end + +%post +# Ensure the installation is up-to-date. +dnf -y --best upgrade +# This required otherwise the kernel will not be bootable, see +# https://bugzilla.redhat.com/show_bug.cgi?id=1911177 +# https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24 +grub2-mkconfig -o '/etc/grub2.cfg' +# Enable Xen domU support. +pushd /etc/dracut.conf.d +echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf +popd +# To make dracut config changes permanent, we need to rerun dracut. +# Rerun dracut for the installed kernel (not the running kernel). +# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and +# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 +KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | + sort -V | tail -1)" +dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION +%end + +# EOF diff --git a/builder/templates/fedora-38.virt-install-cmd b/builder/templates/fedora-38.virt-install-cmd new file mode 100644 index 0000000..ab1243f --- /dev/null +++ b/builder/templates/fedora-38.virt-install-cmd @@ -0,0 +1,20 @@ +# This is the virt-install command which was used to create +# the virt-builder template 'fedora-38' +# NB: This file is generated for documentation purposes ONLY! +# This script was never run, and is not intended to be run. + +'virt-install' \ + '--transient' \ + '--name=tmp-612x9sxk' \ + '--ram=4096' \ + '--arch=x86_64' \ + '--cpu=host' \ + '--vcpus=4' \ + '--os-variant=fedora34' \ + '--initrd-inject=fedora-38.ks' \ + '--extra-args=inst.ks=file:/fedora-38.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ + '--disk=/home/rjones/d/guestfs-tools/builder/templates/tmp-612x9sxk.img,size=6,format=raw' \ + '--location=https://lon.mirror.rackspace.com/fedora/releases/38/Server/x86_64/os/' \ + '--serial=pty' \ + '--nographics' + diff --git a/builder/templates/fedora-39.index-fragment b/builder/templates/fedora-39.index-fragment new file mode 100644 index 0000000..684d178 --- /dev/null +++ b/builder/templates/fedora-39.index-fragment @@ -0,0 +1,22 @@ +[fedora-39] +name=Fedora® 39 Server +osinfo=fedora39 +arch=x86_64 +file=fedora-39.xz +checksum[sha512]=8ff9abba5b3e040e6182f929f76cbee8285baebb1af5c1797fbe1b4115b8c32a62266313bbba7e26cf01ca1f866eb5db6455cb6760013800099c60ee6f77c74a +format=raw +size=6442450944 +compressed_size=654173196 +expand=/dev/sda3 +notes=Fedora® 39 Server + + This Fedora image contains only unmodified @Core group packages. + + Fedora and the Infinity design logo are trademarks of Red Hat, Inc. + Source and further information is available from http://fedoraproject.org/ + + This template was generated by a script in the libguestfs source tree: + builder/templates/make-template.ml + Associated files used to prepare this template can be found in the + same directory. + diff --git a/builder/templates/fedora-39.ks b/builder/templates/fedora-39.ks new file mode 100644 index 0000000..6074f8e --- /dev/null +++ b/builder/templates/fedora-39.ks @@ -0,0 +1,48 @@ +# Kickstart file for fedora-39 +# Generated by libguestfs.git/builder/templates/make-template.ml + +text +reboot +lang en_US.UTF-8 +keyboard us +network --bootproto dhcp +rootpw builder +firewall --enabled --ssh +timezone --utc America/New_York +selinux --enforcing + +bootloader --location=mbr --append="console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH" + + +zerombr +clearpart --all --initlabel --disklabel=gpt +autopart --type=plain + +# Halt the system once configuration has finished. +poweroff + +%packages +@core +%end + +%post +# Ensure the installation is up-to-date. +dnf -y --best upgrade +# This required otherwise the kernel will not be bootable, see +# https://bugzilla.redhat.com/show_bug.cgi?id=1911177 +# https://bugzilla.redhat.com/show_bug.cgi?id=1945835#c24 +grub2-mkconfig -o '/etc/grub2.cfg' +# Enable Xen domU support. +pushd /etc/dracut.conf.d +echo 'add_drivers+=" xen:vbd xen:vif "' > virt-builder-xen-drivers.conf +popd +# To make dracut config changes permanent, we need to rerun dracut. +# Rerun dracut for the installed kernel (not the running kernel). +# See commit 0fa52e4e45d80874bc5ea5f112f74be1d3f3472f and +# https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045 +KERNEL_VERSION="$(rpm -q kernel --qf '%{version}-%{release}.%{arch}\n' | + sort -V | tail -1)" +dracut -f /boot/initramfs-$KERNEL_VERSION.img $KERNEL_VERSION +%end + +# EOF diff --git a/builder/templates/fedora-39.virt-install-cmd b/builder/templates/fedora-39.virt-install-cmd new file mode 100644 index 0000000..896a2c2 --- /dev/null +++ b/builder/templates/fedora-39.virt-install-cmd @@ -0,0 +1,20 @@ +# This is the virt-install command which was used to create +# the virt-builder template 'fedora-39' +# NB: This file is generated for documentation purposes ONLY! +# This script was never run, and is not intended to be run. + +'virt-install' \ + '--transient' \ + '--name=tmp-lu5hmagp' \ + '--ram=4096' \ + '--arch=x86_64' \ + '--cpu=host' \ + '--vcpus=4' \ + '--os-variant=fedora34' \ + '--initrd-inject=fedora-39.ks' \ + '--extra-args=inst.ks=file:/fedora-39.ks console=tty0 console=ttyS0,115200 rd_NO_PLYMOUTH' \ + '--disk=/home/rjones/d/guestfs-tools/builder/templates/tmp-lu5hmagp.img,size=6,format=raw' \ + '--location=https://lon.mirror.rackspace.com/fedora/releases/39/Server/x86_64/os/' \ + '--serial=pty' \ + '--nographics' + diff --git a/builder/templates/make-template.ml b/builder/templates/make-template.ml index b58e55e..917ae32 100755 --- a/builder/templates/make-template.ml +++ b/builder/templates/make-template.ml @@ -359,6 +359,7 @@ and os_of_string os ver = | "debian", "9" -> Debian (9, "stretch") | "debian", "10" -> Debian (10, "buster") | "debian", "11" -> Debian (11, "bullseye") + | "debian", "12" -> Debian (12, "bookworm") | "ubuntu", "10.04" -> Ubuntu (ver, "lucid") | "ubuntu", "12.04" -> Ubuntu (ver, "precise") | "ubuntu", "14.04" -> Ubuntu (ver, "trusty") diff --git a/cat/Makefile.in b/cat/Makefile.in index d44063b..4d2d93e 100644 --- a/cat/Makefile.in +++ b/cat/Makefile.in @@ -544,6 +544,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -694,6 +695,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/edit/Makefile.in b/common/edit/Makefile.in index e555ded..4fad1e1 100644 --- a/common/edit/Makefile.in +++ b/common/edit/Makefile.in @@ -275,6 +275,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -425,6 +426,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlcustomize/Makefile.in b/common/mlcustomize/Makefile.in index fc8fc53..714bb98 100644 --- a/common/mlcustomize/Makefile.in +++ b/common/mlcustomize/Makefile.in @@ -492,6 +492,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -642,6 +643,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlcustomize/SELinux_relabel.ml b/common/mlcustomize/SELinux_relabel.ml index 5ecf7bd..2f3a09b 100644 --- a/common/mlcustomize/SELinux_relabel.ml +++ b/common/mlcustomize/SELinux_relabel.ml @@ -24,10 +24,6 @@ open Printf module G = Guestfs -(* Simple reimplementation of Array.mem, available only with OCaml >= 4.03. *) -let array_find a l = - List.mem a (Array.to_list l) - let rec relabel (g : G.guestfs) = (* Is the guest using SELinux? (Otherwise this is a no-op). *) if is_selinux_guest g then ( @@ -59,14 +55,24 @@ and use_setfiles g = g#aug_load (); debug_augeas_errors g; + let config_path = "/files/etc/selinux/config" in + let config_keys = g#aug_ls config_path in + (* SELinux may be disabled via a setting in config file *) + let selinux_disabled = + let selinuxmode_path = config_path ^ "/SELINUX" in + if Array.mem selinuxmode_path config_keys then + g#aug_get selinuxmode_path = "disabled" + else + false in + if selinux_disabled then + failwith "selinux disabled"; + (* Get the SELinux policy name, eg. "targeted", "minimum". * Use "targeted" if not specified, just like libselinux does. *) let policy = - let config_path = "/files/etc/selinux/config" in let selinuxtype_path = config_path ^ "/SELINUXTYPE" in - let keys = g#aug_ls config_path in - if array_find selinuxtype_path keys then + if Array.mem selinuxtype_path config_keys then g#aug_get selinuxtype_path else "targeted" in diff --git a/common/mlcustomize/customize-options.pod b/common/mlcustomize/customize-options.pod index 22a96e0..ff93630 100644 --- a/common/mlcustomize/customize-options.pod +++ b/common/mlcustomize/customize-options.pod @@ -63,6 +63,30 @@ Change the permissions of C to C. I: C by default would be decimal, unless you prefix it with C<0> to get octal, ie. use C<0700> not C<700>. +=item B<--chown> UID:GID:PATH + +Change the owner user and group ID of a file or directory in the guest. +Note: + +=over 4 + +=item * + +Only numeric UIDs and GIDs will work, and these may not be the same +inside the guest as on the host. + +=item * + +This will not work with Windows guests. + +=back + +For example: + + virt-customize --chown '0:0:/var/log/audit.log' + +See also: I<--upload>. + =item B<--commands-from-file> FILENAME Read the customize commands from a file, one (and its arguments) @@ -403,6 +427,14 @@ the C field. You can have multiple I<--ssh-inject> options, for different users and also for more keys for each user. +=item B<--tar-in> TARFILE:REMOTEDIR + +Copy local files or directories from a local tar file +called C into the disk image, placing them in the +directory C (which must exist). Note that +the tar file must be uncompressed (F<.tar.gz> files will not work +here) + =item B<--timezone> TIMEZONE Set the default timezone of the guest to C. Use a location diff --git a/common/mlcustomize/customize-synopsis.pod b/common/mlcustomize/customize-synopsis.pod index d04f421..bb0ce12 100644 --- a/common/mlcustomize/customize-synopsis.pod +++ b/common/mlcustomize/customize-synopsis.pod @@ -1,16 +1,17 @@ [--append-line FILE:LINE] [--chmod PERMISSIONS:FILE] - [--commands-from-file FILENAME] [--copy SOURCE:DEST] - [--copy-in LOCALPATH:REMOTEDIR] [--delete PATH] [--edit FILE:EXPR] - [--firstboot SCRIPT] [--firstboot-command 'CMD+ARGS'] - [--firstboot-install PKG,PKG..] [--hostname HOSTNAME] - [--inject-qemu-ga METHOD] [--inject-virtio-win METHOD] - [--install PKG,PKG..] [--link TARGET:LINK[:LINK..]] [--mkdir DIR] - [--move SOURCE:DEST] [--password USER:SELECTOR] - [--root-password SELECTOR] [--run SCRIPT] - [--run-command 'CMD+ARGS'] [--scrub FILE] [--sm-attach SELECTOR] - [--sm-register] [--sm-remove] [--sm-unregister] - [--ssh-inject USER[:SELECTOR]] [--truncate FILE] - [--truncate-recursive PATH] [--timezone TIMEZONE] [--touch FILE] + [--chown UID:GID:PATH] [--commands-from-file FILENAME] + [--copy SOURCE:DEST] [--copy-in LOCALPATH:REMOTEDIR] + [--delete PATH] [--edit FILE:EXPR] [--firstboot SCRIPT] + [--firstboot-command 'CMD+ARGS'] [--firstboot-install PKG,PKG..] + [--hostname HOSTNAME] [--inject-qemu-ga METHOD] + [--inject-virtio-win METHOD] [--install PKG,PKG..] + [--link TARGET:LINK[:LINK..]] [--mkdir DIR] [--move SOURCE:DEST] + [--password USER:SELECTOR] [--root-password SELECTOR] + [--run SCRIPT] [--run-command 'CMD+ARGS'] [--scrub FILE] + [--sm-attach SELECTOR] [--sm-register] [--sm-remove] + [--sm-unregister] [--ssh-inject USER[:SELECTOR]] + [--tar-in TARFILE:REMOTEDIR] [--timezone TIMEZONE] [--touch FILE] + [--truncate FILE] [--truncate-recursive PATH] [--uninstall PKG,PKG..] [--update] [--upload FILE:DEST] [--write FILE:CONTENT] [--no-logfile] [--password-crypto md5|sha256|sha512] [--no-selinux-relabel] diff --git a/common/mlcustomize/customize_cmdline.ml b/common/mlcustomize/customize_cmdline.ml index 3c24315..245d996 100644 --- a/common/mlcustomize/customize_cmdline.ml +++ b/common/mlcustomize/customize_cmdline.ml @@ -41,6 +41,8 @@ and op = [ (* --append-line FILE:LINE *) | `Chmod of string * string (* --chmod PERMISSIONS:FILE *) + | `Chown of string * string * string + (* --chown UID:GID:PATH *) | `CommandsFromFile of string (* --commands-from-file FILENAME *) | `Copy of string * string @@ -91,14 +93,16 @@ and op = [ (* --sm-unregister *) | `SSHInject of string * Ssh_key.ssh_key_selector (* --ssh-inject USER[:SELECTOR] *) - | `Truncate of string - (* --truncate FILE *) - | `TruncateRecursive of string - (* --truncate-recursive PATH *) + | `TarIn of string * string + (* --tar-in TARFILE:REMOTEDIR *) | `Timezone of string (* --timezone TIMEZONE *) | `Touch of string (* --touch FILE *) + | `Truncate of string + (* --truncate FILE *) + | `TruncateRecursive of string + (* --truncate-recursive PATH *) | `UninstallPackages of string list (* --uninstall PKG,PKG.. *) | `Update @@ -152,8 +156,13 @@ let rec argspec () = option_name in let len = String.length arg in String.sub arg 0 i, String.sub arg (i+1) (len-(i+1)) - in - let split_string_list arg = + and split_string_triplet option_name arg = + match String.nsplit ~max:3 "," arg with + | [a; b; c] -> a, b, c + | _ -> + error (f_"invalid format for '--%s' parameter, see the man page") + option_name + and split_string_list arg = String.nsplit "," arg in let split_links_list option_name arg = @@ -187,6 +196,17 @@ let rec argspec () = s_"Change the permissions of a file" ), Some "PERMISSIONS:FILE", "Change the permissions of C to C.\n\nI: C by default would be decimal, unless you prefix\nit with C<0> to get octal, ie. use C<0700> not C<700>."; + ( + [ L"chown" ], + Getopt.String ( + s_"UID:GID:PATH", + fun s -> + let p = split_string_triplet "chown" s in + List.push_front (`Chown p) ops + ), + s_"Change the owner user and group ID of a file or directory" + ), + Some "UID:GID:PATH", "Change the owner user and group ID of a file or directory in the guest.\nNote:\n\n=over 4\n\n=item *\n\nOnly numeric UIDs and GIDs will work, and these may not be the same\ninside the guest as on the host.\n\n=item *\n\nThis will not work with Windows guests.\n\n=back\n\nFor example:\n\n virt-customize --chown '0:0:/var/log/audit.log'\n\nSee also: I<--upload>."; ( [ L"commands-from-file" ], Getopt.String ( @@ -400,17 +420,16 @@ let rec argspec () = ), Some "USER[:SELECTOR]", "Inject an ssh key so the given C will be able to log in over\nssh without supplying a password. The C must exist already\nin the guest.\n\nSee L for the format of\nthe C field.\n\nYou can have multiple I<--ssh-inject> options, for different users\nand also for more keys for each user."; ( - [ L"truncate" ], - Getopt.String (s_"FILE", fun s -> List.push_front (`Truncate s) ops), - s_"Truncate a file to zero size" - ), - Some "FILE", "This command truncates C to a zero-length file. The file must exist\nalready."; - ( - [ L"truncate-recursive" ], - Getopt.String (s_"PATH", fun s -> List.push_front (`TruncateRecursive s) ops), - s_"Recursively truncate all files in directory" + [ L"tar-in" ], + Getopt.String ( + s_"TARFILE:REMOTEDIR", + fun s -> + let p = split_string_pair "tar-in" s in + List.push_front (`TarIn p) ops + ), + s_"Copy local files or directories from a tarball into image" ), - Some "PATH", "This command recursively truncates all files under C to zero-length."; + Some "TARFILE:REMOTEDIR", "Copy local files or directories from a local tar file\ncalled C into the disk image, placing them in the\ndirectory C (which must exist). Note that\nthe tar file must be uncompressed (F<.tar.gz> files will not work\nhere)"; ( [ L"timezone" ], Getopt.String (s_"TIMEZONE", fun s -> List.push_front (`Timezone s) ops), @@ -423,6 +442,18 @@ let rec argspec () = s_"Run touch on a file" ), Some "FILE", "This command performs a L-like operation on C."; + ( + [ L"truncate" ], + Getopt.String (s_"FILE", fun s -> List.push_front (`Truncate s) ops), + s_"Truncate a file to zero size" + ), + Some "FILE", "This command truncates C to a zero-length file. The file must exist\nalready."; + ( + [ L"truncate-recursive" ], + Getopt.String (s_"PATH", fun s -> List.push_front (`TruncateRecursive s) ops), + s_"Recursively truncate all files in directory" + ), + Some "PATH", "This command recursively truncates all files under C to zero-length."; ( [ L"uninstall" ], Getopt.String ( diff --git a/common/mlcustomize/customize_cmdline.mli b/common/mlcustomize/customize_cmdline.mli index 0cc166e..51a156e 100644 --- a/common/mlcustomize/customize_cmdline.mli +++ b/common/mlcustomize/customize_cmdline.mli @@ -33,6 +33,8 @@ and op = [ (* --append-line FILE:LINE *) | `Chmod of string * string (* --chmod PERMISSIONS:FILE *) + | `Chown of string * string * string + (* --chown UID:GID:PATH *) | `CommandsFromFile of string (* --commands-from-file FILENAME *) | `Copy of string * string @@ -83,14 +85,16 @@ and op = [ (* --sm-unregister *) | `SSHInject of string * Ssh_key.ssh_key_selector (* --ssh-inject USER[:SELECTOR] *) - | `Truncate of string - (* --truncate FILE *) - | `TruncateRecursive of string - (* --truncate-recursive PATH *) + | `TarIn of string * string + (* --tar-in TARFILE:REMOTEDIR *) | `Timezone of string (* --timezone TIMEZONE *) | `Touch of string (* --touch FILE *) + | `Truncate of string + (* --truncate FILE *) + | `TruncateRecursive of string + (* --truncate-recursive PATH *) | `UninstallPackages of string list (* --uninstall PKG,PKG.. *) | `Update diff --git a/common/mldrivers/Makefile.in b/common/mldrivers/Makefile.in index b59abfc..0c52d55 100644 --- a/common/mldrivers/Makefile.in +++ b/common/mldrivers/Makefile.in @@ -281,6 +281,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -431,6 +432,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mldrivers/linux_bootloaders.ml b/common/mldrivers/linux_bootloaders.ml index 6f8857e..91c5ab9 100644 --- a/common/mldrivers/linux_bootloaders.ml +++ b/common/mldrivers/linux_bootloaders.ml @@ -375,6 +375,18 @@ let detect_bootloader (g : G.guestfs) root i_firmware = with G.Error msg -> error (f_"could not find bootloader mount point (%s): %s") mp msg in + (* + * Workaround for older UEFI-based Debian which may not have + * /boot/efi/EFI/debian/grub.cfg. + *) + let paths = + if g#exists "/boot/grub/grub.cfg" then + match i_firmware with + | Firmware.I_BIOS -> paths + | I_UEFI _ -> paths @ ["/boot/grub/grub.cfg"] + else paths + in + (* We can determine if the bootloader config file is grub 1 or * grub 2 just by looking at the filename. *) diff --git a/common/mlgettext/Makefile.in b/common/mlgettext/Makefile.in index c3e1925..bd58dc1 100644 --- a/common/mlgettext/Makefile.in +++ b/common/mlgettext/Makefile.in @@ -283,6 +283,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -433,6 +434,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlpcre/Makefile.in b/common/mlpcre/Makefile.in index 56935af..d2f01fb 100644 --- a/common/mlpcre/Makefile.in +++ b/common/mlpcre/Makefile.in @@ -492,6 +492,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -642,6 +643,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlprogress/Makefile.in b/common/mlprogress/Makefile.in index bd8d0db..730f397 100644 --- a/common/mlprogress/Makefile.in +++ b/common/mlprogress/Makefile.in @@ -282,6 +282,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -432,6 +433,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlstdutils/Makefile.in b/common/mlstdutils/Makefile.in index 741b01a..2e7b8be 100644 --- a/common/mlstdutils/Makefile.in +++ b/common/mlstdutils/Makefile.in @@ -496,6 +496,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -646,6 +647,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlstdutils/std_utils.ml b/common/mlstdutils/std_utils.ml index 0d2fa22..86b21a7 100644 --- a/common/mlstdutils/std_utils.ml +++ b/common/mlstdutils/std_utils.ml @@ -341,12 +341,12 @@ module List = struct | x::xs, y::ys, z::zs -> (x, y, z) :: combine3 xs ys zs | _ -> invalid_arg "combine3" - let rec assoc_lbl ?(cmp = Pervasives.compare) ~default x = function + let rec assoc_lbl ?(cmp = Stdlib.compare) ~default x = function | [] -> default | (y, y') :: _ when cmp x y = 0 -> y' | _ :: ys -> assoc_lbl ~cmp ~default x ys - let uniq ?(cmp = Pervasives.compare) xs = + let uniq ?(cmp = Stdlib.compare) xs = let rec loop acc = function | [] -> acc | [x] -> x :: acc diff --git a/common/mltools/Makefile.in b/common/mltools/Makefile.in index 913c1fa..b450825 100644 --- a/common/mltools/Makefile.in +++ b/common/mltools/Makefile.in @@ -562,6 +562,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -712,6 +713,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mltools/curl.ml b/common/mltools/curl.ml index 6dba975..73eed90 100644 --- a/common/mltools/curl.ml +++ b/common/mltools/curl.ml @@ -20,11 +20,13 @@ open Printf open Std_utils open Tools_utils +open Common_gettext.Gettext type t = { curl : string; args : args; tmpdir : string option; + url : string; } and args = (string * string option) list @@ -40,11 +42,17 @@ let args_of_proxy = function | SystemProxy -> [] | ForcedProxy url -> [ "proxy", Some url; "noproxy", Some "" ] -let create ?(curl = "curl") ?(proxy = SystemProxy) ?tmpdir args = +let create ?(curl = "curl") ?(proxy = SystemProxy) ?tmpdir args url = + (* The ["url"] key must not appear in [args]. This was how the + * previous version of this module worked, so lets check there + * are no callers still doing this. + *) + List.iter (function "url", _ -> assert false | _ -> ()) args; + let args = safe_args @ args_of_proxy proxy @ args in - { curl = curl; args = args; tmpdir = tmpdir } + { curl; args; tmpdir; url } -let run { curl; args; tmpdir } = +let run { curl; args; tmpdir; url } = let config_file, chan = Filename.open_temp_file ?temp_dir:tmpdir "guestfscurl" ".conf" in List.iter ( @@ -67,15 +75,16 @@ let run { curl; args; tmpdir } = | c -> output_char chan c done; fprintf chan "\"\n" - ) args; + ) (("url", Some url) :: args); close_out chan; let cmd = sprintf "%s -q --config %s" (quote curl) (quote config_file) in - let lines = external_command ~echo_cmd:false cmd in + let help = sprintf (f_"downloading %s") url in + let lines = external_command ~echo_cmd:false ~help cmd in Unix.unlink config_file; lines -let to_string { curl; args } = +let to_string { curl; args; url } = let b = Buffer.create 128 in bprintf b "%s -q" (quote curl); List.iter ( @@ -85,7 +94,7 @@ let to_string { curl; args } = | "user", Some _ -> bprintf b " --user " | name, Some value -> bprintf b " --%s %s" name (quote value) ) args; - bprintf b "\n"; + bprintf b " %s\n" (quote url); Buffer.contents b let print chan t = output_string chan (to_string t) diff --git a/common/mltools/curl.mli b/common/mltools/curl.mli index a3e98dc..1606a79 100644 --- a/common/mltools/curl.mli +++ b/common/mltools/curl.mli @@ -27,13 +27,16 @@ type proxy = | SystemProxy (** Use the system settings. *) | ForcedProxy of string (** The proxy is forced to the specified URL. *) -val create : ?curl:string -> ?proxy:proxy -> ?tmpdir:string -> args -> t +val create : ?curl:string -> ?proxy:proxy -> ?tmpdir:string -> args -> string + -> t (** Create a curl command handle. The curl arguments are a list of key, value pairs corresponding to curl command line parameters, without leading dashes, eg. [("user", Some "user:password")]. + The string parameter is the URL (which is required). + The optional [?curl] parameter controls the name of the curl binary (default ["curl"]). diff --git a/common/mltools/libosinfo-c.c b/common/mltools/libosinfo-c.c index 93357fd..a48c898 100644 --- a/common/mltools/libosinfo-c.c +++ b/common/mltools/libosinfo-c.c @@ -296,7 +296,7 @@ v2v_osinfo_os_get_device_drivers (value osv) driver = OSINFO_DEVICE_DRIVER(osinfo_list_get_nth (OSINFO_LIST(list), i)); - vi = caml_alloc (6, 0); + vi = caml_alloc (7, 0); str = osinfo_device_driver_get_architecture (driver); copyv = caml_copy_string (str); Store_field (vi, 0, copyv); diff --git a/common/mltools/tools_utils.ml b/common/mltools/tools_utils.ml index 8b611e7..23f16c5 100644 --- a/common/mltools/tools_utils.ml +++ b/common/mltools/tools_utils.ml @@ -435,8 +435,12 @@ let create_standard_options argspec ?anon_fun ?(key_opts = false) let getopt = Getopt.create argspec ?anon_fun usage_msg in { getopt; ks; debug_gc } +let external_command_failed help cmd reason = + let help_prefix = match help with None -> "" | Some str -> str ^ ": " in + error "%s%s ‘%s’: %s" help_prefix (s_"external command") cmd reason + (* Run an external command, slurp up the output as a list of lines. *) -let external_command ?(echo_cmd = true) cmd = +let external_command ?(echo_cmd = true) ?help cmd = if echo_cmd then debug "%s" cmd; let chan = Unix.open_process_in cmd in @@ -448,15 +452,18 @@ let external_command ?(echo_cmd = true) cmd = (match stat with | Unix.WEXITED 0 -> () | Unix.WEXITED i -> - error (f_"external command ‘%s’ exited with error %d") cmd i + let reason = sprintf (f_"exited with error %d") i in + external_command_failed help cmd reason | Unix.WSIGNALED i -> - error (f_"external command ‘%s’ killed by signal %d") cmd i + let reason = sprintf (f_"killed by signal %d") i in + external_command_failed help cmd reason | Unix.WSTOPPED i -> - error (f_"external command ‘%s’ stopped by signal %d") cmd i + let reason = sprintf (f_"stopped by signal %d") i in + external_command_failed help cmd reason ); lines -let rec run_commands ?(echo_cmd = true) cmds = +let rec run_commands ?(echo_cmd = true) ?help cmds = let res = Array.make (List.length cmds) 0 in let pids = List.mapi ( @@ -482,21 +489,21 @@ let rec run_commands ?(echo_cmd = true) cmds = let matching_pair = List.hd matching_pair in let idx, _, app, outfd, errfd = matching_pair in pids := new_pids; - res.(idx) <- do_teardown app outfd errfd stat + res.(idx) <- do_teardown help app outfd errfd stat ); done; Array.to_list res -and run_command ?(echo_cmd = true) ?stdout_fd ?stderr_fd args = +and run_command ?(echo_cmd = true) ?help ?stdout_fd ?stderr_fd args = let run_res = do_run args ~echo_cmd ?stdout_fd ?stderr_fd in match run_res with | Either (pid, app, outfd, errfd) -> let _, stat = Unix.waitpid [] pid in - do_teardown app outfd errfd stat + do_teardown help app outfd errfd stat | Or code -> code -and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args = +and do_run ?(echo_cmd = true) ?help ?stdout_fd ?stderr_fd args = let app = List.hd args in let get_fd default = function | None -> @@ -522,16 +529,18 @@ and do_run ?(echo_cmd = true) ?stdout_fd ?stderr_fd args = debug "%s: %s: executable not found" app fn; Or 127 -and do_teardown app outfd errfd exitstat = +and do_teardown help app outfd errfd exitstat = Option.iter Unix.close outfd; Option.iter Unix.close errfd; match exitstat with | Unix.WEXITED i -> - i + i | Unix.WSIGNALED i -> - error (f_"external command ‘%s’ killed by signal %d") app i + let reason = sprintf (f_"killed by signal %d") i in + external_command_failed help app reason | Unix.WSTOPPED i -> - error (f_"external command ‘%s’ stopped by signal %d") app i + let reason = sprintf (f_"stopped by signal %d") i in + external_command_failed help app reason let shell_command ?(echo_cmd = true) cmd = if echo_cmd then diff --git a/common/mltools/tools_utils.mli b/common/mltools/tools_utils.mli index ec900e6..193ba7b 100644 --- a/common/mltools/tools_utils.mli +++ b/common/mltools/tools_utils.mli @@ -103,13 +103,17 @@ val create_standard_options : Getopt.speclist -> ?anon_fun:Getopt.anon_fun -> ?k Returns a new {!cmdline_options} structure. *) -val external_command : ?echo_cmd:bool -> string -> string list +val external_command : ?echo_cmd:bool -> ?help:string -> string -> string list (** Run an external command, slurp up the output as a list of lines. [echo_cmd] specifies whether to output the full command on verbose - mode, and it's on by default. *) + mode, and it's on by default. + + [help] is an optional string which is printed as a prefix in + case the external command fails, eg as a hint to the user about + what we were trying to do. *) -val run_commands : ?echo_cmd:bool -> (string list * Unix.file_descr option * Unix.file_descr option) list -> int list +val run_commands : ?echo_cmd:bool -> ?help:string -> (string list * Unix.file_descr option * Unix.file_descr option) list -> int list (** Run external commands in parallel without using a shell, and return a list with their exit codes. @@ -126,16 +130,24 @@ val run_commands : ?echo_cmd:bool -> (string list * Unix.file_descr option * Uni end of the execution of the command for which it was specified. [echo_cmd] specifies whether output the full command on verbose - mode, and it's on by default. *) + mode, and it's on by default. -val run_command : ?echo_cmd:bool -> ?stdout_fd:Unix.file_descr -> ?stderr_fd:Unix.file_descr -> string list -> int + [help] is an optional string which is printed as a prefix in + case the external command fails, eg as a hint to the user about + what we were trying to do. *) + +val run_command : ?echo_cmd:bool -> ?help:string -> ?stdout_fd:Unix.file_descr -> ?stderr_fd:Unix.file_descr -> string list -> int (** Run an external command without using a shell, and return its exit code. If [stdout_fd] or [stderr_fd] is specified, the file descriptor is automatically closed after executing the command. [echo_cmd] specifies whether output the full command on verbose - mode, and it's on by default. *) + mode, and it's on by default. + + [help] is an optional string which is printed as a prefix in + case the external command fails, eg as a hint to the user about + what we were trying to do. *) val shell_command : ?echo_cmd:bool -> string -> int (** Run an external shell command, and return its exit code. diff --git a/common/mlutils/Makefile.in b/common/mlutils/Makefile.in index 824a1cd..a7d7fcf 100644 --- a/common/mlutils/Makefile.in +++ b/common/mlutils/Makefile.in @@ -497,6 +497,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -647,6 +648,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlvisit/Makefile.in b/common/mlvisit/Makefile.in index f9672ca..3087fdc 100644 --- a/common/mlvisit/Makefile.in +++ b/common/mlvisit/Makefile.in @@ -495,6 +495,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -645,6 +646,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlxml/Makefile.in b/common/mlxml/Makefile.in index 6b3a204..b8b6ae7 100644 --- a/common/mlxml/Makefile.in +++ b/common/mlxml/Makefile.in @@ -282,6 +282,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -432,6 +433,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/mlxml/xml-c.c b/common/mlxml/xml-c.c index 715c3bb..e024bd8 100644 --- a/common/mlxml/xml-c.c +++ b/common/mlxml/xml-c.c @@ -34,6 +34,7 @@ #include #include +#include #include #include #include diff --git a/common/options/Makefile.in b/common/options/Makefile.in index de5431b..3eab7d7 100644 --- a/common/options/Makefile.in +++ b/common/options/Makefile.in @@ -288,6 +288,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -438,6 +439,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/options/key-option.pod b/common/options/key-option.pod index 6bc04df..1470d86 100644 --- a/common/options/key-option.pod +++ b/common/options/key-option.pod @@ -1,22 +1,37 @@ =item B<--key> SELECTOR Specify a key for LUKS, to automatically open a LUKS device when using -the inspection. C can be either the libguestfs device name, or -the UUID of the LUKS device. +the inspection. =over 4 -=item B<--key> C:key:KEY_STRING +=item B<--key> NAMEB<:key:>KEY_STRING + +=item B<--key> UUIDB<:key:>KEY_STRING + +=item B<--key> BKEY_STRING + +C is the libguestfs device name (eg. C). C is +the device UUID. C means try the key against any encrypted +device. Use the specified C as passphrase. -=item B<--key> C:file:FILENAME +=item B<--key> NAMEB<:file:>FILENAME + +=item B<--key> UUIDB<:file:>FILENAME + +=item B<--key> BFILENAME Read the passphrase from F. -=item B<--key> C:clevis +=item B<--key> NAMEB<:clevis> + +=item B<--key> UUIDB<:clevis> + +=item B<--key> B -Attempt passphrase-less unlocking for C with Clevis, over the +Attempt passphrase-less unlocking for the device with Clevis, over the network. Please refer to L for more information on network-bound disk encryption (NBDE). diff --git a/common/options/keys.c b/common/options/keys.c index 48f1bc7..87acba5 100644 --- a/common/options/keys.c +++ b/common/options/keys.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -152,9 +153,13 @@ get_keys (struct key_store *ks, const char *device, const char *uuid, if (ks) { for (i = 0; i < ks->nr_keys; ++i) { struct key_store_key *key = &ks->keys[i]; + bool key_id_matches_this_device; - if (STRNEQ (key->id, device) && (!uuid || STRNEQ (key->id, uuid))) - continue; + key_id_matches_this_device = + STREQ (key->id, "all") || /* special string "all" matches any device */ + STREQ (key->id, device) || + (uuid && STREQ (key->id, uuid)); + if (!key_id_matches_this_device) continue; switch (key->type) { case key_string: @@ -260,8 +265,107 @@ key_store_add_from_selector (struct key_store *ks, const char *selector) return key_store_import_key (ks, &key); } +/* Turn /dev/mapper/VG-LV into /dev/VG/LV, in-place. */ +static void +unescape_device_mapper_lvm (char *id) +{ + static const char dev[] = "/dev/", dev_mapper[] = "/dev/mapper/"; + const char *input_start; + char *output; + enum { M_SCAN, M_FILL, M_DONE } mode; + + if (!STRPREFIX (id, dev_mapper)) + return; + + /* Start parsing "VG-LV" from "id" after "/dev/mapper/". */ + input_start = id + (sizeof dev_mapper - 1); + + /* Start writing the unescaped "VG/LV" output after "/dev/". */ + output = id + (sizeof dev - 1); + + for (mode = M_SCAN; mode < M_DONE; ++mode) { + char c; + const char *input = input_start; + const char *hyphen_buffered = NULL; + bool single_hyphen_seen = false; + + do { + c = *input; + + switch (c) { + case '-': + if (hyphen_buffered == NULL) + /* This hyphen may start an escaped hyphen, or it could be the + * separator in VG-LV. + */ + hyphen_buffered = input; + else { + /* This hyphen completes an escaped hyphen; unescape it. */ + if (mode == M_FILL) + *output++ = '-'; + hyphen_buffered = NULL; + } + break; + + case '/': + /* Slash characters are forbidden in VG-LV anywhere. If there's any, + * we'll find it in the first (i.e., scanning) phase, before we output + * anything back to "id". + */ + assert (mode == M_SCAN); + return; + + default: + /* Encountered a non-slash, non-hyphen character -- which also may be + * the terminating NUL. + */ + if (hyphen_buffered != NULL) { + /* The non-hyphen character comes after a buffered hyphen, so the + * buffered hyphen is supposed to be the single hyphen that separates + * VG from LV in VG-LV. There are three requirements for this + * separator: (a) it must be unique (we must not have seen another + * such separator earlier), (b) it must not be at the start of VG-LV + * (because VG would be empty that way), (c) it must not be at the end + * of VG-LV (because LV would be empty that way). Should any of these + * be violated, we'll catch that during the first (i.e., scanning) + * phase, before modifying "id". + */ + if (single_hyphen_seen || hyphen_buffered == input_start || + c == '\0') { + assert (mode == M_SCAN); + return; + } + + /* Translate the separator hyphen to a slash character. */ + if (mode == M_FILL) + *output++ = '/'; + hyphen_buffered = NULL; + single_hyphen_seen = true; + } + + /* Output the non-hyphen character (including the terminating NUL) + * regardless of whether there was a buffered hyphen separator (which, + * by now, we'll have attempted to translate and flush). + */ + if (mode == M_FILL) + *output++ = c; + } + + ++input; + } while (c != '\0'); + + /* We must have seen the VG-LV separator. If that's not the case, we'll + * catch it before modifying "id". + */ + if (!single_hyphen_seen) { + assert (mode == M_SCAN); + return; + } + } +} + struct key_store * -key_store_import_key (struct key_store *ks, const struct key_store_key *key) +key_store_import_key (struct key_store *ks, struct key_store_key *key) { struct key_store_key *new_keys; @@ -278,6 +382,7 @@ key_store_import_key (struct key_store *ks, const struct key_store_key *key) error (EXIT_FAILURE, errno, "realloc"); ks->keys = new_keys; + unescape_device_mapper_lvm (key->id); ks->keys[ks->nr_keys] = *key; ++ks->nr_keys; diff --git a/common/options/options.h b/common/options/options.h index 94573ee..dcb15c2 100644 --- a/common/options/options.h +++ b/common/options/options.h @@ -109,6 +109,8 @@ struct key_store_key { * device name, or the UUID. * * There may be multiple matching devices in the list. + * + * This may be the special string "all" which matches any device. */ char *id; @@ -169,7 +171,8 @@ extern struct matching_key *get_keys (struct key_store *ks, const char *device, const char *uuid, size_t *nr_matches); extern void free_keys (struct matching_key *keys, size_t nr_matches); extern struct key_store *key_store_add_from_selector (struct key_store *ks, const char *selector); -extern struct key_store *key_store_import_key (struct key_store *ks, const struct key_store_key *key); +extern struct key_store *key_store_import_key (struct key_store *ks, + struct key_store_key *key); extern bool key_store_requires_network (const struct key_store *ks); extern void free_key_store (struct key_store *ks); diff --git a/common/parallel/Makefile.in b/common/parallel/Makefile.in index f1f5ce4..e13674e 100644 --- a/common/parallel/Makefile.in +++ b/common/parallel/Makefile.in @@ -285,6 +285,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -435,6 +436,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/progress/Makefile.in b/common/progress/Makefile.in index 2324f15..12aa8ae 100644 --- a/common/progress/Makefile.in +++ b/common/progress/Makefile.in @@ -278,6 +278,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -428,6 +429,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/structs/Makefile.in b/common/structs/Makefile.in index a761562..ec9ff11 100644 --- a/common/structs/Makefile.in +++ b/common/structs/Makefile.in @@ -279,6 +279,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -429,6 +430,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/utils/Makefile.in b/common/utils/Makefile.in index 24a5965..0398402 100644 --- a/common/utils/Makefile.in +++ b/common/utils/Makefile.in @@ -284,6 +284,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -434,6 +435,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/visit/Makefile.in b/common/visit/Makefile.in index 5447639..495cc54 100644 --- a/common/visit/Makefile.in +++ b/common/visit/Makefile.in @@ -275,6 +275,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -425,6 +426,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/common/windows/Makefile.in b/common/windows/Makefile.in index a7339bf..9f0b4d5 100644 --- a/common/windows/Makefile.in +++ b/common/windows/Makefile.in @@ -277,6 +277,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -427,6 +428,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/configure b/configure index bdd272b..5860871 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for guestfs-tools 1.50.1. +# Generated by GNU Autoconf 2.71 for guestfs-tools 1.52.0. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -618,8 +618,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='guestfs-tools' PACKAGE_TARNAME='guestfs-tools' -PACKAGE_VERSION='1.50.1' -PACKAGE_STRING='guestfs-tools 1.50.1' +PACKAGE_VERSION='1.52.0' +PACKAGE_STRING='guestfs-tools 1.52.0' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -713,6 +713,7 @@ OCAMLOPT OCAMLLIB OCAMLVERSION OCAMLC +HWDATA_PKGDATADIR LIBOSINFO_LIBS LIBOSINFO_CFLAGS JANSSON_LIBS @@ -727,6 +728,8 @@ LIBVIRT_CFLAGS PCRE2_CONFIG PCRE2_LIBS PCRE2_CFLAGS +localedir_c_make +localedir_c POSUB LTLIBINTL LIBINTL @@ -944,6 +947,7 @@ JANSSON_CFLAGS JANSSON_LIBS LIBOSINFO_CFLAGS LIBOSINFO_LIBS +HWDATA_PKGDATADIR LIBCRYPT_CFLAGS LIBCRYPT_LIBS LIBLZMA_CFLAGS @@ -1498,7 +1502,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures guestfs-tools 1.50.1 to adapt to many kinds of systems. +\`configure' configures guestfs-tools 1.52.0 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1569,7 +1573,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of guestfs-tools 1.50.1:";; + short | recursive ) echo "Configuration of guestfs-tools 1.52.0:";; esac cat <<\_ACEOF @@ -1662,6 +1666,8 @@ Some influential environment variables: C compiler flags for LIBOSINFO, overriding pkg-config LIBOSINFO_LIBS linker flags for LIBOSINFO, overriding pkg-config + HWDATA_PKGDATADIR + value of pkgdatadir for hwdata, overriding pkg-config LIBCRYPT_CFLAGS C compiler flags for LIBCRYPT, overriding pkg-config LIBCRYPT_LIBS @@ -1742,7 +1748,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -guestfs-tools configure 1.50.1 +guestfs-tools configure 1.52.0 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -2282,7 +2288,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by guestfs-tools $as_me 1.50.1, which was +It was created by guestfs-tools $as_me 1.52.0, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -4860,7 +4866,7 @@ fi # Define the identity of the package. PACKAGE='guestfs-tools' - VERSION='1.50.1' + VERSION='1.52.0' printf "%s\n" "#define PACKAGE \"$PACKAGE\"" >>confdefs.h @@ -14799,8 +14805,8 @@ printf "%s\n" "no" >&6; } fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBGUESTFS" >&5 -printf %s "checking for LIBGUESTFS... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libguestfs >= 1.49.8" >&5 +printf %s "checking for libguestfs >= 1.49.8... " >&6; } if test -n "$LIBGUESTFS_CFLAGS"; then pkg_cv_LIBGUESTFS_CFLAGS="$LIBGUESTFS_CFLAGS" @@ -14840,7 +14846,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -14849,14 +14855,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBGUESTFS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libguestfs >= 1.49.8" 2>&1` + LIBGUESTFS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libguestfs >= 1.49.8" 2>&1` else - LIBGUESTFS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libguestfs >= 1.49.8" 2>&1` + LIBGUESTFS_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libguestfs >= 1.49.8" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBGUESTFS_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBGUESTFS_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (libguestfs >= 1.49.8) were not met: + as_fn_error $? "Package requirements (libguestfs >= 1.49.8) were not met: $LIBGUESTFS_PKG_ERRORS @@ -14867,9 +14873,9 @@ Alternatively, you may set the environment variables LIBGUESTFS_CFLAGS and LIBGUESTFS_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -14882,8 +14888,8 @@ See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else - LIBGUESTFS_CFLAGS=$pkg_cv_LIBGUESTFS_CFLAGS - LIBGUESTFS_LIBS=$pkg_cv_LIBGUESTFS_LIBS + LIBGUESTFS_CFLAGS=$pkg_cv_LIBGUESTFS_CFLAGS + LIBGUESTFS_LIBS=$pkg_cv_LIBGUESTFS_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -15362,8 +15368,8 @@ fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBTINFO" >&5 -printf %s "checking for LIBTINFO... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for tinfo" >&5 +printf %s "checking for tinfo... " >&6; } if test -n "$LIBTINFO_CFLAGS"; then pkg_cv_LIBTINFO_CFLAGS="$LIBTINFO_CFLAGS" @@ -15403,7 +15409,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -15412,18 +15418,18 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "tinfo" 2>&1` + LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "tinfo" 2>&1` else - LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "tinfo" 2>&1` + LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "tinfo" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBTINFO_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBTINFO_PKG_ERRORS" >&5 pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBTINFO" >&5 -printf %s "checking for LIBTINFO... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncurses" >&5 +printf %s "checking for ncurses... " >&6; } if test -n "$LIBTINFO_CFLAGS"; then pkg_cv_LIBTINFO_CFLAGS="$LIBTINFO_CFLAGS" @@ -15463,7 +15469,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -15472,12 +15478,12 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` + LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` else - LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` + LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBTINFO_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBTINFO_PKG_ERRORS" >&5 for ac_prog in ncurses6-config ncurses5-config @@ -15538,7 +15544,7 @@ fi LIBTINFO_LIBS=`$NCURSES_CONFIG --libs` elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } for ac_prog in ncurses6-config ncurses5-config @@ -15599,21 +15605,21 @@ fi LIBTINFO_LIBS=`$NCURSES_CONFIG --libs` else - LIBTINFO_CFLAGS=$pkg_cv_LIBTINFO_CFLAGS - LIBTINFO_LIBS=$pkg_cv_LIBTINFO_LIBS + LIBTINFO_CFLAGS=$pkg_cv_LIBTINFO_CFLAGS + LIBTINFO_LIBS=$pkg_cv_LIBTINFO_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBTINFO" >&5 -printf %s "checking for LIBTINFO... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for ncurses" >&5 +printf %s "checking for ncurses... " >&6; } if test -n "$LIBTINFO_CFLAGS"; then pkg_cv_LIBTINFO_CFLAGS="$LIBTINFO_CFLAGS" @@ -15653,7 +15659,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -15662,12 +15668,12 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` + LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "ncurses" 2>&1` else - LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` + LIBTINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "ncurses" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBTINFO_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBTINFO_PKG_ERRORS" >&5 for ac_prog in ncurses6-config ncurses5-config @@ -15728,7 +15734,7 @@ fi LIBTINFO_LIBS=`$NCURSES_CONFIG --libs` elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } for ac_prog in ncurses6-config ncurses5-config @@ -15789,16 +15795,16 @@ fi LIBTINFO_LIBS=`$NCURSES_CONFIG --libs` else - LIBTINFO_CFLAGS=$pkg_cv_LIBTINFO_CFLAGS - LIBTINFO_LIBS=$pkg_cv_LIBTINFO_LIBS + LIBTINFO_CFLAGS=$pkg_cv_LIBTINFO_CFLAGS + LIBTINFO_LIBS=$pkg_cv_LIBTINFO_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi else - LIBTINFO_CFLAGS=$pkg_cv_LIBTINFO_CFLAGS - LIBTINFO_LIBS=$pkg_cv_LIBTINFO_LIBS + LIBTINFO_CFLAGS=$pkg_cv_LIBTINFO_CFLAGS + LIBTINFO_LIBS=$pkg_cv_LIBTINFO_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -17465,6 +17471,11 @@ fi + gl_sed_double_backslashes='s/\\/\\\\/g' + gl_sed_escape_doublequotes='s/"/\\"/g' + gl_sed_escape_for_make_1="s,\\([ \"&'();<>\\\\\`|]\\),\\\\\\1,g" + gl_sed_escape_for_make_2='s,\$,\\$$,g' + @@ -18513,7 +18524,8 @@ printf "%s\n" "$ac_res" >&6; } if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ - && test "$PACKAGE" != gettext-tools; }; then + && test "$PACKAGE" != gettext-tools \ + && test "$PACKAGE" != libintl; }; then gt_use_preinstalled_gnugettext=yes else LIBINTL= @@ -18607,18 +18619,56 @@ printf "%s\n" "#define HAVE_DCGETTEXT 1" >>confdefs.h - INTLLIBS="$LIBINTL" + + INTLLIBS="$LIBINTL" + + + gt_save_prefix="${prefix}" + gt_save_datarootdir="${datarootdir}" + gt_save_localedir="${localedir}" + if test "X$prefix" = "XNONE"; then + prefix="$ac_default_prefix" + fi + eval datarootdir="$datarootdir" + eval localedir="$localedir" + + + + + + gl_final_localedir="$localedir" + case "$build_os" in + cygwin*) + case "$host_os" in + mingw*) + gl_final_localedir=`cygpath -w "$gl_final_localedir"` ;; + esac + ;; + esac + localedir_c=`echo "$gl_final_localedir" | sed -e "$gl_sed_double_backslashes" -e "$gl_sed_escape_doublequotes"` + localedir_c='"'"$localedir_c"'"' + + + localedir_c_make=`echo "$localedir_c" | sed -e "$gl_sed_escape_for_make_1" -e "$gl_sed_escape_for_make_2"` + if test "$localedir_c_make" = '\"'"${gl_final_localedir}"'\"'; then + localedir_c_make='\"$(localedir)\"' + fi + + + localedir="${gt_save_localedir}" + datarootdir="${gt_save_datarootdir}" + prefix="${gt_save_prefix}" pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for PCRE2" >&5 -printf %s "checking for PCRE2... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libpcre2-8" >&5 +printf %s "checking for libpcre2-8... " >&6; } if test -n "$PCRE2_CFLAGS"; then pkg_cv_PCRE2_CFLAGS="$PCRE2_CFLAGS" @@ -18658,7 +18708,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -18667,12 +18717,12 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - PCRE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre2-8" 2>&1` + PCRE2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libpcre2-8" 2>&1` else - PCRE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre2-8" 2>&1` + PCRE2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libpcre2-8" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$PCRE2_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$PCRE2_PKG_ERRORS" >&5 for ac_prog in pcre2-config @@ -18733,7 +18783,7 @@ fi PCRE_LIBS=`$PCRE2_CONFIG --libs8` elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } for ac_prog in pcre2-config @@ -18794,8 +18844,8 @@ fi PCRE_LIBS=`$PCRE2_CONFIG --libs8` else - PCRE2_CFLAGS=$pkg_cv_PCRE2_CFLAGS - PCRE2_LIBS=$pkg_cv_PCRE2_LIBS + PCRE2_CFLAGS=$pkg_cv_PCRE2_CFLAGS + PCRE2_LIBS=$pkg_cv_PCRE2_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -18815,8 +18865,8 @@ then : pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBVIRT" >&5 -printf %s "checking for LIBVIRT... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libvirt >= 0.10.2" >&5 +printf %s "checking for libvirt >= 0.10.2... " >&6; } if test -n "$LIBVIRT_CFLAGS"; then pkg_cv_LIBVIRT_CFLAGS="$LIBVIRT_CFLAGS" @@ -18856,7 +18906,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -18865,12 +18915,12 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBVIRT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libvirt >= 0.10.2" 2>&1` + LIBVIRT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libvirt >= 0.10.2" 2>&1` else - LIBVIRT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libvirt >= 0.10.2" 2>&1` + LIBVIRT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libvirt >= 0.10.2" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBVIRT_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBVIRT_PKG_ERRORS" >&5 if test "$DEFAULT_BACKEND" = "libvirt"; then @@ -18881,7 +18931,7 @@ printf "%s\n" "$as_me: WARNING: libvirt not found, some core features will be di fi elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if test "$DEFAULT_BACKEND" = "libvirt"; then @@ -18892,8 +18942,8 @@ printf "%s\n" "$as_me: WARNING: libvirt not found, some core features will be di fi else - LIBVIRT_CFLAGS=$pkg_cv_LIBVIRT_CFLAGS - LIBVIRT_LIBS=$pkg_cv_LIBVIRT_LIBS + LIBVIRT_CFLAGS=$pkg_cv_LIBVIRT_CFLAGS + LIBVIRT_LIBS=$pkg_cv_LIBVIRT_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -18920,8 +18970,8 @@ libvirt_ro_uri='qemu+unix:///system?socket=/var/run/libvirt/libvirt-sock-ro' pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBXML2" >&5 -printf %s "checking for LIBXML2... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libxml-2.0" >&5 +printf %s "checking for libxml-2.0... " >&6; } if test -n "$LIBXML2_CFLAGS"; then pkg_cv_LIBXML2_CFLAGS="$LIBXML2_CFLAGS" @@ -18961,7 +19011,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -18970,14 +19020,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1` + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1` else - LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1` + LIBXML2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBXML2_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBXML2_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (libxml-2.0) were not met: + as_fn_error $? "Package requirements (libxml-2.0) were not met: $LIBXML2_PKG_ERRORS @@ -18988,9 +19038,9 @@ Alternatively, you may set the environment variables LIBXML2_CFLAGS and LIBXML2_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -19003,8 +19053,8 @@ See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else - LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS - LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS + LIBXML2_CFLAGS=$pkg_cv_LIBXML2_CFLAGS + LIBXML2_LIBS=$pkg_cv_LIBXML2_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -19022,8 +19072,8 @@ LIBS="$old_LIBS" pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for JANSSON" >&5 -printf %s "checking for JANSSON... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for jansson >= 2.7" >&5 +printf %s "checking for jansson >= 2.7... " >&6; } if test -n "$JANSSON_CFLAGS"; then pkg_cv_JANSSON_CFLAGS="$JANSSON_CFLAGS" @@ -19063,7 +19113,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -19072,14 +19122,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson >= 2.7" 2>&1` + JANSSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "jansson >= 2.7" 2>&1` else - JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson >= 2.7" 2>&1` + JANSSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "jansson >= 2.7" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$JANSSON_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$JANSSON_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (jansson >= 2.7) were not met: + as_fn_error $? "Package requirements (jansson >= 2.7) were not met: $JANSSON_PKG_ERRORS @@ -19090,9 +19140,9 @@ Alternatively, you may set the environment variables JANSSON_CFLAGS and JANSSON_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -19105,8 +19155,8 @@ See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else - JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS - JANSSON_LIBS=$pkg_cv_JANSSON_LIBS + JANSSON_CFLAGS=$pkg_cv_JANSSON_CFLAGS + JANSSON_LIBS=$pkg_cv_JANSSON_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -19114,8 +19164,8 @@ fi pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBOSINFO" >&5 -printf %s "checking for LIBOSINFO... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libosinfo-1.0" >&5 +printf %s "checking for libosinfo-1.0... " >&6; } if test -n "$LIBOSINFO_CFLAGS"; then pkg_cv_LIBOSINFO_CFLAGS="$LIBOSINFO_CFLAGS" @@ -19155,7 +19205,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -19164,14 +19214,14 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBOSINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libosinfo-1.0" 2>&1` + LIBOSINFO_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libosinfo-1.0" 2>&1` else - LIBOSINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libosinfo-1.0" 2>&1` + LIBOSINFO_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libosinfo-1.0" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBOSINFO_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBOSINFO_PKG_ERRORS" >&5 - as_fn_error $? "Package requirements (libosinfo-1.0) were not met: + as_fn_error $? "Package requirements (libosinfo-1.0) were not met: $LIBOSINFO_PKG_ERRORS @@ -19182,9 +19232,9 @@ Alternatively, you may set the environment variables LIBOSINFO_CFLAGS and LIBOSINFO_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 printf "%s\n" "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full @@ -19197,14 +19247,39 @@ See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else - LIBOSINFO_CFLAGS=$pkg_cv_LIBOSINFO_CFLAGS - LIBOSINFO_LIBS=$pkg_cv_LIBOSINFO_LIBS + LIBOSINFO_CFLAGS=$pkg_cv_LIBOSINFO_CFLAGS + LIBOSINFO_LIBS=$pkg_cv_LIBOSINFO_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } fi +if test -n "$HWDATA_PKGDATADIR"; then + pkg_cv_HWDATA_PKGDATADIR="$HWDATA_PKGDATADIR" + elif test -n "$PKG_CONFIG"; then + if test -n "$PKG_CONFIG" && \ + { { printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"hwdata\""; } >&5 + ($PKG_CONFIG --exists --print-errors "hwdata") 2>&5 + ac_status=$? + printf "%s\n" "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + pkg_cv_HWDATA_PKGDATADIR=`$PKG_CONFIG --variable="pkgdatadir" "hwdata" 2>/dev/null` + test "x$?" != "x0" && pkg_failed=yes +else + pkg_failed=yes +fi + else + pkg_failed=untried +fi +HWDATA_PKGDATADIR=$pkg_cv_HWDATA_PKGDATADIR + +if test "x$HWDATA_PKGDATADIR" = x"" +then : + +fi + + printf "%s\n" printf "%s\n" "--- Checking for OCaml compiler and libguestfs bindings ---" # libguestfs @@ -20365,9 +20440,9 @@ else $as_nop fi -ocaml_ver_str=4.04 +ocaml_ver_str=4.07 ocaml_min_major=4 -ocaml_min_minor=4 +ocaml_min_minor=7 { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking if OCaml version >= $ocaml_ver_str" >&5 printf %s "checking if OCaml version >= $ocaml_ver_str... " >&6; } ocaml_major="`echo $OCAMLVERSION | $AWK -F. '{print $1}'`" @@ -20879,8 +20954,8 @@ printf "%s\n" pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBCRYPT" >&5 -printf %s "checking for LIBCRYPT... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for libxcrypt" >&5 +printf %s "checking for libxcrypt... " >&6; } if test -n "$LIBCRYPT_CFLAGS"; then pkg_cv_LIBCRYPT_CFLAGS="$LIBCRYPT_CFLAGS" @@ -20920,7 +20995,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -20929,12 +21004,12 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBCRYPT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxcrypt" 2>&1` + LIBCRYPT_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxcrypt" 2>&1` else - LIBCRYPT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxcrypt" 2>&1` + LIBCRYPT_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxcrypt" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBCRYPT_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBCRYPT_PKG_ERRORS" >&5 old_LIBS="$LIBS" @@ -21004,7 +21079,7 @@ fi elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } old_LIBS="$LIBS" @@ -21074,8 +21149,8 @@ fi else - LIBCRYPT_CFLAGS=$pkg_cv_LIBCRYPT_CFLAGS - LIBCRYPT_LIBS=$pkg_cv_LIBCRYPT_LIBS + LIBCRYPT_CFLAGS=$pkg_cv_LIBCRYPT_CFLAGS + LIBCRYPT_LIBS=$pkg_cv_LIBCRYPT_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -21097,8 +21172,8 @@ CFLAGS="$old_CFLAGS" pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for LIBLZMA" >&5 -printf %s "checking for LIBLZMA... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for liblzma" >&5 +printf %s "checking for liblzma... " >&6; } if test -n "$LIBLZMA_CFLAGS"; then pkg_cv_LIBLZMA_CFLAGS="$LIBLZMA_CFLAGS" @@ -21138,7 +21213,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -21147,23 +21222,23 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "liblzma" 2>&1` + LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "liblzma" 2>&1` else - LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "liblzma" 2>&1` + LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "liblzma" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$LIBLZMA_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$LIBLZMA_PKG_ERRORS" >&5 - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: liblzma not found, virt-builder will be slower" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: liblzma not found, virt-builder will be slower" >&5 printf "%s\n" "$as_me: WARNING: liblzma not found, virt-builder will be slower" >&2;} elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: liblzma not found, virt-builder will be slower" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: liblzma not found, virt-builder will be slower" >&5 printf "%s\n" "$as_me: WARNING: liblzma not found, virt-builder will be slower" >&2;} else - LIBLZMA_CFLAGS=$pkg_cv_LIBLZMA_CFLAGS - LIBLZMA_LIBS=$pkg_cv_LIBLZMA_LIBS + LIBLZMA_CFLAGS=$pkg_cv_LIBLZMA_CFLAGS + LIBLZMA_LIBS=$pkg_cv_LIBLZMA_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -21214,8 +21289,8 @@ printf "%s\n" pkg_failed=no -{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for BASH_COMPLETION" >&5 -printf %s "checking for BASH_COMPLETION... " >&6; } +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for bash-completion >= 2.0" >&5 +printf %s "checking for bash-completion >= 2.0... " >&6; } if test -n "$BASH_COMPLETION_CFLAGS"; then pkg_cv_BASH_COMPLETION_CFLAGS="$BASH_COMPLETION_CFLAGS" @@ -21255,7 +21330,7 @@ fi if test $pkg_failed = yes; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then @@ -21264,12 +21339,12 @@ else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then - BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` + BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` else - BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` + BASH_COMPLETION_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "bash-completion >= 2.0" 2>&1` fi - # Put the nasty error message in config.log where it belongs - echo "$BASH_COMPLETION_PKG_ERRORS" >&5 + # Put the nasty error message in config.log where it belongs + echo "$BASH_COMPLETION_PKG_ERRORS" >&5 bash_completion=no @@ -21277,7 +21352,7 @@ fi printf "%s\n" "$as_me: WARNING: bash-completion not installed" >&2;} elif test $pkg_failed = untried; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5 printf "%s\n" "no" >&6; } bash_completion=no @@ -21285,8 +21360,8 @@ printf "%s\n" "no" >&6; } printf "%s\n" "$as_me: WARNING: bash-completion not installed" >&2;} else - BASH_COMPLETION_CFLAGS=$pkg_cv_BASH_COMPLETION_CFLAGS - BASH_COMPLETION_LIBS=$pkg_cv_BASH_COMPLETION_LIBS + BASH_COMPLETION_CFLAGS=$pkg_cv_BASH_COMPLETION_CFLAGS + BASH_COMPLETION_LIBS=$pkg_cv_BASH_COMPLETION_LIBS { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: yes" >&5 printf "%s\n" "yes" >&6; } @@ -21347,7 +21422,7 @@ ac_config_files="$ac_config_files run" ac_config_files="$ac_config_files win-reg/virt-win-reg" -ac_config_files="$ac_config_files Makefile align/Makefile bash/Makefile builder/Makefile builder/libguestfs.conf builder/opensuse.conf builder/templates/Makefile builder/test-config/virt-builder/repos.d/test-index.conf builder/test-simplestreams/virt-builder/repos.d/cirros.conf builder/test-website/virt-builder/repos.d/libguestfs.conf cat/Makefile common/edit/Makefile common/mlcustomize/Makefile common/mldrivers/Makefile common/mlgettext/Makefile common/mlpcre/Makefile common/mlprogress/Makefile common/mlstdutils/Makefile common/mlstdutils/guestfs_config.ml common/mltools/Makefile common/mlutils/Makefile common/mlvisit/Makefile common/mlxml/Makefile common/options/Makefile common/parallel/Makefile common/progress/Makefile common/structs/Makefile common/utils/Makefile common/visit/Makefile common/windows/Makefile config.sh customize/Makefile docs/Makefile df/Makefile dib/Makefile diff/Makefile drivers/Makefile edit/Makefile format/Makefile get-kernel/Makefile gnulib/lib/Makefile inspector/Makefile make-fs/Makefile po-docs/Makefile po-docs/ja/Makefile po-docs/uk/Makefile po/Makefile resize/Makefile sparsify/Makefile sysprep/Makefile test-data/Makefile test-data/binaries/Makefile test-data/blank-disks/Makefile test-data/files/Makefile test-data/phony-guests/Makefile test-data/phony-guests/guests.xml win-reg/Makefile" +ac_config_files="$ac_config_files Makefile align/Makefile bash/Makefile builder/Makefile builder/libguestfs.conf builder/opensuse.conf builder/templates/Makefile builder/test-config/virt-builder/repos.d/test-index.conf builder/test-simplestreams/virt-builder/repos.d/cirros.conf builder/test-website/virt-builder/repos.d/libguestfs.conf cat/Makefile common/edit/Makefile common/mlcustomize/Makefile common/mldrivers/Makefile common/mlgettext/Makefile common/mlpcre/Makefile common/mlprogress/Makefile common/mlstdutils/Makefile common/mlstdutils/guestfs_config.ml common/mltools/Makefile common/mlutils/Makefile common/mlvisit/Makefile common/mlxml/Makefile common/options/Makefile common/parallel/Makefile common/progress/Makefile common/structs/Makefile common/utils/Makefile common/visit/Makefile common/windows/Makefile config.sh customize/Makefile docs/Makefile df/Makefile diff/Makefile drivers/Makefile drivers/hwdata_config.ml edit/Makefile format/Makefile get-kernel/Makefile gnulib/lib/Makefile inspector/Makefile make-fs/Makefile po-docs/Makefile po-docs/ja/Makefile po-docs/uk/Makefile po/Makefile resize/Makefile sparsify/Makefile sysprep/Makefile test-data/Makefile test-data/binaries/Makefile test-data/blank-disks/Makefile test-data/files/Makefile test-data/phony-guests/Makefile test-data/phony-guests/guests.xml win-reg/Makefile" cat >confcache <<\_ACEOF @@ -21933,7 +22008,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by guestfs-tools $as_me 1.50.1, which was +This file was extended by guestfs-tools $as_me 1.52.0, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -22001,7 +22076,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -guestfs-tools config.status 1.50.1 +guestfs-tools config.status 1.52.0 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" @@ -22462,9 +22537,9 @@ do "customize/Makefile") CONFIG_FILES="$CONFIG_FILES customize/Makefile" ;; "docs/Makefile") CONFIG_FILES="$CONFIG_FILES docs/Makefile" ;; "df/Makefile") CONFIG_FILES="$CONFIG_FILES df/Makefile" ;; - "dib/Makefile") CONFIG_FILES="$CONFIG_FILES dib/Makefile" ;; "diff/Makefile") CONFIG_FILES="$CONFIG_FILES diff/Makefile" ;; "drivers/Makefile") CONFIG_FILES="$CONFIG_FILES drivers/Makefile" ;; + "drivers/hwdata_config.ml") CONFIG_FILES="$CONFIG_FILES drivers/hwdata_config.ml" ;; "edit/Makefile") CONFIG_FILES="$CONFIG_FILES edit/Makefile" ;; "format/Makefile") CONFIG_FILES="$CONFIG_FILES format/Makefile" ;; "get-kernel/Makefile") CONFIG_FILES="$CONFIG_FILES get-kernel/Makefile" ;; @@ -23896,7 +23971,7 @@ echo "If any optional component is configured 'no' when you expected 'yes'" echo "then you should check the preceding messages." echo echo "Please report bugs back to the mailing list:" -echo "http://www.redhat.com/mailman/listinfo/libguestfs" +echo "https://lists.libguestfs.org" echo echo "Next you should type 'make' to build the package," echo "then 'make check' to run the tests." diff --git a/configure.ac b/configure.ac index 24a89d6..95690ef 100644 --- a/configure.ac +++ b/configure.ac @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -AC_INIT([guestfs-tools], [1.50.1]) +AC_INIT([guestfs-tools], [1.52.0]) dnl The common/ subdirectory assumes this. In libguestfs it contains dnl the --with-extra parameter. Here we just define it to the version. @@ -136,9 +136,9 @@ AC_CONFIG_FILES([Makefile customize/Makefile docs/Makefile df/Makefile - dib/Makefile diff/Makefile drivers/Makefile + drivers/hwdata_config.ml edit/Makefile format/Makefile get-kernel/Makefile @@ -182,7 +182,7 @@ echo "If any optional component is configured 'no' when you expected 'yes'" echo "then you should check the preceding messages." echo echo "Please report bugs back to the mailing list:" -echo "http://www.redhat.com/mailman/listinfo/libguestfs" +echo "https://lists.libguestfs.org" echo echo "Next you should type 'make' to build the package," echo "then 'make check' to run the tests." diff --git a/customize/Makefile.in b/customize/Makefile.in index 5bf84ec..481f9e2 100644 --- a/customize/Makefile.in +++ b/customize/Makefile.in @@ -514,6 +514,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -664,6 +665,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/customize/customize_cmdline.ml b/customize/customize_cmdline.ml index 3c24315..245d996 100644 --- a/customize/customize_cmdline.ml +++ b/customize/customize_cmdline.ml @@ -41,6 +41,8 @@ and op = [ (* --append-line FILE:LINE *) | `Chmod of string * string (* --chmod PERMISSIONS:FILE *) + | `Chown of string * string * string + (* --chown UID:GID:PATH *) | `CommandsFromFile of string (* --commands-from-file FILENAME *) | `Copy of string * string @@ -91,14 +93,16 @@ and op = [ (* --sm-unregister *) | `SSHInject of string * Ssh_key.ssh_key_selector (* --ssh-inject USER[:SELECTOR] *) - | `Truncate of string - (* --truncate FILE *) - | `TruncateRecursive of string - (* --truncate-recursive PATH *) + | `TarIn of string * string + (* --tar-in TARFILE:REMOTEDIR *) | `Timezone of string (* --timezone TIMEZONE *) | `Touch of string (* --touch FILE *) + | `Truncate of string + (* --truncate FILE *) + | `TruncateRecursive of string + (* --truncate-recursive PATH *) | `UninstallPackages of string list (* --uninstall PKG,PKG.. *) | `Update @@ -152,8 +156,13 @@ let rec argspec () = option_name in let len = String.length arg in String.sub arg 0 i, String.sub arg (i+1) (len-(i+1)) - in - let split_string_list arg = + and split_string_triplet option_name arg = + match String.nsplit ~max:3 "," arg with + | [a; b; c] -> a, b, c + | _ -> + error (f_"invalid format for '--%s' parameter, see the man page") + option_name + and split_string_list arg = String.nsplit "," arg in let split_links_list option_name arg = @@ -187,6 +196,17 @@ let rec argspec () = s_"Change the permissions of a file" ), Some "PERMISSIONS:FILE", "Change the permissions of C to C.\n\nI: C by default would be decimal, unless you prefix\nit with C<0> to get octal, ie. use C<0700> not C<700>."; + ( + [ L"chown" ], + Getopt.String ( + s_"UID:GID:PATH", + fun s -> + let p = split_string_triplet "chown" s in + List.push_front (`Chown p) ops + ), + s_"Change the owner user and group ID of a file or directory" + ), + Some "UID:GID:PATH", "Change the owner user and group ID of a file or directory in the guest.\nNote:\n\n=over 4\n\n=item *\n\nOnly numeric UIDs and GIDs will work, and these may not be the same\ninside the guest as on the host.\n\n=item *\n\nThis will not work with Windows guests.\n\n=back\n\nFor example:\n\n virt-customize --chown '0:0:/var/log/audit.log'\n\nSee also: I<--upload>."; ( [ L"commands-from-file" ], Getopt.String ( @@ -400,17 +420,16 @@ let rec argspec () = ), Some "USER[:SELECTOR]", "Inject an ssh key so the given C will be able to log in over\nssh without supplying a password. The C must exist already\nin the guest.\n\nSee L for the format of\nthe C field.\n\nYou can have multiple I<--ssh-inject> options, for different users\nand also for more keys for each user."; ( - [ L"truncate" ], - Getopt.String (s_"FILE", fun s -> List.push_front (`Truncate s) ops), - s_"Truncate a file to zero size" - ), - Some "FILE", "This command truncates C to a zero-length file. The file must exist\nalready."; - ( - [ L"truncate-recursive" ], - Getopt.String (s_"PATH", fun s -> List.push_front (`TruncateRecursive s) ops), - s_"Recursively truncate all files in directory" + [ L"tar-in" ], + Getopt.String ( + s_"TARFILE:REMOTEDIR", + fun s -> + let p = split_string_pair "tar-in" s in + List.push_front (`TarIn p) ops + ), + s_"Copy local files or directories from a tarball into image" ), - Some "PATH", "This command recursively truncates all files under C to zero-length."; + Some "TARFILE:REMOTEDIR", "Copy local files or directories from a local tar file\ncalled C into the disk image, placing them in the\ndirectory C (which must exist). Note that\nthe tar file must be uncompressed (F<.tar.gz> files will not work\nhere)"; ( [ L"timezone" ], Getopt.String (s_"TIMEZONE", fun s -> List.push_front (`Timezone s) ops), @@ -423,6 +442,18 @@ let rec argspec () = s_"Run touch on a file" ), Some "FILE", "This command performs a L-like operation on C."; + ( + [ L"truncate" ], + Getopt.String (s_"FILE", fun s -> List.push_front (`Truncate s) ops), + s_"Truncate a file to zero size" + ), + Some "FILE", "This command truncates C to a zero-length file. The file must exist\nalready."; + ( + [ L"truncate-recursive" ], + Getopt.String (s_"PATH", fun s -> List.push_front (`TruncateRecursive s) ops), + s_"Recursively truncate all files in directory" + ), + Some "PATH", "This command recursively truncates all files under C to zero-length."; ( [ L"uninstall" ], Getopt.String ( diff --git a/customize/customize_cmdline.mli b/customize/customize_cmdline.mli index 0cc166e..51a156e 100644 --- a/customize/customize_cmdline.mli +++ b/customize/customize_cmdline.mli @@ -33,6 +33,8 @@ and op = [ (* --append-line FILE:LINE *) | `Chmod of string * string (* --chmod PERMISSIONS:FILE *) + | `Chown of string * string * string + (* --chown UID:GID:PATH *) | `CommandsFromFile of string (* --commands-from-file FILENAME *) | `Copy of string * string @@ -83,14 +85,16 @@ and op = [ (* --sm-unregister *) | `SSHInject of string * Ssh_key.ssh_key_selector (* --ssh-inject USER[:SELECTOR] *) - | `Truncate of string - (* --truncate FILE *) - | `TruncateRecursive of string - (* --truncate-recursive PATH *) + | `TarIn of string * string + (* --tar-in TARFILE:REMOTEDIR *) | `Timezone of string (* --timezone TIMEZONE *) | `Touch of string (* --touch FILE *) + | `Truncate of string + (* --truncate FILE *) + | `TruncateRecursive of string + (* --truncate-recursive PATH *) | `UninstallPackages of string list (* --uninstall PKG,PKG.. *) | `Update diff --git a/customize/customize_run.ml b/customize/customize_run.ml index f03774e..1314d6e 100644 --- a/customize/customize_run.ml +++ b/customize/customize_run.ml @@ -153,6 +153,16 @@ let run (g : G.guestfs) root (ops : ops) = let mode = if String.is_prefix mode "0" then "0o" ^ mode else mode in g#chmod (int_of_string mode) path + | `Chown (uid, gid, path) -> + let uid, gid = + try int_of_string uid, int_of_string gid + with Failure _ -> + error (f_"--chown: could not parse numeric UID:GID from \ + %s:%s") uid gid in + + message (f_"Changing owner of %s to %d:%d") path uid gid; + g#chown uid gid path + | `Command cmd -> message (f_"Running: %s") cmd; do_run ~display:cmd cmd @@ -312,6 +322,10 @@ let run (g : G.guestfs) root (ops : ops) = ) else warning (f_"SSH key could not be injected for this type of guest") + | `TarIn (tarfile, remotedir) -> + message (f_"Unpack tar file: %s to %s") tarfile remotedir; + g#tar_in tarfile remotedir + | `Truncate path -> message (f_"Truncating: %s") path; g#truncate path diff --git a/df/Makefile.in b/df/Makefile.in index f2c7a1d..f73ac2d 100644 --- a/df/Makefile.in +++ b/df/Makefile.in @@ -499,6 +499,7 @@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ +HWDATA_PKGDATADIR = @HWDATA_PKGDATADIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ @@ -649,6 +650,8 @@ libdir = @libdir@ libexecdir = @libexecdir@ libvirt_ro_uri = @libvirt_ro_uri@ localedir = @localedir@ +localedir_c = @localedir_c@ +localedir_c_make = @localedir_c_make@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ diff --git a/dib/Makefile.am b/dib/Makefile.am deleted file mode 100644 index 7581feb..0000000 --- a/dib/Makefile.am +++ /dev/null @@ -1,169 +0,0 @@ -# libguestfs virt-dib tool -# Copyright (C) 2015 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -include $(top_srcdir)/subdir-rules.mk - -EXTRA_DIST = \ - $(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \ - test-virt-dib-docs.sh \ - virt-dib.pod - -SOURCES_MLI = \ - cmdline.mli \ - dib.mli \ - elements.mli \ - output_format.mli \ - $(patsubst %,output_format_%.mli,$(formats)) \ - utils.mli - -# Filenames output_format_.ml in alphabetical order. -formats = \ - docker \ - qcow2 \ - raw \ - squashfs \ - tar \ - tgz \ - vhd - -SOURCES_ML = \ - utils.ml \ - output_format.ml \ - cmdline.ml \ - elements.ml \ - $(patsubst %,output_format_%.ml,$(formats)) \ - dib.ml - -SOURCES_C = \ - dummy.c - -bin_PROGRAMS = - -if HAVE_OCAML - -bin_PROGRAMS += virt-dib - -virt_dib_SOURCES = $(SOURCES_C) -virt_dib_CPPFLAGS = \ - -I. \ - -I$(top_builddir) \ - -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ - -I$(shell $(OCAMLC) -where) \ - -I$(top_srcdir)/gnulib/lib \ - -I$(top_srcdir)/common/utils \ - -I$(top_srcdir)/lib -virt_dib_CFLAGS = \ - -pthread \ - $(WARN_CFLAGS) $(WERROR_CFLAGS) - -BOBJECTS = \ - $(SOURCES_ML:.ml=.cmo) -XOBJECTS = $(BOBJECTS:.cmo=.cmx) - -OCAMLPACKAGES = \ - -package str,unix,guestfs \ - -I $(top_builddir)/common/utils/.libs \ - -I $(top_builddir)/gnulib/lib/.libs \ - -I $(top_builddir)/ocaml \ - -I $(top_builddir)/common/mlstdutils \ - -I $(top_builddir)/common/mlutils \ - -I $(top_builddir)/common/mlgettext \ - -I $(top_builddir)/common/mlpcre \ - -I $(top_builddir)/common/mltools -if HAVE_OCAML_PKG_GETTEXT -OCAMLPACKAGES += -package gettext-stub -endif - -OCAMLCLIBS = \ - -pthread -lpthread \ - -lutils \ - $(LIBXML2_LIBS) \ - $(LIBGUESTFS_LIBS) \ - $(LIBINTL) \ - -lgnu - -OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)' - -if !HAVE_OCAMLOPT -OBJECTS = $(BOBJECTS) -else -OBJECTS = $(XOBJECTS) -endif - -OCAMLLINKFLAGS = \ - mlstdutils.$(MLARCHIVE) \ - mlguestfs.$(MLARCHIVE) \ - mlcutils.$(MLARCHIVE) \ - mlgettext.$(MLARCHIVE) \ - mlpcre.$(MLARCHIVE) \ - mltools.$(MLARCHIVE) \ - $(LINK_CUSTOM_OCAMLC_ONLY) - -virt_dib_DEPENDENCIES = \ - $(OBJECTS) \ - ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ - ../common/mlutils/mlcutils.$(MLARCHIVE) \ - ../common/mlgettext/mlgettext.$(MLARCHIVE) \ - ../common/mlpcre/mlpcre.$(MLARCHIVE) \ - ../common/mltools/mltools.$(MLARCHIVE) \ - $(top_builddir)/ocaml-link.sh -virt_dib_LINK = \ - $(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ - $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \ - $(OBJECTS) -o $@ - -# The output_format_*.mli files are all empty and autogenerated. -CLEANFILES += \ - $(patsubst %,output_format_%.mli,$(formats)) - -output_format_%.mli: - rm -f $@ $@-t - echo '(* This file is generated by Makefile.am. *)' >> $@-t - echo '(* Nothing is exported from output format modules. *)' >> $@-t - mv $@-t $@ - -# Tests. - -TESTS_ENVIRONMENT = $(top_builddir)/run --test - -TESTS = test-virt-dib-docs.sh - -# Manual pages and HTML files for the website. - -man_MANS = virt-dib.1 - -noinst_DATA = $(top_builddir)/website/virt-dib.1.html - -virt-dib.1 $(top_builddir)/website/virt-dib.1.html: stamp-virt-dib.pod - -stamp-virt-dib.pod: virt-dib.pod - $(PODWRAPPER) \ - --man virt-dib.1 \ - --html $(top_builddir)/website/virt-dib.1.html \ - --license GPLv2+ \ - --warning safe \ - $< - touch $@ - -# OCaml dependencies. -.depend: $(SOURCES_MLI) $(SOURCES_ML) - $(top_builddir)/ocaml-dep.sh $^ --include .depend - -endif - -.PHONY: docs diff --git a/dib/Makefile.in b/dib/Makefile.in deleted file mode 100644 index 7985a71..0000000 --- a/dib/Makefile.in +++ /dev/null @@ -1,1487 +0,0 @@ -# Makefile.in generated by automake 1.16.5 from Makefile.am. -# @configure_input@ - -# Copyright (C) 1994-2021 Free Software Foundation, Inc. - -# This Makefile.in is free software; the Free Software Foundation -# gives unlimited permission to copy and/or distribute it, -# with or without modifications, as long as this notice is preserved. - -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY, to the extent permitted by law; without -# even the implied warranty of MERCHANTABILITY or FITNESS FOR A -# PARTICULAR PURPOSE. - -@SET_MAKE@ - -# libguestfs virt-dib tool -# Copyright (C) 2015 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# libguestfs -# Copyright (C) 2009-2023 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# subdir-rules.mk should be included in every *subdirectory* Makefile.am. - -# libguestfs -# Copyright (C) 2013 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -# 'common-rules.mk' should be included in every Makefile.am. -# cf. 'subdir-rules.mk' - - -VPATH = @srcdir@ -am__is_gnu_make = { \ - if test -z '$(MAKELEVEL)'; then \ - false; \ - elif test -n '$(MAKE_HOST)'; then \ - true; \ - elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ - true; \ - else \ - false; \ - fi; \ -} -am__make_running_with_option = \ - case $${target_option-} in \ - ?) ;; \ - *) echo "am__make_running_with_option: internal error: invalid" \ - "target option '$${target_option-}' specified" >&2; \ - exit 1;; \ - esac; \ - has_opt=no; \ - sane_makeflags=$$MAKEFLAGS; \ - if $(am__is_gnu_make); then \ - sane_makeflags=$$MFLAGS; \ - else \ - case $$MAKEFLAGS in \ - *\\[\ \ ]*) \ - bs=\\; \ - sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ - | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ - esac; \ - fi; \ - skip_next=no; \ - strip_trailopt () \ - { \ - flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ - }; \ - for flg in $$sane_makeflags; do \ - test $$skip_next = yes && { skip_next=no; continue; }; \ - case $$flg in \ - *=*|--*) continue;; \ - -*I) strip_trailopt 'I'; skip_next=yes;; \ - -*I?*) strip_trailopt 'I';; \ - -*O) strip_trailopt 'O'; skip_next=yes;; \ - -*O?*) strip_trailopt 'O';; \ - -*l) strip_trailopt 'l'; skip_next=yes;; \ - -*l?*) strip_trailopt 'l';; \ - -[dEDm]) skip_next=yes;; \ - -[JT]) skip_next=yes;; \ - esac; \ - case $$flg in \ - *$$target_option*) has_opt=yes; break;; \ - esac; \ - done; \ - test $$has_opt = yes -am__make_dryrun = (target_option=n; $(am__make_running_with_option)) -am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) -pkgdatadir = $(datadir)/@PACKAGE@ -pkgincludedir = $(includedir)/@PACKAGE@ -pkglibdir = $(libdir)/@PACKAGE@ -pkglibexecdir = $(libexecdir)/@PACKAGE@ -am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd -install_sh_DATA = $(install_sh) -c -m 644 -install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c -INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) -NORMAL_INSTALL = : -PRE_INSTALL = : -POST_INSTALL = : -NORMAL_UNINSTALL = : -PRE_UNINSTALL = : -POST_UNINSTALL = : -build_triplet = @build@ -host_triplet = @host@ -bin_PROGRAMS = $(am__EXEEXT_1) -@HAVE_OCAML_TRUE@am__append_1 = virt-dib -@HAVE_OCAML_PKG_GETTEXT_TRUE@@HAVE_OCAML_TRUE@am__append_2 = -package gettext-stub - -# The output_format_*.mli files are all empty and autogenerated. -@HAVE_OCAML_TRUE@am__append_3 = \ -@HAVE_OCAML_TRUE@ $(patsubst %,output_format_%.mli,$(formats)) - -subdir = dib -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \ - $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ - $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ - $(top_srcdir)/m4/ocaml.m4 $(top_srcdir)/m4/guestfs-progs.m4 \ - $(top_srcdir)/m4/guestfs-c.m4 \ - $(top_srcdir)/m4/guestfs-libraries.m4 \ - $(top_srcdir)/m4/guestfs-ocaml-gettext.m4 \ - $(top_srcdir)/m4/guestfs-ocaml.m4 \ - $(top_srcdir)/m4/guestfs-perl.m4 \ - $(top_srcdir)/m4/guestfs-misc-libraries.m4 \ - $(top_srcdir)/m4/guestfs-bash-completion.m4 \ - $(top_srcdir)/configure.ac -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) -mkinstalldirs = $(install_sh) -d -CONFIG_HEADER = $(top_builddir)/config.h -CONFIG_CLEAN_FILES = -CONFIG_CLEAN_VPATH_FILES = -@HAVE_OCAML_TRUE@am__EXEEXT_1 = virt-dib$(EXEEXT) -am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)" -PROGRAMS = $(bin_PROGRAMS) -am__virt_dib_SOURCES_DIST = dummy.c -am__objects_1 = virt_dib-dummy.$(OBJEXT) -@HAVE_OCAML_TRUE@am_virt_dib_OBJECTS = $(am__objects_1) -virt_dib_OBJECTS = $(am_virt_dib_OBJECTS) -virt_dib_LDADD = $(LDADD) -AM_V_P = $(am__v_P_@AM_V@) -am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) -am__v_P_0 = false -am__v_P_1 = : -AM_V_GEN = $(am__v_GEN_@AM_V@) -am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) -am__v_GEN_0 = @echo " GEN " $@; -am__v_GEN_1 = -AM_V_at = $(am__v_at_@AM_V@) -am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) -am__v_at_0 = @ -am__v_at_1 = -DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) -depcomp = $(SHELL) $(top_srcdir)/build-aux/depcomp -am__maybe_remake_depfiles = depfiles -am__depfiles_remade = ./$(DEPDIR)/virt_dib-dummy.Po -am__mv = mv -f -AM_V_lt = $(am__v_lt_@AM_V@) -am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) -am__v_lt_0 = --silent -am__v_lt_1 = -COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ - $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CFLAGS) $(CFLAGS) -AM_V_CC = $(am__v_CC_@AM_V@) -am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) -am__v_CC_0 = @echo " CC " $@; -am__v_CC_1 = -CCLD = $(CC) -LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ - $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ - $(AM_LDFLAGS) $(LDFLAGS) -o $@ -AM_V_CCLD = $(am__v_CCLD_@AM_V@) -am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) -am__v_CCLD_0 = @echo " CCLD " $@; -am__v_CCLD_1 = -SOURCES = $(virt_dib_SOURCES) -DIST_SOURCES = $(am__virt_dib_SOURCES_DIST) -am__can_run_installinfo = \ - case $$AM_UPDATE_INFO_DIR in \ - n|no|NO) false;; \ - *) (install-info --version) >/dev/null 2>&1;; \ - esac -am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; -am__vpath_adj = case $$p in \ - $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ - *) f=$$p;; \ - esac; -am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; -am__install_max = 40 -am__nobase_strip_setup = \ - srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` -am__nobase_strip = \ - for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" -am__nobase_list = $(am__nobase_strip_setup); \ - for p in $$list; do echo "$$p $$p"; done | \ - sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ - $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ - if (++n[$$2] == $(am__install_max)) \ - { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ - END { for (dir in files) print dir, files[dir] }' -am__base_list = \ - sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ - sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__uninstall_files_from_dir = { \ - test -z "$$files" \ - || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ - || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ - $(am__cd) "$$dir" && rm -f $$files; }; \ - } -man1dir = $(mandir)/man1 -NROFF = nroff -MANS = $(man_MANS) -DATA = $(noinst_DATA) -am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) -# Read a list of newline-separated strings from the standard input, -# and print each of them once, without duplicates. Input order is -# *not* preserved. -am__uniquify_input = $(AWK) '\ - BEGIN { nonempty = 0; } \ - { items[$$0] = 1; nonempty = 1; } \ - END { if (nonempty) { for (i in items) print i; }; } \ -' -# Make sure the list of sources is unique. This is necessary because, -# e.g., the same source file might be shared among _SOURCES variables -# for different programs/libraries. -am__define_uniq_tagged_files = \ - list='$(am__tagged_files)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | $(am__uniquify_input)` -am__tty_colors_dummy = \ - mgn= red= grn= lgn= blu= brg= std=; \ - am__color_tests=no -am__tty_colors = { \ - $(am__tty_colors_dummy); \ - if test "X$(AM_COLOR_TESTS)" = Xno; then \ - am__color_tests=no; \ - elif test "X$(AM_COLOR_TESTS)" = Xalways; then \ - am__color_tests=yes; \ - elif test "X$$TERM" != Xdumb && { test -t 1; } 2>/dev/null; then \ - am__color_tests=yes; \ - fi; \ - if test $$am__color_tests = yes; then \ - red=''; \ - grn=''; \ - lgn=''; \ - blu=''; \ - mgn=''; \ - brg=''; \ - std=''; \ - fi; \ -} -am__recheck_rx = ^[ ]*:recheck:[ ]* -am__global_test_result_rx = ^[ ]*:global-test-result:[ ]* -am__copy_in_global_log_rx = ^[ ]*:copy-in-global-log:[ ]* -# A command that, given a newline-separated list of test names on the -# standard input, print the name of the tests that are to be re-run -# upon "make recheck". -am__list_recheck_tests = $(AWK) '{ \ - recheck = 1; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - { \ - if ((getline line2 < ($$0 ".log")) < 0) \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \ - { \ - recheck = 0; \ - break; \ - } \ - else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \ - { \ - break; \ - } \ - }; \ - if (recheck) \ - print $$0; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# A command that, given a newline-separated list of test names on the -# standard input, create the global log from their .trs and .log files. -am__create_global_log = $(AWK) ' \ -function fatal(msg) \ -{ \ - print "fatal: making $@: " msg | "cat >&2"; \ - exit 1; \ -} \ -function rst_section(header) \ -{ \ - print header; \ - len = length(header); \ - for (i = 1; i <= len; i = i + 1) \ - printf "="; \ - printf "\n\n"; \ -} \ -{ \ - copy_in_global_log = 1; \ - global_test_result = "RUN"; \ - while ((rc = (getline line < ($$0 ".trs"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".trs"); \ - if (line ~ /$(am__global_test_result_rx)/) \ - { \ - sub("$(am__global_test_result_rx)", "", line); \ - sub("[ ]*$$", "", line); \ - global_test_result = line; \ - } \ - else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \ - copy_in_global_log = 0; \ - }; \ - if (copy_in_global_log) \ - { \ - rst_section(global_test_result ": " $$0); \ - while ((rc = (getline line < ($$0 ".log"))) != 0) \ - { \ - if (rc < 0) \ - fatal("failed to read from " $$0 ".log"); \ - print line; \ - }; \ - printf "\n"; \ - }; \ - close ($$0 ".trs"); \ - close ($$0 ".log"); \ -}' -# Restructured Text title. -am__rst_title = { sed 's/.*/ & /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; } -# Solaris 10 'make', and several other traditional 'make' implementations, -# pass "-e" to $(SHELL), and POSIX 2008 even requires this. Work around it -# by disabling -e (using the XSI extension "set +e") if it's set. -am__sh_e_setup = case $$- in *e*) set +e;; esac -# Default flags passed to test drivers. -am__common_driver_flags = \ - --color-tests "$$am__color_tests" \ - --enable-hard-errors "$$am__enable_hard_errors" \ - --expect-failure "$$am__expect_failure" -# To be inserted before the command running the test. Creates the -# directory for the log if needed. Stores in $dir the directory -# containing $f, in $tst the test, in $log the log. Executes the -# developer- defined test setup AM_TESTS_ENVIRONMENT (if any), and -# passes TESTS_ENVIRONMENT. Set up options for the wrapper that -# will run the test scripts (or their associated LOG_COMPILER, if -# thy have one). -am__check_pre = \ -$(am__sh_e_setup); \ -$(am__vpath_adj_setup) $(am__vpath_adj) \ -$(am__tty_colors); \ -srcdir=$(srcdir); export srcdir; \ -case "$@" in \ - */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;; \ - *) am__odir=.;; \ -esac; \ -test "x$$am__odir" = x"." || test -d "$$am__odir" \ - || $(MKDIR_P) "$$am__odir" || exit $$?; \ -if test -f "./$$f"; then dir=./; \ -elif test -f "$$f"; then dir=; \ -else dir="$(srcdir)/"; fi; \ -tst=$$dir$$f; log='$@'; \ -if test -n '$(DISABLE_HARD_ERRORS)'; then \ - am__enable_hard_errors=no; \ -else \ - am__enable_hard_errors=yes; \ -fi; \ -case " $(XFAIL_TESTS) " in \ - *[\ \ ]$$f[\ \ ]* | *[\ \ ]$$dir$$f[\ \ ]*) \ - am__expect_failure=yes;; \ - *) \ - am__expect_failure=no;; \ -esac; \ -$(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) -# A shell command to get the names of the tests scripts with any registered -# extension removed (i.e., equivalently, the names of the test logs, with -# the '.log' extension removed). The result is saved in the shell variable -# '$bases'. This honors runtime overriding of TESTS and TEST_LOGS. Sadly, -# we cannot use something simpler, involving e.g., "$(TEST_LOGS:.log=)", -# since that might cause problem with VPATH rewrites for suffix-less tests. -# See also 'test-harness-vpath-rewrite.sh' and 'test-trs-basic.sh'. -am__set_TESTS_bases = \ - bases='$(TEST_LOGS)'; \ - bases=`for i in $$bases; do echo $$i; done | sed 's/\.log$$//'`; \ - bases=`echo $$bases` -AM_TESTSUITE_SUMMARY_HEADER = ' for $(PACKAGE_STRING)' -RECHECK_LOGS = $(TEST_LOGS) -AM_RECURSIVE_TARGETS = check recheck -TEST_SUITE_LOG = test-suite.log -TEST_EXTENSIONS = @EXEEXT@ .test -LOG_COMPILE = $(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS) -am__set_b = \ - case '$@' in \ - */*) \ - case '$*' in \ - */*) b='$*';; \ - *) b=`echo '$@' | sed 's/\.log$$//'`; \ - esac;; \ - *) \ - b='$*';; \ - esac -am__test_logs1 = $(TESTS:=.log) -am__test_logs2 = $(am__test_logs1:@EXEEXT@.log=.log) -TEST_LOGS = $(am__test_logs2:.test.log=.log) -TEST_LOG_DRIVER = $(SHELL) $(top_srcdir)/build-aux/test-driver -TEST_LOG_COMPILE = $(TEST_LOG_COMPILER) $(AM_TEST_LOG_FLAGS) \ - $(TEST_LOG_FLAGS) -am__DIST_COMMON = $(srcdir)/Makefile.in \ - $(top_srcdir)/build-aux/depcomp \ - $(top_srcdir)/build-aux/test-driver \ - $(top_srcdir)/common-rules.mk $(top_srcdir)/subdir-rules.mk -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) -ACLOCAL = @ACLOCAL@ -AMTAR = @AMTAR@ -AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ -AR = @AR@ -AUTOCONF = @AUTOCONF@ -AUTOHEADER = @AUTOHEADER@ -AUTOMAKE = @AUTOMAKE@ -AWK = @AWK@ -BASH_COMPLETIONS_DIR = @BASH_COMPLETIONS_DIR@ -BASH_COMPLETION_CFLAGS = @BASH_COMPLETION_CFLAGS@ -BASH_COMPLETION_LIBS = @BASH_COMPLETION_LIBS@ -CC = @CC@ -CCDEPMODE = @CCDEPMODE@ -CFLAGS = @CFLAGS@ -CPP = @CPP@ -CPPFLAGS = @CPPFLAGS@ -CSCOPE = @CSCOPE@ -CTAGS = @CTAGS@ -CYGPATH_W = @CYGPATH_W@ -DEFS = @DEFS@ -DEPDIR = @DEPDIR@ -DLLTOOL = @DLLTOOL@ -DSYMUTIL = @DSYMUTIL@ -DUMPBIN = @DUMPBIN@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -ETAGS = @ETAGS@ -EXEEXT = @EXEEXT@ -FGREP = @FGREP@ -GCC_VISIBILITY_HIDDEN = @GCC_VISIBILITY_HIDDEN@ -GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ -GMSGFMT = @GMSGFMT@ -GMSGFMT_015 = @GMSGFMT_015@ -GREP = @GREP@ -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ -INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ -INTLLIBS = @INTLLIBS@ -INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ -JANSSON_CFLAGS = @JANSSON_CFLAGS@ -JANSSON_LIBS = @JANSSON_LIBS@ -LD = @LD@ -LDFLAGS = @LDFLAGS@ -LEX = @LEX@ -LEXLIB = @LEXLIB@ -LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ -LIBCRYPT_CFLAGS = @LIBCRYPT_CFLAGS@ -LIBCRYPT_LIBS = @LIBCRYPT_LIBS@ -LIBGUESTFS_CFLAGS = @LIBGUESTFS_CFLAGS@ -LIBGUESTFS_LIBS = @LIBGUESTFS_LIBS@ -LIBICONV = @LIBICONV@ -LIBINTL = @LIBINTL@ -LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ -LIBLZMA_LIBS = @LIBLZMA_LIBS@ -LIBOBJS = @LIBOBJS@ -LIBOSINFO_CFLAGS = @LIBOSINFO_CFLAGS@ -LIBOSINFO_LIBS = @LIBOSINFO_LIBS@ -LIBS = @LIBS@ -LIBTINFO_CFLAGS = @LIBTINFO_CFLAGS@ -LIBTINFO_LIBS = @LIBTINFO_LIBS@ -LIBTOOL = @LIBTOOL@ -LIBVIRT_CFLAGS = @LIBVIRT_CFLAGS@ -LIBVIRT_LIBS = @LIBVIRT_LIBS@ -LIBXML2_CFLAGS = @LIBXML2_CFLAGS@ -LIBXML2_LIBS = @LIBXML2_LIBS@ -LIPO = @LIPO@ -LN_S = @LN_S@ -LTLIBICONV = @LTLIBICONV@ -LTLIBINTL = @LTLIBINTL@ -LTLIBOBJS = @LTLIBOBJS@ -LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ -MAKEINFO = @MAKEINFO@ -MANIFEST_TOOL = @MANIFEST_TOOL@ -MKDIR_P = @MKDIR_P@ -MKISOFS = @MKISOFS@ -MSGCAT = @MSGCAT@ -MSGFMT = @MSGFMT@ -MSGMERGE = @MSGMERGE@ -MSGMERGE_FOR_MSGFMT_OPTION = @MSGMERGE_FOR_MSGFMT_OPTION@ -NCURSES_CONFIG = @NCURSES_CONFIG@ -NM = @NM@ -NMEDIT = @NMEDIT@ -OBJDUMP = @OBJDUMP@ -OBJEXT = @OBJEXT@ -OCAMLBEST = @OCAMLBEST@ -OCAMLBUILD = @OCAMLBUILD@ -OCAMLC = @OCAMLC@ -OCAMLCDOTOPT = @OCAMLCDOTOPT@ -OCAMLDEP = @OCAMLDEP@ -OCAMLDOC = @OCAMLDOC@ -OCAMLFIND = @OCAMLFIND@ -OCAMLLIB = @OCAMLLIB@ -OCAMLMKLIB = @OCAMLMKLIB@ -OCAMLMKTOP = @OCAMLMKTOP@ -OCAMLOPT = @OCAMLOPT@ -OCAMLOPTDOTOPT = @OCAMLOPTDOTOPT@ -OCAMLVERSION = @OCAMLVERSION@ -OCAML_FLAGS = @OCAML_FLAGS@ -OCAML_GETTEXT = @OCAML_GETTEXT@ -OCAML_PKG_gettext = @OCAML_PKG_gettext@ -OCAML_PKG_guestfs = @OCAML_PKG_guestfs@ -OCAML_PKG_ounit2 = @OCAML_PKG_ounit2@ -OCAML_RUNTIME_VARIANT_PIC_OPTION = @OCAML_RUNTIME_VARIANT_PIC_OPTION@ -OCAML_WARN_ERROR = @OCAML_WARN_ERROR@ -OTOOL = @OTOOL@ -OTOOL64 = @OTOOL64@ -PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_URL = @PACKAGE_URL@ -PACKAGE_VERSION = @PACKAGE_VERSION@ -PACKAGE_VERSION_FULL = @PACKAGE_VERSION_FULL@ -PATH_SEPARATOR = @PATH_SEPARATOR@ -PCRE2_CFLAGS = @PCRE2_CFLAGS@ -PCRE2_CONFIG = @PCRE2_CONFIG@ -PCRE2_LIBS = @PCRE2_LIBS@ -PERL = @PERL@ -PKG_CONFIG = @PKG_CONFIG@ -PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ -PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ -PO4A_GETTEXTIZE = @PO4A_GETTEXTIZE@ -PO4A_TRANSLATE = @PO4A_TRANSLATE@ -PODWRAPPER = @PODWRAPPER@ -POSUB = @POSUB@ -RANLIB = @RANLIB@ -REALPATH = @REALPATH@ -SED = @SED@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ -SQLITE3 = @SQLITE3@ -STRIP = @STRIP@ -SYSCONFDIR = @SYSCONFDIR@ -USE_NLS = @USE_NLS@ -VALGRIND = @VALGRIND@ -VERSION = @VERSION@ -VERSION_SCRIPT_FLAGS = @VERSION_SCRIPT_FLAGS@ -XGETTEXT = @XGETTEXT@ -XGETTEXT_015 = @XGETTEXT_015@ -XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ -XMLLINT = @XMLLINT@ -XZCAT = @XZCAT@ -YACC = @YACC@ -YFLAGS = @YFLAGS@ -abs_builddir = @abs_builddir@ -abs_srcdir = @abs_srcdir@ -abs_top_builddir = @abs_top_builddir@ -abs_top_srcdir = @abs_top_srcdir@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ -am__include = @am__include@ -am__leading_dot = @am__leading_dot@ -am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -builddir = @builddir@ -datadir = @datadir@ -datarootdir = @datarootdir@ -docdir = @docdir@ -dvidir = @dvidir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ -htmldir = @htmldir@ -includedir = @includedir@ -infodir = @infodir@ -install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -libvirt_ro_uri = @libvirt_ro_uri@ -localedir = @localedir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -ounit_is_v2 = @ounit_is_v2@ -pdfdir = @pdfdir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -psdir = @psdir@ -runstatedir = @runstatedir@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -srcdir = @srcdir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ -top_build_prefix = @top_build_prefix@ -top_builddir = @top_builddir@ -top_srcdir = @top_srcdir@ - -# Files that should universally be removed by 'make clean'. Note if -# there is any case in any subdirectory where a file should not be -# removed by 'make clean', it should not be listed here! - -# Editor backup files - -# Patch original and reject files. - -# OCaml intermediate and generated files. - -# OCaml -annot files (used for displaying types in some IDEs). - -# OCaml oUnit generated files. - -# Manual pages - these are all generated from *.pod, so the -# pages themselves should all be removed by 'make clean'. - -# Stamp files used when generating man pages. - -# Bindtests temporary files used in many language bindings. -CLEANFILES = *~ *.bak *.orig *.rej *.cmi *.cmo *.cma *.cmx *.cmxa \ - dll*.so *.a *.annot oUnit-*.cache oUnit-*.log *.1 *.3 *.5 *.8 \ - stamp-*.pod bindtests.tmp $(am__append_3) - -# Files that should be universally removed by 'make distclean'. -DISTCLEANFILES = .depend stamp-* - -# Special suffixes used by OCaml. - -# Special suffixes used by PO files. -SUFFIXES = .cmo .cmi .cmx .ml .mli .mll .mly .po .gmo -LOG_DRIVER = env $(SHELL) $(top_srcdir)/build-aux/guestfs-test-driver - -# Rules for building OCaml objects. -# See also: -# guestfs-hacking(1) section "HOW OCAML PROGRAMS ARE COMPILED AND LINKED" -@HAVE_OCAMLOPT_FALSE@MLARCHIVE = cma -@HAVE_OCAMLOPT_TRUE@MLARCHIVE = cmxa -@HAVE_OCAMLOPT_FALSE@LINK_CUSTOM_OCAMLC_ONLY = -custom -@HAVE_OCAMLOPT_FALSE@BEST = c -@HAVE_OCAMLOPT_TRUE@BEST = opt - -# custom silent rules -guestfs_am_v_ocamlc = $(guestfs_am_v_ocamlc_@AM_V@) -guestfs_am_v_ocamlc_ = $(guestfs_am_v_ocamlc_@AM_DEFAULT_V@) -guestfs_am_v_ocamlc_0 = @echo " OCAMLC " $@; -guestfs_am_v_ocamlcmi = $(guestfs_am_v_ocamlcmi_@AM_V@) -guestfs_am_v_ocamlcmi_ = $(guestfs_am_v_ocamlcmi_@AM_DEFAULT_V@) -guestfs_am_v_ocamlcmi_0 = @echo " OCAMLCMI" $@; -guestfs_am_v_ocamlopt = $(guestfs_am_v_ocamlopt_@AM_V@) -guestfs_am_v_ocamlopt_ = $(guestfs_am_v_ocamlopt_@AM_DEFAULT_V@) -guestfs_am_v_ocamlopt_0 = @echo " OCAMLOPT" $@; -guestfs_am_v_javac = $(guestfs_am_v_javac_@AM_V@) -guestfs_am_v_javac_ = $(guestfs_am_v_javac_@AM_DEFAULT_V@) -guestfs_am_v_javac_0 = @echo " JAVAC " $@; -guestfs_am_v_erlc = $(guestfs_am_v_erlc_@AM_V@) -guestfs_am_v_erlc_ = $(guestfs_am_v_erlc_@AM_DEFAULT_V@) -guestfs_am_v_erlc_0 = @echo " ERLC " $@; -guestfs_am_v_podwrapper = $(guestfs_am_v_podwrapper_@AM_V@) -guestfs_am_v_podwrapper_ = $(guestfs_am_v_podwrapper_@AM_DEFAULT_V@) -guestfs_am_v_podwrapper_0 = @echo " POD " $@; -guestfs_am_v_jar = $(guestfs_am_v_jar_@AM_V@) -guestfs_am_v_jar_ = $(guestfs_am_v_jar_@AM_DEFAULT_V@) -guestfs_am_v_jar_0 = @echo " JAR " $@; -guestfs_am_v_po4a_translate = $(guestfs_am_v_po4a_translate_@AM_V@) -guestfs_am_v_po4a_translate_ = $(guestfs_am_v_po4a_translate_@AM_DEFAULT_V@) -guestfs_am_v_po4a_translate_0 = @echo " PO4A-T " $@; -EXTRA_DIST = \ - $(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \ - test-virt-dib-docs.sh \ - virt-dib.pod - -SOURCES_MLI = \ - cmdline.mli \ - dib.mli \ - elements.mli \ - output_format.mli \ - $(patsubst %,output_format_%.mli,$(formats)) \ - utils.mli - - -# Filenames output_format_.ml in alphabetical order. -formats = \ - docker \ - qcow2 \ - raw \ - squashfs \ - tar \ - tgz \ - vhd - -SOURCES_ML = \ - utils.ml \ - output_format.ml \ - cmdline.ml \ - elements.ml \ - $(patsubst %,output_format_%.ml,$(formats)) \ - dib.ml - -SOURCES_C = \ - dummy.c - -@HAVE_OCAML_TRUE@virt_dib_SOURCES = $(SOURCES_C) -@HAVE_OCAML_TRUE@virt_dib_CPPFLAGS = \ -@HAVE_OCAML_TRUE@ -I. \ -@HAVE_OCAML_TRUE@ -I$(top_builddir) \ -@HAVE_OCAML_TRUE@ -I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \ -@HAVE_OCAML_TRUE@ -I$(shell $(OCAMLC) -where) \ -@HAVE_OCAML_TRUE@ -I$(top_srcdir)/gnulib/lib \ -@HAVE_OCAML_TRUE@ -I$(top_srcdir)/common/utils \ -@HAVE_OCAML_TRUE@ -I$(top_srcdir)/lib - -@HAVE_OCAML_TRUE@virt_dib_CFLAGS = \ -@HAVE_OCAML_TRUE@ -pthread \ -@HAVE_OCAML_TRUE@ $(WARN_CFLAGS) $(WERROR_CFLAGS) - -@HAVE_OCAML_TRUE@BOBJECTS = \ -@HAVE_OCAML_TRUE@ $(SOURCES_ML:.ml=.cmo) - -@HAVE_OCAML_TRUE@XOBJECTS = $(BOBJECTS:.cmo=.cmx) -@HAVE_OCAML_TRUE@OCAMLPACKAGES = -package str,unix,guestfs -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/common/utils/.libs -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/gnulib/lib/.libs -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/ocaml -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/common/mlstdutils -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/common/mlutils -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/common/mlgettext -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/common/mlpcre -I \ -@HAVE_OCAML_TRUE@ $(top_builddir)/common/mltools \ -@HAVE_OCAML_TRUE@ $(am__append_2) -@HAVE_OCAML_TRUE@OCAMLCLIBS = \ -@HAVE_OCAML_TRUE@ -pthread -lpthread \ -@HAVE_OCAML_TRUE@ -lutils \ -@HAVE_OCAML_TRUE@ $(LIBXML2_LIBS) \ -@HAVE_OCAML_TRUE@ $(LIBGUESTFS_LIBS) \ -@HAVE_OCAML_TRUE@ $(LIBINTL) \ -@HAVE_OCAML_TRUE@ -lgnu - -@HAVE_OCAML_TRUE@OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)' -@HAVE_OCAMLOPT_FALSE@@HAVE_OCAML_TRUE@OBJECTS = $(BOBJECTS) -@HAVE_OCAMLOPT_TRUE@@HAVE_OCAML_TRUE@OBJECTS = $(XOBJECTS) -@HAVE_OCAML_TRUE@OCAMLLINKFLAGS = \ -@HAVE_OCAML_TRUE@ mlstdutils.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ mlguestfs.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ mlcutils.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ mlgettext.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ mlpcre.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ mltools.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ $(LINK_CUSTOM_OCAMLC_ONLY) - -@HAVE_OCAML_TRUE@virt_dib_DEPENDENCIES = \ -@HAVE_OCAML_TRUE@ $(OBJECTS) \ -@HAVE_OCAML_TRUE@ ../common/mlstdutils/mlstdutils.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ ../common/mlutils/mlcutils.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ ../common/mlgettext/mlgettext.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ ../common/mlpcre/mlpcre.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ ../common/mltools/mltools.$(MLARCHIVE) \ -@HAVE_OCAML_TRUE@ $(top_builddir)/ocaml-link.sh - -@HAVE_OCAML_TRUE@virt_dib_LINK = \ -@HAVE_OCAML_TRUE@ $(top_builddir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \ -@HAVE_OCAML_TRUE@ $(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \ -@HAVE_OCAML_TRUE@ $(OBJECTS) -o $@ - - -# Tests. -@HAVE_OCAML_TRUE@TESTS_ENVIRONMENT = $(top_builddir)/run --test -@HAVE_OCAML_TRUE@TESTS = test-virt-dib-docs.sh - -# Manual pages and HTML files for the website. -@HAVE_OCAML_TRUE@man_MANS = virt-dib.1 -@HAVE_OCAML_TRUE@noinst_DATA = $(top_builddir)/website/virt-dib.1.html -all: all-am - -.SUFFIXES: -.SUFFIXES: .cmo .cmi .cmx .ml .mli .mll .mly .po .gmo .c .lo .log .o .obj .test .test$(EXEEXT) .trs -$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/subdir-rules.mk $(top_srcdir)/common-rules.mk $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ - && { if test -f $@; then exit 0; else break; fi; }; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign dib/Makefile'; \ - $(am__cd) $(top_srcdir) && \ - $(AUTOMAKE) --foreign dib/Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ - esac; -$(top_srcdir)/subdir-rules.mk $(top_srcdir)/common-rules.mk $(am__empty): - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(am__aclocal_m4_deps): -install-binPROGRAMS: $(bin_PROGRAMS) - @$(NORMAL_INSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - if test -n "$$list"; then \ - echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ - fi; \ - for p in $$list; do echo "$$p $$p"; done | \ - sed 's/$(EXEEXT)$$//' | \ - while read p p1; do if test -f $$p \ - || test -f $$p1 \ - ; then echo "$$p"; echo "$$p"; else :; fi; \ - done | \ - sed -e 'p;s,.*/,,;n;h' \ - -e 's|.*|.|' \ - -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ - sed 'N;N;N;s,\n, ,g' | \ - $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ - { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ - if ($$2 == $$4) files[d] = files[d] " " $$1; \ - else { print "f", $$3 "/" $$4, $$1; } } \ - END { for (d in files) print "f", d, files[d] }' | \ - while read type dir files; do \ - if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ - test -z "$$files" || { \ - echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ - $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ - } \ - ; done - -uninstall-binPROGRAMS: - @$(NORMAL_UNINSTALL) - @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ - files=`for p in $$list; do echo "$$p"; done | \ - sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ - -e 's/$$/$(EXEEXT)/' \ - `; \ - test -n "$$list" || exit 0; \ - echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ - cd "$(DESTDIR)$(bindir)" && rm -f $$files - -clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ - echo " rm -f" $$list; \ - rm -f $$list || exit $$?; \ - test -n "$(EXEEXT)" || exit 0; \ - list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f" $$list; \ - rm -f $$list - -virt-dib$(EXEEXT): $(virt_dib_OBJECTS) $(virt_dib_DEPENDENCIES) $(EXTRA_virt_dib_DEPENDENCIES) - @rm -f virt-dib$(EXEEXT) - $(AM_V_GEN)$(virt_dib_LINK) $(virt_dib_OBJECTS) $(virt_dib_LDADD) $(LIBS) - -mostlyclean-compile: - -rm -f *.$(OBJEXT) - -distclean-compile: - -rm -f *.tab.c - -@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virt_dib-dummy.Po@am__quote@ # am--include-marker - -$(am__depfiles_remade): - @$(MKDIR_P) $(@D) - @echo '# dummy' >$@-t && $(am__mv) $@-t $@ - -am--depfiles: $(am__depfiles_remade) - -.c.o: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< - -.c.obj: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ -@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` - -.c.lo: -@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ -@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ -@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< - -virt_dib-dummy.o: dummy.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(virt_dib_CPPFLAGS) $(CPPFLAGS) $(virt_dib_CFLAGS) $(CFLAGS) -MT virt_dib-dummy.o -MD -MP -MF $(DEPDIR)/virt_dib-dummy.Tpo -c -o virt_dib-dummy.o `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/virt_dib-dummy.Tpo $(DEPDIR)/virt_dib-dummy.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy.c' object='virt_dib-dummy.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(virt_dib_CPPFLAGS) $(CPPFLAGS) $(virt_dib_CFLAGS) $(CFLAGS) -c -o virt_dib-dummy.o `test -f 'dummy.c' || echo '$(srcdir)/'`dummy.c - -virt_dib-dummy.obj: dummy.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(virt_dib_CPPFLAGS) $(CPPFLAGS) $(virt_dib_CFLAGS) $(CFLAGS) -MT virt_dib-dummy.obj -MD -MP -MF $(DEPDIR)/virt_dib-dummy.Tpo -c -o virt_dib-dummy.obj `if test -f 'dummy.c'; then $(CYGPATH_W) 'dummy.c'; else $(CYGPATH_W) '$(srcdir)/dummy.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/virt_dib-dummy.Tpo $(DEPDIR)/virt_dib-dummy.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='dummy.c' object='virt_dib-dummy.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(virt_dib_CPPFLAGS) $(CPPFLAGS) $(virt_dib_CFLAGS) $(CFLAGS) -c -o virt_dib-dummy.obj `if test -f 'dummy.c'; then $(CYGPATH_W) 'dummy.c'; else $(CYGPATH_W) '$(srcdir)/dummy.c'; fi` - -mostlyclean-libtool: - -rm -f *.lo - -clean-libtool: - -rm -rf .libs _libs -install-man1: $(man_MANS) - @$(NORMAL_INSTALL) - @list1=''; \ - list2='$(man_MANS)'; \ - test -n "$(man1dir)" \ - && test -n "`echo $$list1$$list2`" \ - || exit 0; \ - echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \ - $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \ - { for i in $$list1; do echo "$$i"; done; \ - if test -n "$$list2"; then \ - for i in $$list2; do echo "$$i"; done \ - | sed -n '/\.1[a-z]*$$/p'; \ - fi; \ - } | while read p; do \ - if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ - echo "$$d$$p"; echo "$$p"; \ - done | \ - sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ - sed 'N;N;s,\n, ,g' | { \ - list=; while read file base inst; do \ - if test "$$base" = "$$inst"; then list="$$list $$file"; else \ - echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \ - $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \ - fi; \ - done; \ - for i in $$list; do echo "$$i"; done | $(am__base_list) | \ - while read files; do \ - test -z "$$files" || { \ - echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \ - $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \ - done; } - -uninstall-man1: - @$(NORMAL_UNINSTALL) - @list=''; test -n "$(man1dir)" || exit 0; \ - files=`{ for i in $$list; do echo "$$i"; done; \ - l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ - sed -n '/\.1[a-z]*$$/p'; \ - } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \ - -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ - dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir) - -ID: $(am__tagged_files) - $(am__define_uniq_tagged_files); mkid -fID $$unique -tags: tags-am -TAGS: tags - -tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - set x; \ - here=`pwd`; \ - $(am__define_uniq_tagged_files); \ - shift; \ - if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - if test $$# -gt 0; then \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - "$$@" $$unique; \ - else \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$unique; \ - fi; \ - fi -ctags: ctags-am - -CTAGS: ctags -ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) - $(am__define_uniq_tagged_files); \ - test -z "$(CTAGS_ARGS)$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ - $$unique - -GTAGS: - here=`$(am__cd) $(top_builddir) && pwd` \ - && $(am__cd) $(top_srcdir) \ - && gtags -i $(GTAGS_ARGS) "$$here" -cscopelist: cscopelist-am - -cscopelist-am: $(am__tagged_files) - list='$(am__tagged_files)'; \ - case "$(srcdir)" in \ - [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ - *) sdir=$(subdir)/$(srcdir) ;; \ - esac; \ - for i in $$list; do \ - if test -f "$$i"; then \ - echo "$(subdir)/$$i"; \ - else \ - echo "$$sdir/$$i"; \ - fi; \ - done >> $(top_builddir)/cscope.files - -distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags - -# Recover from deleted '.trs' file; this should ensure that -# "rm -f foo.log; make foo.trs" re-run 'foo.test', and re-create -# both 'foo.log' and 'foo.trs'. Break the recipe in two subshells -# to avoid problems with "make -n". -.log.trs: - rm -f $< $@ - $(MAKE) $(AM_MAKEFLAGS) $< - -# Leading 'am--fnord' is there to ensure the list of targets does not -# expand to empty, as could happen e.g. with make check TESTS=''. -am--fnord $(TEST_LOGS) $(TEST_LOGS:.log=.trs): $(am__force_recheck) -am--force-recheck: - @: - -$(TEST_SUITE_LOG): $(TEST_LOGS) - @$(am__set_TESTS_bases); \ - am__f_ok () { test -f "$$1" && test -r "$$1"; }; \ - redo_bases=`for i in $$bases; do \ - am__f_ok $$i.trs && am__f_ok $$i.log || echo $$i; \ - done`; \ - if test -n "$$redo_bases"; then \ - redo_logs=`for i in $$redo_bases; do echo $$i.log; done`; \ - redo_results=`for i in $$redo_bases; do echo $$i.trs; done`; \ - if $(am__make_dryrun); then :; else \ - rm -f $$redo_logs && rm -f $$redo_results || exit 1; \ - fi; \ - fi; \ - if test -n "$$am__remaking_logs"; then \ - echo "fatal: making $(TEST_SUITE_LOG): possible infinite" \ - "recursion detected" >&2; \ - elif test -n "$$redo_logs"; then \ - am__remaking_logs=yes $(MAKE) $(AM_MAKEFLAGS) $$redo_logs; \ - fi; \ - if $(am__make_dryrun); then :; else \ - st=0; \ - errmsg="fatal: making $(TEST_SUITE_LOG): failed to create"; \ - for i in $$redo_bases; do \ - test -f $$i.trs && test -r $$i.trs \ - || { echo "$$errmsg $$i.trs" >&2; st=1; }; \ - test -f $$i.log && test -r $$i.log \ - || { echo "$$errmsg $$i.log" >&2; st=1; }; \ - done; \ - test $$st -eq 0 || exit 1; \ - fi - @$(am__sh_e_setup); $(am__tty_colors); $(am__set_TESTS_bases); \ - ws='[ ]'; \ - results=`for b in $$bases; do echo $$b.trs; done`; \ - test -n "$$results" || results=/dev/null; \ - all=` grep "^$$ws*:test-result:" $$results | wc -l`; \ - pass=` grep "^$$ws*:test-result:$$ws*PASS" $$results | wc -l`; \ - fail=` grep "^$$ws*:test-result:$$ws*FAIL" $$results | wc -l`; \ - skip=` grep "^$$ws*:test-result:$$ws*SKIP" $$results | wc -l`; \ - xfail=`grep "^$$ws*:test-result:$$ws*XFAIL" $$results | wc -l`; \ - xpass=`grep "^$$ws*:test-result:$$ws*XPASS" $$results | wc -l`; \ - error=`grep "^$$ws*:test-result:$$ws*ERROR" $$results | wc -l`; \ - if test `expr $$fail + $$xpass + $$error` -eq 0; then \ - success=true; \ - else \ - success=false; \ - fi; \ - br='==================='; br=$$br$$br$$br$$br; \ - result_count () \ - { \ - if test x"$$1" = x"--maybe-color"; then \ - maybe_colorize=yes; \ - elif test x"$$1" = x"--no-color"; then \ - maybe_colorize=no; \ - else \ - echo "$@: invalid 'result_count' usage" >&2; exit 4; \ - fi; \ - shift; \ - desc=$$1 count=$$2; \ - if test $$maybe_colorize = yes && test $$count -gt 0; then \ - color_start=$$3 color_end=$$std; \ - else \ - color_start= color_end=; \ - fi; \ - echo "$${color_start}# $$desc $$count$${color_end}"; \ - }; \ - create_testsuite_report () \ - { \ - result_count $$1 "TOTAL:" $$all "$$brg"; \ - result_count $$1 "PASS: " $$pass "$$grn"; \ - result_count $$1 "SKIP: " $$skip "$$blu"; \ - result_count $$1 "XFAIL:" $$xfail "$$lgn"; \ - result_count $$1 "FAIL: " $$fail "$$red"; \ - result_count $$1 "XPASS:" $$xpass "$$red"; \ - result_count $$1 "ERROR:" $$error "$$mgn"; \ - }; \ - { \ - echo "$(PACKAGE_STRING): $(subdir)/$(TEST_SUITE_LOG)" | \ - $(am__rst_title); \ - create_testsuite_report --no-color; \ - echo; \ - echo ".. contents:: :depth: 2"; \ - echo; \ - for b in $$bases; do echo $$b; done \ - | $(am__create_global_log); \ - } >$(TEST_SUITE_LOG).tmp || exit 1; \ - mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG); \ - if $$success; then \ - col="$$grn"; \ - else \ - col="$$red"; \ - test x"$$VERBOSE" = x || cat $(TEST_SUITE_LOG); \ - fi; \ - echo "$${col}$$br$${std}"; \ - echo "$${col}Testsuite summary"$(AM_TESTSUITE_SUMMARY_HEADER)"$${std}"; \ - echo "$${col}$$br$${std}"; \ - create_testsuite_report --maybe-color; \ - echo "$$col$$br$$std"; \ - if $$success; then :; else \ - echo "$${col}See $(subdir)/$(TEST_SUITE_LOG)$${std}"; \ - if test -n "$(PACKAGE_BUGREPORT)"; then \ - echo "$${col}Please report to $(PACKAGE_BUGREPORT)$${std}"; \ - fi; \ - echo "$$col$$br$$std"; \ - fi; \ - $$success || exit 1 - -check-TESTS: - @list='$(RECHECK_LOGS)'; test -z "$$list" || rm -f $$list - @list='$(RECHECK_LOGS:.log=.trs)'; test -z "$$list" || rm -f $$list - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - trs_list=`for i in $$bases; do echo $$i.trs; done`; \ - log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) TEST_LOGS="$$log_list"; \ - exit $$?; -recheck: all - @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - @set +e; $(am__set_TESTS_bases); \ - bases=`for i in $$bases; do echo $$i; done \ - | $(am__list_recheck_tests)` || exit 1; \ - log_list=`for i in $$bases; do echo $$i.log; done`; \ - log_list=`echo $$log_list`; \ - $(MAKE) $(AM_MAKEFLAGS) $(TEST_SUITE_LOG) \ - am__force_recheck=am--force-recheck \ - TEST_LOGS="$$log_list"; \ - exit $$? -test-virt-dib-docs.sh.log: test-virt-dib-docs.sh - @p='test-virt-dib-docs.sh'; \ - b='test-virt-dib-docs.sh'; \ - $(am__check_pre) $(LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_LOG_DRIVER_FLAGS) $(LOG_DRIVER_FLAGS) -- $(LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -.test.log: - @p='$<'; \ - $(am__set_b); \ - $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ - --log-file $$b.log --trs-file $$b.trs \ - $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ - "$$tst" $(AM_TESTS_FD_REDIRECT) -@am__EXEEXT_TRUE@.test$(EXEEXT).log: -@am__EXEEXT_TRUE@ @p='$<'; \ -@am__EXEEXT_TRUE@ $(am__set_b); \ -@am__EXEEXT_TRUE@ $(am__check_pre) $(TEST_LOG_DRIVER) --test-name "$$f" \ -@am__EXEEXT_TRUE@ --log-file $$b.log --trs-file $$b.trs \ -@am__EXEEXT_TRUE@ $(am__common_driver_flags) $(AM_TEST_LOG_DRIVER_FLAGS) $(TEST_LOG_DRIVER_FLAGS) -- $(TEST_LOG_COMPILE) \ -@am__EXEEXT_TRUE@ "$$tst" $(AM_TESTS_FD_REDIRECT) -distdir: $(BUILT_SOURCES) - $(MAKE) $(AM_MAKEFLAGS) distdir-am - -distdir-am: $(DISTFILES) - @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ - list='$(DISTFILES)'; \ - dist_files=`for file in $$list; do echo $$file; done | \ - sed -e "s|^$$srcdirstrip/||;t" \ - -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ - case $$dist_files in \ - */*) $(MKDIR_P) `echo "$$dist_files" | \ - sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ - sort -u` ;; \ - esac; \ - for file in $$dist_files; do \ - if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ - if test -d $$d/$$file; then \ - dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ - if test -d "$(distdir)/$$file"; then \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ - cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ - find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ - fi; \ - cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ - else \ - test -f "$(distdir)/$$file" \ - || cp -p $$d/$$file "$(distdir)/$$file" \ - || exit 1; \ - fi; \ - done -check-am: all-am - $(MAKE) $(AM_MAKEFLAGS) check-TESTS -check: check-am -all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) -installdirs: - for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man1dir)"; do \ - test -z "$$dir" || $(MKDIR_P) "$$dir"; \ - done -install: install-am -install-exec: install-exec-am -install-data: install-data-am -uninstall: uninstall-am - -install-am: all-am - @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am - -installcheck: installcheck-am -install-strip: - if test -z '$(STRIP)'; then \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - install; \ - else \ - $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ - "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ - fi -mostlyclean-generic: - -test -z "$(TEST_LOGS)" || rm -f $(TEST_LOGS) - -test -z "$(TEST_LOGS:.log=.trs)" || rm -f $(TEST_LOGS:.log=.trs) - -test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG) - -clean-generic: - -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) - -distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) - -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) - -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) - -maintainer-clean-generic: - @echo "This command is intended for maintainers to use" - @echo "it deletes files that may require special tools to rebuild." -clean: clean-am - -clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am - -distclean: distclean-am - -rm -f ./$(DEPDIR)/virt_dib-dummy.Po - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-tags - -dvi: dvi-am - -dvi-am: - -html: html-am - -html-am: - -info: info-am - -info-am: - -install-data-am: install-man - -install-dvi: install-dvi-am - -install-dvi-am: - -install-exec-am: install-binPROGRAMS - -install-html: install-html-am - -install-html-am: - -install-info: install-info-am - -install-info-am: - -install-man: install-man1 - -install-pdf: install-pdf-am - -install-pdf-am: - -install-ps: install-ps-am - -install-ps-am: - -installcheck-am: - -maintainer-clean: maintainer-clean-am - -rm -f ./$(DEPDIR)/virt_dib-dummy.Po - -rm -f Makefile -maintainer-clean-am: distclean-am maintainer-clean-generic - -mostlyclean: mostlyclean-am - -mostlyclean-am: mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool - -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - -uninstall-am: uninstall-binPROGRAMS uninstall-man - -uninstall-man: uninstall-man1 - -.MAKE: check-am install-am install-strip - -.PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-TESTS \ - check-am clean clean-binPROGRAMS clean-generic clean-libtool \ - cscopelist-am ctags ctags-am distclean distclean-compile \ - distclean-generic distclean-libtool distclean-tags distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-binPROGRAMS install-data install-data-am install-dvi \ - install-dvi-am install-exec install-exec-am install-html \ - install-html-am install-info install-info-am install-man \ - install-man1 install-pdf install-pdf-am install-ps \ - install-ps-am install-strip installcheck installcheck-am \ - installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-compile mostlyclean-generic \ - mostlyclean-libtool pdf pdf-am ps ps-am recheck tags tags-am \ - uninstall uninstall-am uninstall-binPROGRAMS uninstall-man \ - uninstall-man1 - -.PRECIOUS: Makefile - - --include $(top_builddir)/localenv - -# Individual Makefile.am's should define generator_built if that -# subdirectory contains any files which are built by the generator. -# Set generator_built to the list of those files. - -$(generator_built): $(top_builddir)/generator/stamp-generator - -$(top_builddir)/generator/stamp-generator: $(top_builddir)/generator/generator - @if test -f $(top_builddir)/generator/Makefile; then \ - $(MAKE) -C $(top_builddir)/generator stamp-generator; \ - else \ - echo "warning: Run 'make' at the top level to build $(generator_built)"; \ - fi - -# If this file doesn't exist, just print a warning and continue. -# During 'make distclean' we can end up deleting this file. -$(top_builddir)/generator/generator: - @if test -f $(top_builddir)/generator/Makefile; then \ - $(MAKE) -C $(top_builddir)/generator generator; \ - else \ - echo "warning: Run 'make' at the top level to build $@"; \ - fi - -%.cmi: %.mli - $(guestfs_am_v_ocamlcmi)$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ -%.cmo: %.ml - $(guestfs_am_v_ocamlc)$(OCAMLFIND) ocamlc $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ -@HAVE_OCAMLOPT_TRUE@%.cmx: %.ml -@HAVE_OCAMLOPT_TRUE@ $(guestfs_am_v_ocamlopt)$(OCAMLFIND) ocamlopt $(OCAMLFLAGS) $(OCAMLPACKAGES) -c $< -o $@ - -# Test shell scripts should use '$TEST_FUNCTIONS' to get a predefined -# set of helper functions for running tests (see test-functions.sh). -# -# Notes: -# -# (1) This is in fact a single command all on one line. The variables -# are evaluated in test-functions.sh. -# -# (2) We use absolute paths here and in test-functions.sh so that the -# test can change directory freely. But we also include the -# non-absolute values so they can be used by the test script itself. -export TEST_FUNCTIONS := \ - source $(abs_top_srcdir)/test-functions.sh \ - abs_srcdir="$(abs_srcdir)" \ - abs_builddir="$(abs_builddir)" \ - top_srcdir="$(top_srcdir)" \ - top_builddir="$(top_builddir)" \ - abs_top_srcdir="$(abs_top_srcdir)" \ - abs_top_builddir="$(abs_top_builddir)" - -@HAVE_OCAML_TRUE@output_format_%.mli: -@HAVE_OCAML_TRUE@ rm -f $@ $@-t -@HAVE_OCAML_TRUE@ echo '(* This file is generated by Makefile.am. *)' >> $@-t -@HAVE_OCAML_TRUE@ echo '(* Nothing is exported from output format modules. *)' >> $@-t -@HAVE_OCAML_TRUE@ mv $@-t $@ - -@HAVE_OCAML_TRUE@virt-dib.1 $(top_builddir)/website/virt-dib.1.html: stamp-virt-dib.pod - -@HAVE_OCAML_TRUE@stamp-virt-dib.pod: virt-dib.pod -@HAVE_OCAML_TRUE@ $(PODWRAPPER) \ -@HAVE_OCAML_TRUE@ --man virt-dib.1 \ -@HAVE_OCAML_TRUE@ --html $(top_builddir)/website/virt-dib.1.html \ -@HAVE_OCAML_TRUE@ --license GPLv2+ \ -@HAVE_OCAML_TRUE@ --warning safe \ -@HAVE_OCAML_TRUE@ $< -@HAVE_OCAML_TRUE@ touch $@ - -# OCaml dependencies. -@HAVE_OCAML_TRUE@.depend: $(SOURCES_MLI) $(SOURCES_ML) -@HAVE_OCAML_TRUE@ $(top_builddir)/ocaml-dep.sh $^ -@HAVE_OCAML_TRUE@-include .depend - -.PHONY: docs - -# Tell versions [3.59,3.63) of GNU make to not export all variables. -# Otherwise a system limit (for SysV at least) may be exceeded. -.NOEXPORT: diff --git a/dib/cmdline.ml b/dib/cmdline.ml deleted file mode 100644 index 11ff573..0000000 --- a/dib/cmdline.ml +++ /dev/null @@ -1,267 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -(* Command line argument parsing. *) - -open Std_utils -open Tools_utils -open Common_gettext.Gettext -open Getopt.OptionName - -open Utils - -open Printf - -type cmdline = { - debug : int; - basepath : string; - elements : string list; - excluded_elements : string list; - element_paths : string list; - excluded_scripts : string list; - use_base : bool; - drive : string option; - drive_format : string option; - image_name : string; - fs_type : string; - size : int64; - root_label : string option; - install_type : string; - image_cache : string option; - mkfs_options : string option; - is_ramdisk : bool; - ramdisk_element : string; - extra_packages : string list; - memsize : int option; - network : bool; - smp : int option; - delete_on_failure : bool; - formats : Output_format.set; - arch : string; - envvars : string list; - checksum : bool; - python : string option; -} - -let parse_cmdline () = - let usage_msg = - sprintf (f_"\ -%s: run diskimage-builder elements to generate images - - virt-dib -B DIB-LIB -p ELEMENTS-PATH elements... - -A short summary of the options is given below. For detailed help please -read the man page virt-dib(1). -") - prog in - - let elements = ref [] in - let append_element element = List.push_front element elements in - - let excluded_elements = ref [] in - let append_excluded_element element = List.push_front element excluded_elements in - - let element_paths = ref [] in - let append_element_path arg = List.push_front arg element_paths in - - let excluded_scripts = ref [] in - let append_excluded_script arg = List.push_front arg excluded_scripts in - - let debug = ref 0 in - let set_debug arg = - if arg < 0 then - error (f_"--debug parameter must be >= 0"); - debug := arg in - - let basepath = ref "" in - - let image_name = ref "image" in - - let fs_type = ref "ext4" in - - let size = ref (unit_GB 5) in - let set_size arg = size := parse_size arg in - - let memsize = ref None in - let set_memsize arg = memsize := Some arg in - - let network = ref true in - - let smp = ref None in - let set_smp arg = smp := Some arg in - - let formats = ref None in - let set_format arg = - let fmts = List.remove_duplicates (String.nsplit "," arg) in - let fmtset = - List.fold_left ( - fun fmtset fmt -> - try Output_format.add_to_set fmt fmtset - with Not_found -> - error (f_"invalid format ‘%s’ in --formats") fmt - ) Output_format.empty_set fmts in - formats := Some fmtset in - - let envvars = ref [] in - let append_envvar arg = List.push_front arg envvars in - - let use_base = ref true in - - let arch = ref "" in - - let drive = ref None in - let set_drive arg = drive := Some arg in - let drive_format = ref None in - let set_drive_format arg = drive_format := Some arg in - - let root_label = ref None in - let set_root_label arg = root_label := Some arg in - - let install_type = ref "source" in - - let image_cache = ref None in - let set_image_cache arg = image_cache := Some arg in - - let delete_on_failure = ref true in - - let is_ramdisk = ref false in - let ramdisk_element = ref "ramdisk" in - - let mkfs_options = ref None in - let set_mkfs_options arg = mkfs_options := Some arg in - - let extra_packages = ref [] in - let append_extra_packages arg = - List.push_front_list (List.rev (String.nsplit "," arg)) extra_packages in - - let checksum = ref false in - - let python = ref None in - let set_python arg = python := Some arg in - - let argspec = [ - [ S 'p'; L"element-path" ], Getopt.String ("path", append_element_path), s_"Add new a elements location"; - [ L"exclude-element" ], Getopt.String ("element", append_excluded_element), - s_"Exclude the specified element"; - [ L"exclude-script" ], Getopt.String ("script", append_excluded_script), - s_"Exclude the specified script"; - [ L"envvar" ], Getopt.String ("envvar[=value]", append_envvar), s_"Carry/set this environment variable"; - [ L"skip-base" ], Getopt.Clear use_base, s_"Skip the inclusion of the ‘base’ element"; - [ L"root-label" ], Getopt.String ("label", set_root_label), s_"Label for the root fs"; - [ L"install-type" ], Getopt.Set_string ("type", install_type), s_"Installation type"; - [ L"image-cache" ], Getopt.String ("directory", set_image_cache), s_"Location for cached images"; - [ L"mkfs-options" ], Getopt.String ("option", set_mkfs_options), - s_"Add mkfs options"; - [ L"extra-packages" ], Getopt.String ("pkg,...", append_extra_packages), - s_"Add extra packages to install"; - [ L"checksum" ], Getopt.Set checksum, s_"Generate MD5 and SHA256 checksum files"; - [ L"python" ], Getopt.String ("python", set_python), s_"Set Python interpreter"; - - [ L"ramdisk" ], Getopt.Set is_ramdisk, "Switch to a ramdisk build"; - [ L"ramdisk-element" ], Getopt.Set_string ("name", ramdisk_element), s_"Main element for building ramdisks"; - - [ L"name" ], Getopt.Set_string ("name", image_name), s_"Name of the image"; - [ L"fs-type" ], Getopt.Set_string ("fs", fs_type), s_"Filesystem for the image"; - [ L"size" ], Getopt.String ("size", set_size), s_"Set output disk size"; - [ L"formats" ], Getopt.String ("qcow2,tgz,...", set_format), s_"Output formats"; - [ L"arch" ], Getopt.Set_string ("arch", arch), s_"Output architecture"; - [ L"drive" ], Getopt.String ("path", set_drive), s_"Optional drive for caches"; - [ L"drive-format" ], Getopt.String (s_"format", set_drive_format), s_"Format of optional drive"; - - [ S 'm'; L"memsize" ], Getopt.Int ("mb", set_memsize), s_"Set memory size"; - [ L"network" ], Getopt.Set network, s_"Enable appliance network (default)"; - [ L"no-network" ], Getopt.Clear network, s_"Disable appliance network"; - [ L"smp" ], Getopt.Int ("vcpus", set_smp), s_"Set number of vCPUs"; - [ L"no-delete-on-failure" ], Getopt.Clear delete_on_failure, - s_"Don’t delete output file on failure"; - - [ L"debug" ], Getopt.Int ("level", set_debug), s_"Set debug level"; - [ S 'B' ], Getopt.Set_string ("path", basepath), s_"Base path of diskimage-builder library"; - ] in - let argspec = argspec @ Output_format.extra_args () in - - let opthandle = create_standard_options argspec ~anon_fun:append_element ~machine_readable:true usage_msg in - Getopt.parse opthandle.getopt; - - let debug = !debug in - let basepath = !basepath in - let elements = List.rev !elements in - let excluded_elements = List.rev !excluded_elements in - let element_paths = List.rev !element_paths in - let excluded_scripts = List.rev !excluded_scripts in - let image_name = !image_name in - let fs_type = !fs_type in - let size = !size in - let memsize = !memsize in - let network = !network in - let smp = !smp in - let formats = !formats in - let envvars = !envvars in - let use_base = !use_base in - let arch = !arch in - let drive = !drive in - let drive_format = !drive_format in - let root_label = !root_label in - let install_type = !install_type in - let image_cache = !image_cache in - let delete_on_failure = !delete_on_failure in - let is_ramdisk = !is_ramdisk in - let ramdisk_element = !ramdisk_element in - let mkfs_options = !mkfs_options in - let extra_packages = List.rev !extra_packages in - let checksum = !checksum in - let python = !python in - - (* No elements and machine-readable mode? Print some facts. *) - (match elements, machine_readable () with - | [], Some { pr } -> - pr "virt-dib\n"; - let formats_list = Output_format.list_formats () in - List.iter (pr "output:%s\n") formats_list; - exit 0 - | _, _ -> () - ); - - if basepath = "" then - error (f_"-B must be specified"); - - let formats = - match formats with - | None -> Output_format.add_to_set "qcow2" Output_format.empty_set - | Some fmtset -> - if Output_format.set_cardinal fmtset = 0 then - error (f_"the list of output formats cannot be empty"); - fmtset in - - if elements = [] then - error (f_"at least one distribution root element must be specified"); - - let python = Option.map get_required_tool python in - - { debug = debug; basepath = basepath; elements = elements; - excluded_elements = excluded_elements; element_paths = element_paths; - excluded_scripts = excluded_scripts; use_base = use_base; drive = drive; - drive_format = drive_format; image_name = image_name; fs_type = fs_type; - size = size; root_label = root_label; install_type = install_type; - image_cache = image_cache; mkfs_options = mkfs_options; - is_ramdisk = is_ramdisk; ramdisk_element = ramdisk_element; - extra_packages = extra_packages; memsize = memsize; network = network; - smp = smp; delete_on_failure = delete_on_failure; - formats = formats; arch = arch; envvars = envvars; - checksum = checksum; python = python; - } diff --git a/dib/cmdline.mli b/dib/cmdline.mli deleted file mode 100644 index 5c82efd..0000000 --- a/dib/cmdline.mli +++ /dev/null @@ -1,52 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -(** Command line argument parsing. *) - -type cmdline = { - debug : int; - basepath : string; - elements : string list; - excluded_elements : string list; - element_paths : string list; - excluded_scripts : string list; - use_base : bool; - drive : string option; - drive_format : string option; - image_name : string; - fs_type : string; - size : int64; - root_label : string option; - install_type : string; - image_cache : string option; - mkfs_options : string option; - is_ramdisk : bool; - ramdisk_element : string; - extra_packages : string list; - memsize : int option; - network : bool; - smp : int option; - delete_on_failure : bool; - formats : Output_format.set; - arch : string; - envvars : string list; - checksum : bool; - python : string option; -} - -val parse_cmdline : unit -> cmdline diff --git a/dib/dib.ml b/dib/dib.ml deleted file mode 100644 index 9ae154b..0000000 --- a/dib/dib.ml +++ /dev/null @@ -1,1007 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Std_utils -open Tools_utils -open Unix_utils -open Common_gettext.Gettext - -open Cmdline -open Utils -open Elements - -open Printf - -module G = Guestfs - -let checksums = [ "md5"; "sha256" ] -and tool_of_checksum csum = - csum ^ "sum" - -let exclude_elements elements = function - | [] -> - (* No elements to filter out, so just don't bother iterating through - * the elements. *) - elements - | excl -> StringSet.filter (not_in_list excl) elements - -let read_envvars envvars = - List.filter_map ( - fun var -> - let i = String.find var "=" in - if i = -1 then ( - try Some (var, Sys.getenv var) - with Not_found -> None - ) else ( - let len = String.length var in - Some (String.sub var 0 i, String.sub var (i + 1) (len - i - 1)) - ) - ) envvars - -let read_dib_envvars () = - let vars = Array.to_list (Unix.environment ()) in - let vars = List.filter (fun x -> String.is_prefix x "DIB_") vars in - let vars = List.map (fun x -> x ^ "\n") vars in - String.concat "" vars - -let write_script fn text = - with_open_out fn ( - fun oc -> - output_string oc text; - flush oc - ); - Unix.chmod fn 0o755 - -let envvars_string l = - let l = List.map ( - fun (var, value) -> - sprintf "export %s=%s" var (quote value) - ) l in - String.concat "\n" l - -let prepare_external ~envvars ~dib_args ~dib_vars ~out_name ~root_label - ~rootfs_uuid ~image_cache ~arch ~network ~debug ~fs_type ~checksum - ~python - destdir libdir fakebindir loaded_elements all_elements element_paths = - let network_string = if network then "" else "1" in - let checksum_string = if checksum then "1" else "" in - let elements_paths_yaml = - List.map ( - fun e -> - sprintf "%s: %s" e (quote (Hashtbl.find loaded_elements e).directory) - ) (StringSet.elements all_elements) in - let elements_paths_yaml = String.concat ", " elements_paths_yaml in - let elements_paths_array = - List.map ( - fun e -> - sprintf "[%s]=%s" e (quote (Hashtbl.find loaded_elements e).directory) - ) (StringSet.elements all_elements) in - let elements_paths_array = String.concat " " elements_paths_array in - - let run_extra = sprintf "\ -#!/bin/bash -set -e -%s -mount_dir=$1 -shift -hooks_dir=$1 -shift -target_dir=$1 -shift -script=$1 -shift - -VIRT_DIB_OURPATH=$(dirname $(realpath $0)) - -# user variables -%s - -export PATH=%s:$PATH - -# d-i-b variables -export TMP_MOUNT_PATH=\"$mount_dir\" -export DIB_OFFLINE=%s -export IMAGE_NAME=\"%s\" -export DIB_ROOT_LABEL=\"%s\" -export DIB_IMAGE_ROOT_FS_UUID=%s -export DIB_IMAGE_CACHE=\"%s\" -export _LIB=%s -export ARCH=%s -export TMP_HOOKS_PATH=\"$hooks_dir\" -export DIB_ARGS=\"%s\" -export IMAGE_ELEMENT=\"%s\" -export ELEMENTS_PATH=\"%s\" -export DIB_ENV=%s -export TMPDIR=\"${TMP_MOUNT_PATH}/tmp\" -export TMP_DIR=\"${TMPDIR}\" -export DIB_DEBUG_TRACE=%d -export FS_TYPE=%s -export DIB_CHECKSUM=%s -export DIB_PYTHON_EXEC=%s - -elinfo_out=$(<${VIRT_DIB_OURPATH}/elinfo_out) -eval \"$elinfo_out\" - -ENVIRONMENT_D_DIR=$target_dir/../environment.d - -if [ -d $ENVIRONMENT_D_DIR ] ; then - env_files=$(find $ENVIRONMENT_D_DIR -maxdepth 1 -xtype f | \ - grep -E \"/[0-9A-Za-z_\\.-]+$\" | \ - LANG=C sort -n) - for env_file in $env_files ; do - source $env_file - done -fi - -source $_LIB/die - -$target_dir/$script -" - (if debug >= 1 then "set -x\n" else "") - (envvars_string envvars) - fakebindir - network_string - out_name - root_label - rootfs_uuid - image_cache - (quote libdir) - arch - dib_args - (String.concat " " (StringSet.elements all_elements)) - (String.concat ":" element_paths) - (quote dib_vars) - debug - fs_type - checksum_string - python in - write_script (destdir // "run-part-extra.sh") run_extra; - let elinfo_out = sprintf "\ -export IMAGE_ELEMENT_YAML=\"{%s}\" -function get_image_element_array { - echo \"%s\" -}; -export -f get_image_element_array; -" - elements_paths_yaml - elements_paths_array in - write_script (destdir // "elinfo_out") elinfo_out - -let prepare_aux ~envvars ~dib_args ~dib_vars ~log_file ~out_name ~rootfs_uuid - ~arch ~network ~root_label ~install_type ~debug ~extra_packages ~fs_type - ~checksum destdir all_elements = - let network_string = if network then "" else "1" in - let checksum_string = if checksum then "1" else "" in - - let script_run_part = sprintf "\ -#!/bin/bash -set -e -%s -sysroot=$1 -shift -mysysroot=$1 -shift -blockdev=$1 -shift -target_dir=$1 -shift -new_wd=$1 -shift -script=$1 -shift - -# user variables -%s - -# system variables -export HOME=$mysysroot/tmp/in_target.aux/perm/home -export PATH=$mysysroot/tmp/in_target.aux/hooks/bin:$PATH -export TMP=$mysysroot/tmp -export TMPDIR=$TMP -export TMP_DIR=$TMP - -# d-i-b variables -export TMP_MOUNT_PATH=$sysroot -export TARGET_ROOT=$sysroot -export DIB_OFFLINE=%s -export IMAGE_NAME=\"%s\" -export DIB_IMAGE_ROOT_FS_UUID=%s -export DIB_IMAGE_CACHE=$HOME/.cache/image-create -export DIB_ROOT_LABEL=\"%s\" -export _LIB=$mysysroot/tmp/in_target.aux/lib -export _PREFIX=$mysysroot/tmp/in_target.aux/elements -export ARCH=%s -export TMP_HOOKS_PATH=$mysysroot/tmp/in_target.aux/hooks -export DIB_ARGS=\"%s\" -export DIB_MANIFEST_SAVE_DIR=\"$mysysroot/tmp/in_target.aux/out/${IMAGE_NAME}.d\" -export IMAGE_BLOCK_DEVICE=$blockdev -export IMAGE_BLOCK_DEVICE_WITHOUT_PART=$(echo ${IMAGE_BLOCK_DEVICE} | sed -e \"s|^\\(.*loop[0-9]*\\)p[0-9]*$|\\1|g\") -export IMAGE_ELEMENT=\"%s\" -export DIB_ENV=%s -export DIB_DEBUG_TRACE=%d -export DIB_NO_TMPFS=1 -export FS_TYPE=%s -export DIB_CHECKSUM=%s - -export TMP_BUILD_DIR=$mysysroot/tmp/in_target.aux -export TMP_IMAGE_DIR=$mysysroot/tmp/in_target.aux - -if [ -n \"$mysysroot\" ]; then - export PATH=$mysysroot/tmp/in_target.aux/fake-bin:$PATH - source $_LIB/die -else - export PATH=\"$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\" -fi - -ENVIRONMENT_D_DIR=$target_dir/../environment.d - -if [ -d $ENVIRONMENT_D_DIR ] ; then - env_files=$(find $ENVIRONMENT_D_DIR -maxdepth 1 -xtype f | \ - grep -E \"/[0-9A-Za-z_\\.-]+$\" | \ - LANG=C sort -n) - for env_file in $env_files ; do - source $env_file - done -fi - -if [ -n \"$new_wd\" ]; then - cd \"$mysysroot/$new_wd\" -fi - -$target_dir/$script -" - (if debug >= 1 then "set -x\n" else "") - (envvars_string envvars) - network_string - out_name - rootfs_uuid - root_label - arch - dib_args - (String.concat " " (StringSet.elements all_elements)) - (quote dib_vars) - debug - fs_type - checksum_string in - write_script (destdir // "run-part.sh") script_run_part; - let script_run_and_log = "\ -#!/bin/bash -logfile=$1 -shift -exec 3>&1 -exit `( ( ( $(dirname $0)/run-part.sh \"$@\" ) 2>&1 3>&-; echo $? >&4) | tee -a $logfile >&3 >&2) 4>&1` -" in - write_script (destdir // "run-and-log.sh") script_run_and_log; - - (* Create the fake sudo support. *) - do_mkdir (destdir // "fake-bin"); - let fake_sudo = "\ -#!/bin/bash -set -e - -SCRIPTNAME=fake-sudo - -ARGS_SHORT=\"EHiu:\" -ARGS_LONG=\"\" -TEMP=`POSIXLY_CORRECT=1 getopt ${ARGS_SHORT:+-o $ARGS_SHORT} ${ARGS_LONG:+--long $ARGS_LONG} \ - -n \"$SCRIPTNAME\" -- \"$@\"` -if [ $? != 0 ]; then echo \"$SCRIPTNAME: terminating...\" >&2 ; exit 1 ; fi -eval set -- \"$TEMP\" - -preserve_env= -set_home= -login_shell= -user= - -while true; do - case \"$1\" in - -E) preserve_env=1; shift;; - -H) set_home=1; shift;; - -i) login_shell=1; shift;; - -u) user=$2; shift 2;; - --) shift; break;; - *) echo \"$SCRIPTNAME: internal arguments error\"; exit 1;; - esac -done - -if [ -n \"$user\" ]; then - if [ $user != root -a $user != `whoami` ]; then - echo \"$SCRIPTNAME: cannot use the sudo user $user, only root and $(whoami) handled\" >&2 - exit 1 - fi -fi - -if [ -z \"$preserve_env\" ]; then - for envvar in `awk 'BEGIN{for (i in ENVIRON) {print i}}'`; do - case \"$envvar\" in - PATH | USER | USERNAME | HOSTNAME | TERM | LANG | HOME | SHELL | LOGNAME ) ;; - BASH_FUNC_* ) unset -f $envvar ;; - *) unset $envvar ;; - esac - done -fi -# TMPDIR needs to be unset, regardless of -E -unset TMPDIR -# ... and do that also to the other \"TMPDIR\"-like variables -unset TMP -unset TMP_DIR - -cmd=$1 -shift -$cmd \"$@\" -" in - write_script (destdir // "fake-bin" // "sudo") fake_sudo; - (* Pick dib-run-parts from the host, if available, otherwise put - * a fake executable which will error out if used. - *) - (try - let loc = which "dib-run-parts" in - do_cp loc (destdir // "fake-bin") - with Executable_not_found _ -> - let fake_dib_run_parts = "\ -#!/bin/sh -echo \"Please install dib-run-parts on the host\" -exit 1 -" in - write_script (destdir // "fake-bin" // "dib-run-parts") fake_dib_run_parts; - ); - - (* Write the custom hooks. *) - let script_install_type_env = sprintf "\ -export DIB_DEFAULT_INSTALLTYPE=${DIB_DEFAULT_INSTALLTYPE:-\"%s\"} -" - install_type in - write_script (destdir // "hooks" // "environment.d" // "11-dib-install-type.bash") script_install_type_env; - - (* Write install-packages.sh if needed. *) - if extra_packages <> [] then ( - let script_install_packages = sprintf "\ -#!/bin/bash -install-packages %s -" - (String.concat " " extra_packages) in - write_script (destdir // "install-packages.sh") script_install_packages; - ); - - do_mkdir (destdir // "perm") - -let timing_output ~target_name entries timings = - let buf = Buffer.create 4096 in - Buffer.add_string buf "----------------------- PROFILING -----------------------\n"; - Buffer.add_char buf '\n'; - bprintf buf "Target: %s\n" target_name; - Buffer.add_char buf '\n'; - bprintf buf "%-40s %9s\n" "Script" "Seconds"; - bprintf buf "%-40s %9s\n" "---------------------------------------" "----------"; - Buffer.add_char buf '\n'; - List.iter ( - fun x -> - bprintf buf "%-40s %10.3f\n" x (Hashtbl.find timings x); - ) entries; - Buffer.add_char buf '\n'; - Buffer.add_string buf "--------------------- END PROFILING ---------------------\n"; - Buffer.contents buf - -type sysroot_type = - | In - | Out - | Subroot - -let timed_run fn = - let time_before = Unix.gettimeofday () in - fn (); - let time_after = Unix.gettimeofday () in - time_after -. time_before - -let run_parts ~debug ~sysroot ~blockdev ~log_file ?(new_wd = "") - (g : Guestfs.guestfs) hook_name scripts = - let hook_dir = "/tmp/in_target.aux/hooks/" ^ hook_name in - let scripts = List.sort digit_prefix_compare scripts in - let outbuf = Buffer.create 16384 in - let timings = Hashtbl.create 13 in - let new_wd = - match sysroot, new_wd with - | (Out|Subroot), "" -> "''" - | (In|Out|Subroot), dir -> dir in - List.iter ( - fun x -> - message (f_"Running: %s/%s") hook_name x; - g#write_append log_file (sprintf "Running %s/%s...\n" hook_name x); - let out = ref "" in - let run () = - let outstr = - match sysroot with - | In -> - g#sh (sprintf "/tmp/in_target.aux/run-and-log.sh '%s' '' '' '%s' '%s' '%s' '%s'" log_file blockdev hook_dir new_wd x) - | Out -> - g#debug "sh" [| "/sysroot/tmp/in_target.aux/run-and-log.sh"; "/sysroot" ^ log_file; "/sysroot"; "/sysroot"; blockdev; "/sysroot" ^ hook_dir; new_wd; x |] - | Subroot -> - g#debug "sh" [| "/sysroot/tmp/in_target.aux/run-and-log.sh"; "/sysroot" ^ log_file; "/sysroot/subroot"; "/sysroot"; blockdev; "/sysroot" ^ hook_dir; new_wd; x |] in - out := outstr; - Buffer.add_string outbuf outstr in - let delta_t = timed_run run in - Buffer.add_char outbuf '\n'; - out := ensure_trailing_newline !out; - printf "%s%!" !out; - if debug >= 1 then ( - printf "%s completed after %.3f s\n" x delta_t - ); - Hashtbl.add timings x delta_t; - ) scripts; - g#write_append log_file (timing_output ~target_name:hook_name scripts timings); - flush_all (); - Buffer.contents outbuf - -let run_parts_host ~debug (g : Guestfs.guestfs) hook_name base_mount_dir scripts run_script = - let scripts = List.sort digit_prefix_compare scripts in - let mount_dir = base_mount_dir // hook_name in - (* Point to the in-guest hooks, so that changes there can affect - * other phases. - *) - let hooks_dir = mount_dir // "tmp" // "in_target.aux" // "hooks" in - let hook_dir = hooks_dir // hook_name in - do_mkdir mount_dir; - - let rec fork_and_run () = - let pid = Unix.fork () in - if pid = 0 then ( (* child *) - let retcode = run_scripts () in - flush_all (); - let cmd = [ "guestunmount"; mount_dir ] in - ignore (run_command cmd); - Exit._exit retcode - ); - pid - and run_scripts () = - let timings = Hashtbl.create 13 in - let rec loop = function - | x :: xs -> - message (f_"Running: %s/%s") hook_name x; - let cmd = [ run_script; mount_dir; hooks_dir; hook_dir; x ] in - let retcode = ref 0 in - let run () = - retcode := run_command cmd in - let delta_t = timed_run run in - if debug >= 1 then ( - printf "\n"; - printf "%s completed after %.3f s\n" x delta_t - ); - Hashtbl.add timings x delta_t; - let retcode = !retcode in - if retcode <> 0 then retcode - else loop xs - | [] -> 0 - in - let retcode = loop scripts in - if debug >= 1 then ( - print_string (timing_output ~target_name:hook_name scripts timings) - ); - retcode - in - - g#mount_local mount_dir; - let pid = fork_and_run () in - g#mount_local_run (); - - (match snd (Unix.waitpid [] pid) with - | Unix.WEXITED 0 -> () - | Unix.WEXITED i -> exit i - | Unix.WSIGNALED i - | Unix.WSTOPPED i -> - error (f_"sub-process killed by signal (%d)") i - ); - - flush_all () - -let run_install_packages ~debug ~blockdev ~log_file - (g : Guestfs.guestfs) packages = - let pkgs_string = String.concat " " packages in - message (f_"Installing: %s") pkgs_string; - g#write_append log_file (sprintf "Installing %s...\n" pkgs_string); - let out = g#sh (sprintf "/tmp/in_target.aux/run-and-log.sh '%s' '' '' '%s' '/tmp/in_target.aux' '' 'install-packages.sh'" log_file blockdev) in - let out = ensure_trailing_newline out in - if debug >= 1 then ( - printf "%s%!" out; - printf "package installation completed\n"; - ); - flush_all (); - out - -(* Finalize the list of output formats. *) -let () = Output_format.bake () - -let main () = - let cmdline = parse_cmdline () in - let debug = cmdline.debug in - - (* Check that the specified base directory of diskimage-builder - * has the "die" script in it, so we know the directory is the - * right one (hopefully so, at least). - *) - if not (Sys.file_exists (cmdline.basepath // "die")) then - error (f_"the specified base path is not the diskimage-builder library"); - - (* Check for required tools. *) - let python = - match cmdline.python with - | None -> get_required_tool "python" - | Some exe -> exe in - require_tool "uuidgen"; - Output_format.check_formats_prerequisites cmdline.formats; - if cmdline.checksum then - List.iter (fun x -> require_tool (tool_of_checksum x)) checksums; - - let image_basename = Filename.basename cmdline.image_name in - let image_basename_d = image_basename ^ ".d" in - - let tmpdir = Mkdtemp.temp_dir "dib." in - On_exit.rm_rf tmpdir; - let auxtmpdir = tmpdir // "in_target.aux" in - do_mkdir auxtmpdir; - let hookstmpdir = auxtmpdir // "hooks" in - do_mkdir (hookstmpdir // "environment.d"); (* Just like d-i-b does. *) - do_mkdir (auxtmpdir // "out" // image_basename_d); - let elements = - if cmdline.use_base then ["base"] @ cmdline.elements - else cmdline.elements in - let elements = - if cmdline.is_ramdisk then [cmdline.ramdisk_element] @ elements - else elements in - info (f_"Elements: %s") (String.concat " " elements); - if debug >= 1 then ( - printf "tmpdir: %s\n" tmpdir; - printf "element paths: %s\n" (String.concat ":" cmdline.element_paths); - ); - - let loaded_elements = load_elements ~debug cmdline.element_paths in - if debug >= 1 then ( - printf "loaded elements:\n"; - Hashtbl.iter ( - fun k v -> - printf " %s => %s\n" k v.directory; - Hashtbl.iter ( - fun k v -> - printf "\t%-20s %s\n" k (String.concat " " (List.sort compare v)) - ) v.hooks; - ) loaded_elements; - printf "\n"; - ); - let all_elements = load_dependencies elements loaded_elements in - let all_elements = exclude_elements all_elements - (cmdline.excluded_elements @ builtin_elements_blacklist) in - - info (f_"Expanded elements: %s") - (String.concat " " (StringSet.elements all_elements)); - - let envvars = read_envvars cmdline.envvars in - info (f_"Carried environment variables: %s") - (String.concat " " (List.map fst envvars)); - if debug >= 1 then ( - printf "carried over envvars:\n"; - if envvars <> [] then - List.iter ( - fun (var, value) -> - printf " %s=%s\n" var value - ) envvars - else - printf " (none)\n"; - printf "\n"; - ); - let dib_args = stringify_args (Array.to_list Sys.argv) in - let dib_vars = read_dib_envvars () in - if debug >= 1 then ( - printf "DIB args:\n%s\n" dib_args; - printf "DIB envvars:\n%s\n" dib_vars - ); - - message (f_"Preparing auxiliary data"); - - copy_elements all_elements loaded_elements - (cmdline.excluded_scripts @ builtin_scripts_blacklist) hookstmpdir; - - (* Re-read the hook scripts from the hooks dir, as d-i-b (and we too) - * has basically copied over anything found in elements. - *) - let final_hooks = load_hooks ~debug hookstmpdir in - - let log_file = "/tmp/in_target.aux/perm/" ^ (log_filename ()) in - - let arch = - match cmdline.arch with - | "" -> current_arch () - | arch -> arch in - - let root_label = - match cmdline.root_label with - | None -> - (* XFS has a limit of 12 characters for filesystem labels. - * Not changing the default for other filesystems to maintain - * backwards compatibility. - *) - (match cmdline.fs_type with - | "xfs" -> "img-rootfs" - | _ -> "cloudimg-rootfs") - | Some label -> label in - - let image_cache = - match cmdline.image_cache with - | None -> Sys.getenv "HOME" // ".cache" // "image-create" - | Some dir -> dir in - do_mkdir image_cache; - - let rootfs_uuid = uuidgen () in - - prepare_aux ~envvars ~dib_args ~dib_vars ~log_file ~out_name:image_basename - ~rootfs_uuid ~arch ~network:cmdline.network ~root_label - ~install_type:cmdline.install_type ~debug - ~extra_packages:cmdline.extra_packages - ~fs_type:cmdline.fs_type - ~checksum:cmdline.checksum - auxtmpdir all_elements; - - let delete_output_file = ref cmdline.delete_on_failure in - let delete_file () = - if !delete_output_file then ( - let filenames = Output_format.get_filenames cmdline.formats cmdline.image_name in - List.iter ( - fun fn -> - try Unix.unlink fn with _ -> () - ) filenames - ) - in - at_exit delete_file; - - prepare_external ~envvars ~dib_args ~dib_vars ~out_name:image_basename - ~root_label ~rootfs_uuid ~image_cache ~arch - ~network:cmdline.network ~debug - ~fs_type:cmdline.fs_type - ~checksum:cmdline.checksum - ~python - tmpdir cmdline.basepath - (auxtmpdir // "fake-bin") - loaded_elements all_elements cmdline.element_paths; - - let run_hook ~blockdev ~sysroot ?(new_wd = "") (g : Guestfs.guestfs) hook = - try - let scripts = - (* Sadly, scripts (especially in root.d and extra-data.d) - * can add (by copying or symlinking) new scripts for other - * phases, which would be ignored if we were using the lists - * collected after composing the tree of hooks. - * As result, when running in-chroot hooks, re-read the list - * of scripts actually available for each hook. - *) - match hook with - | "pre-install.d" | "install.d" | "post-install.d" | "finalise.d" -> - let scripts_path = "/tmp/in_target.aux/hooks/" ^ hook in - (* Cleanly handle cases when the phase directory does not exist. *) - if g#is_dir ~followsymlinks:true scripts_path then - load_scripts g scripts_path - else - raise Not_found - | _ -> - Hashtbl.find final_hooks hook in - if debug >= 1 then ( - printf "Running hooks for %s...\n%!" hook; - ); - run_parts ~debug ~sysroot ~blockdev ~log_file ~new_wd g hook scripts - with Not_found -> "" in - - let copy_in (g : Guestfs.guestfs) srcdir destdir = - let desttar = Filename.temp_file ~temp_dir:tmpdir "virt-dib." ".tar.gz" in - let cmd = [ "tar"; "czf"; desttar; "-C"; srcdir; "--owner=root"; - "--group=root"; "." ] in - if run_command cmd <> 0 then exit 1; - g#mkdir_p destdir; - g#tar_in ~compress:"gzip" desttar destdir; - Sys.remove desttar in - - if debug >= 1 then - ignore (run_command [ "tree"; "-ps"; tmpdir ]); - - message (f_"Opening the disks"); - - let is_ramdisk_build = - cmdline.is_ramdisk || StringSet.mem "ironic-agent" all_elements in - - let g, tmpdisk, tmpdiskfmt, drive_partition = - let g = open_guestfs () in - Option.iter g#set_memsize cmdline.memsize; - Option.iter g#set_smp cmdline.smp; - g#set_network cmdline.network; - - (* Main disk with the built image. *) - let fmt = "raw" in - let fn = - (* If "raw" is among the selected outputs, use it as main backing - * disk, otherwise create a temporary disk. - *) - if not is_ramdisk_build && Output_format.set_mem "raw" cmdline.formats then - cmdline.image_name - else - Filename.temp_file ~temp_dir:tmpdir "image." "" in - let fn = output_filename fn fmt in - (* Produce the output image. *) - g#disk_create fn fmt cmdline.size; - g#add_drive ~readonly:false ~format:fmt fn; - - (* Helper drive for elements and binaries. *) - g#add_drive_scratch (unit_GB 5); - - (match cmdline.drive with - | None -> - g#add_drive_scratch (unit_GB 5) - | Some drive -> - g#add_drive ?format:cmdline.drive_format drive; - ); - - g#launch (); - - Output_format.check_formats_appliance_prerequisites cmdline.formats g; - - (* Prepare the /in_target.aux partition. *) - g#mkfs "ext2" "/dev/sdb"; - g#mount "/dev/sdb" "/"; - - copy_in g auxtmpdir "/"; - copy_in g cmdline.basepath "/lib"; - g#umount "/"; - - (* Prepare the /in_target.aux/perm partition. *) - let drive_partition = - match cmdline.drive with - | None -> - g#mkfs "ext2" "/dev/sdc"; - "/dev/sdc" - | Some _ -> - let partitions = Array.to_list (g#list_partitions ()) in - (match partitions with - | [] -> "/dev/sdc" - | p -> - let p = List.filter (fun x -> String.is_prefix x "/dev/sdc") p in - if p = [] then - error (f_"no partitions found in the helper drive"); - List.hd p - ) in - g#mount drive_partition "/"; - g#mkdir_p "/home/.cache/image-create"; - g#umount "/"; - - g, fn, fmt, drive_partition in - - let mount_aux () = - g#mkmountpoint "/tmp/in_target.aux"; - g#mount "/dev/sdb" "/tmp/in_target.aux"; - g#mount drive_partition "/tmp/in_target.aux/perm" in - - (* Small kludge: try to umount all first: if that fails, use lsof and fuser - * to find out what might have caused the failure, run udevadm to try - * to settle things down (udev, you never know), and try umount all again. - *) - let checked_umount_all () = - try g#umount_all () - with G.Error _ -> - if debug >= 1 then ( - (try printf "lsof:\n%s\nEND\n" (g#debug "sh" [| "lsof"; "/sysroot"; |]) with _ -> ()); - (try printf "fuser:\n%s\nEND\n" (g#debug "sh" [| "fuser"; "-v"; "-m"; "/sysroot"; |]) with _ -> ()); - (try printf "losetup:\n%s\nEND\n" (g#debug "sh" [| "losetup"; "--list"; "--all" |]) with _ -> ()); - ); - ignore (g#debug "sh" [| "udevadm"; "--debug"; "settle" |]); - g#umount_all () in - - g#mkmountpoint "/tmp"; - mount_aux (); - - let blockdev = - (* Setup a loopback device, just like d-i-b would tie an image in the host - * environment. - *) - let run_losetup device = - let lines = g#debug "sh" [| "losetup"; "--show"; "-f"; device |] in - let lines = String.nsplit "\n" lines in - let lines = List.filter ((<>) "") lines in - (match lines with - | [] -> device - | x :: _ -> x - ) in - let blockdev = run_losetup "/dev/sda" in - - let run_hook_out_eval hook envvar = - let lines = run_hook ~sysroot:Out ~blockdev g hook in - let lines = String.nsplit "\n" lines in - let lines = List.filter ((<>) "") lines in - if lines = [] then None - else (try Some (var_from_lines envvar lines) with _ -> None) in - - (match run_hook_out_eval "block-device.d" "IMAGE_BLOCK_DEVICE" with - | None -> blockdev - | Some x -> x - ) in - - let rec run_hook_out ?(new_wd = "") hook = - do_run_hooks_noout ~sysroot:Out ~new_wd hook - and run_hook_in hook = - do_run_hooks_noout ~sysroot:In hook - and run_hook_subroot hook = - do_run_hooks_noout ~sysroot:Subroot hook - and do_run_hooks_noout ~sysroot ?(new_wd = "") hook = - ignore (run_hook ~sysroot ~blockdev ~new_wd g hook) - and run_hook_host hook = - try - let scripts = Hashtbl.find final_hooks hook in - if debug >= 1 then ( - printf "Running hooks for %s...\n%!" hook; - ); - run_parts_host ~debug g hook tmpdir scripts - (tmpdir // "run-part-extra.sh") - with Not_found -> () in - - g#sync (); - checked_umount_all (); - flush_all (); - - message (f_"Setting up the destination root"); - - (* Create and mount the target filesystem. *) - let mkfs_options = - match cmdline.mkfs_options with - | None -> [] - | Some o -> [ o ] in - let mkfs_options = - [ "-t"; cmdline.fs_type ] @ - (match cmdline.fs_type with - | "ext4" -> - (* Very conservative to handle images being resized a lot - * Without -J option specified, default journal size will be set to 32M - * and online resize will be failed with error of needs too many credits. - *) - [ "-i"; "4096"; "-J"; "size=64" ] - | _ -> [] - ) @ mkfs_options @ [ blockdev ] in - ignore (g#debug "sh" (Array.of_list ([ "mkfs" ] @ mkfs_options))); - g#set_label blockdev root_label; - if String.is_prefix cmdline.fs_type "ext" then - g#set_uuid blockdev rootfs_uuid; - g#mount blockdev "/"; - g#mkmountpoint "/tmp"; - mount_aux (); - g#mkdir "/subroot"; - - run_hook_subroot "root.d"; - - g#sync (); - g#umount "/tmp/in_target.aux/perm"; - g#umount "/tmp/in_target.aux"; - g#rm_rf "/tmp"; - let subroot_items = - let l = Array.to_list (g#ls "/subroot") in - let l_lost_plus_found, l = List.partition ((=) "lost+found") l in - if l_lost_plus_found <> [] then ( - g#rm_rf "/subroot/lost+found"; - ); - l in - List.iter (fun x -> g#mv ("/subroot/" ^ x) ("/" ^ x)) subroot_items; - g#rmdir "/subroot"; - (* Check /tmp exists already. *) - ignore (g#is_dir "/tmp"); - mount_aux (); - g#ln_s "in_target.aux/hooks" "/tmp/in_target.d"; - - run_hook_host "extra-data.d"; - - run_hook_in "pre-install.d"; - - if cmdline.extra_packages <> [] then - ignore (run_install_packages ~debug ~blockdev ~log_file g - cmdline.extra_packages); - - run_hook_in "install.d"; - - run_hook_in "post-install.d"; - - (* Unmount and remount the image, as d-i-b does at this point too. *) - g#sync (); - checked_umount_all (); - flush_all (); - g#mount blockdev "/"; - (* Check /tmp/in_target.aux still exists. *) - ignore (g#is_dir "/tmp/in_target.aux"); - g#mount "/dev/sdb" "/tmp/in_target.aux"; - g#mount drive_partition "/tmp/in_target.aux/perm"; - - run_hook_in "finalise.d"; - - let out_dir = "/tmp/in_target.aux/out/" ^ image_basename_d in - - run_hook_out ~new_wd:out_dir "cleanup.d"; - - g#sync (); - - if g#ls out_dir <> [||] then ( - message (f_"Extracting data out of the image"); - do_mkdir (cmdline.image_name ^ ".d"); - g#copy_out out_dir (Filename.dirname cmdline.image_name); - ); - - (* Unmount everything, and remount only the root to cleanup - * its /tmp; this way we should be pretty sure that there is - * nothing left mounted over /tmp, so it is safe to empty it. - *) - checked_umount_all (); - flush_all (); - g#mount blockdev "/"; - Array.iter (fun x -> g#rm_rf ("/tmp/" ^ x)) (g#ls "/tmp"); - (* Truncate /var/log files in preparation for first boot. *) - truncate_recursive g "/var/log"; - let non_log fn = - not (String.is_suffix fn ".log") - in - (* Remove root logs. *) - rm_rf_only_files g ~filter:non_log "/root"; - - flush_all (); - - Output_format.run_formats_on_filesystem cmdline.formats g cmdline.image_name tmpdir; - - message (f_"Umounting the disks"); - - (* Now that we've finished the build, don't delete the output file on - * exit. - *) - delete_output_file := false; - - g#sync (); - checked_umount_all (); - g#shutdown (); - g#close (); - - flush_all (); - - (* Don't produce images as output when doing a ramdisk build. *) - if not is_ramdisk_build then - Output_format.run_formats_on_file cmdline.formats cmdline.image_name (tmpdisk, tmpdiskfmt) tmpdir; - - if not is_ramdisk_build && cmdline.checksum then ( - let file_flags = [ Unix.O_WRONLY; Unix.O_CREAT; Unix.O_TRUNC; ] in - let filenames = Output_format.get_filenames cmdline.formats cmdline.image_name in - List.iter ( - fun fn -> - message (f_"Generating checksums for %s") fn; - let cmds = - List.map ( - fun csum -> - let csum_fn = fn ^ "." ^ csum in - let csum_tool = tool_of_checksum csum in - let outfd = Unix.openfile csum_fn file_flags 0o640 in - [ csum_tool; fn ], Some outfd, None - ) checksums in - let res = run_commands cmds in - List.iteri ( - fun i code -> - if code <> 0 then ( - let args, _, _ = List.nth cmds i in - error (f_"external command ‘%s’ exited with error %d") - (List.hd args) code - ) - ) res; - ) filenames; - ); - - message (f_"Done") - -let () = run_main_and_handle_errors main diff --git a/dib/dib.mli b/dib/dib.mli deleted file mode 100644 index 84aa4fc..0000000 --- a/dib/dib.mli +++ /dev/null @@ -1,19 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -(* Nothing is exported. *) diff --git a/dib/dummy.c b/dib/dummy.c deleted file mode 100644 index ebab619..0000000 --- a/dib/dummy.c +++ /dev/null @@ -1,2 +0,0 @@ -/* Dummy source, to be used for OCaml-based tools with no C sources. */ -enum { foo = 1 }; diff --git a/dib/elements.ml b/dib/elements.ml deleted file mode 100644 index 5a904ba..0000000 --- a/dib/elements.ml +++ /dev/null @@ -1,207 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -(* Parsing and handling of elements. *) - -open Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Utils - -open Printf - -type element = { - directory : string; - hooks : hooks_map; -} -and hooks_map = (string, string list) Hashtbl.t (* hook name, scripts *) - -exception Duplicate_script of string * string (* hook, script *) - -let builtin_elements_blacklist = [ -] - -let builtin_scripts_blacklist = [ - "01-sahara-version"; (* Gets the Git commit ID of the d-i-b and - * sahara-image-elements repositories. *) -] - -let valid_script_name n = - let is_char_valid = function - | 'A'..'Z' | 'a'..'z' | '0'..'9' | '_' | '-' -> true - | _ -> false in - try ignore (string_index_fn (fun c -> not (is_char_valid c)) n); false - with Not_found -> true - -let stringset_of_list l = - List.fold_left (fun acc x -> StringSet.add x acc) StringSet.empty l - -let load_hooks ~debug path = - let hooks = Hashtbl.create 13 in - let entries = Array.to_list (Sys.readdir path) in - let entries = List.filter (fun x -> Filename.check_suffix x ".d") entries in - let entries = List.map (fun x -> (x, path // x)) entries in - let entries = List.filter (fun (_, x) -> is_directory x) entries in - List.iter ( - fun (hook, p) -> - let listing = Array.to_list (Sys.readdir p) in - let scripts = List.filter valid_script_name listing in - let scripts = List.filter ( - fun x -> - try - let s = Unix.stat (p // x) in - s.Unix.st_kind = Unix.S_REG && s.Unix.st_perm land 0o111 > 0 - with Unix.Unix_error _ -> false - ) scripts in - if scripts <> [] then - Hashtbl.add hooks hook scripts - ) entries; - hooks - -let load_scripts (g : Guestfs.guestfs) path = - let listing = Array.to_list (g#readdir path) in - let scripts = List.filter ( - function - | { Guestfs.ftyp = ('r'|'l'|'u'|'?') } -> true - | _ -> false - ) listing in - let scripts = List.filter (fun x -> valid_script_name x.Guestfs.name) scripts in - List.filter_map ( - fun x -> - let { Guestfs.st_mode = mode } = g#statns (path ^ "/" ^ x.Guestfs.name) in - if mode &^ 0o111_L > 0_L then Some x.Guestfs.name - else None - ) scripts - -let load_elements ~debug paths = - let loaded_elements = Hashtbl.create 13 in - let paths = List.filter is_directory paths in - List.iter ( - fun path -> - let listing = Array.to_list (Sys.readdir path) in - let listing = List.map (fun x -> (x, path // x)) listing in - let listing = List.filter (fun (_, x) -> is_directory x) listing in - List.iter ( - fun (p, dir) -> - if not (Hashtbl.mem loaded_elements p) then ( - let elem = { directory = dir; hooks = load_hooks ~debug dir } in - Hashtbl.add loaded_elements p elem - ) else if debug >= 1 then ( - printf "element %s (in %s) already present" p path; - ) - ) listing - ) paths; - loaded_elements - -let load_dependencies elements loaded_elements = - let get filename element = - try - let path = (Hashtbl.find loaded_elements element).directory in - let path = path // filename in - if Sys.file_exists path then ( - let lines = read_whole_file path in - let lines = String.nsplit "\n" lines in - let lines = List.filter ((<>) "") lines in - stringset_of_list lines - ) else - StringSet.empty - with Not_found -> - error (f_"element %s not found") element in - let get_deps = get "element-deps" in - let get_provides = get "element-provides" in - - let queue = Queue.create () in - let final = ref StringSet.empty in - let provided = ref StringSet.empty in - let provided_by = Hashtbl.create 13 in - List.iter (fun x -> Queue.push x queue) elements; - final := stringset_of_list elements; - while not (Queue.is_empty queue) do - let elem = Queue.pop queue in - if StringSet.mem elem !provided <> true then ( - let element_deps = get_deps elem in - let element_provides = get_provides elem in - (* Save which elements provide another element for potential - * error message. - *) - StringSet.iter (fun x -> Hashtbl.add provided_by x elem) element_provides; - provided := StringSet.union !provided element_provides; - StringSet.iter (fun x -> Queue.push x queue) - (StringSet.diff element_deps (StringSet.union !final !provided)); - final := StringSet.union !final element_deps - ) - done; - let conflicts = StringSet.inter (stringset_of_list elements) !provided in - if not (StringSet.is_empty conflicts) then ( - let buf = Buffer.create 100 in - StringSet.iter ( - fun elem -> - let s = sprintf (f_" %s: already provided by %s") - elem (Hashtbl.find provided_by elem) in - Buffer.add_string buf s - ) conflicts; - error (f_"following elements are already provided by another element:\n%s") - (Buffer.contents buf) - ); - if not (StringSet.mem "operating-system" !provided) then - error (f_"please include an operating system element"); - StringSet.diff !final !provided - -let copy_element element destdir blacklist = - let entries = Array.to_list (Sys.readdir element.directory) in - let entries = List.filter ((<>) "tests") entries in - let entries = List.filter ((<>) "test-elements") entries in - let dirs, nondirs = List.partition is_directory entries in - let dirs = List.map (fun x -> (x, element.directory // x, destdir // x)) dirs in - let nondirs = List.map (fun x -> element.directory // x) nondirs in - List.iter ( - fun (e, path, destpath) -> - do_mkdir destpath; - let subentries = Array.to_list (Sys.readdir path) in - let subentries = List.filter (not_in_list blacklist) subentries in - List.iter ( - fun sube -> - if is_regular_file (destpath // sube) then ( - raise (Duplicate_script (e, sube)) - ) else - do_cp (path // sube) destpath - ) subentries; - ) dirs; - List.iter ( - fun path -> - do_cp path destdir - ) nondirs - -let copy_elements elements loaded_elements blacklist destdir = - do_mkdir destdir; - StringSet.iter ( - fun element -> - try - copy_element (Hashtbl.find loaded_elements element) destdir blacklist - with - | Duplicate_script (hook, script) -> - let element_has_script e = - try - let s = Hashtbl.find (Hashtbl.find loaded_elements e).hooks hook in - List.exists ((=) script) s - with Not_found -> false in - let dups = StringSet.filter element_has_script elements in - error (f_"There is a duplicated script in your elements:\n%s/%s in: %s") - hook script (String.concat " " (StringSet.elements dups)) - ) elements diff --git a/dib/elements.mli b/dib/elements.mli deleted file mode 100644 index f351afe..0000000 --- a/dib/elements.mli +++ /dev/null @@ -1,61 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -(** Parsing and handling of elements. *) - -type element = { - directory : string; (** directory of the element *) - hooks : hooks_map; (** available hooks, and scripts for each hook*) -} -and hooks_map = (string, string list) Hashtbl.t (** hook name, scripts *) - -val builtin_elements_blacklist : string list -(** These are the elements which we don't ever try to use. *) - -val builtin_scripts_blacklist : string list -(** These are the scripts which we don't ever try to run. - - Usual reason could be that they are not compatible the way - virt-dib works, e.g. they expect the tree of elements outside - the chroot, which is not available in the appliance. *) - -val load_elements : debug:int -> string list -> (string, element) Hashtbl.t -(** [load_elements ~debug paths] loads elements from the specified - [paths]; returns a [Hashtbl.t] of {!element} structs indexed by - the element name. *) - -val load_dependencies : StringSet.elt list -> (string, element) Hashtbl.t -> StringSet.t -(** [load_dependencies element_set elements] returns the whole set of - elements needed to use [element_set], including [element_list] - themselves. In other words, this recursively resolves the - dependencies of [element_set]. *) - -val copy_elements : StringSet.t -> (string, element) Hashtbl.t -> string list -> string -> unit -(** [copy_elements element_set elements blacklisted_scripts destdir] - copies the elements in [element_set] (with the element definitions - provided as [elements]) into the [destdir] directory. - - [blacklisted_scripts] contains names of scripts to never copy. *) - -val load_hooks : debug:int -> string -> hooks_map -(** [load_hooks ~debug path] loads the hooks from the specified - [path] (which usually represents an element). *) - -val load_scripts : Guestfs.guestfs -> string -> string list -(** [load_scripts g path] loads the scripts from the specified [path] - (which usually represents a directory of an hook). *) diff --git a/dib/output_format.ml b/dib/output_format.ml deleted file mode 100644 index 247f335..0000000 --- a/dib/output_format.ml +++ /dev/null @@ -1,192 +0,0 @@ -(* virt-dib - * Copyright (C) 2012-2023 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Std_utils -open Tools_utils -open Common_gettext.Gettext -open Getopt.OptionName - -open Utils - -type format = { - name : string; - extra_args : extra_arg list; - output_to_file : bool; - check_prerequisites : (unit -> unit) option; - check_appliance_prerequisites : (Guestfs.guestfs -> unit) option; - run_on_filesystem : (Guestfs.guestfs -> string -> string -> unit) option; - run_on_file : (string -> (string * string) -> string -> unit) option; -} -and extra_arg = { - extra_argspec : Getopt.keys * Getopt.spec * Getopt.doc; -} - -let defaults = { - name = ""; - extra_args = []; - output_to_file = true; - check_prerequisites = None; - check_appliance_prerequisites = None; - run_on_filesystem = None; - run_on_file = None; -} - -let all_formats = ref [] - -module FormatSet = Set.Make ( - struct - type t = format - let compare a b = compare a.name b.name - end -) -type set = FormatSet.t - -let empty_set = FormatSet.empty - -let add_to_set name set = - let op = List.find (fun { name = n } -> name = n) !all_formats in - FormatSet.add op set - -let set_mem x set = - FormatSet.exists (fun { name = n } -> n = x) set - -let set_cardinal set = - FormatSet.cardinal set - -let register_format op = - List.push_front op all_formats - -let baked = ref false -let rec bake () = - (* Note we actually want all_formats to be sorted by name, - * ignoring the order field. - *) - let ops = - List.sort (fun { name = a } { name = b } -> compare a b) !all_formats in - check_no_dupes ops; - List.iter check ops; - all_formats := ops; - baked := true -and check_no_dupes ops = - ignore ( - List.fold_left ( - fun opset op -> - if FormatSet.mem op opset then - error (f_"duplicate format name (%s)") op.name; - add_to_set op.name opset - ) empty_set ops - ) -and check op = - let n = String.length op.name in - if n = 0 then - error (f_"format name is an empty string"); - for i = 0 to n-1 do - match String.unsafe_get op.name i with - | 'a'..'z' | 'A'..'Z' | '0'..'9' | '-' -> () - | c -> - error (f_"disallowed character (%c) in format name") c - done - -let extra_args () = - assert !baked; - - List.flatten ( - List.map (fun { extra_args } -> - List.map (fun { extra_argspec = argspec } -> argspec) extra_args - ) !all_formats - ) - -let list_formats () = - assert !baked; - - List.map (fun { name = n } -> n) !all_formats - -let compare_formats { name = n1 } { name = n2 } = - compare n1 n2 - -let check_formats_prerequisites ~formats = - assert !baked; - - (* Run the formats in alphabetical, rather than random order. *) - let formats = List.sort compare_formats (FormatSet.elements formats) in - - List.iter ( - function - | { check_prerequisites = Some fn } -> - fn () - | { check_prerequisites = None } -> () - ) formats - -let check_formats_appliance_prerequisites ~formats g = - assert !baked; - - (* Run the formats in alphabetical, rather than random order. *) - let formats = List.sort compare_formats (FormatSet.elements formats) in - - List.iter ( - function - | { check_appliance_prerequisites = Some fn } -> - fn g - | { check_appliance_prerequisites = None } -> () - ) formats - -let run_formats_on_filesystem ~formats g image_name tmpdir = - assert !baked; - - (* Run the formats in alphabetical, rather than random order. *) - let formats = List.sort compare_formats (FormatSet.elements formats) in - - List.iter ( - function - | { run_on_filesystem = Some fn; name; output_to_file } -> - let filename = - if output_to_file then output_filename image_name name - else "" in - fn g filename tmpdir - | { run_on_filesystem = None } -> () - ) formats - -let run_formats_on_file ~formats image_name tmpdisk tmpdir = - assert !baked; - - (* Run the formats in alphabetical, rather than random order. *) - let formats = List.sort compare_formats (FormatSet.elements formats) in - - List.iter ( - function - | { run_on_file = Some fn; name; output_to_file } -> - let filename = - if output_to_file then output_filename image_name name - else "" in - fn filename tmpdisk tmpdir - | { run_on_file = None } -> () - ) formats - -let get_filenames ~formats image_name = - assert !baked; - - (* Run the formats in alphabetical, rather than random order. *) - let formats = List.sort compare_formats (FormatSet.elements formats) in - - List.filter_map ( - function - | { output_to_file = true; name } -> - Some (output_filename image_name name) - | { output_to_file = false } -> - None - ) formats diff --git a/dib/output_format.mli b/dib/output_format.mli deleted file mode 100644 index d545891..0000000 --- a/dib/output_format.mli +++ /dev/null @@ -1,131 +0,0 @@ -(* virt-dib - * Copyright (C) 2012-2023 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -(** Handling of output formats. *) - -(** Structure used to describe output formats. *) -type format = { - name : string; - (** The name of the format, which is exposed via the [--formats] - command line parameter. Must contain only alphanumeric and - '-' (dash) character. *) - - extra_args : extra_arg list; - (** Extra command-line arguments, if any. eg. The [docker] - format has an extra [--docker-target] parameter. - - For a description of each list element, see {!extra_arg} below. - - You can decide the types of the arguments, whether they are - mandatory etc. *) - - output_to_file : bool; - (** Whether the format writes to a file. Most of the formats - produce a file as result, although some (e.g. docker) do - not. *) - - check_prerequisites : (unit -> unit) option; - (** The function which is called after the command line processing - to check whether the requirements for this format (available - tools, values for command line arguments, etc) are fulfilled. *) - - check_appliance_prerequisites : (Guestfs.guestfs -> unit) option; - (** The function which is called after the appliance start to check - whether the requirements in the appliance for this format - (available features, filesystems, etc) are fulfilled. *) - - run_on_filesystem : (Guestfs.guestfs -> string -> string -> unit) option; - (** The function which is called to perform the export while the - guest is mounted. - - The parameters are: - - [g]: the libguestfs handle - - [filename]: the output filename for the format, or an empty - string if {!output_to_file} is [false] - - [tmpdir]: the temporary directory currently in use *) - - run_on_file : (string -> (string * string) -> string -> unit) option; - (** The function which is called to perform the export using the - temporary disk as reference. - - The parameters are: - - [filename]: the output filename for the format, or an empty - string if {!output_to_file} is [false] - - [tmpdisk]: a tuple representing the temporary disk, as - [(filename, format)] - - [tmpdir]: the temporary directory currently in use *) -} - -and extra_arg = { - extra_argspec : Getopt.keys * Getopt.spec * Getopt.doc; - (** The argspec. See [Getopt] module in [common/mltools]. *) -} - -val defaults : format -(** This is so formats can write [let op = { defaults with ... }]. *) - -val register_format : format -> unit -(** Register a format. *) - -val bake : unit -> unit -(** 'Bake' is called after all modules have been registered. We - finalize the list of formats, sort it, and run some checks. *) - -val extra_args : unit -> Getopt.speclist -(** Get the list of extra arguments for the command line. *) - -val list_formats : unit -> string list -(** List supported formats. *) - -type set -(** A (sub-)set of formats. *) - -val empty_set : set -(** Empty set of formats. *) - -val add_to_set : string -> set -> set -(** [add_to_set name set] adds the format named [name] to [set]. - - Note that this will raise [Not_found] if [name] is not - a valid format name. *) - -val set_mem : string -> set -> bool -(** Check whether the specified format is in the set. *) - -val set_cardinal : set -> int -(** Return the size of the formats set. *) - -val check_formats_prerequisites : formats:set -> unit -(** Check the prerequisites in all the formats listed in the [formats] set. *) - -val check_formats_appliance_prerequisites : formats:set -> Guestfs.guestfs -> unit -(** Check the appliance prerequisites in all the formats listed in the - [formats] set. *) - -val run_formats_on_filesystem : formats:set -> Guestfs.guestfs -> string -> string -> unit -(** Run the filesystem-based export for all the formats listed in the - [formats] set. *) - -val run_formats_on_file : formats:set -> string -> (string * string) -> string -> unit -(** Run the disk-based export for all the formats listed in the - [formats] set. *) - -val get_filenames : formats:set -> string -> string list -(** Return the list of all the output filenames for formats in the - [formats] set. Only formats with {!output_to_file} as [true] - will be taken into account. *) diff --git a/dib/output_format_docker.ml b/dib/output_format_docker.ml deleted file mode 100644 index 7f254ba..0000000 --- a/dib/output_format_docker.ml +++ /dev/null @@ -1,57 +0,0 @@ -(* virt-dib - * Copyright (C) 2016-2023 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Tools_utils -open Common_gettext.Gettext -open Getopt.OptionName - -open Utils -open Output_format - -let docker_target = ref None -let set_docker_target arg = docker_target := Some arg - -let docker_check () = - require_tool "docker"; - if !docker_target = None then - error (f_"docker: a target was not specified, use ‘--docker-target’") - -let docker_run_fs (g : Guestfs.guestfs) _ temp_dir = - let docker_target = - match !docker_target with - | None -> assert false (* checked earlier *) - | Some t -> t in - message (f_"Importing the image to docker as ‘%s’") docker_target; - let dockertmp = Filename.temp_file ~temp_dir "docker." ".tar" in - g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true ~selinux:true - "/" dockertmp; - let cmd = [ "sudo"; "docker"; "import"; dockertmp; docker_target ] in - if run_command cmd <> 0 then exit 1 - -let fmt = { - defaults with - name = "docker"; - output_to_file = false; - extra_args = [ - { extra_argspec = [ L"docker-target" ], Getopt.String ("target", set_docker_target), s_"Repo and tag for docker"; }; - ]; - check_prerequisites = Some docker_check; - run_on_filesystem = Some docker_run_fs; -} - -let () = register_format fmt diff --git a/dib/output_format_docker.mli b/dib/output_format_docker.mli deleted file mode 100644 index 99cb5e6..0000000 --- a/dib/output_format_docker.mli +++ /dev/null @@ -1,2 +0,0 @@ -(* This file is generated by Makefile.am. *) -(* Nothing is exported from output format modules. *) diff --git a/dib/output_format_qcow2.ml b/dib/output_format_qcow2.ml deleted file mode 100644 index d126056..0000000 --- a/dib/output_format_qcow2.ml +++ /dev/null @@ -1,56 +0,0 @@ -(* virt-dib - * Copyright (C) 2015-2023 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Std_utils -open Tools_utils -open Common_gettext.Gettext -open Getopt.OptionName - -open Utils -open Output_format - -let compressed = ref true -let qemu_img_options = ref None -let set_qemu_img_options arg = qemu_img_options := Some arg - -let qcow2_check () = - require_tool "qemu-img" - -let qcow2_run_file filename (tmpdisk, tmpdiskfmt) _ = - message (f_"Converting to qcow2"); - let cmd = [ "qemu-img"; "convert" ] @ - (if !compressed then [ "-c" ] else []) @ - [ "-f"; tmpdiskfmt; tmpdisk; "-O"; "qcow2" ] @ - (match !qemu_img_options with - | None -> [] - | Some opt -> [ "-o"; opt ]) @ - [ qemu_input_filename filename ] in - if run_command cmd <> 0 then exit 1 - -let fmt = { - defaults with - name = "qcow2"; - extra_args = [ - { extra_argspec = [ S 'u' ], Getopt.Clear compressed, s_"Do not compress the qcow2 image"; }; - { extra_argspec = [ L"qemu-img-options" ], Getopt.String ("option", set_qemu_img_options), s_"Add qemu-img options"; }; - ]; - check_prerequisites = Some qcow2_check; - run_on_file = Some qcow2_run_file; -} - -let () = register_format fmt diff --git a/dib/output_format_qcow2.mli b/dib/output_format_qcow2.mli deleted file mode 100644 index 99cb5e6..0000000 --- a/dib/output_format_qcow2.mli +++ /dev/null @@ -1,2 +0,0 @@ -(* This file is generated by Makefile.am. *) -(* Nothing is exported from output format modules. *) diff --git a/dib/output_format_raw.ml b/dib/output_format_raw.ml deleted file mode 100644 index a366798..0000000 --- a/dib/output_format_raw.ml +++ /dev/null @@ -1,31 +0,0 @@ -(* virt-dib - * Copyright (C) 2015-2023 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Output_format - -(* The raw format is currently handled on its own in virt-dib, - * so this is merely to add the output format to the available - * ones. This might change in the future, though. - *) - -let fmt = { - defaults with - name = "raw"; -} - -let () = register_format fmt diff --git a/dib/output_format_raw.mli b/dib/output_format_raw.mli deleted file mode 100644 index 99cb5e6..0000000 --- a/dib/output_format_raw.mli +++ /dev/null @@ -1,2 +0,0 @@ -(* This file is generated by Makefile.am. *) -(* Nothing is exported from output format modules. *) diff --git a/dib/output_format_squashfs.ml b/dib/output_format_squashfs.ml deleted file mode 100644 index d81589b..0000000 --- a/dib/output_format_squashfs.ml +++ /dev/null @@ -1,39 +0,0 @@ -(* virt-dib - * Copyright (C) 2017 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Tools_utils -open Common_gettext.Gettext - -open Output_format - -let squashfs_check (g : Guestfs.guestfs) = - g#available [| "squashfs" |] - -let squashfs_run_fs (g : Guestfs.guestfs) filename _ = - message (f_"Compressing the image as squashfs"); - g#mksquashfs ~excludes:[| "sys/*"; "proc/*"; "dev/*" |] ~compress:"xz" - "/" filename - -let fmt = { - defaults with - name = "squashfs"; - check_appliance_prerequisites = Some squashfs_check; - run_on_filesystem = Some squashfs_run_fs; -} - -let () = register_format fmt diff --git a/dib/output_format_squashfs.mli b/dib/output_format_squashfs.mli deleted file mode 100644 index 99cb5e6..0000000 --- a/dib/output_format_squashfs.mli +++ /dev/null @@ -1,2 +0,0 @@ -(* This file is generated by Makefile.am. *) -(* Nothing is exported from output format modules. *) diff --git a/dib/output_format_tar.ml b/dib/output_format_tar.ml deleted file mode 100644 index 6f749f8..0000000 --- a/dib/output_format_tar.ml +++ /dev/null @@ -1,35 +0,0 @@ -(* virt-dib - * Copyright (C) 2015-2023 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Tools_utils -open Common_gettext.Gettext - -open Output_format - -let tar_run_fs (g : Guestfs.guestfs) filename _ = - message (f_"Compressing the image as tar"); - g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true ~selinux:true - "/" filename - -let fmt = { - defaults with - name = "tar"; - run_on_filesystem = Some tar_run_fs; -} - -let () = register_format fmt diff --git a/dib/output_format_tar.mli b/dib/output_format_tar.mli deleted file mode 100644 index 99cb5e6..0000000 --- a/dib/output_format_tar.mli +++ /dev/null @@ -1,2 +0,0 @@ -(* This file is generated by Makefile.am. *) -(* Nothing is exported from output format modules. *) diff --git a/dib/output_format_tgz.ml b/dib/output_format_tgz.ml deleted file mode 100644 index 447dfe6..0000000 --- a/dib/output_format_tgz.ml +++ /dev/null @@ -1,35 +0,0 @@ -(* virt-dib - * Copyright (C) 2017 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Tools_utils -open Common_gettext.Gettext - -open Output_format - -let tgz_run_fs (g : Guestfs.guestfs) filename _ = - message (f_"Compressing the image as tar.gz"); - g#tar_out ~excludes:[| "./sys/*"; "./proc/*" |] ~xattrs:true ~selinux:true - ~compress:"gzip" "/" filename - -let fmt = { - defaults with - name = "tgz"; - run_on_filesystem = Some tgz_run_fs; -} - -let () = register_format fmt diff --git a/dib/output_format_tgz.mli b/dib/output_format_tgz.mli deleted file mode 100644 index 99cb5e6..0000000 --- a/dib/output_format_tgz.mli +++ /dev/null @@ -1,2 +0,0 @@ -(* This file is generated by Makefile.am. *) -(* Nothing is exported from output format modules. *) diff --git a/dib/output_format_vhd.ml b/dib/output_format_vhd.ml deleted file mode 100644 index 1d56947..0000000 --- a/dib/output_format_vhd.ml +++ /dev/null @@ -1,47 +0,0 @@ -(* virt-dib - * Copyright (C) 2015-2023 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Tools_utils -open Common_gettext.Gettext - -open Utils -open Output_format - -let vhd_check () = - require_tool "vhd-util" - -let vhd_run_file filename (tmpdisk, _) temp_dir = - message (f_"Converting to VHD"); - let fn_intermediate = Filename.temp_file ~temp_dir "vhd-intermediate." "" in - let cmd = [ "vhd-util"; "convert"; "-s"; "0"; "-t"; "1"; - "-i"; tmpdisk; "-o"; fn_intermediate ] in - if run_command cmd <> 0 then exit 1; - let cmd = [ "vhd-util"; "convert"; "-s"; "1"; "-t"; "2"; - "-i"; fn_intermediate; "-o"; filename ] in - if run_command cmd <> 0 then exit 1; - if not (Sys.file_exists filename) then - error (f_"VHD output not produced, most probably vhd-util is old or not patched for ‘convert’") - -let fmt = { - defaults with - name = "vhd"; - check_prerequisites = Some vhd_check; - run_on_file = Some vhd_run_file; -} - -let () = register_format fmt diff --git a/dib/output_format_vhd.mli b/dib/output_format_vhd.mli deleted file mode 100644 index 99cb5e6..0000000 --- a/dib/output_format_vhd.mli +++ /dev/null @@ -1,2 +0,0 @@ -(* This file is generated by Makefile.am. *) -(* Nothing is exported from output format modules. *) diff --git a/dib/test-virt-dib-docs.sh b/dib/test-virt-dib-docs.sh deleted file mode 100755 index 2ce7223..0000000 --- a/dib/test-virt-dib-docs.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/bash - -# libguestfs -# Copyright (C) 2016 Red Hat Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -set -e - -$TEST_FUNCTIONS - -$top_srcdir/podcheck.pl "$srcdir/virt-dib.pod" virt-dib diff --git a/dib/utils.ml b/dib/utils.ml deleted file mode 100644 index 856705d..0000000 --- a/dib/utils.ml +++ /dev/null @@ -1,111 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -open Std_utils -open Tools_utils -open Common_gettext.Gettext - -open Printf - -let unit_GB howmany = - (Int64.of_int howmany) *^ 1024_L *^ 1024_L *^ 1024_L - -let current_arch () = - (* Turn a CPU into the dpkg architecture naming. *) - match Guestfs_config.host_cpu with - | "amd64" | "x86_64" -> "amd64" - | "i386" | "i486" | "i586" | "i686" -> "i386" - | arch when String.is_prefix arch "armv" -> "armhf" - | arch -> arch - -let output_filename image_name = function - | "squashfs" -> image_name ^ ".squash" - | fmt -> image_name ^ "." ^ fmt - -let log_filename () = - let tm = Unix.gmtime (Unix.time ()) in - sprintf "%s-%d%02d%02d-%02d%02d%02d.log" - prog (tm.Unix.tm_year + 1900) (tm.Unix.tm_mon + 1) tm.Unix.tm_mday - tm.Unix.tm_hour tm.Unix.tm_min tm.Unix.tm_sec - -let var_from_lines var lines = - let var_with_equal = var ^ "=" in - let var_lines = List.filter (fun x -> String.is_prefix x var_with_equal) lines in - match var_lines with - | [] -> - error (f_"variable ‘%s’ not found in lines:\n%s") - var (String.concat "\n" lines) - | [x] -> snd (String.split "=" x) - | _ -> - error (f_"variable ‘%s’ has more than one occurrency in lines:\n%s") - var (String.concat "\n" lines) - -let string_index_fn fn str = - let len = String.length str in - let rec loop i = - if i = len then raise Not_found - else if fn str.[i] then i - else loop (i + 1) in - loop 0 - -let digit_prefix_compare a b = - let myint str = - try int_of_string str - with _ -> 0 in - let mylength str = - match String.length str with - | 0 -> max_int - | x -> x in - let split_prefix str = - let len = String.length str in - let digits = - try string_index_fn (fun x -> not (Char.isdigit x)) str - with Not_found -> len in - match digits with - | 0 -> "", str - | x when x = len -> str, "" - | _ -> String.sub str 0 digits, String.sub str digits (len - digits) in - - let pref_a, rest_a = split_prefix a in - let pref_b, rest_b = split_prefix b in - match mylength pref_a, mylength pref_b, compare (myint pref_a) (myint pref_b) with - | x, y, 0 when x = y -> compare rest_a rest_b - | x, y, 0 -> x - y - | _, _, x -> x - -let do_mkdir dir = - mkdir_p dir 0o755 - -let get_required_tool tool = - try which tool - with Executable_not_found tool -> - error (f_"%s needed but not found") tool - -let require_tool tool = - ignore (get_required_tool tool) - -let do_cp src destdir = - let cmd = [ "cp"; "-t"; destdir; "-a"; src ] in - if run_command cmd <> 0 then exit 1 - -let ensure_trailing_newline str = - if String.length str > 0 && str.[String.length str - 1] <> '\n' then str ^ "\n" - else str - -let not_in_list l e = - not (List.mem e l) diff --git a/dib/utils.mli b/dib/utils.mli deleted file mode 100644 index dbbf821..0000000 --- a/dib/utils.mli +++ /dev/null @@ -1,66 +0,0 @@ -(* virt-dib - * Copyright (C) 2015 Red Hat Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - *) - -val unit_GB : int -> int64 -(** [unit_GB n] returns n * 2^30 *) - -val current_arch : unit -> string -(** Turn the host_cpu into the dpkg architecture naming. *) - -val output_filename : string -> string -> string -(** [output_filename image_name format] generates a suitable output - filename based on the image filename and output format. *) - -val log_filename : unit -> string -(** Generate a name for the log file containing the program name and - current date/time. *) - -val var_from_lines : string -> string list -> string -(** Find variable definition in a set of lines of the form [var=value]. *) - -val string_index_fn : (char -> bool) -> string -> int -(** Apply function to each character in the string. If the function - returns true, return the index of the character. - - In other words, like {!String.index} but using a function - instead of a single character. - - @raise Not_found if no match *) - -val digit_prefix_compare : string -> string -> int - -val do_mkdir : string -> unit -(** Wrapper around [mkdir -p -m 0755] *) - -val get_required_tool : string -> string -(** Ensure external program is installed. Return the full path of the - program or fail with an error message. *) - -val require_tool : string -> unit -(** Same as {!get_required_tool} but only checks the external program - is installed and does not return the path. *) - -val do_cp : string -> string -> unit -(** Wrapper around [cp -a src destdir]. *) - -val ensure_trailing_newline : string -> string -(** If the input string is not [""], ensure there is a trailing ['\n'], - adding one if necessary. *) - -val not_in_list : 'a list -> 'a -> bool -(** Opposite of {!List.mem}. *) diff --git a/dib/virt-dib.pod b/dib/virt-dib.pod deleted file mode 100644 index c0119d2..0000000 --- a/dib/virt-dib.pod +++ /dev/null @@ -1,727 +0,0 @@ -=head1 NAME - -virt-dib - Run diskimage-builder elements - -=head1 SYNOPSIS - - virt-dib -B DIB-LIB [options] elements... - -=head1 DESCRIPTION - -Virt-dib is a tool for using the elements of C -to build a new disk image, generate new ramdisks, etc. - -Virt-dib is intended as safe replacement for C -and its C mode, see -L for a quick comparison with -usage of C. - -C is part of the TripleO OpenStack project: -L. - -=head1 EXAMPLES - -=head2 Build simple images of distributions - - virt-dib \ - -B /path/to/diskimage-builder/lib \ - -p /path/to/diskimage-builder/elements \ - --envvar DIB_RELEASE=jessie \ - --name debian-jessie \ - debian vm - -This builds a Debian Jessie (8.x) disk image, suitable for running -as virtual machine, saved as F. - -=head2 Build ramdisks - - virt-dib \ - -B /path/to/diskimage-builder/lib \ - -p /path/to/diskimage-builder/elements \ - --ramdisk \ - --name ramdisk \ - ubuntu deploy-ironic - -This builds a ramdisk for the Ironic OpenStack component based -on the Ubuntu distribution. - -=head1 OPTIONS - -=over 4 - -=item B<--help> - -Display help. - -=item B<-B> PATH - -Set the path to the library directory of C. This is -usually the F subdirectory in the sources and when installed, -and F when installed in F. - -This parameter is B, as virt-dib needs to provide it for -the elements (as some of them might use scripts in it). -Virt-dib itself does not make use of the library directory. - -=item B<--arch> ARCHITECTURE - -Use the specified architecture for the output image. The default -value is the same as the host running virt-dib. - -Right now this option does nothing more than setting the C -environment variable for the elements, and it’s up to them to -produce an image for the requested architecture. - -=item B<--checksum> - -Generate checksum files for the generated image. The supported -checksums are MD5, and SHA256. - -=item B<--colors> - -=item B<--colours> - -Use ANSI colour sequences to colourize messages. This is the default -when the output is a tty. If the output of the program is redirected -to a file, ANSI colour sequences are disabled unless you use this -option. - -=item B<--debug> LEVEL - -Set the debug level to C, which is a non-negative integer -number. The default is C<0>. - -This debug level is different than what I<-x> and I<-v> set, -and it increases the debugging information printed out. -Specifically, this sets the C, and any value -E C<0> enables tracing in the scripts executed. - -=item B<--docker-target> TARGET - -Set the repository and tag for docker. - -This is used only when the formats include C, and it is -required in that case. - -=item B<--drive> DISK - -Add the specified disk to be used as helper drive where to cache -files of the elements, like disk images, distribution packages, etc. - -See L. - -=item B<--drive-format> raw - -=item B<--drive-format> qcow2 - -Specify the format of the helper drive. If this flag is not given -then it is auto-detected from the drive itself. - -If working with untrusted raw-format guest disk images, you should -ensure the format is always specified. - -This option is used only if I<--drive> is specified. - -See L. - -=item B<-p> PATH - -=item B<--element-path> PATH - -Add a new path with elements. Paths are used in the same order as the -I<-p> parameters appear, so a path specified first is looked first, -and so on. - -Obviously, it is recommended to add the path to the own elements of -C, as most of the other elements will rely on them. - -=item B<--extra-packages> PACKAGE,... - -Install additional packages in the image being built. - -This relies on the C binary provided by the -package management elements. - -This option can be specified multiple times, each time with multiple -packages separated by comma. - -=item B<--envvar> VARIABLE - -=item B<--envvar> VARIABLE=VALUE - -Carry or set an environment variable for the elements. - -See L below for more information on the -interaction and usage of environment variables. - -This option can be used in two ways: - -=over 4 - -=item B<--envvar> VARIABLE - -Carry the environment variable C. If it is not set, nothing -is exported to the elements. - -=item B<--envvar> VARIABLE=VALUE - -Set the environment variable C with value C for the -elements, regardless whether an environment variable with the same -name exists. - -This can be useful to pass environment variable without exporting -them in the environment where virt-dib runs. - -=back - -=item B<--exclude-element> ELEMENT - -Ignore the specified element. - -=item B<--exclude-script> SCRIPT - -Ignore any element script named C