qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Update scripts/meson-buildoptions.sh


From: Stefan Hajnoczi
Subject: Re: [PATCH] Update scripts/meson-buildoptions.sh
Date: Tue, 3 Jan 2023 10:51:36 -0500

On Tue, 3 Jan 2023 at 10:26, Alessandro Di Federico <ale@rev.ng> wrote:
>
> On Tue, 3 Jan 2023 09:37:51 -0500
> Stefan Hajnoczi <stefanha@gmail.com> wrote:
>
> > I don't understand the issue. Can you describe the steps that cause
> > meson-buildoptions.sh to become out-of-sync with meson_options.txt?
> >
> > This will continue to be a problem in the future. Is there a way to
> > fix it permanently?
>
> In Makefile we have:
>
>     $(SRC_PATH)/scripts/meson-buildoptions.sh:    
> $(SRC_PATH)/meson_options.txt
>
> (Cc'ing Paolo since he's the author of this line)
>
> This means make will regenerate
> `$(SRC_PATH)/scripts/meson-buildoptions.sh` if its last modification
> date is older than `$(SRC_PATH)/meson_options.txt`.
>
> However these files are in the source directory, so this will behave
> properly only under certain circumstances.
>
> For instance if, for some reason, someone committed a new version of
> `meson_options.txt` but not of `meson-buildoptions.sh`, a fresh clone
> of the repo will not have the dates set correctly to trigger the
> Makefile rule above:
>
>     $ ls -ln scripts/meson*
>     -rw-r--r-- 1 1000 1000 28913 Jan  3 15:58 scripts/meson-buildoptions.sh
>     -rw-r--r-- 1 1000 1000    91 Jan  3 15:58 scripts/meson.build
>
> This is because git does not update file dates depending on the last
> commit changing them.
>
> This, on top of the fact that invoking `ninja` does not trigger
> regeneration (which works for most other use cases), leads to a good
> chance of forgetting to update meson-buildoptions.sh.
>
> We could add the target to ninja to mitigate the risk, but still, the
> dates problem remains.
>
> An alternative solution would be to avoid committing generated files and
> simply regenerating it every time.
>
> On my machine `meson.py introspect --buildoptions` +
> `scripts/meson-buildoptions.py` take 1.070s.
> `./configure --help` takes 0.162s, so it's a bit sad.
> On the other hand an actual invocation of configure can take
> significantly longer (`./configure` takes 29.150s on my machine).
>
> To avoid re-running it every time we could invoke `make
> update-buildoptions` in `configure` but keep
> `scripts/meson-buildoptions.sh` in the build directory.

QEMU's Makefile used to a use a technique where it generated
"timestamp" files and used cmp(1) to check if rebuilding was
necessary:
1. Always generate meson-buildoptions.sh-timestamp.
2. If cmp meson-buildoptions.sh-timestamp meson-buildoptions.sh
detects a difference, cp meson-buildoptions.sh-timestamp
meson-buildoptions.sh.
3. Let make handle dependencies on meson-buildoptions.sh as usual.

You can find examples by grepping for -timestamp in the git log -p output.

I think this would solve the problem?

Stefan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]