mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-21 22:53:37 +00:00
customize: Move Firstboot and SELinux_relabel modules to common/mlcustomize.
These two modules are a dependency of virt-v2v. Since we intend to split virt-v2v from the other OCaml virt-* programs, we cannot have a dependency between virt-v2v and virt-customize. Instead we must move the modules to a common directory (common/mlcustomize) and have both tools depending on the modules from there. This is simple refactoring and should not affect how the programs work or are tested.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -127,6 +127,8 @@ Makefile.in
|
||||
/common/errnostring/errnostring-gperf.gperf
|
||||
/common/errnostring/errnostring.h
|
||||
/common/mlaugeas/.depend
|
||||
/common/mlcustomize/.depend
|
||||
/common/mlcustomize/test-firstboot-*.sh
|
||||
/common/mlgettext/.depend
|
||||
/common/mlgettext/common_gettext.ml
|
||||
/common/mllibvirt/.depend
|
||||
@@ -178,7 +180,6 @@ Makefile.in
|
||||
/customize/customize-options.pod
|
||||
/customize/customize-synopsis.pod
|
||||
/customize/stamp-virt-customize.pod
|
||||
/customize/test-firstboot-*.sh
|
||||
/customize/test-password-*.sh
|
||||
/customize/test-settings-*.sh
|
||||
/customize/virt-customize
|
||||
|
||||
@@ -163,6 +163,7 @@ SUBDIRS += common/mlprogress
|
||||
SUBDIRS += common/mlvisit
|
||||
SUBDIRS += common/mlxml
|
||||
SUBDIRS += common/mltools
|
||||
SUBDIRS += common/mlcustomize
|
||||
if HAVE_LIBVIRT
|
||||
SUBDIRS += common/mllibvirt
|
||||
endif
|
||||
|
||||
@@ -188,6 +188,7 @@ OCAMLPACKAGES = \
|
||||
-I $(top_builddir)/common/mlgettext \
|
||||
-I $(top_builddir)/common/mlpcre \
|
||||
-I $(top_builddir)/common/mltools \
|
||||
-I $(top_builddir)/common/mlcustomize \
|
||||
-I $(top_builddir)/customize
|
||||
OCAMLPACKAGES_TESTS =
|
||||
if HAVE_OCAML_PKG_GETTEXT
|
||||
@@ -226,6 +227,7 @@ OCAMLLINKFLAGS = \
|
||||
mlguestfs.$(MLARCHIVE) \
|
||||
mlcutils.$(MLARCHIVE) \
|
||||
mltools.$(MLARCHIVE) \
|
||||
mlcustomize.$(MLARCHIVE) \
|
||||
customize.$(MLARCHIVE) \
|
||||
$(LINK_CUSTOM_OCAMLC_ONLY)
|
||||
|
||||
@@ -236,6 +238,7 @@ virt_builder_DEPENDENCIES = \
|
||||
../common/mlstdutils/mlstdutils.$(MLARCHIVE) \
|
||||
../common/mlutils/mlcutils.$(MLARCHIVE) \
|
||||
../common/mltools/mltools.$(MLARCHIVE) \
|
||||
../common/mlcustomize/mlcustomize.$(MLARCHIVE) \
|
||||
../customize/customize.$(MLARCHIVE) \
|
||||
$(top_srcdir)/ocaml-link.sh
|
||||
virt_builder_LINK = \
|
||||
|
||||
172
common/mlcustomize/Makefile.am
Normal file
172
common/mlcustomize/Makefile.am
Normal file
@@ -0,0 +1,172 @@
|
||||
# libguestfs OCaml virt-customize common code
|
||||
# Copyright (C) 2011-2019 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-firstboot.sh \
|
||||
test-selinuxrelabel.sh
|
||||
|
||||
SOURCES_MLI = \
|
||||
firstboot.mli \
|
||||
SELinux_relabel.mli
|
||||
|
||||
SOURCES_ML = \
|
||||
firstboot.ml \
|
||||
SELinux_relabel.ml
|
||||
|
||||
if HAVE_OCAML
|
||||
|
||||
# We pretend that we're building a C library. automake handles the
|
||||
# compilation of the C sources for us. At the end we take the C
|
||||
# objects and OCaml objects and link them into the OCaml library.
|
||||
# This C library is never used.
|
||||
|
||||
noinst_LIBRARIES = libmlcustomize.a
|
||||
|
||||
if !HAVE_OCAMLOPT
|
||||
MLCUSTOMIZE_CMA = mlcustomize.cma
|
||||
else
|
||||
MLCUSTOMIZE_CMA = mlcustomize.cmxa
|
||||
endif
|
||||
|
||||
noinst_DATA = $(MLCUSTOMIZE_CMA)
|
||||
|
||||
libmlcustomize_a_SOURCES = dummy.c
|
||||
libmlcustomize_a_CPPFLAGS = \
|
||||
-DCAML_NAME_SPACE \
|
||||
-I. \
|
||||
-I$(top_builddir) \
|
||||
-I$(top_srcdir)/gnulib/lib -I$(top_builddir)/gnulib/lib \
|
||||
-I$(shell $(OCAMLC) -where) \
|
||||
-I$(top_srcdir)/common/utils \
|
||||
-I$(top_srcdir)/lib \
|
||||
-I$(top_srcdir)/common/mlstdutils \
|
||||
-I$(top_srcdir)/common/mlgettext \
|
||||
-I$(top_srcdir)/common/mlpcre \
|
||||
-I$(top_srcdir)/common/mltools
|
||||
libmlcustomize_a_CFLAGS = \
|
||||
$(WARN_CFLAGS) $(WERROR_CFLAGS) \
|
||||
-fPIC
|
||||
|
||||
BOBJECTS = $(SOURCES_ML:.ml=.cmo)
|
||||
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
|
||||
|
||||
# -I $(top_builddir)/lib/.libs is a hack which forces corresponding -L
|
||||
# option to be passed to gcc, so we don't try linking against an
|
||||
# installed copy of libguestfs.
|
||||
OCAMLPACKAGES = \
|
||||
-package str,unix \
|
||||
-I $(top_builddir)/common/utils/.libs \
|
||||
-I $(top_builddir)/lib/.libs \
|
||||
-I $(top_builddir)/gnulib/lib/.libs \
|
||||
-I $(top_builddir)/ocaml \
|
||||
-I $(top_builddir)/common/mlstdutils \
|
||||
-I $(top_builddir)/common/mlgettext \
|
||||
-I $(top_builddir)/common/mlpcre \
|
||||
-I $(top_builddir)/common/mltools \
|
||||
-I $(builddir)
|
||||
OCAMLPACKAGES_TESTS = $(MLCUSTOMIZE_CMA)
|
||||
if HAVE_OCAML_PKG_GETTEXT
|
||||
OCAMLPACKAGES += -package gettext-stub
|
||||
endif
|
||||
|
||||
OCAMLCLIBS = \
|
||||
-lutils \
|
||||
$(LIBINTL) \
|
||||
-lgnu
|
||||
|
||||
OCAMLFLAGS = $(OCAML_FLAGS) $(OCAML_WARN_ERROR) -ccopt '$(CFLAGS)'
|
||||
|
||||
if !HAVE_OCAMLOPT
|
||||
OBJECTS = $(BOBJECTS)
|
||||
else
|
||||
OBJECTS = $(XOBJECTS)
|
||||
endif
|
||||
|
||||
libmlcustomize_a_DEPENDENCIES = $(OBJECTS)
|
||||
|
||||
$(MLCUSTOMIZE_CMA): $(OBJECTS) libmlcustomize.a
|
||||
$(OCAMLFIND) mklib $(OCAMLPACKAGES) \
|
||||
$(OBJECTS) $(libmlcustomize_a_OBJECTS) -o mlcustomize
|
||||
|
||||
# Tests.
|
||||
|
||||
TESTS_ENVIRONMENT = $(top_builddir)/run --test
|
||||
|
||||
TESTS =
|
||||
|
||||
if ENABLE_APPLIANCE
|
||||
TESTS += \
|
||||
$(SLOW_TESTS)
|
||||
endif
|
||||
|
||||
check-valgrind:
|
||||
$(MAKE) VG="@VG@" check
|
||||
|
||||
# Slow tests of virt-customize functionality in real guests.
|
||||
|
||||
SLOW_TESTS = \
|
||||
$(firstboot_test_scripts) \
|
||||
test-selinuxrelabel.sh
|
||||
|
||||
check-slow:
|
||||
$(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1
|
||||
|
||||
firstboot_test_scripts := \
|
||||
test-firstboot-rhel-4.9.sh \
|
||||
test-firstboot-rhel-5.11.sh \
|
||||
test-firstboot-rhel-6.8.sh \
|
||||
test-firstboot-rhel-7.2.sh \
|
||||
test-firstboot-debian-6.sh \
|
||||
test-firstboot-debian-7.sh \
|
||||
test-firstboot-debian-8.sh \
|
||||
test-firstboot-fedora-26.sh \
|
||||
test-firstboot-fedora-27.sh \
|
||||
test-firstboot-ubuntu-10.04.sh \
|
||||
test-firstboot-ubuntu-12.04.sh \
|
||||
test-firstboot-ubuntu-14.04.sh \
|
||||
test-firstboot-ubuntu-16.04.sh \
|
||||
test-firstboot-ubuntu-18.04.sh \
|
||||
test-firstboot-windows-6.2-server.sh \
|
||||
test-firstboot-windows-6.3-server.sh \
|
||||
test-firstboot-windows-10.0-server.sh
|
||||
# Firstboot is known-broken on RHEL 3:
|
||||
# test-firstboot-rhel-3.9.sh
|
||||
|
||||
test-firstboot-%.sh:
|
||||
rm -f $@ $@-t
|
||||
f=`echo "$@" | $(SED) 's/test-firstboot-\(.*\).sh/\1/'`; \
|
||||
echo 'script=$@ exec $$srcdir/test-firstboot.sh' "$$f" > $@-t
|
||||
chmod 0755 $@-t
|
||||
mv $@-t $@
|
||||
|
||||
CLEANFILES += \
|
||||
$(firstboot_test_scripts) \
|
||||
firstboot-*.img
|
||||
|
||||
# Dependencies.
|
||||
.depend: $(srcdir)/*.mli $(srcdir)/*.ml
|
||||
$(top_builddir)/ocaml-dep.sh $^
|
||||
-include .depend
|
||||
|
||||
endif
|
||||
|
||||
.PHONY: docs
|
||||
2
common/mlcustomize/dummy.c
Normal file
2
common/mlcustomize/dummy.c
Normal file
@@ -0,0 +1,2 @@
|
||||
/* Dummy source, to be used for OCaml-based tools with no C sources. */
|
||||
enum { foo = 1 };
|
||||
@@ -237,6 +237,7 @@ AC_CONFIG_FILES([Makefile
|
||||
common/errnostring/Makefile
|
||||
common/edit/Makefile
|
||||
common/mlaugeas/Makefile
|
||||
common/mlcustomize/Makefile
|
||||
common/mlgettext/Makefile
|
||||
common/mllibvirt/Makefile
|
||||
common/mlpcre/Makefile
|
||||
|
||||
@@ -21,9 +21,7 @@ EXTRA_DIST = \
|
||||
$(generator_built) \
|
||||
$(SOURCES_MLI) $(SOURCES_ML) $(SOURCES_C) \
|
||||
customize_main.ml \
|
||||
test-firstboot.sh \
|
||||
test-password.pl \
|
||||
test-selinuxrelabel.sh \
|
||||
test-settings.sh \
|
||||
test-virt-customize.sh \
|
||||
test-virt-customize-docs.sh \
|
||||
@@ -41,12 +39,10 @@ SOURCES_MLI = \
|
||||
customize_cmdline.mli \
|
||||
customize_main.mli \
|
||||
customize_run.mli \
|
||||
firstboot.mli \
|
||||
hostname.mli \
|
||||
password.mli \
|
||||
perl_edit.mli \
|
||||
random_seed.mli \
|
||||
SELinux_relabel.mli \
|
||||
ssh_key.mli \
|
||||
subscription_manager.mli \
|
||||
timezone.mli
|
||||
@@ -55,12 +51,10 @@ SOURCES_MLI = \
|
||||
SOURCES_ML = \
|
||||
append_line.ml \
|
||||
crypt.ml \
|
||||
firstboot.ml \
|
||||
hostname.ml \
|
||||
password.ml \
|
||||
perl_edit.ml \
|
||||
random_seed.ml \
|
||||
SELinux_relabel.ml \
|
||||
ssh_key.ml \
|
||||
subscription_manager.ml \
|
||||
timezone.ml \
|
||||
@@ -130,6 +124,7 @@ OCAMLPACKAGES = \
|
||||
-I $(top_builddir)/common/mlgettext \
|
||||
-I $(top_builddir)/common/mlpcre \
|
||||
-I $(top_builddir)/common/mltools \
|
||||
-I $(top_builddir)/common/mlcustomize \
|
||||
-I $(builddir)
|
||||
if HAVE_OCAML_PKG_GETTEXT
|
||||
OCAMLPACKAGES += -package gettext-stub
|
||||
@@ -162,6 +157,7 @@ OCAMLLINKFLAGS = \
|
||||
mlpcre.$(MLARCHIVE) \
|
||||
mlcutils.$(MLARCHIVE) \
|
||||
mltools.$(MLARCHIVE) \
|
||||
mlcustomize.$(MLARCHIVE) \
|
||||
customize.$(MLARCHIVE) \
|
||||
$(LINK_CUSTOM_OCAMLC_ONLY)
|
||||
|
||||
@@ -180,10 +176,12 @@ virt_customize_DEPENDENCIES = \
|
||||
$(top_srcdir)/ocaml-link.sh \
|
||||
$(CUSTOMIZE_THEOBJECTS) \
|
||||
$(CUSTOMIZE_CMA) \
|
||||
../common/mlcustomize/mlcustomize.$(MLARCHIVE) \
|
||||
../common/mlutils/mlcutils.$(MLARCHIVE) \
|
||||
../common/mlgettext/mlgettext.$(MLARCHIVE) \
|
||||
../common/mlpcre/mlpcre.$(MLARCHIVE) \
|
||||
../common/mltools/mltools.$(MLARCHIVE)
|
||||
../common/mltools/mltools.$(MLARCHIVE) \
|
||||
../common/mlcustomize/mlcustomize.$(MLARCHIVE)
|
||||
virt_customize_LINK = \
|
||||
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
|
||||
$(OCAMLFIND) $(BEST) $(OCAMLFLAGS) $(OCAMLPACKAGES) $(OCAMLLINKFLAGS) \
|
||||
@@ -225,42 +223,12 @@ check-valgrind:
|
||||
# Slow tests of virt-customize functionality in real guests.
|
||||
|
||||
SLOW_TESTS = \
|
||||
$(firstboot_test_scripts) \
|
||||
$(password_test_scripts) \
|
||||
test-selinuxrelabel.sh \
|
||||
$(settings_test_scripts)
|
||||
|
||||
check-slow:
|
||||
$(MAKE) check TESTS="$(SLOW_TESTS)" SLOW=1
|
||||
|
||||
firstboot_test_scripts := \
|
||||
test-firstboot-rhel-4.9.sh \
|
||||
test-firstboot-rhel-5.11.sh \
|
||||
test-firstboot-rhel-6.8.sh \
|
||||
test-firstboot-rhel-7.2.sh \
|
||||
test-firstboot-debian-6.sh \
|
||||
test-firstboot-debian-7.sh \
|
||||
test-firstboot-debian-8.sh \
|
||||
test-firstboot-fedora-26.sh \
|
||||
test-firstboot-fedora-27.sh \
|
||||
test-firstboot-ubuntu-10.04.sh \
|
||||
test-firstboot-ubuntu-12.04.sh \
|
||||
test-firstboot-ubuntu-14.04.sh \
|
||||
test-firstboot-ubuntu-16.04.sh \
|
||||
test-firstboot-ubuntu-18.04.sh \
|
||||
test-firstboot-windows-6.2-server.sh \
|
||||
test-firstboot-windows-6.3-server.sh \
|
||||
test-firstboot-windows-10.0-server.sh
|
||||
# Firstboot is known-broken on RHEL 3:
|
||||
# test-firstboot-rhel-3.9.sh
|
||||
|
||||
test-firstboot-%.sh:
|
||||
rm -f $@ $@-t
|
||||
f=`echo "$@" | $(SED) 's/test-firstboot-\(.*\).sh/\1/'`; \
|
||||
echo 'script=$@ exec $$srcdir/test-firstboot.sh' "$$f" > $@-t
|
||||
chmod 0755 $@-t
|
||||
mv $@-t $@
|
||||
|
||||
password_test_scripts := \
|
||||
test-password-centos-7.2.sh \
|
||||
test-password-debian-6.sh \
|
||||
@@ -310,10 +278,8 @@ test-settings-%.sh:
|
||||
mv $@-t $@
|
||||
|
||||
CLEANFILES += \
|
||||
$(firstboot_test_scripts) \
|
||||
$(password_test_scripts) \
|
||||
$(settings_test_scripts) \
|
||||
firstboot-*.img \
|
||||
password-*.img \
|
||||
password-*.log \
|
||||
settings-*.img
|
||||
|
||||
@@ -99,6 +99,11 @@ handled by this library.
|
||||
Bindings for the Augeas library. These come from the ocaml-augeas
|
||||
library L<http://git.annexia.org/?p=ocaml-augeas.git>
|
||||
|
||||
=item F<common/mlcustomize>
|
||||
|
||||
Library code associated with C<virt-customize> but also used in other
|
||||
tools.
|
||||
|
||||
=item F<common/mlgettext>
|
||||
|
||||
Small, generated wrapper which allows libguestfs to be compiled with
|
||||
|
||||
@@ -120,6 +120,7 @@ OCAMLPACKAGES = \
|
||||
-I $(top_builddir)/common/mlpcre \
|
||||
-I $(top_builddir)/common/mlvisit \
|
||||
-I $(top_builddir)/common/mltools \
|
||||
-I $(top_builddir)/common/mlcustomize \
|
||||
-I $(top_builddir)/customize
|
||||
if HAVE_OCAML_PKG_GETTEXT
|
||||
OCAMLPACKAGES += -package gettext-stub
|
||||
@@ -151,6 +152,7 @@ OCAMLLINKFLAGS = \
|
||||
mlcutils.$(MLARCHIVE) \
|
||||
mltools.$(MLARCHIVE) \
|
||||
mlvisit.$(MLARCHIVE) \
|
||||
mlcustomize.$(MLARCHIVE) \
|
||||
customize.$(MLARCHIVE) \
|
||||
$(LINK_CUSTOM_OCAMLC_ONLY)
|
||||
|
||||
@@ -161,6 +163,7 @@ virt_sysprep_DEPENDENCIES = \
|
||||
../common/mlgettext/mlgettext.$(MLARCHIVE) \
|
||||
../common/mlpcre/mlpcre.$(MLARCHIVE) \
|
||||
../common/mltools/mltools.$(MLARCHIVE) \
|
||||
../common/mlcustomize/mlcustomize.$(MLARCHIVE) \
|
||||
../customize/customize.$(MLARCHIVE) \
|
||||
$(top_srcdir)/ocaml-link.sh
|
||||
virt_sysprep_LINK = \
|
||||
|
||||
@@ -206,8 +206,8 @@ virt_v2v_CFLAGS = \
|
||||
$(LIBVIRT_CFLAGS)
|
||||
|
||||
BOBJECTS = \
|
||||
$(top_builddir)/customize/firstboot.cmo \
|
||||
$(top_builddir)/customize/SELinux_relabel.cmo \
|
||||
$(top_builddir)/common/mlcustomize/firstboot.cmo \
|
||||
$(top_builddir)/common/mlcustomize/SELinux_relabel.cmo \
|
||||
$(SOURCES_ML:.ml=.cmo)
|
||||
XOBJECTS = $(BOBJECTS:.cmo=.cmx)
|
||||
|
||||
@@ -228,7 +228,7 @@ OCAMLPACKAGES = \
|
||||
-I $(top_builddir)/common/mlxml \
|
||||
-I $(top_builddir)/common/mltools \
|
||||
-I $(top_builddir)/common/mllibvirt \
|
||||
-I $(top_builddir)/customize
|
||||
-I $(top_builddir)/common/mlcustomize
|
||||
if HAVE_OCAML_PKG_GETTEXT
|
||||
OCAMLPACKAGES += -package gettext-stub
|
||||
endif
|
||||
@@ -259,6 +259,7 @@ OCAMLLINKFLAGS = \
|
||||
mlcutils.$(MLARCHIVE) \
|
||||
mltools.$(MLARCHIVE) \
|
||||
mllibvirt.$(MLARCHIVE) \
|
||||
mlcustomize.$(MLARCHIVE) \
|
||||
$(LINK_CUSTOM_OCAMLC_ONLY)
|
||||
|
||||
virt_v2v_DEPENDENCIES = $(OBJECTS) $(top_srcdir)/ocaml-link.sh
|
||||
@@ -305,6 +306,7 @@ virt_v2v_copy_to_local_DEPENDENCIES = \
|
||||
../common/mlutils/mlcutils.$(MLARCHIVE) \
|
||||
../common/mltools/mltools.$(MLARCHIVE) \
|
||||
../common/mllibvirt/mllibvirt.$(MLARCHIVE) \
|
||||
../common/mlcustomize/mlcustomize.$(MLARCHIVE) \
|
||||
$(top_srcdir)/ocaml-link.sh
|
||||
virt_v2v_copy_to_local_LINK = \
|
||||
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
|
||||
@@ -678,7 +680,6 @@ check_PROGRAMS += v2v_unit_tests var_expander_tests
|
||||
endif
|
||||
|
||||
v2v_unit_tests_BOBJECTS = \
|
||||
$(top_builddir)/customize/firstboot.cmo \
|
||||
types.cmo \
|
||||
uefi.cmo \
|
||||
utils.cmo \
|
||||
@@ -727,6 +728,7 @@ v2v_unit_tests_DEPENDENCIES = \
|
||||
../common/mlpcre/mlpcre.$(MLARCHIVE) \
|
||||
../common/mlutils/mlcutils.$(MLARCHIVE) \
|
||||
../common/mltools/mltools.$(MLARCHIVE) \
|
||||
../common/mlcustomize/mlcustomize.$(MLARCHIVE) \
|
||||
$(top_srcdir)/ocaml-link.sh
|
||||
v2v_unit_tests_LINK = \
|
||||
$(top_srcdir)/ocaml-link.sh -cclib '$(OCAMLCLIBS)' -- \
|
||||
|
||||
Reference in New Issue
Block a user