[Pkg-libvirt-commits] [libguestfs] 14/31: p2v: Introduce a common file to store virt-p2v ISO dependencies.
Hilko Bengen
bengen at moszumanska.debian.org
Sun Nov 1 17:13:06 UTC 2015
This is an automated email from the git hooks/post-receive script.
bengen pushed a commit to annotated tag upstream/1.29.46
in repository libguestfs.
commit 467cd4b76014ef3e21c14a2a04c2c0e735425096
Author: Richard W.M. Jones <rjones at redhat.com>
Date: Tue Jun 2 16:27:13 2015 +0100
p2v: Introduce a common file to store virt-p2v ISO dependencies.
Instead of having virt-p2v-make-disk and virt-p2v-make-kickstart
separately contain a list of the virt-p2v ISO dependencies, combine
the dependencies into a single file ('p2v/dependencies.m4') and use
that to generate the respective dependencies in each script.
---
.gitignore | 4 ++
p2v/Makefile.am | 14 ++++++
p2v/dependencies.m4 | 100 +++++++++++++++++++++++++++++++++++++++++
p2v/p2v.ks.in | 16 +------
p2v/virt-p2v-make-disk.in | 70 ++++++++++++++---------------
p2v/virt-p2v-make-kickstart.in | 21 +++++++++
6 files changed, 175 insertions(+), 50 deletions(-)
diff --git a/.gitignore b/.gitignore
index 29f9d6d..e3fbe3e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -328,6 +328,10 @@ Makefile.in
/ocaml/stamp-mlguestfs
/ocaml/t/*.bc
/ocaml/t/*.opt
+/p2v/dependencies.archlinux
+/p2v/dependencies.debian
+/p2v/dependencies.redhat
+/p2v/dependencies.suse
/p2v/launch-virt-p2v
/p2v/stamp-virt-p2v.pod
/p2v/stamp-virt-p2v-make-disk.pod
diff --git a/p2v/Makefile.am b/p2v/Makefile.am
index 0ea317f..7a155d8 100644
--- a/p2v/Makefile.am
+++ b/p2v/Makefile.am
@@ -19,6 +19,7 @@ include $(top_srcdir)/subdir-rules.mk
EXTRA_DIST = \
HACKING \
+ dependencies.m4 \
issue \
launch-virt-p2v.in \
p2v.ks.in \
@@ -79,10 +80,23 @@ virt_p2v_LDADD = \
# Scripts to build the disk image, USB key, or kickstart.
bin_SCRIPTS = virt-p2v-make-disk virt-p2v-make-kickstart
+dependencies_files = \
+ dependencies.archlinux \
+ dependencies.debian \
+ dependencies.redhat \
+ dependencies.suse
+CLEANFILES += $(dependencies_files)
+
+$(dependencies_files): dependencies.m4
+ define=`echo $@ | $(SED) 's/dependencies.//;y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`; \
+ m4 -D$$define=1 $< > $@-t
+ mv $@-t $@
+
# Support files needed by the virt-p2v-make-* scripts.
virtp2vdatadir = $(datadir)/virt-p2v
virtp2vdata_DATA = \
+ $(dependencies_files) \
issue \
launch-virt-p2v \
p2v.ks.in \
diff --git a/p2v/dependencies.m4 b/p2v/dependencies.m4
new file mode 100644
index 0000000..81a36ca
--- /dev/null
+++ b/p2v/dependencies.m4
@@ -0,0 +1,100 @@
+dnl This is the list of distro packages which are required by
+dnl virt-p2v.
+dnl
+dnl This file is processed by m4 with only one of the following
+dnl symbols defined (depending on the target distro):
+dnl
+dnl REDHAT=1 Fedora, RHEL, CentOS, SL and workalikes
+dnl DEBIAN=1 Debian and Ubuntu
+dnl ARCHLINUX=1 Arch Linux
+dnl SUSE=1 SUSE, OpenSUSE
+dnl
+dnl NB 1: Must be one package name per line. Blank lines are ignored.
+dnl
+dnl NB 2: This works differently from appliance/packagelist.in
+dnl because we don't care about the current DISTRO (the one on
+dnl which libguestfs is being compiled), since we can "cross-build"
+dnl the virt-p2v ISO to any other Linux distro.
+dnl
+dnl NB 3: libguestfs is not a dependency of virt-p2v. libguestfs
+dnl only runs on the virt-v2v conversion server.
+
+ifelse(REDHAT,1,
+ dnl Used by the virt-p2v binary.
+ pcre
+ libxml2
+ gtk2
+
+ dnl Run as external programs by the p2v binary.
+ /usr/bin/ssh
+ /usr/bin/qemu-nbd
+
+ dnl The hwdata package contains PCI IDs, used by virt-p2v to display
+ dnl network vendor information (RHBZ#855059).
+ hwdata
+
+ dnl X11 environment
+ /usr/bin/xinit
+ /usr/bin/Xorg
+ xorg-x11-drivers
+ xorg-x11-fonts-Type1
+ metacity
+
+ NetworkManager
+ nm-connection-editor
+ network-manager-applet
+ dbus-x11 dnl required by nm-applet, but not a dependency in Fedora
+
+ dnl RHBZ#1157679
+ @hardware-support
+)
+
+ifelse(DEBIAN,1,
+ libpcre3
+ libxml2
+ libgtk2.0-0
+ openssh-client
+ qemu-utils
+ hwdata
+ xorg
+ xserver-xorg-video-all
+ metacity
+ network-manager
+ network-manager-gnome
+ network-manager-applet
+ dbus-x11
+)
+
+ifelse(ARCHLINUX,1,
+ pcre
+ libxml2
+ gtk2
+ openssh
+ qemu
+ hwdata
+ xorg-xinit
+ xorg-server
+ xf86-video-*
+ metacity
+ NetworkManager
+ nm-connection-editor
+ network-manager-applet
+ dbus-x11
+)
+
+ifelse(SUSE,1,
+ pcre
+ libxml2
+ gtk2
+ /usr/bin/ssh
+ /usr/bin/qemu-nbd
+ hwdata
+ /usr/bin/xinit
+ /usr/bin/Xorg
+ xf86-video-*
+ metacity
+ NetworkManager
+ nm-connection-editor
+ network-manager-applet
+ dbus-x11
+)
diff --git a/p2v/p2v.ks.in b/p2v/p2v.ks.in
index 0abad7d..32c6a5a 100644
--- a/p2v/p2v.ks.in
+++ b/p2v/p2v.ks.in
@@ -68,21 +68,7 @@ firewalld
/usr/bin/gzip
# The dependencies of virt-p2v.
-/usr/bin/xinit
-/usr/bin/ssh
-/usr/bin/qemu-nbd
-/usr/bin/Xorg
-xorg-x11-drivers
-xorg-x11-fonts-Type1
-metacity
-pcre
-libxml2
-gtk2
-nm-connection-editor
-network-manager-applet
-dbus-x11
-hwdata
- at hardware-support --optional
+__DEPENDENCIES__
%end
diff --git a/p2v/virt-p2v-make-disk.in b/p2v/virt-p2v-make-disk.in
index 316c224..24a3f44 100644
--- a/p2v/virt-p2v-make-disk.in
+++ b/p2v/virt-p2v-make-disk.in
@@ -82,28 +82,24 @@ cleanup ()
}
trap cleanup INT QUIT TERM EXIT ERR
-# The dependencies are:
-#
-# - pcre (library only)
-# - libxml2 (library only)
-# - gtk2 (library only)
-# - ssh
-# - qemu-nbd
-# - xinit (script, part of X)
-# - Xorg (or another X server, but only Xorg has been tested)
-# - Xorg drivers
-# - some fonts
-# - hardware support (firmware etc, RHBZ#1157679)
-# - metacity (window manager, another could be used)
-# - NetworkManager
-# - nm-connection-editor
-# - nm-applet
-# - dbus-x11 (required by nm-applet, but not specified as a dep in Fedora)
-#
-# Note that libguestfs is NOT a dependency.
+# Deal with stupid autotools libexecdir-not-expandable crap.
+prefix="@prefix@"
+exec_prefix="@exec_prefix@"
+libexecdir="@libexecdir@"
+
+if [ -n "$VIRT_P2V_DATA_DIR" ]; then
+ datadir="$VIRT_P2V_DATA_DIR"
+ host_libexecdir="$VIRT_P2V_DATA_DIR"
+else
+ datadir="@datadir@/virt-p2v"
+ host_libexecdir="@libexecdir@"
+fi
+
+# Variations depending on the target distro. The main difference
+# is in the list of distro packages we add to the base appliance.
case "$osversion" in
centos-*|fedora-*|rhel-*|scientificlinux-*)
- deps=pcre,libxml2,gtk2,/usr/bin/xinit,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/Xorg,xorg-x11-drivers,xorg-x11-fonts-Type1,metacity,NetworkManager,nm-connection-editor,network-manager-applet,dbus-x11,hwdata, at hardware-support
+ depsfile="$datadir/dependencies.redhat"
cat > $tmpdir/p2v.conf <<'EOF'
add_drivers+=" usb-storage "
EOF
@@ -121,38 +117,42 @@ EOF
"
;;
debian-*|ubuntu-*)
- deps=libpcre3,libxml2,libgtk2.0-0,openssh-client,qemu-utils,xorg,xserver-xorg-video-all,metacity,network-manager,network-manager-gnome,network-manager-applet,dbus-x11,hwdata
+ depsfile="$datadir/dependencies.debian"
;;
archlinux-*)
- deps=pcre,libxml2,gtk2,openssh,qemu,xorg-xinit,xorg-server,xf86-video-*,metacity,NetworkManager,nm-connection-editor,network-manager-applet,dbus-x11,hwdata
+ depsfile="$datadir/dependencies.archlinux"
;;
opensuse-*|suse-*)
- deps=pcre,libxml2,gtk2,/usr/bin/ssh,/usr/bin/qemu-nbd,/usr/bin/xinit,/usr/bin/Xorg,xf86-video-*,metacity,NetworkManager,nm-connection-editor,network-manager-applet,dbus-x11,hwdata
+ depsfile="$datadir/dependencies.suse"
;;
*)
echo "$program: internal error: could not work out the Linux distro from '$osversion'"
exit 1
esac
-# Deal with stupid autotools libexecdir-not-expandable crap.
-prefix="@prefix@"
-exec_prefix="@exec_prefix@"
-libexecdir="@libexecdir@"
-
-if [ -n "$VIRT_P2V_DATA_DIR" ]; then
- datadir="$VIRT_P2V_DATA_DIR"
- host_libexecdir="$VIRT_P2V_DATA_DIR"
-else
- datadir="@datadir@/virt-p2v"
- host_libexecdir="@libexecdir@"
+# Virt-builder requires the dependencies to be comma-separated with
+# no spaces. The $depsfile is one dependency per line.
+if [ ! -f "$depsfile" ]; then
+ echo "$0: cannot find dependencies file ($depsfile)"
+ exit 1
fi
+install=
+while read line; do
+ if [ -n "$line" ]; then
+ if [ -z "$install" ]; then
+ install="$line"
+ else
+ install="$install,$line"
+ fi
+ fi
+done < $depsfile
# Run virt-builder. Note we controversially assume systemd here. We
# could provide a sysvinit fallback if required.
virt-builder "$osversion" \
--output "$output" \
--update \
- --install "$deps" \
+ --install "$install" \
--root-password password:p2v \
--upload "$datadir"/issue:/etc/issue \
--upload "$datadir"/issue:/etc/issue.net \
diff --git a/p2v/virt-p2v-make-kickstart.in b/p2v/virt-p2v-make-kickstart.in
index 22a4eaa..f236cf9 100644
--- a/p2v/virt-p2v-make-kickstart.in
+++ b/p2v/virt-p2v-make-kickstart.in
@@ -133,6 +133,25 @@ repo --name=custom$i --baseurl=$repo $proxy
esac
done
+# Dependencies. Since kickstart is Red Hat-specific, only include
+# dependencies.redhat here.
+depsfile="$datadir/dependencies.redhat"
+if [ ! -f "$depsfile" ]; then
+ echo "$0: cannot find dependencies file ($depsfile)"
+ exit 1
+fi
+dependencies=
+while read line; do
+ if [ -n "$line" ]; then
+ if [ -z "$dependencies" ]; then
+ dependencies="$line"
+ else
+ dependencies="$dependencies
+$line"
+ fi
+ fi
+done < $depsfile
+
# Now generate the final kickstart, substituting as necessary.
# AWK FTW!
@AWK@ \
@@ -140,6 +159,7 @@ done
-v "base64_launch_virt_p2v=$base64_launch_virt_p2v" \
-v "base64_p2v_service=$base64_p2v_service" \
-v "base64_virt_p2v=$base64_virt_p2v" \
+ -v "dependencies=$dependencies" \
-v "md5sum_virt_p2v=$md5sum_virt_p2v" \
-v "repos=$repos" \
-v "libexecdir=$libexecdir" \
@@ -150,6 +170,7 @@ done
gsub (/__BASE64_LAUNCH_VIRT_P2V__/, base64_launch_virt_p2v);
gsub (/__BASE64_P2V_SERVICE__/, base64_p2v_service);
gsub (/__BASE64_VIRT_P2V__/, base64_virt_p2v);
+ gsub (/__DEPENDENCIES__/, dependencies);
gsub (/__MD5SUM_VIRT_P2V__/, md5sum_virt_p2v);
gsub (/__REPOS__/, repos);
gsub (/__LIBEXECDIR__/, libexecdir);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-libvirt/libguestfs.git
More information about the Pkg-libvirt-commits
mailing list