Move the appliance and build scripts into new appliance/ subdirectory.
authorRichard W.M. Jones <rjones@redhat.com>
Thu, 28 May 2009 12:00:31 +0000 (13:00 +0100)
committerRichard W.M. Jones <rjones@redhat.com>
Thu, 28 May 2009 12:00:31 +0000 (13:00 +0100)
20 files changed:
.gitignore
HACKING
Makefile.am
appliance/Makefile.am [new file with mode: 0644]
appliance/make-initramfs.sh.in [moved from make-initramfs.sh.in with 95% similarity]
appliance/update-initramfs.sh.in [moved from update-initramfs.sh.in with 87% similarity]
configure.ac
examples/README
fish/fish.c
haskell/Makefile.am
inspector/run-inspector-locally
java/Makefile.am
ocaml/Makefile.am
perl/examples/README
perl/run-perl-tests
python/Makefile.am
recipes/README
ruby/run-ruby-tests
src/generator.ml
tests.c

index 5032bf3..a002cab 100644 (file)
@@ -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 4e6ac4c..4f88e88 100644 (file)
--- 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.
 
index c8cf76c..17adf1c 100644 (file)
@@ -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 (file)
index 0000000..0002663
--- /dev/null
@@ -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
+
similarity index 95%
rename from make-initramfs.sh.in
rename to appliance/make-initramfs.sh.in
index aa61811..248f2e2 100755 (executable)
 
 # 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
similarity index 87%
rename from update-initramfs.sh.in
rename to appliance/update-initramfs.sh.in
index 080cfdd..3b779f8 100755 (executable)
@@ -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
index bca88d7..d40464d 100644 (file)
@@ -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
index 77bf6a4..408d6a2 100644 (file)
@@ -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).
index 79f77fe..18d3880 100644 (file)
@@ -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);
index 06efdfd..1086ee9 100644 (file)
@@ -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
index 9aebfd7..3f2d600 100755 (executable)
@@ -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 "$@"
index b49c303..cc9891b 100644 (file)
@@ -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
index 760caf6..b43049a 100644 (file)
@@ -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
index a7c654f..e538558 100644 (file)
@@ -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
index 228fb17..e3f315e 100755 (executable)
@@ -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 "$@"
index bab869e..4c72bbd 100644 (file)
@@ -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
 
index 6a1f728..6f7e255 100644 (file)
@@ -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
index 3bf5577..8232b29 100755 (executable)
@@ -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 "$@"
 
index 4e18f98..03439aa 100755 (executable)
@@ -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 4baf486..11bd2a5 100644 (file)
--- 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);