Skip to content

Let a unit carry a removelist and name the variables its conf script reads - #5

Merged
marcos-mendez merged 1 commit into
masterfrom
feat/unit-slots
Sep 27, 2026
Merged

marcos-mendez merged 1 commit into
masterfrom
feat/unit-slots

Conversation

@marcos-mendez

Copy link
Copy Markdown
Collaborator

The second half of the Keel decision 0010 prerequisite: the unit loop read overlay/ and conf and nothing else, so two thirds of what a component is could be expressed as a unit and the last third could not.

A removelist. A common component goes through three phases: its overlay, its conf script, its removelist. A unit had no slot for the third, so a component with a non-empty removelist could not leave the shared tree (common/removelists/mysql is 0 bytes, which is why the experiment did not notice). The loop now has that phase, after the unit conf scripts and before the common removelists, which is where the common removelists sit relative to the common conf scripts. Only a regular file counts, as for the product-local REMOVELIST.

CONF_VARS. _CONF_VARS is settled before any unit is looked at, so a unit had no way to ask for a build-time variable: mk/turnkey/mysql.mk line 1 is CONF_VARS += MYSQL_PASS, and the unit form of that line did not exist. A unit may now carry conf-vars, one variable name per line with # starting a comment; those names join CONF_VARS. Values still come from the environment or the product Makefile, exactly as a makefile fragment naming a variable leaves them. The names are read from UNIT_DIRS and not from UNITS, so the chroot environment of a layered build does not change with the set of units that build applies. An entry that is not a variable name stops make and names the file it came from, instead of reaching export as junk.

UNIT_DIRS moves above the CONF_VARS block, since _CONF_VARS now needs it.

Test plan

  • tests/units.sh, 56 checks (was 38): the removelist applied and its position, a removelist that is a directory, a unit without one, a unit left out of UNITS, a failing removelist; for conf-vars a set variable reaching FAB_CHROOT_ENV, an unset one left out, two units contributing, the set not moving with UNITS, no file at all, and the error path with the offending file named.
  • tests/coverage.sh 100: 75 of 75 checks, 100 percent, gate 100.
  • tests/source-date-epoch.sh unchanged and passing.

…reads

The unit loop read overlay/ and conf and nothing else, so two thirds of what
a component is could be expressed as a unit and the last third could not.

A removelist. A common component goes through three phases: its overlay, its
conf script, its removelist. A unit had no slot for the third, so a component
with a non-empty removelist could not leave the shared tree. The loop now has
that phase, after the unit conf scripts and before the common removelists,
where the common removelists sit relative to the common conf scripts. Only a
regular file counts, as for the product-local REMOVELIST.

CONF_VARS. _CONF_VARS is settled before any unit is looked at, so a unit had
no way to ask for a build-time variable: mk/turnkey/mysql.mk line 1 is
"CONF_VARS += MYSQL_PASS" and the unit form of that line did not exist. A
unit may now carry conf-vars, naming one variable per line with # starting a
comment, and those names join CONF_VARS. The values still come from the
environment or the product Makefile, exactly as a makefile fragment naming a
variable leaves them. The names are read from UNIT_DIRS and not from UNITS,
so the chroot environment of a layered build does not change with the set of
units that build applies; an entry that is not a variable name stops make and
names the file it came from, rather than reaching export as junk.

UNIT_DIRS moves above the CONF_VARS block, since _CONF_VARS now needs it.

tests/units.sh grows to 56 checks: the removelist applied, its position, a
removelist that is a directory, a unit without one, a unit left out of UNITS,
a failing removelist, and for conf-vars a set variable reaching the chroot, an
unset one left out, several units contributing, the set not moving with UNITS,
and the error path. tests/coverage.sh: 75 of 75, 100 percent.
@marcos-mendez
marcos-mendez merged commit 16730a5 into master Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant