Skip to content

feat: recut a rootfs#13

Open
upils wants to merge 9 commits into
feat/select-manifestfrom
feat/recut
Open

feat: recut a rootfs#13
upils wants to merge 9 commits into
feat/select-manifestfrom
feat/recut

Conversation

@upils
Copy link
Copy Markdown
Owner

@upils upils commented Apr 23, 2026

  • Have you signed the CLA?

This PR enables easily reviewing changes until feat/select-manifest is merged.

@upils upils changed the title Feat/recut feat: recut a rootfs Apr 23, 2026
@upils upils mentioned this pull request Apr 29, 2026
1 task
@upils upils marked this pull request as ready for review April 29, 2026 06:37
Copy link
Copy Markdown

@letFunny letFunny left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed the changes we discussed: moving to a different file, function flow, getting the new manifest, etc. To be completely honest, it looks extremely good to me. I am sure there are minor comments, rewordings and small refactors to be done, but I think you nailed the core structure

Comment thread internal/slicer/merge.go
// Skip the entry if both previous and new one are identical, except for
// manifests. No Size/SHA256/FinalSH2A56 are recorded for manifests, so make
// sure they are NOT skipped.
if prevEntry.Mode == entry.Mode &&
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style-wise I would create an auxiliary var called isManifest. This condition is very hard to read.

Comment thread internal/slicer/merge.go
"github.com/canonical/chisel/public/manifest"
)

// merge applies the content from the workDir to the targetDir. This
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments in this function are AMAZING, very good job there.

Comment thread internal/slicer/merge.go
}
}

// Step 4: Apply WorkDir content to TargetDir.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: "Apply" is a little bit imprecise IMO.

Comment thread internal/slicer/slicer.go
}()
}

err := cut(cutTargetDir, options.Selection, options.Archives)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you want to make it even more clear you could try the approach where the branching decides what to call, e.g.

if options.PreviousManifest != nil {
    mkdir_tmp_dir()
    cut()
    merge()
} else {
    cut(normal_args)
}

Maybe this will help address Gustavo's comments. Personally I think the difference is minor and stylistic, I am okay with both.

Comment thread internal/slicer/merge.go
// previously cut by Chisel in the targetDir.
func merge(targetDir string, workDir string, prevManifest *manifest.Manifest, release *setup.Release) error {
logf("Merging cut in %s...", targetDir)
newManifest, err := SelectValidManifest(workDir, release)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bit sad to see in terms of re-doing work, but this looks very good in terms of more encapsulation. Great idea Paul!

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.

2 participants