Record the units a layer carries, so a child can subtract them #8
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Keel-Linux/buildtasks!8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat/layer-units"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Prerequisite of Keel decision 0010: nothing migrates out of the shared tree until
bt-layerrecords units in the layer manifest.A component handed to fab as a unit (a directory under
UNIT_DIRSwith a plan, an overlay, a conf script and a removelist) appeared in no manifest field. A child layer computes what to apply by subtracting what the parent recorded, so it could not subtract the component and would re-apply the overlay and re-run the conf script.conf/mysqldoesln -s /etc/init.d/mysqlunderbash -eand fails with "File exists" the second time, so the second layer of the stack did not build at all. That is the LAMP case.The two fields
unitsname@versionsorted by name, ornonebuild_unitsdefaultwithout a parent, else the difference, ornoneunitsis cumulative, the parent's record merged with this build's own. Thecommon_*fields are cumulative too, but only because a child recipe includes its parent's makefile fragments; here it is kept so deliberately, because a child that carries no database content of its own still sits on the database and its own child has to know that.The subtraction rule
build_unitsis the recipe's own units minus the parent's, matched by name. Same name and same version means the parent already applied it, so it is skipped. Same name at a different version fails the build: a conf script runs once, so there is no move from one version of a component to another inside a child layer, and the parent is the thing to rebuild.Versions
The first of three sources that answers: a
versionfile (the pin an assembly step writes); the unit's own git HEAD, but only when the directory is the top of that work tree, so the commit of an enclosing product repository is never passed off as the component's; otherwise a digest of the directory content, so an assembled or scratch unit still has an identity.Compatibility
The applied set reaches fab as
UNITS, added in keel-linux/fab#4. A parent manifest written before these fields existed reads asnonethrough the newlayer_manifest_opt.keelvalidates a manifest by its required keys and round-trips the rest, so both fields passkeel verifyandkeel pulluntouched, and manifests without them still validate; checked againstkeel/layers/manifest.pyon this host.Test plan
tests/layer: ten new functions and six builds (a rootfs layer with a unit, a child composing the same unit, a child adding one, a child with none of its own, a version conflict, aconffab would skip, and a parent manifest older than the fields).tests/coverage.sh 99:bin/layer-lib331 of 332,bt-layer110 of 111, both 99 percent; the other four files 100 percent. Gate 99.keelloads, validates and byte-identically round-trips a manifest carrying both fields, and still validates one without them.