Commit Graph

37 Commits

Author SHA1 Message Date
Richard W.M. Jones
72cfaff5c5 Update copyright dates for 2025
Automated using this command:

perl -pi.bak -e 's/(20[012][0-9])-20[12][01234]/$1-2025/g' `git ls-files`
2025-02-16 17:00:46 +00:00
Richard W.M. Jones
b5fbc7e617 tests: Replace $TEST_FUNCTIONS
Replace strange $TEST_FUNCTIONS variable/expansion thing with
something more like what we use in nbdkit, a simple tests/functions.sh
script that gets sourced into each test script.

Update the common submodule to get:

  commit 8137d47d0e654065391151eb275e3b64f230f6f5
  Author: Richard W.M. Jones <rjones@redhat.com>
  Date:   Thu Feb 13 11:13:55 2025 +0000

    mlcustomize, mltools: Replace $TEST_FUNCTIONS

    TEST_FUNCTIONS is being removed from libguestfs and guestfs-tools (it
    was removed from virt-v2v a while back).  Make the same adjustment in
    the common submodule.

(and some other commits which are not relevant to libguestfs)
2025-02-13 11:15:34 +00:00
Richard W.M. Jones
e2c7bddf10 Update copyright dates for 2023
Run this command across the source:

  perl -pi.bak -e 's/(20[012][0-9])-20[12][012]/$1-2023/g' `git ls-files`

and remove changes to po{,-docs}/*.po{,t} (these will be regenerated
later when we run 'make dist').
2023-02-07 10:50:48 +00:00
Pino Toscano
bd896d68c0 po-docs: split pot and po handling
With the Weblate adoption, we let it update the po files from the
catalog template. The po4a behaviour of extracting the template,
merging the existing translations, and creating the translated PODs at
once is problematic. Hence, split the extraction and the translated POD
generation in two.

Use po4a-gettextize to extract the catalog template only, not doing it
anymore automatically at each build. There is no more need for a
po4a.conf file.

Use po4a-translate to create translated PODs from the po files, keeping
the fixup of the generated files (to avoid spurious =encoding, etc).
Add a silent rule to hide the po4a-translate command lines by default.

These changes also allow us to get rid of the POD existance checks with
associated error message pointing to the update-po rule. Now each
translated POD file is generated because of make dependency, and it
depends only on its po file.

Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-08-13 11:27:44 +02:00
Richard W.M. Jones
0e17236d7d Update copyright dates to 2020. 2020-03-06 19:32:32 +00:00
Pino Toscano
4cd801dcff build: fix make implicit dependencies on ml/mli files
As proposed in the Debian bug #946594 [1], the implicit .cmi/.cmo/.cmx
dependencies are tied to files in the source directory only, and thus
they break when either the .ml or the .mli files are in the build
directory. Since there is already VPATH set up by automake, rely on it
to locate the right source.

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=946594#36

Solution proposed by Vincent Danjean, thanks!

This reverts commit 802c5d2055 in this
file.
2019-12-17 15:38:00 +01:00
Richard W.M. Jones
05d4fcb64d Update copyright dates for 2019.
This command run over the source:

perl -pi.bak -e 's/(20[01][0-9])-2018/$1-2019/g' `git ls-files`
2019-01-08 11:58:30 +00:00
Hilko Bengen
802c5d2055 Fix out-of-tree builds of OCaml components
- Add $(srcdir), $(builddir) to Makefiles where required
- Post-process ocamldep output
- generate ocaml/.depends
2018-04-12 11:43:56 +02:00
Richard W.M. Jones
212762c593 Update copyright dates for 2018.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2017/$1-2018/g' `git ls-files`
2018-01-04 15:30:10 +00:00
Richard W.M. Jones
d79df649e0 build: Since .mli files are now required, always build .cmi first.
Here is an example of a failure with the previous dependency
calculation:

  $ make -j5
  make: Entering directory '/home/rjones/d/libguestfs/common/mlstdutils'
    OCAMLOPT guestfs_config.cmx
    CC       libmlstdutils_a-dummy.o
    OCAMLOPT libdir.cmx
    OCAMLCMI stringMap.cmi
    OCAMLCMI stringSet.cmi
    OCAMLCMI guestfs_config.cmi
    OCAMLCMI std_utils.cmi
    OCAMLC   guestfs_config.cmo
    OCAMLC   libdir.cmo
    OCAMLC   stringMap.cmo
    OCAMLC   stringSet.cmo
    OCAMLOPT stringMap.cmx
    OCAMLOPT stringSet.cmx
    OCAMLOPT std_utils.cmx
    OCAMLC   std_utils.cmo
  ocamlfind ocamlc -package str,unix -I . -a guestfs_config.cmo libdir.cmo stringMap.cmo stringSet.cmo std_utils.cmo -o mlstdutils.cma
  ocamlfind ocamlopt -package str,unix -I . -a guestfs_config.cmx libdir.cmx stringMap.cmx stringSet.cmx std_utils.cmx -o mlstdutils.cmxa
    AR       libmlstdutils.a
  File "_none_", line 1:
  Error: Files std_utils.cmx and guestfs_config.cmx
         make inconsistent assumptions over interface Guestfs_config
  make: *** [Makefile:2523: mlstdutils.cmxa] Error 2
  make: Leaving directory '/home/rjones/d/libguestfs/common/mlstdutils'

What seems to be happening is that there is a rule:

  std_utils.cmx : guestfs_config.cmi guestfs_config.cmx [...]

In this case, make chose to build guestfs_config.cmx and
guestfs_config.cmi in parallel (see the first 5 rules above).  However
building guestfs_config.cmx also creates guestfs_config.cmi
(implicitly - this is not expressed in make dependencies, and make
doesn't "know" that guestfs_config.cmi has already been created).

Unfortunately the OCaml compiler doesn't create output files
atomically.  Worse than that, it creates an intermediate version of
the output file, reads it back and then creates the final version.  It
seems if the build of std_utils.cmi reads this intermediate version.
In any case, Std_utils sees the wrong hash of the Guestfs_config
module.

The above only happens where we have a *.ml file without a
corresponding *.mli file.  That is because if there is a *.mli file,
ocamldep generates slightly different dependencies:

  guestfs_config.cmx [...] : guestfs_config.cmi guestfs_config.ml
  std_utils.cmx : guestfs_config.cmi guestfs_config.cmx [...]

std_utils.cmx still depends on both files, but there is an extra rule
which ensures that guestfs_config.cmx isn't built in parallel with
guestfs_config.cmi.

I tested this change by running this command:

  $ while ( rm common/mlstdutils/.depend; make -C common/mlstdutils/ clean && make -C common/mlstdutils/ ) >& /tmp/log; do echo -n .; done

Before the change it would fail after about 100 iterations.  After the
change it ran for 10000s iterations and did not fail ever.

Updates commit 6d0ad49d5e.
2017-09-21 18:05:07 +01:00
Richard W.M. Jones
6d0ad49d5e build: Add missing pattern rule to build *.cmi from *.ml.
In the case where we have a module.ml without a corresponding
module.mli file, ocamldep generates (correct) dependencies:

  module.cmx module.cmi : module.ml

but we had no rule telling make how to generate the module.cmi
file from module.ml.

This didn't matter very much because when make came to build
module.cmx, the module.cmi file is generated as a side-effect.

However for highly parallel builds, the build ordering was still
incorrect.  Any other module that depends on module.cmi could be built
in parallel.  You would very occasionally see errors like this one:

  File "_none_", line 1:
  Error: Files index.cmx and utils.cmx
         make inconsistent assumptions over interface Utils

Fixing this involves adding a ‘%.cmi: %.ml’ rule.  However we have to
be careful that make doesn't run this rule instead of the ‘%.cmi: %.mli’
rule (if module.mli did exist).  It turns out that GNU make says we
can depend on rule ordering in the Makefile for this.

I found that this only works correctly if we use "%"-style pattern
rules (not the ‘.ml.cmi:’ old-style rules).

This is *still* not a complete fix.  Make still doesn't know that the
rules ‘%.cmo: %.ml’ and ‘%.cmx: %.ml’ also build the .cmi file as a
side-effect, so you can still occasionally see build failures.
However I could not work out how to add the extra information to the
dependencies without causing make itself to go into an infinite loop.
It may be that in the end we will have to get rid of pattern rules
completely and generate the complete OCaml rule set.
2017-09-15 13:31:18 +01:00
Richard W.M. Jones
a1b3d8d04b tests: Extend $TEST_FUNCTIONS with predefined functions for skipping tests etc.
Apply this change across all the shell scripts containing tests.

Additionally this defines the environment variables $abs_srcdir,
$abs_builddir, $top_srcdir, $top_builddir, $abs_top_srcdir and
$abs_top_builddir which can now be used throughout test scripts.
2017-02-21 17:23:22 +00:00
Richard W.M. Jones
e66be44016 tests: Add $TEST_FUNCTIONS.
This macro(?) expands to some shell script to source the
tests/test-functions.sh file from its correct location.  The intention
is to use this in all tests, but in this commit only the existing
tests which already include test-functions.sh are modified.
2017-02-21 17:23:22 +00:00
Pino Toscano
55bf7de97c Update copyright dates for 2017
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2016/$1-2017/g' `git ls-files`

(Thanks Rich for the perl snippet, as used in past years.)
2017-01-03 16:48:21 +01:00
Richard W.M. Jones
97cbddac12 build: In silent rules, differentiate between .cmi and ocamlc.
Although we happen to use 'ocamlc' to compile .mli files to .cmi,
it is used in a different mode from bytecode compilation.
2016-09-02 12:40:12 +01:00
Pino Toscano
5991ce1c2a build: add silent rules for jar 2016-08-18 13:00:27 +02:00
Richard W.M. Jones
7de25f7d71 build: Line up "OCAMLOPT" with other silent rules.
Tidies up commit 0b94c4d3bb.
2016-08-05 10:37:46 +01:00
Richard W.M. Jones
a11a7ebbc3 build: Add silent rules for podwrapper.
Also quietens the podwrapper script itself, as there is no reason to
print 'wrote <output>' for each output file.
2016-08-04 23:33:58 +01:00
Pino Toscano
0b94c4d3bb build: add simple custom silent rules for automake
Add makefile variables to enable silent rules for simple command
invocations, such as ocamlc, ocamlopt, javac, and erlc.

This reduces the log output when building with silent rules, still
showing the full command lines otherwise.
2016-08-04 16:18:33 +02:00
Richard W.M. Jones
c2fda2c1f2 build: Factor out definition of BEST and OCAMLLINKFLAGS.
No change, just refactoring.
2016-07-18 14:11:22 +01:00
Richard W.M. Jones
2c6bfccb06 build: Fix dependencies on mllib and customize.
Binaries should be rebuilt if mllib.cma/mllib.cmxa or
customize.cma/customize.cmxa change.

Fixes commit 1e2877c6f4.
2016-07-18 14:10:28 +01:00
Richard W.M. Jones
a3cb12ab2c ocaml: Move identical rules for building OCaml objects to common file. 2016-06-13 08:51:46 +01:00
Richard W.M. Jones
307c83177c Update copyright dates for 2016.
Run the following command over the source:

  perl -pi.bak -e 's/(20[01][0-9])-2015/$1-2016/g' `git ls-files`
2016-01-02 21:19:51 +00:00
Pino Toscano
18c730e7f6 build: use a custom test driver
Use a custom test driver for running the tests: based on the test-driver
provided by automake, it adds the running time of the test in each .trs
file.
2015-11-06 16:11:55 +01:00
Richard W.M. Jones
c5800dc97d Update copyright dates for 2015. 2015-01-17 09:08:15 +00:00
Richard W.M. Jones
6c971faecf Update copyright dates for 2014. 2014-01-02 16:53:34 +00:00
Richard W.M. Jones
ef4969c2ce build: Fix 'make distclean' (again).
So it doesn't break after the generator has been deleted by
a previous distclean rule.
2013-06-10 18:09:43 +01:00
Richard W.M. Jones
49bdaabc7d build: Add common-rules.mk, common rules for all Makefiles.
This file is mainly a central place to:

 - include localenv if it exists, and

 - define the RHEL 5 backwards compatibility macros, instead of
   spreading them over every other file.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
074e3b5c67 generator: Don't always recurse into the generator directory.
Previously, every subdirectory that contained generated files would
cause a recursion into the ../generator directory.  This was slow and
unnecessary.  Only recurse if the generator actually needs to be
rerun.

Note this changes the semantics slightly: For example if you added a
new action and just ran `make -C ocaml' then previously the generator
would be rerun, but now it would not.  However I'm not convinced the
previous semantics were that useful, particularly considering that
with this change a simple `make' is much faster.
2013-06-04 12:41:11 +01:00
Richard W.M. Jones
3f450de0a9 Fix 'make distclean'.
Because the generator subdirectory is cleaned first, and other
directories recurse into the generator directory, 'make distclean'
would fail (because generator/Makefile would be deleted by that
point).

Change subdirs-rules.mk so it doesn't fail if generator/Makefile has
been deleted already.
2013-04-25 12:22:31 +01:00
Richard W.M. Jones
88b59ea92f subdirs-rules: Remove 'appliance' rule.
It was used in only one place (perl/Makefile.am).

If users want to build just the appliance, then they could do 'make -C
appliance'.
2013-04-25 12:22:07 +01:00
Richard W.M. Jones
856e78a2ce subdir-rules.mk: Remove rules that recursively build src/ and daemon/.
These are unnecessary, and slow down the whole build.
2012-08-15 17:49:49 +01:00
Matthew Booth
04ea1375c5 Update FSF address. 2011-11-08 14:43:07 +00:00
Richard Jones
04d8209077 Split generator into separate source files.
'src/generator.ml' is no more.  Instead the generator is logically
split up over many different source files.

Read generator/README for help and tips.

We compile the generator down to bytecode, not native code.  This
means it will run more slowly, but is done for maximum portability.
2010-09-11 12:04:44 +01:00
Matthew Booth
a7a88083f0 build: Add missing dependencies in perl directory
make all in the perl directory was missing a check that the library had been
built.

make check in the perl directory was missing a check that the appliance and test
images had been built.
2009-11-21 21:14:03 +00:00
Matthew Booth
8b135cb552 build: Rebuild the daemon as necessary from other directories
This change ensure that making the appliance will always rebuild the daemon if
required.
2009-11-21 21:12:45 +00:00
Matthew Booth
c477e2fb78 build: Fix inter-directory dependencies
This change adds an explicit dependency on generator.ml for every file it
generates, except java files. Java is left for another time because it's
considerably trickier.

It also adds a build rule for src/libguestfs.la so it can be rebuilt as required
from other directories.

It does this by creating a top level make file, subdir-rules.mk, which can be
included from sub-directories. sub-directories need to define 'generator_built'
to include local files which are built by generator.ml, and they will be updated
automatically.

This fixes parallel make, and will automatically re-create generated files when
make is run from any directory.

It also fixes the problem which efad4f53 was targetting. Specifically,
src/guestfs_protocol.(c|h) had an erroneous dependency on stamp-generator, and
therefore generator.ml, despite not being directly created by it. This caused
them to be recreated every time generator.ml ran rather than only when
src/guestfs_protocol.x was updated, which cascaded into a daemon and therefore
appliance update.

This patch also changes the contents of the distribution tarball by including
files created by rpcgen.
2009-11-19 16:40:22 +00:00