Skip to content

Conversation

@bdbaddog
Copy link
Contributor

@bdbaddog bdbaddog commented Oct 30, 2025

Test copied from @mwichmann 's feature/cachdir-opt branch

doc and readme/etc forthcoming

Copied from @mwichmann comment below:

A checklist of things to work out. This was supposed to be a simple change (cough, cough).

  • Does command-line cachedir override global cachedir if both specified? See attached test template.
  • CLI cachedir path should be stored in some kind of normalized form, else each environment will make it's own taking the path as relative to the SConscript directory (see attached test - cache1 crreated in both top dir and in src.
  • Top-relative path doesn't work.
  • The --cache-debug file is an only-one thing; it looks like the logic can open this several times, which isn't great. It was originally opened in write mode, which meant a second open clobbered info from the first. For now, it's being opened in append more to not lost logged data. Possibly debug info should store in class attributes, rather than instance?
  • Would it be better to use logging for the cache than driect writes?

Possible test for multiple global cache specifications
cachedir-cli.tar.gz

Contributor Checklist:

  • I have created a new test or updated the unit tests to cover the new/changed functionality.
  • I have updated CHANGES.txt and RELEASE.txt (and read the README.rst).
  • I have updated the appropriate documentation

mwichmann and others added 3 commits October 22, 2025 07:07
This is part 5 of the series.

Signed-off-by: Mats Wichmann <[email protected]>
Both functions have equivalence tables between option names they can
use and the corresponding command-line options.  The cli option names
are now clickable to be able to jump to the actual descriptions (there
are no option behavior descriptions in GetOption or SetOption).

A little bit of wording tweak as well, limited to these two functions.

Signed-off-by: Mats Wichmann <[email protected]>
@mwichmann
Copy link
Collaborator

mwichmann commented Oct 30, 2025

index 98725d5ed..dbc60c415 100644
--- a/doc/man/scons.xml
+++ b/doc/man/scons.xml
@@ -708,6 +708,20 @@ derived-file cache specified by &f-link-CacheDir;.</para>
   </listitem>
   </varlistentry>
 
+  <varlistentry id="opt-cache-dir">
+  <term>-<option>-cache-dir=<replaceable>cachedir</replaceable></option></term>
+  <listitem>
+<para>Enable derived-file caching globally, using
+<replaceable>cachedir</replaceable> as the cache directory.
+An individual &consenv; may still specify a different
+cache directory by calling &f-link-env-CacheDir;.
+</para>
+<para><emphasis>Added in version NEXT_RELEASE.</emphasis></para>
+  </listitem>
+  </varlistentry>
+
+  <varlistentry>
+
   <varlistentry id="opt-cache-disable">
   <term>
     <option>--cache-disable</option>,

Questions:

  1. There's a list of cache options in the --interactive section listed as affecting build. Should add there?
  2. Do you prefer "Added in NEXT_RELEASE" or "New in NEXT_RELEASE". I seem to have used both in the manpage.
  3. In the actual add_option, the argument is capitalized (CACHEDIR). Should it be in the manpage also? (don't believe that's consistent at the moment).

@mwichmann mwichmann linked an issue Oct 30, 2025 that may be closed by this pull request
bdbaddog and others added 9 commits November 1, 2025 15:32
manpage: make clickable links for Get/SetOption
More Builder Method manpage updates
Tweak: intermediate directories are now made so the temporary
cachedir creation is less likely to fail.

Tweak: if debug output is selected and sent to a file, the
file is now opened in append mode. This fixes a problem of lost output
if multiple cachedirs are used in one run (presumably rare except
for testing scenarios), but isn't an ideal solution for the issue.

Signed-off-by: Mats Wichmann <[email protected]>
Add manpage entry for --cache-dir + tweaks
@mwichmann
Copy link
Collaborator

A checklist of things to work out. This was supposed to be a simple change (cough, cough).

  • Does command-line cachedir override global cachedir if both specified? See attached test template.
  • CLI cachedir path should be stored in some kind of normalized form, else each environment will make it's own taking the path as relative to the SConscript directory (see attached test - cache1 crreated in both top dir and in src.
  • Top-relative path doesn't work.
  • The --cache-debug file is an only-one thing; it looks like the logic can open this several times, which isn't great. It was originally opened in write mode, which meant a second open clobbered info from the first. For now, it's being opened in append more to not lost logged data. Possibly debug info should store in class attributes, rather than instance?
  • Would it be better to use logging for the cache than driect writes?

Possible test for multiple global cache specifications
cachedir-cli.tar.gz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow specifying cachedir from cmdline

2 participants