[Libguestfs] [PATCH 2/5] Move virt tools (virt-cat, virt-edit etc) into tools/ subdirectory.

Matthew Booth mbooth at redhat.com
Mon Oct 19 15:55:51 UTC 2009


As mentioned on IRC, I'm going to reply quoting git's rename-friendly 
output rather than the original patch.

---
diff --git a/edit/Makefile.am b/tools/Makefile.am
similarity index 64%
rename from edit/Makefile.am
rename to tools/Makefile.am
index 6afdd62..d5fc23c 100644
--- a/edit/Makefile.am
+++ b/tools/Makefile.am
@@ -1,4 +1,4 @@
-# libguestfs virt-edit
+# 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-edit-locally \
-       virt-edit
+       run-locally \
+       $(tools:%=virt-%)
+
+if HAVE_TOOLS

-if HAVE_EDIT
+bin_SCRIPTS = $(tools:%=virt-%)
---

You use the $(tools:%=virt-%) construction in a few places. It would 
improve readability if you pulled it up to the top and reused it. Maybe 
define:
virt_tools = $(tools:%=virt-%)
right below the tools definition.

---
-$(top_builddir)/html/virt-edit.1.html: virt-edit
+$(top_builddir)/html/virt-%.1.html: virt-%
         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/$<
+         --outfile html/$<.1.html \
+         tools/$<
---

You lost the title in the html documentation. Not a huge deal, I guess, 
but still a regression.

---
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
@@ -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);
---

The print looks like debug output. Did you intend to leave it in there?

Matt
-- 
Matthew Booth, RHCA, RHCSS
Red Hat Engineering, Virtualisation Team

M:       +44 (0)7977 267231
GPG ID:  D33C3490
GPG FPR: 3733 612D 2D05 5458 8A8A 1600 3441 EA19 D33C 3490




More information about the Libguestfs mailing list