Instead of creating Guestfs handles and manually apply common options
(e.g. debug and trace), use the open_guestfs in Common_utils.
This also applies the common options to handles which didn't set them
before, so we can inspect also their messages if needed.
Resolve also symlinks when checking whether a path passed to --edit is a
file: the file editing code supports symlinks anyway (properly changes
the target file, instead of overwrite the symlink with a real file), so
it is safe to allow this operation in customize/builder.
Check that a path provided to --edit exists already; while the is_file
call later will fail for non-existing files, with an explicit check a
better error message can be provided.
Move the random set of HTML files we build from html/ into
the website/ directory.
Also in the website/ directory, put the index.html file from
http://libguestfs.org, which was previously not under version control.
It is generated from index.html.in so we can automatically add the
current version and release date.
Also in the website/ directory, put various CSS file, images, etc.
which are required by the website and were also previously not under
version control.
Change the 'make website' rule to 'make maintainer-upload-website'.
As the name suggests, it is only useful for the maintainer, and will
fail with an error for anyone else.
Create a new top-level directory called test-data, which will carry
all the test data which is large and/or shared between multiple tests.
There are actually several new subdirectories created:
test-data/binaries: The pre-built binary and library files for random
architectures that we use to test various architecture detection
features (was part of tests/data).
test-data/blank-disks: The blank disks which are used for disk format
detection (was part of tests/data).
test-data/files: Other miscellaneous test files from tests/data that
are not included in the above.
test-data/phony-guests: The phony guests (was tests/guests).
test-data: The top-level directory builds the 'test.iso' image file
that is used for testing the C API and in miscellaneous other tests.
Unfortunately Coccinelle places a Config module in the ocaml libdir,
and this confuses ocamlfind (only when Coccinelle is installed).
Since this is a private module that only libguestfs tools use
internally, just rename it from Config -> Guestfs_config.
This is just a straight refactoring. Various ad hoc string_*
functions that appeared in Common_utils have been renamed and placed
in the String.* namespace. The old vs "new" functions are:
string_prefix -> String.is_prefix
string_suffix -> String.is_suffix
string_find -> String.find
replace_str -> String.replace
string_nsplit -> String.nsplit
string_split -> String.split
string_lines_split -> String.lines_split
string_random8 -> String.random8
Use the generator_built variable to list any files which are built by
the generator. This ensures they get automatically rebuilt.
Three files were missing from EXTRA_DIST, so they were not included in
the tarball, meaning you would have needed OCaml to build from the
tarball. You would have seen this when building:
cd .. && /builddir/build/BUILD/libguestfs-1.31.9/generator/generator
written gobject/docs/guestfs-title.sgml
written customize/customize-synopsis.pod
written customize/customize-options.pod
generated 476921 lines of code
Move --debug-gc as common option for all the OCaml-based tools, even a
couple of them which didn't have it previously.
As implementation note, make set_debug_gc private to
set_standard_options, as it needed to be moved otherwise, and it is no
more required as public function.
Introduce a new common helper to add the common options for libguestfs
tools (short/long options, version, verbose, trace), and sort them.
All the OCaml-based tools had these options already, so there are no
functional changes in the interface they provide.
The only difference is that now the options are always sorted, while
some tools didn't had them like that previously: because of this, a
couple of ditto markers (as descriptions) don't match what's above them
anymore, and thus their full description is put instead.
When running (eg) dnf on a 32 bit i686 guest when the host is 64 bit
x86_64, dnf believes it is running on a 64 bit machine and so tries to
install x86_64 packages. We can 'trick' dnf into believing it's a 32
bit machine using the setarch program.
$ virt-builder fedora-22 --arch i686 --install 'gperf'
...
[ 27.4] Installing packages: gperf
...
Running transaction test
Error: Transaction check error:
package libgcc-5.1.1-4.fc22.x86_64 is intended for a different architecture
...
The use of a heredoc to solve quoting issues comes from:
http://stackoverflow.com/a/3435460
Thanks: Jan Sedlák for finding the solution.
Several tools handle --debug-gc command-line option, by explicitly
forcing GC on every exit path. This is tedious and prone to forgetting
some of the exit paths.
Instead, add a generic handler for --debug-gc, which installs an at_exit
hook to do the GC consistency check, and which can be called right in
the command-line parser. Also adjust all users of --debug-gc to use
that handler.
Signed-off-by: Roman Kagan <rkagan@virtuozzo.com>
It turns out that -- some of the time -- systemd ignores unit files
which are not placed in one of the official unit directories. This
caused the service to be timed out and killed when the systemd daemon
was reloaded, as could happen for long-running package installs at
first boot.
Thanks: Marius Vollmer for diagnosing the problem and finding the
solution.
I discovered that 'dnf upgrade' doesn't actually upgrade to the latest
versions of packages unless you also supply the '--best' flag.
This also changes update -> upgrade, since apparently 'dnf update'
is deprecated.
Because this 'feature' is broken (since 2013):
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=13928
we have to replace all instances of $(top_srcdir) in *_SOURCES lines
with a relative path. According to what I read, this shouldn't break
split builds, but I didn't test it.
The only things automake moans about now are:
* Unescaped left brace in regex is deprecated, passed through in regex; marked by <-- HERE in m/\${ <-- HERE ([^ \t=:+{}]+)}/ at /usr/bin/automake line 3936.
- This is another bug in automake
* autoreconf: configure.ac: AM_GNU_GETTEXT is used, but not AM_GNU_GETTEXT_VERSION
- This is a feature, not a bug.
When warning that there is no known default password encryption for the
current guest, print also its minor version (help debugging unsupported
guests).
Also, fix wrapping (and indentation) of the message.
Move the read_password_from_file helper in Password to mllib with a more
generic name, and use it in place of the former.
Also, use it in v2v instead of reading the whole file contaning a
password: given that the documentation says that the whole content is
used, there will not be newlines in the password file, so the behaviour
will be preserved. The oly difference is that newline is no more an
acceptable character for passwords, but that is a really unlikely
(if not impossible at all) situation.
Collect this small snippet to get the part of a string after the last
occurrency of a character; replace with it the current snippets doing
the same.
Should be just code motion.
Done using a sequence of regular expressions like this:
perl -pi.bak -e 's{C</}{F</}g' `git ls-files \*.pod` generator/actions.ml
perl -pi.bak -e 's{C<C:\\}{F<C:\\}g' `git ls-files \*.pod` generator/actions.ml
[etc]
and then tediously checking every change by hand.
In APIs such as guestfs_download, when the FileOut parameter exactly
matches "/dev/stdout" or "/dev/stderr", don't reopen the possibly
redirected output file with O_TRUNC (truncate). Instead dup the file
descriptor.
This magic behaviour doesn't happen for /dev/fd/* (or any other output
file) allowing callers the choice of using /dev/stderr or /dev/fd/2
depending on whether or not they want truncation.
This works around an annoying virt-builder bug. If you do:
$ virt-builder fedora-21 --install no_such_package -v -x >& /tmp/log
then when the `--install' command fails, virt-builder will download
the log file using `guestfs_download (g, log, "/dev/stderr")'. Since
this truncates the redirected /dev/stderr, the final log file is
truncated and corrupted.
With this patch the log file is no longer corrupted.
In cases where we are asked to run commands in the guest (eg. options
such as --run-command or --install), give a clear error in the cases
where the guest arch is not compatible with the host arch.
Similar code existed in virt-builder, but I have removed that. Users
will still get an error message, it will just happen a bit later on.
There is a slight change in semantics here, in that architectures are
no longer normalized when matching, but that's probably fine since
`virt-builder -l' prints the exact arch string that people should use.
This large commit is just code refactoring. Instead of having
every OCaml tool define 'prog' the same way, always as:
let prog = Filename.basename Sys.executable_name
move that into a single place, Common_utils.prog. Then we can use
that global value everywhere else, instead of having to pass it as a
parameter into a dozen different functions.
Create a single ocaml-link.sh script, which supports a -cclib parameter
so it can be used instead of the per-project link.sh scripts.
As result, the libraries for each OCaml application can be moved back to
each Makefile.am.