Skip to content

Chisel can build on top of already chiseled output - #25

Closed
rebornplusplus wants to merge 5 commits into
canonical:mainfrom
rebornplusplus:ROCKS-307-record-installed-slices
Closed

rebornplusplus wants to merge 5 commits into
canonical:mainfrom
rebornplusplus:ROCKS-307-record-installed-slices

Conversation

@rebornplusplus

Copy link
Copy Markdown

Resolves #10

Chisel records installed slices and checks before installing again
- Records are saved at /var/lib/chisel/chisel.db
- Slice names are kept in pkg_slice format one per line

Fix: Symlink overwrite
* Info: In Go, os.Symlink fails if symlink already exists
* Help: https://stackoverflow.com/questions/37345844/how-to-overwrite-a-symlink-in-go

Rafid Bin Mostofa added 2 commits September 8, 2022 14:04
- Records are saved at /var/lib/chisel/chisel.db
- Slice names are kept in pkg_slice format one per line
@rebornplusplus

Copy link
Copy Markdown
Author

First run: Install libc6_libs and libc6_config.

./chisel cut --release ../chisel-releases --root output/ libc6_libs libc6_config
2022/09/08 14:58:21 Processing ../chisel-releases release...
2022/09/08 14:58:21 Selecting slices...
2022/09/08 14:58:21 Fetching ubuntu 22.04 jammy suite details...
...
2022/09/08 14:58:25 Fetching index for ubuntu 22.04 jammy-updates universe component...
2022/09/08 14:58:25 Fetching pool/main/g/glibc/libc6_2.35-0ubuntu3.1_amd64.deb...
2022/09/08 14:58:25 Extracting files from package "libc6"...

Second run: Install openssl_bins and openssl_config over the previous file system. The installed slices should be skipped in installation.

./chisel cut --release ../chisel-releases --root output/ openssl_bins openssl_config
2022/09/08 14:58:37 Processing ../chisel-releases release...
2022/09/08 14:58:37 Selecting slices...
2022/09/08 14:58:37 Slice "libc6_config" is already installed, skipping...
2022/09/08 14:58:37 Slice "libc6_libs" is already installed, skipping...
2022/09/08 14:58:37 Fetching ubuntu 22.04 jammy suite details...
...
2022/09/08 14:58:39 Fetching index for ubuntu 22.04 jammy-updates universe component...
2022/09/08 14:58:39 Fetching pool/main/o/openssl/libssl3_3.0.2-0ubuntu1.6_amd64.deb...
2022/09/08 14:58:39 Fetching pool/main/o/openssl/openssl_3.0.2-0ubuntu1.6_amd64.deb...
2022/09/08 14:58:39 Extracting files from package "libssl3"...
2022/09/08 14:58:39 Extracting files from package "openssl"...

@woky woky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good. Clear and concise.

Note that there are no tests and you will probably need to address my suggestion in slices_db.go to make it testable.

Comment thread internal/fsutil/create.go Resolved
Comment thread internal/setup/slices_db.go Resolved
* setup.Select takes new db argument now
* Refactored the code fragments depending on setup.Select
@rebornplusplus

Copy link
Copy Markdown
Author

@woky, Thanks for your suggestions! I modified the source that way and added a simple test. Can you please take a look again?

@woky

woky commented Sep 9, 2022 •

Copy link
Copy Markdown
Contributor

added a simple test

-		selection, err := setup.Select(release, test.slices)
+		selection, err := setup.Select(release, test.slices, &setup.ChiselDB{})

This is very simple test. ;-) I don't think this is going to fly. Try to make a new tests with temporary directory and some existing slices installed.

@woky woky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

See my take on createSymlink(): woky@d7883a0

Comment thread internal/fsutil/create.go Resolved
Comment thread internal/fsutil/create.go Resolved
@rebornplusplus
rebornplusplus force-pushed the ROCKS-307-record-installed-slices branch from ea88900 to d3e6f43 Compare September 12, 2022 12:14
@rebornplusplus

Copy link
Copy Markdown
Author

Update:

  • Followed @woky's take on Symlinks.
  • Added test for ChiselDB

@woky
woky requested a review from niemeyer September 13, 2022 10:10

@woky woky left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM!

Comment thread cmd/chisel/cmd_cut.go
return err

return printVersions()
// return printVersions()

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

why has this been commented?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

It seemed like unreachable code to me, so I commented it out to keep it anyway for future reference. Doesn't make any difference if it's not commented out though.

@cjdcordeiro cjdcordeiro left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is great. simple and functional. thanks.

I do have one comment, which is more of a request for comment (we might need to discuss it):

  • the chisel DB goes into /var/lib/chisel/chisel.db, even if base-files has not been installed. So, within the scope of #18, who owns /var/lib? In this PR you are creating it manually, but in reality it should probably belong to base-files. Should we always install base-files_var by default? or should the chisel.db be placed in /? (or maybe we shouldn't worry about this at all...) TBD

@cjdcordeiro

Copy link
Copy Markdown
Collaborator

@rebornplusplus I think we can close this PR, since the underlying feature will be split into multiple feature requests

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.

[RFC] Record installed slices in --root and install only what's missing

4 participants