235 Commits

Author SHA1 Message Date
Richard W.M. Jones
fe97d5ed9c builder: pxzcat: Ignore return value from posix_fadvise.
Quiets warning from Coverity.
2014-03-26 20:03:15 +00:00
Richard W.M. Jones
2b208d84db Add virt-customize standalone tool.
This includes some simple tests and a manual page.
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
51834ad219 customize: Add a --password option for setting user passwords. 2014-03-25 12:41:04 +00:00
Richard W.M. Jones
4b0b3589e8 customize: Move virt-customize-related code to a separate directory.
Split virt-builder into build and customize steps, so that we can spin
off a separate tool called 'virt-customize'.  This commit does not in
fact create such a tool, but it moves all the common code into a
library, in the customize/ subdirectory of the source.

Although this is mostly refactoring, it does change the order in which
virt-builder command line arguments are processed, so they are now
processed in the order they appear, not the inflexible fixed order
used before.
2014-03-25 12:41:04 +00:00
Richard W.M. Jones
20f412637e builder: Fix typo in string.
Thanks: Yuri Chornoivan
2014-03-22 14:08:45 +00:00
Pino Toscano
e589b6e823 builder: do not parse the same repository file name twice
When parsing the repository configuration files, track the file names
parsed, and in case of same file name in multiple location consider only
the one in the directory coming before others in the prioritised list of
paths.

This way it is possible to "shadow" a configuration file in a system
path with one with the same name in a local directory, for example.
2014-03-20 16:57:29 +01:00
Pino Toscano
603ad40c5a builder: allow the index parser to parse files with no sections
Gracefully handle files with no sections; extend the validate.sh test
to try to validate an empty file.
2014-03-20 16:39:40 +01:00
Pino Toscano
fa0fed8a2d builder: allow to run website tests under valgrind 2014-03-20 16:39:40 +01:00
Pino Toscano
62875c88be builder: clean the parsing structs on error 2014-03-20 15:36:38 +01:00
Pino Toscano
c6c27620d0 builder: rename and make public the section/field free functions
They will be needed also elsewhere.
2014-03-20 15:36:38 +01:00
Pino Toscano
87ed6365e4 builder/virt-index-validate: try to cleanup in any occasion
Always close the file (ignoring its result) after a parsing, and cleanup
the parse_context object before any exit().

This eases the debugging of memory issues in the actual parser.
2014-03-20 15:36:38 +01:00
Richard W.M. Jones
c4dc70f8c4 podwrapper: Remove =encoding from input files and add it back in podwrapper.
This changes podwrapper so that the input (POD) files should not
contain an =encoding directive.  However they must be UTF-8.
Podwrapper then adds the '=encoding utf8' directive back during final
generation.

This in particular avoids problems with nested =encoding directives in
fragments.  These break POD, and are undesirable anyway.
2014-03-20 13:47:19 +00:00
Pino Toscano
7c70429e2e builder: show the application name in errors of the index parser 2014-03-19 16:48:20 +01:00
Pino Toscano
15f04f21b9 builder: show the file name in errors of the index parser 2014-03-19 16:14:34 +01:00
Pino Toscano
c871ed6b50 builder: make the C index parser reentrant
Switch the lex/yacc parser into reentrant mode, to ease the handling of
parsing-specific data; introduce a new parser_context struct for that,
which is added as extra data to the parser.

This should cause no behaviour changes in the parsing, just no more
global variables used for getting data in/out the parser.
2014-03-19 15:42:45 +01:00
Pino Toscano
53afa03af9 builder: fix typo in comment
Followup of commit b1cf6246f3.
2014-03-12 16:07:55 +01:00
Pino Toscano
b1cf6246f3 builder: complete architecture handling
Add the possibility to choose which architecture use to build the wanted
image (--arch). Since this implies that running commands on the guest is
usually not possible when the architecture is different than the host
one, virt-builder will nevertheless try to check whether the host is
compatible with the guest, allowing to run commands only in that case.

The caching scheme is adapted to account for the architecture (with
--print-cache showing the architecture as well).
2014-03-12 15:06:55 +01:00
Pino Toscano
cc495247f2 builder: show the architecture in the short --list output
Just like the other --list output formats provide the architecture, show
them also in the short format.
2014-03-12 15:05:24 +01:00
Pino Toscano
6379c85d1f builder: output translated notes also in --notes 2014-03-11 14:25:39 +01:00
Pino Toscano
3cffc28834 builder: move some language-related code into a Languages module
Mostly code motion, no behaviour changes.
2014-03-11 14:20:22 +01:00
Pino Toscano
8ba31e69dc builder: use Filename.check_suffix
... instead of manually extracting and checking the suffix by ourselves
2014-03-10 13:42:16 +01:00
Hilko Bengen
b30e2cf122 Fix out-of-tree build: Do not accidentally build mllib components in srcdir 2014-03-04 00:06:09 +01:00
Hilko Bengen
d7e3aea7bc Fixes for various tests in out-of-tree builds 2014-03-04 00:06:09 +01:00
Pino Toscano
631c7d9241 builder: install a $sysconfdir/virt-builder -> xdg-virt-builder symlink
This way "virt-builder" appears directly in the sysconfdir.
2014-03-03 16:28:14 +01:00
Pino Toscano
962837650c builder: add libguestfs.gpg to EXTRA_DIST
It needs to be in EXTRA_DIST, otherwise it is not put in the dist.
2014-02-28 15:07:32 +01:00
Hilko Bengen
f75142c577 Fix building on architectures where ocamlopt is not available 2014-02-28 14:01:25 +00:00
Pino Toscano
963b0341e2 builder: update documentation
Update the documentation according to the new .conf files structure, the
drop of VIRT_BUILDER_SOURCE and VIRT_BUILDER_FINGERPRINT, the drop of
hardcoded source and its key, etc.
2014-02-27 09:59:56 +00:00
Pino Toscano
47538865f2 builder: remove the default fingerprint/pubkey
Sigchecker can still import keys from the user's keyring, so there is no
need to hardcode fingerprint and key of the index hosted on
libguestfs.org (which is now pointed to using a .conf file).
2014-02-27 09:59:56 +00:00
Pino Toscano
573cae45c3 builder: remove VIRT_BUILDER_SOURCE and VIRT_BUILDER_FINGERPRINT
Drop these two environment variables, and the implicit hardcoded source
hosted at libguestfs.org.
This means all the sources must be provided as .conf files, or at each
invocation with --source.
2014-02-27 09:59:56 +00:00
Pino Toscano
f4990bef1c builder: switch sources to .conf files
Introduce and use simple .conf files to configure the sources of indexes
for virt-builder. The location of these files is in XDG_CONFIG_DIRS /
XDG_CONFIG_HOME, so it can be easily overridden.

There are three .conf(.in) files shipped with this commit:
- "test-index.conf.in" (in "test-config"), which points to the
  "test-index" index (used in tests only); the tests are adapted to
  point to the hierarchy containing this .conf
- "libguestfs.conf.in" (in "test-website"), which points to the local
  "index.asc" (i.e. the offline copy of the libguestfs.org index);
  run(.in) will point to the hierarchy providing this .conf
- "libguestfs.conf.in" (directly among the other sources), which points
  to the online "index.asc" and it is installed in sysconfdir, along
  with the key of this repository

The tests are adapted, other than to the different way to pick sources,
to the different output of --list, as "test-index" is not signed.
2014-02-27 09:59:56 +00:00
Pino Toscano
a3f1ac9a2d builder: extract the default key to file
This is basically default_pubkey from sigchecker.ml, just extracted as
file. Not used right now, but will be in the future.
2014-02-27 09:59:56 +00:00
Pino Toscano
a21da3c801 builder: add functions to read XDG_CONFIG_DIRS and XDG_CONFIG_PATH 2014-02-27 09:59:56 +00:00
Pino Toscano
ad38e68c34 builder: use Sigchecker.gpgkey_type for the fingerprint
Use Sigchecker.gpgkey_type instead of just string as type in the
sources list; adapt the listing code (and its expected output) to that.

No behaviour change which eases a bit the addition of new sources with
other key types.
2014-02-27 09:59:56 +00:00
Pino Toscano
c09f5bbc70 builder: allow "no key" as key in Sigchecker
Additional way to distinguish no actual key available for signature
checking; make sure to not allow signing in such situation.
2014-02-27 09:59:56 +00:00
Richard W.M. Jones
d353b4a3c8 builder: Add arch= entry for Cirros.
Thanks: Pino Toscano.
2014-02-24 20:13:41 +00:00
Richard W.M. Jones
9124730df2 builder: Add arch=x86_64 entries. 2014-02-24 15:43:13 +00:00
Pino Toscano
8ed905c7e6 builder: split INI C <-> OCaml glue code in own module
Move in an own module the code which calls the C
virt_builder_parse_index and does the array -> list conversion of the
result. This way this code can be easily called also in places different
than Index_parser without the need to copy the types mapping, etc.

Just code motion, no actual behaviour changes.
2014-02-24 15:08:03 +01:00
Pino Toscano
61323fabaf builder: add a mandatory 'arch' key in index files
Introduce a mandatory arch= key in all the entries of index files, to
identify which architecture is each. Adapt the long and JSON list
outputs to print also this new field.

This introduces an incompatibility with index files created with
virt-builder < 1.26, as they will be rejected until entries will have
the arch= key added (which is ignored by older virt-builder, so adding
it will not create backward-compatibility issues).
2014-02-24 11:31:35 +01:00
Pino Toscano
35e53c0381 builder: allow Sigchecker to import keys from file
Extend Sigchecker so it allows both fingerprints (to be imported from
user's keyring, as before) and keys stored in files. To simplify this
process (and have the fingerprint always around), the key is imported
on Sigchecker.create time, instead of lazily at the first verification.
2014-02-21 15:21:08 +01:00
Pino Toscano
dd03d38be3 builder: use a disposable GPG keyring for every Sigchecker
Create a temporary directory and tell gpg to use it as homedir, so
imported keys do not get into the user's keyring. This also avoid
importing the default key  when a different one is needed to check the
signature.

The only exception is when a non-default fingerprint is used: in this
case, that key is read from the user's keyring, since it is where it is.
2014-02-21 14:39:57 +01:00
Richard W.M. Jones
7794d9a187 builder: Add ScientificLinux 6.5. 2014-02-21 08:35:49 +00:00
Pino Toscano
4c5a6afc84 builder: accept also '_' in group names 2014-02-19 16:40:00 +01:00
Pino Toscano
bb35e72503 builder: move the XDG path handling in an own file
Just code motion and renaming, no actual behaviour changes.
2014-02-18 12:55:14 +01:00
Richard W.M. Jones
360abeebda builder: Fix dependencies which are not generated correctly by automake.
See the error messages here:
https://www.redhat.com/archives/libguestfs/2014-February/msg00148.html

This fixes commit e2cc8b6465.
2014-02-17 09:53:25 +00:00
Richard W.M. Jones
9018356a67 Use bindtextdomain in some programs where it was missing.
Found by make syntax-check.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
e3d23cccf4 builder: Suppress warning about unused yyunput.
CC       virt_index_validate-index-validate.o
index-scan.c:1270:17: warning: 'yyunput' defined but not used [-Wunused-function]
     static void yyunput (int c, register char * yy_bp )
                 ^
  CCLD     virt-index-validate

By using %option nounput we can prevent this from being generated in
the first place.
2014-02-14 12:33:37 +00:00
Richard W.M. Jones
e4fe09c5ae builder: pxzcat: Fix char * signedness warning. 2014-02-13 17:48:23 +00:00
Pino Toscano
76e3e15d03 builder: do a copy when downloading local files
Instead of spawning curl even to "download" file:// URIs, just copy
them.
2014-02-11 12:52:10 +01:00
Pino Toscano
ba3569704c builder: prepare for different per-protocol download actions
Small refactor of Downloader.download_to to allow different download
actions depending on the protocol of the URI (which is now parsed).

No actual behaviour changes, just mostly code motion.
2014-02-11 12:39:56 +01:00
Pino Toscano
c66cec6ffa builder: isolate C libraries in an own OCAMLCLIBS
Just moving stuff within Makefile.am, no functional changes.
2014-02-11 10:40:31 +01:00