summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2009-05-28 13:00:31 +0100
committerRichard W.M. Jones <rjones@redhat.com>2009-05-28 13:00:31 +0100
commita1e8cdf2a254c5eddaf525cd7c34e4c937690204 (patch)
tree4a53b93475a9f5ddd2b0159068818a530e21a797
parent4e444d53cc9497b7cb36ad35fdee825cade72b0f (diff)
downloadlibguestfs-a1e8cdf2a254c5eddaf525cd7c34e4c937690204.tar.gz
libguestfs-a1e8cdf2a254c5eddaf525cd7c34e4c937690204.tar.xz
libguestfs-a1e8cdf2a254c5eddaf525cd7c34e4c937690204.zip
Move the appliance and build scripts into new appliance/ subdirectory.
-rw-r--r--.gitignore10
-rw-r--r--HACKING3
-rw-r--r--Makefile.am60
-rw-r--r--appliance/Makefile.am82
-rwxr-xr-xappliance/make-initramfs.sh.in (renamed from make-initramfs.sh.in)10
-rwxr-xr-xappliance/update-initramfs.sh.in (renamed from update-initramfs.sh.in)6
-rw-r--r--configure.ac5
-rw-r--r--examples/README2
-rw-r--r--fish/fish.c9
-rw-r--r--haskell/Makefile.am4
-rwxr-xr-xinspector/run-inspector-locally2
-rw-r--r--java/Makefile.am2
-rw-r--r--ocaml/Makefile.am2
-rw-r--r--perl/examples/README2
-rwxr-xr-xperl/run-perl-tests2
-rw-r--r--python/Makefile.am4
-rw-r--r--recipes/README2
-rwxr-xr-xruby/run-ruby-tests2
-rwxr-xr-xsrc/generator.ml2
-rw-r--r--tests.c2
20 files changed, 123 insertions, 90 deletions
diff --git a/.gitignore b/.gitignore
index 5032bf3e..a002cab5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,6 +19,11 @@ ChangeLog
Makefile.in
Makefile
aclocal.m4
+appliance/initramfs.*.img
+appliance/make-initramfs.sh
+appliance/make-initramfs.sh.in.old
+appliance/update-initramfs.sh
+appliance/vmlinuz.*
autom4te.cache
compile
config.h
@@ -47,7 +52,6 @@ html/recipes.html
html/virt-inspector.1.html
initramfs
initramfs.timestamp
-initramfs.*.img
inspector/virt-inspector.1
install-sh
java/api
@@ -59,8 +63,6 @@ libguestfs.spec
libguestfs-*.tar.gz
libtool
ltmain.sh
-make-initramfs.sh
-make-initramfs.sh.in.old
m4/libtool.m4
m4/ltoptions.m4
m4/ltsugar.m4
@@ -93,5 +95,3 @@ test-command
test*.img
test*.tmp
tests
-update-initramfs.sh
-vmlinuz.*
diff --git a/HACKING b/HACKING
index 4e6ac4ce..4f88e884 100644
--- a/HACKING
+++ b/HACKING
@@ -31,6 +31,9 @@ Please test any changes.
Directories
----------------------------------------------------------------------
+appliance/
+ The qemu appliance, build scripts and so on.
+
contrib/
Outside contributions, experimental parts.
diff --git a/Makefile.am b/Makefile.am
index c8cf76c6..17adf1ca 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -17,7 +17,7 @@
ACLOCAL_AMFLAGS = -I m4
-SUBDIRS = src daemon fish po examples images
+SUBDIRS = src daemon appliance fish po examples images
if HAVE_OCAML
SUBDIRS += ocaml
@@ -43,7 +43,6 @@ endif
EXTRA_DIST = \
config.rpath \
- make-initramfs.sh update-initramfs.sh \
guestfs.pod guestfs-actions.pod guestfs-structs.pod \
guestfish.pod guestfish-actions.pod \
html/pod.css \
@@ -65,33 +64,6 @@ EXTRA_DIST = \
contrib/febootstrap/install.sh \
test-bootbootboot.sh
-# Build the root filesystem.
-# Currently this is arch-dependent, so it seems like putting it in
-# $(libdir) is best. When we build cross-architecture filesystems we
-# should probably move them to $(datadir).
-
-fsdir = $(libdir)/guestfs
-
-INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
-VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
-
-fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
-
-$(INITRAMFSIMG) $(VMLINUZ): initramfs/fakeroot.log
-
-initramfs/fakeroot.log: make-initramfs.sh.in
- -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
- -mv $(VMLINUZ) $(VMLINUZ).bak
- if ! bash $(top_builddir)/make-initramfs.sh; then rm -f $@; exit 1; fi
-
-$(INITRAMFSIMG): initramfs/fakeroot.log daemon/guestfsd
- rm -f $@
- bash $(top_builddir)/update-initramfs.sh
- touch $@
-
-make-initramfs.sh: make-initramfs.sh.in
- ./config.status $@
-
# Tests. These are auto-generated from the test descriptions
# in the generator.
@@ -109,8 +81,6 @@ TESTS_ENVIRONMENT = \
SKIP_TEST_ZEROFREE=$(shell test -x initramfs/usr/sbin/zerofree || echo 1) \
$(VG)
-$(TESTS): $(INITRAMFS) $(VMLINUZ)
-
# Run the tests under valgrind.
valgrind:
@@ -204,34 +174,6 @@ dist-hook:
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = libguestfs.pc
-# Test-boot the image.
-
-test-boot: emptydisk
- qemu-system-$(host_cpu) \
- -m 384 \
- -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
- -hda emptydisk
-
-emptydisk:
- rm -f emptydisk
- dd if=/dev/zero of=emptydisk bs=1024 count=1440
- echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
-
-# This is a more realistic test boot command line which better
-# reflects what the library does.
-
-test-boot-realistic: emptydisk
- qemu-system-$(host_cpu) \
- -m 384 \
- -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
- -hda emptydisk \
- -append "console=ttyS0 guestfs=10.0.2.4:6666" \
- -nographic \
- -serial stdio \
- -net channel,6666:unix:/tmp/sock,server,nowait \
- -net user,vlan=0 \
- -net nic,model=virtio,vlan=0
-
# Make clean.
CLEANFILES = $(fs_DATA) emptydisk pod2htm?.tmp
diff --git a/appliance/Makefile.am b/appliance/Makefile.am
new file mode 100644
index 00000000..0002663c
--- /dev/null
+++ b/appliance/Makefile.am
@@ -0,0 +1,82 @@
+# libguestfs
+# Copyright (C) 2009 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+EXTRA_DIST = \
+ make-initramfs.sh update-initramfs.sh
+
+# Build the root filesystem (appliance).
+# Currently this is arch-dependent, so it seems like putting it in
+# $(libdir) is best. When we build cross-architecture filesystems we
+# should probably move them to $(datadir).
+
+fsdir = $(libdir)/guestfs
+
+INITRAMFSIMG = initramfs.$(REPO).$(host_cpu).img
+VMLINUZ = vmlinuz.$(REPO).$(host_cpu)
+
+fs_DATA = $(INITRAMFSIMG) $(VMLINUZ)
+
+$(INITRAMFSIMG) $(VMLINUZ): $(top_builddir)/initramfs/fakeroot.log
+
+$(top_builddir)/initramfs/fakeroot.log: make-initramfs.sh.in
+ -mv $(INITRAMFSIMG) $(INITRAMFSIMG).bak
+ -mv $(VMLINUZ) $(VMLINUZ).bak
+ if ! bash make-initramfs.sh; then rm -f $@; exit 1; fi
+
+$(INITRAMFSIMG): $(top_builddir)/initramfs/fakeroot.log $(top_builddir)/daemon/guestfsd
+ rm -f $@
+ bash update-initramfs.sh
+ touch $@
+
+make-initramfs.sh: make-initramfs.sh.in
+ ./config.status $@
+
+# Test-boot the image.
+
+test-boot: emptydisk
+ qemu-system-$(host_cpu) \
+ -m 384 \
+ -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
+ -hda emptydisk
+
+emptydisk:
+ rm -f emptydisk
+ dd if=/dev/zero of=emptydisk bs=1024 count=1440
+ echo 0, | sfdisk -q -C 80 -H 2 -S 18 emptydisk > /dev/null
+
+# This is a more realistic test boot command line which better
+# reflects what the library does.
+
+test-boot-realistic: emptydisk
+ qemu-system-$(host_cpu) \
+ -m 384 \
+ -kernel $(VMLINUZ) -initrd $(INITRAMFSIMG) \
+ -hda emptydisk \
+ -append "console=ttyS0 guestfs=10.0.2.4:6666" \
+ -nographic \
+ -serial stdio \
+ -net channel,6666:unix:/tmp/sock,server,nowait \
+ -net user,vlan=0 \
+ -net nic,model=virtio,vlan=0
+
+# Make clean.
+
+CLEANFILES = $(fs_DATA)
+
+clean-local:
+ rm -rf $(top_builddir)/initramfs
+
diff --git a/make-initramfs.sh.in b/appliance/make-initramfs.sh.in
index aa61811c..248f2e2d 100755
--- a/make-initramfs.sh.in
+++ b/appliance/make-initramfs.sh.in
@@ -18,9 +18,11 @@
# This is called from the Makefile to build the initramfs.
+unset CDPATH
+
set -e
-unset CDPATH
+cd @top_builddir@
modules="
-i augeas-libs
@@ -45,8 +47,8 @@ modules="
"
# Decide on names for the final output. These have to match Makefile.am.
-output=initramfs.@REPO@.@host_cpu@.img
-koutput=vmlinuz.@REPO@.@host_cpu@
+output=appliance/initramfs.@REPO@.@host_cpu@.img
+koutput=appliance/vmlinuz.@REPO@.@host_cpu@
rm -f $output
rm -f $koutput
@@ -151,7 +153,7 @@ rm init.new
#@FEBOOTSTRAP_RUN@ initramfs -- ln -f /init /sbin/init
# Copy the daemon into the filesystem.
-@FEBOOTSTRAP_INSTALL@ initramfs @abs_builddir@/daemon/guestfsd /sbin/guestfsd 0755 root.root
+@FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
# Generate final image.
@FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
diff --git a/update-initramfs.sh.in b/appliance/update-initramfs.sh.in
index 080cfdd2..3b779f85 100755
--- a/update-initramfs.sh.in
+++ b/appliance/update-initramfs.sh.in
@@ -23,10 +23,12 @@ unset CDPATH
set -e
-output=initramfs.@REPO@.@host_cpu@.img
+cd @top_builddir@
+
+output=appliance/initramfs.@REPO@.@host_cpu@.img
# Copy the daemon into the filesystem.
-@FEBOOTSTRAP_INSTALL@ initramfs @abs_builddir@/daemon/guestfsd /sbin/guestfsd 0755 root.root
+@FEBOOTSTRAP_INSTALL@ initramfs daemon/guestfsd /sbin/guestfsd 0755 root.root
# Generate final image.
@FEBOOTSTRAP_TO_INITRAMFS@ initramfs > $output-t
diff --git a/configure.ac b/configure.ac
index bca88d7d..d40464d7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -446,6 +446,8 @@ dnl Produce output files.
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_FILES([Makefile
src/Makefile fish/Makefile po/Makefile.in examples/Makefile
+ appliance/Makefile
+ appliance/make-initramfs.sh appliance/update-initramfs.sh
images/Makefile
ocaml/Makefile ocaml/examples/Makefile
perl/Makefile
@@ -454,13 +456,12 @@ AC_CONFIG_FILES([Makefile
java/Makefile
haskell/Makefile
inspector/Makefile
- make-initramfs.sh update-initramfs.sh
libguestfs.pc
ocaml/META perl/Makefile.PL])
AC_OUTPUT
dnl WTF?
-chmod +x make-initramfs.sh update-initramfs.sh
+chmod +x appliance/make-initramfs.sh appliance/update-initramfs.sh
dnl Produce summary.
echo
diff --git a/examples/README b/examples/README
index 77bf6a41..408d6a23 100644
--- a/examples/README
+++ b/examples/README
@@ -10,6 +10,6 @@ Tips:
LIBGUESTFS_DEBUG=1
(2) If you haven't installed libguestfs, run the examples like this:
-LIBGUESTFS_PATH=. examples/to-xml
+LIBGUESTFS_PATH=appliance examples/to-xml
(the path should point to the directory containing vmlinuz.* and
initramfs.* files).
diff --git a/fish/fish.c b/fish/fish.c
index 79f77fe9..18d3880d 100644
--- a/fish/fish.c
+++ b/fish/fish.c
@@ -137,9 +137,10 @@ main (int argc, char *argv[])
guestfs_set_autosync (g, 1);
- /* If developing, add . to the path. Note that libtools interferes
- * with this because uninstalled guestfish is a shell script that runs
- * the real program with an absolute path. Detect that too.
+ /* If developing, add ./appliance to the path. Note that libtools
+ * interferes with this because uninstalled guestfish is a shell
+ * script that runs the real program with an absolute path. Detect
+ * that too.
*
* BUT if LIBGUESTFS_PATH environment variable is already set by
* the user, then don't override it.
@@ -147,7 +148,7 @@ main (int argc, char *argv[])
if (getenv ("LIBGUESTFS_PATH") == NULL &&
argv[0] &&
(argv[0][0] != '/' || strstr (argv[0], "/.libs/lt-") != NULL))
- guestfs_set_path (g, ".:" GUESTFS_DEFAULT_PATH);
+ guestfs_set_path (g, "appliance:" GUESTFS_DEFAULT_PATH);
for (;;) {
c = getopt_long (argc, argv, options, long_options, NULL);
diff --git a/haskell/Makefile.am b/haskell/Makefile.am
index 06efdfdc..1086ee97 100644
--- a/haskell/Makefile.am
+++ b/haskell/Makefile.am
@@ -22,8 +22,8 @@ CLEANFILES = *~
if HAVE_HASKELL
TESTS_ENVIRONMENT = \
- LD_LIBRARY_PATH=$(abs_top_builddir)/src/.libs \
- LIBGUESTFS_PATH=$(abs_top_builddir) \
+ LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
$(VG)
TESTS = Guestfs005Load Guestfs010Launch Guestfs050LVCreate
diff --git a/inspector/run-inspector-locally b/inspector/run-inspector-locally
index 9aebfd7f..3f2d6004 100755
--- a/inspector/run-inspector-locally
+++ b/inspector/run-inspector-locally
@@ -24,6 +24,6 @@
# ./inspector/run-inspector-locally [usual virt-inspector args ...]
export LD_LIBRARY_PATH=$(pwd)/src/.libs
-export LIBGUESTFS_PATH=$(pwd)
+export LIBGUESTFS_PATH=$(pwd)/appliance
export PERL5LIB=$(pwd)/perl/blib/lib:$(pwd)/perl/blib/arch
perl ./inspector/virt-inspector.pl "$@"
diff --git a/java/Makefile.am b/java/Makefile.am
index b49c3034..cc9891b6 100644
--- a/java/Makefile.am
+++ b/java/Makefile.am
@@ -90,7 +90,7 @@ TESTS = $(java_tests:.java=.class)
TESTS_ENVIRONMENT = \
JAVA=$(JAVA) \
CLASSPATH=t:libguestfs-$(VERSION).jar \
- LIBGUESTFS_PATH=$(abs_top_builddir) \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
./run-java-test
t/%.class: t/%.java
diff --git a/ocaml/Makefile.am b/ocaml/Makefile.am
index 760caf62..b43049aa 100644
--- a/ocaml/Makefile.am
+++ b/ocaml/Makefile.am
@@ -44,7 +44,7 @@ guestfs_c_actions.o: guestfs_c_actions.c
TESTS_ENVIRONMENT = \
LD_LIBRARY_PATH=$(top_builddir)/src/.libs \
- LIBGUESTFS_PATH=$(top_builddir) \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
$(VG)
TESTS = t/guestfs_005_load t/guestfs_010_launch t/guestfs_050_lvcreate
diff --git a/perl/examples/README b/perl/examples/README
index a7c654f7..e5385583 100644
--- a/perl/examples/README
+++ b/perl/examples/README
@@ -12,6 +12,6 @@ Tips:
LIBGUESTFS_PATH as in this example (if run from the root directory of
the source distribution):
- LIBGUESTFS_PATH=$(pwd) \
+ LIBGUESTFS_PATH=$(pwd)/appliance \
PERL5LIB=$(pwd)/perl/blib/lib:$(pwd)/perl/blib/arch/auto/Sys/Guestfs \
perl/examples/foo
diff --git a/perl/run-perl-tests b/perl/run-perl-tests
index 228fb17c..e3f315e9 100755
--- a/perl/run-perl-tests
+++ b/perl/run-perl-tests
@@ -17,5 +17,5 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
export LD_LIBRARY_PATH=../src/.libs
-export LIBGUESTFS_PATH=$(cd .. > /dev/null && pwd)
+export LIBGUESTFS_PATH=../appliance
make -f Makefile-pl test "$@"
diff --git a/python/Makefile.am b/python/Makefile.am
index bab869e7..4c72bbd4 100644
--- a/python/Makefile.am
+++ b/python/Makefile.am
@@ -33,8 +33,8 @@ libguestfsmod_la_CFLAGS = -Wall -I$(PYTHON_INCLUDEDIR) -I$(top_builddir)/src
libguestfsmod_la_LIBADD = $(top_builddir)/src/libguestfs.la
TESTS_ENVIRONMENT = \
- LIBGUESTFS_PATH=$(abs_top_builddir) \
- PYTHONPATH=$(abs_top_builddir)/python:$(abs_top_builddir)/python/.libs \
+ LIBGUESTFS_PATH=$(top_builddir)/appliance \
+ PYTHONPATH=$(top_builddir)/python:$(top_builddir)/python/.libs \
$(PYTHON)
TESTS = t/005-import.py t/010-launch.py t/050-lvcreate.py
diff --git a/recipes/README b/recipes/README
index 6a1f7288..6f7e2558 100644
--- a/recipes/README
+++ b/recipes/README
@@ -17,7 +17,7 @@ without restrictions.
To run a script before libguestfs has been installed, you can do
something like this:
- LIBGUESTFS_PATH=.. PATH=../fish:$PATH ./show-devices.sh disk.img
+ LIBGUESTFS_PATH=../appliance PATH=../fish:$PATH ./show-devices.sh disk.img
You can apply these recipes in your own programs by translating the
guestfish commands into API calls in the language of your choice. The
diff --git a/ruby/run-ruby-tests b/ruby/run-ruby-tests
index 3bf55776..8232b29a 100755
--- a/ruby/run-ruby-tests
+++ b/ruby/run-ruby-tests
@@ -17,6 +17,6 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
export LD_LIBRARY_PATH=../src/.libs
-export LIBGUESTFS_PATH=$(cd .. > /dev/null && pwd)
+export LIBGUESTFS_PATH=../appliance
rake test "$@"
diff --git a/src/generator.ml b/src/generator.ml
index 4e18f985..03439aa0 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -3720,7 +3720,7 @@ int main (int argc, char *argv[])
srcdir = getenv (\"srcdir\");
if (!srcdir) srcdir = \".\";
chdir (srcdir);
- guestfs_set_path (g, \".\");
+ guestfs_set_path (g, \"appliance\");
filename = \"test1.img\";
fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);
diff --git a/tests.c b/tests.c
index 4baf4867..11bd2a52 100644
--- a/tests.c
+++ b/tests.c
@@ -15702,7 +15702,7 @@ int main (int argc, char *argv[])
srcdir = getenv ("srcdir");
if (!srcdir) srcdir = ".";
chdir (srcdir);
- guestfs_set_path (g, ".");
+ guestfs_set_path (g, "appliance");
filename = "test1.img";
fd = open (filename, O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK|O_TRUNC, 0666);