Commit Graph

317 Commits

Author SHA1 Message Date
Pino Toscano
b00adf3b78 tools: implement --short-options
Just like --long-options, it makes it possible to know which short
options are supported by each tool; this can help improving the bash
completion, for example.
2014-11-27 16:26:13 +01:00
Pino Toscano
b2b65bcefb mllib: remove the TTY module
The only function provided is isatty_stdout, which is no more used now
in favour of Unix.isatty.
2014-11-25 15:40:49 +01:00
Richard W.M. Jones
f421c7cae8 ocaml: Remove *.annot files when doing 'make clean'.
Commit fd70cdc3c5 passes the -annot flag
to the compiler, generating *.annot files (containing type information
used by emacs and IDEs).  Remove these files when doing 'make clean'.
2014-11-15 17:39:01 +00:00
Richard W.M. Jones
34d6851574 Rename LIBNCURSES* to LIBTINFO*.
We actually depend on libtinfo or libtermcap, not curses, so
rename the variable.

This updates commit 96add4d5b3.
2014-11-13 13:22:21 +00:00
Mike Frysinger
96add4d5b3 use pkg-config to look up ncurses
Hardcoding -ltinfo breaks on distros that do not build the sep library
(which is the default ncurses behavior).  Use pkg-config to look up the
right libraries regardless of how the distro built things.
2014-11-13 13:19:55 +00:00
Richard W.M. Jones
ea04bcbc84 Use -ltinfo instead of -lncurses.
In tools except guestfish, we don't use ncurses, or even curses, just
2 termcap functions and a global variable.  These are provided by
libtinfo, so just link to that.

In guestfish we use readline which needs ncurses.  Leave that alone.
2014-11-05 21:34:58 +00:00
Pino Toscano
a5426cce5f build: check for libintl, and use it
Look for libint/gettext and link to it; this properly detects whether
libint is part of libc.
2014-11-05 13:45:17 +01:00
Pino Toscano
aba82825a3 builder: fix inclusion of <config.h> in lex-generated source
Use a %top block for including <config.h>, so it is included prior to
any other include, even for system ones. This makes sure its definitions
are properly used in gnulib replacement headers.
2014-11-04 17:59:55 +01:00
Pino Toscano
3d6c2af450 customize: Add --ssh-inject option for injecting SSH keys.
This adds a customize option:

  virt-customize --ssh-inject USER
  virt-customize --ssh-inject USER:string:KEY_STRING
  virt-customize --ssh-inject USER:file:FILENAME

(ditto for virt-builder and virt-sysprep)

In each case this injects into the guest user USER
a) the current (host) user's ssh pubkey
b) the key specified as KEY_STRING
c) the key in FILENAME
adding it to ~USER/.ssh/authorized_keys in the guest.

For example:

  virt-builder fedora-20 --ssh-inject root

will add the local user's ssh pubkey into the root account of the
newly created guest.  Or:

  virt-customize -a disk.img \
     --ssh-inject 'mary:string:ssh-rsa AAAA.... mary@localhost'

adds the given ssh pubkey to mary's account in the guest.

This doesn't set the SELinux labels correctly on newly created files
and directories, so you have to use --selinux-relabel (probably we
should fix this as part of the general effort to fix SELinux
relabelling).  However it should preserve the labels if the
~/.ssh/authorized_keys file already exists.

Most of this work is based on a patch sent to the mailing list by
Richard W.M. Jones <rjones@redhat.com>:
https://www.redhat.com/archives/libguestfs/2014-November/msg00000.html
2014-11-03 20:47:38 +01:00
Pino Toscano
d082cd6ae5 builder: pass Sources.source objects directly
Instead of passing the (uri, key, proxy) tuple around, pass the whole
Sources.source record; this requires creating proper Sources.source also
for uri+fingerprint passed via command line.

No functional changes.
2014-10-31 17:49:46 +01:00
Pino Toscano
56bd781b76 builder: use gpgkey_type for the gpgkey field in sources 2014-10-31 17:46:14 +01:00
Pino Toscano
3987bbcd91 builder: move the gpgkey_type type from Sigchecker to Utils
No functional change, just code motion.
2014-10-31 17:46:14 +01:00
Richard W.M. Jones
c085a0ba73 builder: Updated CentOS image to 6.6. 2014-10-31 13:57:26 +00:00
Richard W.M. Jones
6d338ae4e6 builder: Document that --edit option can be split across lines. 2014-10-28 22:49:58 +00:00
Richard W.M. Jones
f7664b7f76 customize: Add Customize_utils module and use common error/warning/info functions.
Add a Customize_utils module.  This contains common error/warning/info
functions, and also quote = Filename.quote.

Examine every existing call to printf/eprintf and change where
necessary so that:

 - error is used instead of eprintf + exit 1

 - warning no longer needs ~prog argument (it is added by Utils module)

 - any verbose output should go to stdout, not stderr

 - info is used to print general informational messages

Also, don't pass ~prog parameter around.  Instead we just get it from
the executable name.
2014-10-25 15:00:21 +01:00
Richard W.M. Jones
b99983480a builder: Add Utils module and use common error/warning/info functions.
Add a Utils module.  This contains common error/warning/info functions,
and also quote = Filename.quote.

Examine every existing call to printf/eprintf and change where
necessary so that:

 - error is used instead of eprintf + exit 1

 - warning no longer needs ~prog argument (it is added by Utils module)

 - any verbose output should go to stdout, not stderr

 - info is used to print general informational messages
2014-10-25 14:57:51 +01:00
Pino Toscano
d2c853f414 builder: rename "program_name" into "progname"
"program_name" is already used as shorthand define for
program_invocation_short_name.
2014-10-23 19:03:12 +02:00
Richard W.M. Jones
90dc8942bf ocaml: Factor out flags into configure script.
No change, just refactoring.
2014-10-23 15:41:49 +01:00
Richard W.M. Jones
d8e26d0e4d mllib: Enhance and rename 'detect_compression' function so it can detect a few more file types. 2014-10-18 19:01:44 +01:00
Pino Toscano
5c7cb0ac7c builder: use the JSON module
Switch to the JSON OCaml module for JSON output.

The resulting output is the same, except from an indentation level more
within lists.
2014-10-10 17:08:56 +02:00
Richard W.M. Jones
9018a23828 mllib: Coloured messages, errors, warnings.
Uses ANSI terminal codes to colour the output.
2014-10-02 15:31:49 +01:00
Pino Toscano
5f9437ca4b builder, customize: disable SELinux
Having SELinux enabled (even if not enforcing) in the appliance causes
troubles to applications/libraries that read/write SELinux attributes.
2014-09-29 14:19:23 +02:00
Richard W.M. Jones
e85a976c5a tests: Don't use relative paths to binaries in tests.
All tests run under the ./run binary.  For a long time the ./run
binary has set the $PATH environment variable to contain all of the
directories with binaries in them.

Therefore there is no reason to use ../fish/guestfish instead of just
plain guestfish (and the same applies to other built binaries).
2014-09-17 17:31:50 +01:00
Hilko Bengen
7039d0e7f6 Generate *.cmx targets only if a native OCaml compiler exists 2014-09-14 21:21:25 +02:00
Richard W.M. Jones
a18c2aca14 Revert "Use ocamldep -all option."
This reverts commit a3881445ef.

See discussion on the mailing list:

https://www.redhat.com/archives/libguestfs/2014-September/msg00069.html
2014-09-14 18:46:49 +01:00
Richard W.M. Jones
de3614e0ff builder: Fix documentation of --list --list-format option (RHBZ#1140547).
Also give an error if users use the incorrect one:

$ virt-builder --list --format json
virt-builder: virt-builder --list: use '--list-format', not '--format'.
2014-09-11 10:14:24 +01:00
Richard W.M. Jones
bb362f6878 OCaml virt-* tools: Handle pretty printing of exceptions through a common library function. 2014-09-03 12:37:39 +01:00
Richard W.M. Jones
a3881445ef Use ocamldep -all option.
In v2v, 'stringMap.ml' has no corresponding *.mli file.  ocamldep does
not generate a *.cmi dependency for such modules, and this can result
in parallel builds failing rarely because:

 (1) stringMap.ml is built (which has the side-effect of generating
     stringMap.cmi)

 (2) at the same time, types.mli is compiled.  types.mli depends on
     stringMap.cmi, but it is half way through being created by (1).

There is no dependency to serialize (1) and (2).

The resulting error is:

  File "types.mli", line 1:
  Error: Corrupted compiled interface
  stringMap.cmi

Using 'ocamldep -all' generates extra deps for the *.cmi files, and
otherwise appears to be safe, so use it.

There are currently a few upstream OCaml bugs with dependencies and
parallel builds:

http://caml.inria.fr/mantis/view.php?id=3190
http://caml.inria.fr/mantis/view.php?id=4991
http://caml.inria.fr/mantis/view.php?id=5000

It's not clear which of these apply here.
2014-09-01 22:24:14 +01:00
Richard W.M. Jones
705e4bfd11 builder: Add test of the --edit option. 2014-08-31 13:37:51 +01:00
Pino Toscano
c6b7e6cdda customize: use the common perl file editing code
Wrap edit_file_perl to OCaml, and use it instead of the OCaml version
of it.
2014-08-29 11:30:17 +02:00
Pino Toscano
6b2bf2c7ac builder: do not use xz --block-size for the test images
Do not use the --block-size parameter of xz when compressing the test
images, as that option does not exist in xz < 5.1.
2014-08-19 14:22:07 +02:00
Pino Toscano
40fbd447ee build: manually drop flex-/bison-generated files from dist
It seems that Automake cannot handle properly the files generated by
flex and bison, leaving them in the dist tarball.

For now, add a dist-hook to manually prune them from distdir.
2014-08-13 16:43:19 +02:00
Richard W.M. Jones
6a51ae503c builder: Missing include of <locale.h>.
Required by setlocale.  For some reason you only see the error
when compiling with -O0.
2014-08-13 13:52:48 +01:00
Richard W.M. Jones
f18464995f tests: builder: Allow test to be skipped. 2014-07-25 16:06:46 +01:00
Richard W.M. Jones
f4698575cc customize: Add the ability to use --firstboot for Windows guests.
This allows you to add potentially multiple --firstboot
scripts to a Windows guest.
2014-07-23 17:02:49 +01:00
Richard W.M. Jones
fe9d3f7a90 ocaml: Ignore Warning 3: deprecated feature: String.* functions.
In OCaml 4.02, the 'string' type can be made immutable.  All String.*
functions that are concerned with creating or mutating strings now
give a warning like this:

  Warning 3: deprecated feature: String.unsafe_set

Disable this warning since we don't want to turn on immutable strings
yet.
2014-07-15 17:51:52 +01:00
Richard W.M. Jones
2ee1fb6472 builder: CentOS 7.0 2014-07-08 10:12:10 +01:00
Pino Toscano
71ac957d4a Use Mkdtemp.temp_dir instead of Mkdtemp.mkdtemp 2014-07-07 19:33:44 +02:00
Richard W.M. Jones
b6b9b90dd7 Use -v and -x flags consistently across OCaml virt-* tools.
virt-customize:
virt-sparsify:
virt-sysprep:
virt-v2v:
  - These tools consistently used -v to mean verbose/debugging
    and -x to mean enable libguestfs tracing.

virt-builder:
virt-resize:
  - These two tools did not recognize -x at all, and used -v
    to enable libguestfs tracing and general debugging.
  - This commit changes these two tools to consume -v/-x
    consistently with the other tools.

Unfortunately this has a cascade of effects through the code.
2014-06-24 16:54:32 +01:00
Richard W.M. Jones
6f73266363 mllib: Add a common 'warning' utility function.
This commit changes many places in OCaml utilities that print
warnings to use the warning function instead.
2014-06-23 21:58:10 +01:00
Richard W.M. Jones
7b89f657c4 mllib: Move common code for comparing version strings to library. 2014-06-23 21:58:10 +01:00
Richard W.M. Jones
54c77f99cc builder: Update centos.sh to add CentOS 7 QA. 2014-06-20 11:08:24 +01:00
Richard W.M. Jones
893bfe2e36 mllib: Create a common utility function is_directory.
This is a wrapper around Sys.is_directory which doesn't throw
exceptions.
2014-06-13 19:59:22 +01:00
Richard W.M. Jones
bacc7fd0a3 builder: Rebuild Fedora 19 disk image with Xen drivers. 2014-06-12 22:13:25 +01:00
Richard W.M. Jones
005316b7d8 builder: Get rid of remaining disk image signatures.
These were deprecated and replaced in virt-builder 1.24.1.
2014-06-12 15:48:55 +01:00
Richard W.M. Jones
58ea77e79b builder: Update Fedora 20 image, with Xen drivers.
This commit also removes the disk image signature.  These have not
been needed since virt-builder 1.24.1.  No one should be running that
version of virt-builder since there are newer 1.24 branch versions.
2014-06-12 15:48:55 +01:00
Richard W.M. Jones
0fa52e4e45 builder: Fedora: Enable Xen driver support.
See:
https://www.redhat.com/archives/libguestfs/2014-June/thread.html#00045

Notes:

(1) Edit dracut configuration to make sure the change is permanent, in
case kickstart, virt-builder or something else installs a kernel or
runs dracut.

(2) We need to run dracut on the just-installed kernel, not on the
running kernel.  The snippet to do this was copied from the Fedora
cloud kickstart.

Thanks: Olaf Hering, George Dunlap, Dario Faggioli.
2014-06-12 15:48:54 +01:00
Richard W.M. Jones
d4d6540b24 builder: virt-install now requires '--serial pty' parameter.
This updates commit 73ebaa3066.
2014-06-12 15:48:54 +01:00
Richard W.M. Jones
73ebaa3066 builder: virt-install now seems to require '--serial pty' option. 2014-06-11 12:43:03 +01:00
Richard W.M. Jones
99472ab2e9 builder: Further updates to RHEL 7 GA script.
The location of the trees have moved ... again.
2014-06-11 12:42:08 +01:00