From: Richard Jones Date: Mon, 19 Oct 2009 09:18:46 +0000 (+0100) Subject: Move virt tools (virt-cat, virt-edit etc) into tools/ subdirectory. X-Git-Tag: 1.0.74~9 X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=945b6e0a085611b45b2ab0752a66e6e60b21666c;p=libguestfs.git Move virt tools (virt-cat, virt-edit etc) into tools/ subdirectory. This moves the tool programs into a single directory: cat/* -> tools/virt-cat df/* -> tools/virt-df edit/* -> tools/virt-edit rescue/* -> tools/virt-rescue This in itself simplifies the build process because we only need one Makefile and one copy of 'run-locally'. 'run-*-locally' has become just 'run-locally' and takes an extra parameter which is the name of the tool, eg: run-locally cat [virt-cat params...] virt-inspector stays in its own directory, because this contains more than just a single Perl script. --- diff --git a/.gitignore b/.gitignore index 508f13a..4467a63 100644 --- a/.gitignore +++ b/.gitignore @@ -23,7 +23,6 @@ capitests/test*.img capitests/tests capitests/tests.c capitests/test*.tmp -cat/virt-cat.1 ChangeLog *.class *.cma @@ -47,8 +46,6 @@ daemon/names.c daemon/stubs.c depcomp .deps -df/virt-df.1 -edit/virt-edit.1 emptydisk examples/hello examples/to-xml @@ -179,7 +176,6 @@ python/guestfs.py python/guestfs-py.c python/guestfs.pyc regressions/test1.img -rescue/virt-rescue.1 ruby/bindtests.rb ruby/ext/guestfs/extconf.h ruby/ext/guestfs/_guestfs.c @@ -201,6 +197,7 @@ stamp-h1 test-tool/libguestfs-test-tool.1 test-tool/libguestfs-test-tool test-tool/libguestfs-test-tool-helper +tools/virt-*.1 /GNUmakefile /maint.mk /build-aux diff --git a/HACKING b/HACKING index bdb8287..ca5b9a9 100644 --- a/HACKING +++ b/HACKING @@ -68,9 +68,6 @@ Directories appliance/ The qemu appliance, build scripts and so on. -cat/ - The virt-cat tool. - capitests/ Automated tests of the C API. @@ -80,12 +77,6 @@ contrib/ daemon/ The daemon that runs inside the guest and carries out actions. -df/ - The virt-df tool. - -edit/ - The virt-edit tool. - examples/ The examples. @@ -125,12 +116,15 @@ python/ regressions/ Regression tests. -rescue/ - The virt-rescue tool. - ruby/ Ruby bindings. +tools/ + Command line tools like virt-cat, virt-df, virt-edit and more. + In versions <= 1.0.73 these were all in separate directories + like cat/, df/, edit/, but since then we moved them all into + one directory to simplify builds. + src/ Source code to the C library. Also contains the crucial generator program. diff --git a/Makefile.am b/Makefile.am index c4a84f7..73d4f63 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,9 +26,14 @@ SUBDIRS = gnulib/lib src daemon appliance fish po examples images \ if HAVE_PERL SUBDIRS += perl endif + if HAVE_INSPECTOR SUBDIRS += inspector endif +if HAVE_TOOLS +SUBDIRS += tools +endif + if HAVE_OCAML SUBDIRS += ocaml ocaml/examples endif @@ -44,18 +49,6 @@ endif if HAVE_HASKELL SUBDIRS += haskell endif -if HAVE_DF -SUBDIRS += df -endif -if HAVE_CAT -SUBDIRS += cat -endif -if HAVE_RESCUE -SUBDIRS += rescue -endif -if HAVE_EDIT -SUBDIRS += edit -endif EXTRA_DIST = \ guestfs.pod guestfs-actions.pod guestfs-structs.pod \ diff --git a/cat/run-cat-locally b/cat/run-cat-locally deleted file mode 100755 index 7c31aaf..0000000 --- a/cat/run-cat-locally +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl -# virt-cat -# 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. - -# This script sets up the environment so you can run virt-cat in place -# without needing to do 'make install' first. You can also run virt-cat -# by creating a symlink to this script and putting it in your path. -# -# Use it like this: -# ./run-cat-locally [usual virt-cat args ...] - -use strict; -use warnings; - -use File::Basename qw(dirname); -use File::Spec; -use Cwd qw(abs_path); - -my $path = $0; - -# Follow symlinks until we get to the real file -while(-l $path) { - my $link = readlink($path) or die "readlink: $path: $!"; - if(File::Spec->file_name_is_absolute($link)) { - $path = $link; - } else { - $path = File::Spec->catfile(dirname($path), $link); - } -} - -# Get the absolute path of the parent directory -$path = abs_path(dirname($path).'/..'); - -$ENV{LD_LIBRARY_PATH} = $path.'/src/.libs'; -$ENV{LIBGUESTFS_PATH} = $path.'/appliance'; -$ENV{PERL5LIB} = $path.'/perl/blib/lib:'.$path.'/perl/blib/arch'; - -exec('perl', $path.'/cat/virt-cat', @ARGV); diff --git a/configure.ac b/configure.ac index 2d4cd33..ab42561 100644 --- a/configure.ac +++ b/configure.ac @@ -675,18 +675,12 @@ for pm in Pod::Usage Getopt::Long Sys::Virt Data::Dumper XML::Writer Locale::Tex fi done if test "x$missing_perl_modules" = "xyes"; then - AC_MSG_WARN([some Perl modules required to compile virt-cat, virt-df, virt-edit, virt-inspector and virt-rescue are missing]) + AC_MSG_WARN([some Perl modules required to compile virt-inspector and the other virt-* tools are missing]) fi -AM_CONDITIONAL([HAVE_CAT], - [test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"]) -AM_CONDITIONAL([HAVE_DF], - [test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"]) -AM_CONDITIONAL([HAVE_EDIT], - [test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"]) AM_CONDITIONAL([HAVE_INSPECTOR], [test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"]) -AM_CONDITIONAL([HAVE_RESCUE], +AM_CONDITIONAL([HAVE_TOOLS], [test "x$PERL" != "xno" -a "x$missing_perl_modules" != "xyes"]) dnl Library versioning. @@ -723,11 +717,8 @@ AC_CONFIG_FILES([Makefile ruby/Makefile ruby/Rakefile java/Makefile haskell/Makefile - cat/Makefile - df/Makefile - edit/Makefile inspector/Makefile - rescue/Makefile + tools/Makefile libguestfs.pc gnulib/lib/Makefile gnulib/tests/Makefile @@ -755,16 +746,10 @@ echo -n "Java bindings ....................... " if test "x$HAVE_JAVA_TRUE" = "x"; then echo "yes"; else echo "no"; fi echo -n "Haskell bindings .................... " if test "x$HAVE_HASKELL" = "x"; then echo "yes"; else echo "no"; fi -echo -n "virt-cat ............................ " -if test "x$HAVE_CAT" = "x"; then echo "yes"; else echo "no"; fi -echo -n "virt-df ............................. " -if test "x$HAVE_DF" = "x"; then echo "yes"; else echo "no"; fi -echo -n "virt-edit ........................... " -if test "x$HAVE_EDIT" = "x"; then echo "yes"; else echo "no"; fi echo -n "virt-inspector ...................... " if test "x$HAVE_INSPECTOR" = "x"; then echo "yes"; else echo "no"; fi -echo -n "virt-rescue ......................... " -if test "x$HAVE_RESCUE" = "x"; then echo "yes"; else echo "no"; fi +echo -n "virt-* tools ........................ " +if test "x$HAVE_TOOLS" = "x"; then echo "yes"; else echo "no"; fi echo "supermin appliance .................. $enable_supermin" echo echo "If any optional component is configured 'no' when you expected 'yes'" diff --git a/df/Makefile.am b/df/Makefile.am deleted file mode 100644 index f333f97..0000000 --- a/df/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -# libguestfs virt-df -# 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 = \ - run-df-locally \ - virt-df - -if HAVE_DF - -bin_SCRIPTS = virt-df -man_MANS = virt-df.1 - -noinst_DATA = $(top_builddir)/html/virt-df.1.html - -virt-df.1: virt-df - $(POD2MAN) \ - --section 1 \ - -c "Virtualization Support" \ - --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \ - $< > $@-t && mv $@-t $@ - -$(top_builddir)/html/virt-df.1.html: virt-df - mkdir -p $(top_builddir)/html - cd $(top_builddir) && pod2html \ - --css 'pod.css' \ - --title 'virt-df, display free space on virtual filesystems' \ - --htmldir html \ - --outfile html/virt-df.1.html \ - df/$< - -endif diff --git a/df/run-df-locally b/df/run-df-locally deleted file mode 100755 index 94697b0..0000000 --- a/df/run-df-locally +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl -# virt-df -# 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. - -# This script sets up the environment so you can run virt-df in place -# without needing to do 'make install' first. You can also run virt-df -# by creating a symlink to this script and putting it in your path. -# -# Use it like this: -# ./run-df-locally [usual virt-df args ...] - -use strict; -use warnings; - -use File::Basename qw(dirname); -use File::Spec; -use Cwd qw(abs_path); - -my $path = $0; - -# Follow symlinks until we get to the real file -while(-l $path) { - my $link = readlink($path) or die "readlink: $path: $!"; - if(File::Spec->file_name_is_absolute($link)) { - $path = $link; - } else { - $path = File::Spec->catfile(dirname($path), $link); - } -} - -# Get the absolute path of the parent directory -$path = abs_path(dirname($path).'/..'); - -$ENV{LD_LIBRARY_PATH} = $path.'/src/.libs'; -$ENV{LIBGUESTFS_PATH} = $path.'/appliance'; -$ENV{PERL5LIB} = $path.'/perl/blib/lib:'.$path.'/perl/blib/arch'; - -exec('perl', $path.'/df/virt-df', @ARGV); diff --git a/edit/Makefile.am b/edit/Makefile.am deleted file mode 100644 index 6afdd62..0000000 --- a/edit/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -# libguestfs virt-edit -# 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 = \ - run-edit-locally \ - virt-edit - -if HAVE_EDIT - -bin_SCRIPTS = virt-edit -man_MANS = virt-edit.1 - -noinst_DATA = $(top_builddir)/html/virt-edit.1.html - -virt-edit.1: virt-edit - $(POD2MAN) \ - --section 1 \ - -c "Virtualization Support" \ - --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \ - $< > $@-t && mv $@-t $@ - -$(top_builddir)/html/virt-edit.1.html: virt-edit - mkdir -p $(top_builddir)/html - cd $(top_builddir) && pod2html \ - --css 'pod.css' \ - --title 'virt-edit, edit a file in a virtual machine' \ - --htmldir html \ - --outfile html/virt-edit.1.html \ - edit/$< - -endif diff --git a/edit/run-edit-locally b/edit/run-edit-locally deleted file mode 100755 index 127463f..0000000 --- a/edit/run-edit-locally +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/perl -# virt-edit -# 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. - -# This script sets up the environment so you can run virt-edit in place -# without needing to do 'make install' first. You can also run virt-edit -# by creating a symlink to this script and putting it in your path. -# -# Use it like this: -# ./run-edit-locally [usual virt-edit args ...] - -use strict; -use warnings; - -use File::Basename qw(dirname); -use File::Spec; -use Cwd qw(abs_path); - -my $path = $0; - -# Follow symlinks until we get to the real file -while(-l $path) { - my $link = readlink($path) or die "readlink: $path: $!"; - if(File::Spec->file_name_is_absolute($link)) { - $path = $link; - } else { - $path = File::Spec->catfile(dirname($path), $link); - } -} - -# Get the absolute path of the parent directory -$path = abs_path(dirname($path).'/..'); - -$ENV{LD_LIBRARY_PATH} = $path.'/src/.libs'; -$ENV{LIBGUESTFS_PATH} = $path.'/appliance'; -$ENV{PERL5LIB} = $path.'/perl/blib/lib:'.$path.'/perl/blib/arch'; - -exec('perl', $path.'/edit/virt-edit', @ARGV); diff --git a/po/POTFILES.in b/po/POTFILES.in index 7ccadcf..b99493b 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,4 +1,3 @@ -cat/virt-cat daemon/augeas.c daemon/blockdev.c daemon/checksum.c @@ -55,8 +54,6 @@ daemon/wc.c daemon/xattr.c daemon/zero.c daemon/zerofree.c -df/virt-df -edit/virt-edit fish/alloc.c fish/cmds.c fish/completion.c @@ -81,10 +78,13 @@ perl/lib/Sys/Guestfs.pm perl/lib/Sys/Guestfs/Lib.pm python/guestfs-py.c regressions/test-noexec-stack.pl -rescue/virt-rescue ruby/ext/guestfs/_guestfs.c src/guestfs-actions.c src/guestfs-bindtests.c src/guestfs.c test-tool/helper.c test-tool/test-tool.c +tools/virt-cat +tools/virt-df +tools/virt-edit +tools/virt-rescue diff --git a/rescue/Makefile.am b/rescue/Makefile.am deleted file mode 100644 index b532e25..0000000 --- a/rescue/Makefile.am +++ /dev/null @@ -1,45 +0,0 @@ -# libguestfs virt-rescue -# 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 = \ - run-rescue-locally \ - virt-rescue - -if HAVE_RESCUE - -bin_SCRIPTS = virt-rescue -man_MANS = virt-rescue.1 - -noinst_DATA = $(top_builddir)/html/virt-rescue.1.html - -virt-rescue.1: virt-rescue - $(POD2MAN) \ - --section 1 \ - -c "Virtualization Support" \ - --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \ - $< > $@-t && mv $@-t $@ - -$(top_builddir)/html/virt-rescue.1.html: virt-rescue - mkdir -p $(top_builddir)/html - cd $(top_builddir) && pod2html \ - --css 'pod.css' \ - --title 'virt-rescue, run a rescue shell on a virtual machine' \ - --htmldir html \ - --outfile html/virt-rescue.1.html \ - rescue/$< - -endif diff --git a/cat/Makefile.am b/tools/Makefile.am similarity index 64% rename from cat/Makefile.am rename to tools/Makefile.am index 6b9a1bb..d5fc23c 100644 --- a/cat/Makefile.am +++ b/tools/Makefile.am @@ -1,4 +1,4 @@ -# libguestfs virt-cat +# libguestfs virt-* tools # Copyright (C) 2009 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify @@ -15,31 +15,36 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +tools = cat df edit rescue + EXTRA_DIST = \ - run-cat-locally \ - virt-cat + run-locally \ + $(tools:%=virt-%) + +if HAVE_TOOLS -if HAVE_CAT +bin_SCRIPTS = $(tools:%=virt-%) -bin_SCRIPTS = virt-cat -man_MANS = virt-cat.1 +# XXX Bug in automake? If you list virt-cat.1 explicitly, then it +# builds and installs the man pages. However if this is removed, +# then the man pages are neither built nor installed. +man_MANS = virt-cat.1 $(patsubst %,virt-%.1,$(filter-out cat,$(tools))) -noinst_DATA = $(top_builddir)/html/virt-cat.1.html +noinst_DATA = $(tools:%=$(top_builddir)/html/virt-%.1.html) -virt-cat.1: virt-cat +virt-%.1: virt-% $(POD2MAN) \ --section 1 \ -c "Virtualization Support" \ --release "$(PACKAGE_NAME)-$(PACKAGE_VERSION)" \ $< > $@-t && mv $@-t $@ -$(top_builddir)/html/virt-cat.1.html: virt-cat +$(top_builddir)/html/virt-%.1.html: virt-% mkdir -p $(top_builddir)/html cd $(top_builddir) && pod2html \ --css 'pod.css' \ - --title 'virt-cat, display a file in a virtual machine' \ --htmldir html \ - --outfile html/virt-cat.1.html \ - cat/$< + --outfile html/$<.1.html \ + tools/$< endif diff --git a/rescue/run-rescue-locally b/tools/run-locally similarity index 80% rename from rescue/run-rescue-locally rename to tools/run-locally index 18097cf..0bf1c0a 100755 --- a/rescue/run-rescue-locally +++ b/tools/run-locally @@ -1,5 +1,4 @@ #!/usr/bin/perl -# virt-rescue # Copyright (C) 2009 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify @@ -16,13 +15,15 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -# This script sets up the environment so you can run virt-rescue in +# This script sets up the environment so you can run virt-* tools in # place without needing to do 'make install' first. You can also run -# virt-rescue by creating a symlink to this script and putting it in +# the tools by creating a symlink to this script and putting it in # your path. # # Use it like this: -# ./run-rescue-locally [usual virt-rescue args ...] +# ./run-locally tool [usual virt-tool args ...] +# eg: +# ./run-locally cat domname /etc/passwd use strict; use warnings; @@ -32,6 +33,7 @@ use File::Spec; use Cwd qw(abs_path); my $path = $0; +my $tool = shift @ARGV; # Follow symlinks until we get to the real file while(-l $path) { @@ -50,4 +52,5 @@ $ENV{LD_LIBRARY_PATH} = $path.'/src/.libs'; $ENV{LIBGUESTFS_PATH} = $path.'/appliance'; $ENV{PERL5LIB} = $path.'/perl/blib/lib:'.$path.'/perl/blib/arch'; -exec('perl', $path.'/rescue/virt-rescue', @ARGV); +print (join " ", ("$path/tools/virt-$tool", @ARGV), "\n"); +exec('perl', "$path/tools/virt-$tool", @ARGV); diff --git a/cat/virt-cat b/tools/virt-cat similarity index 100% rename from cat/virt-cat rename to tools/virt-cat diff --git a/df/virt-df b/tools/virt-df similarity index 100% rename from df/virt-df rename to tools/virt-df diff --git a/edit/virt-edit b/tools/virt-edit similarity index 100% rename from edit/virt-edit rename to tools/virt-edit diff --git a/rescue/virt-rescue b/tools/virt-rescue similarity index 100% rename from rescue/virt-rescue rename to tools/virt-rescue