-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expand ensure_dir to allow copying subdirectories #4
Open
smklein
wants to merge
1
commit into
illumos:main
Choose a base branch
from
smklein:copy-directory
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
smklein
commented
Mar 3, 2023
Comment on lines
+2588
to
+2613
ensure::directory(log, &dst, owner, group, mode)?; | ||
|
||
if let Some(extsrc) = &extsrc { | ||
if extsrc.starts_with('/') { | ||
bail!("external source directory must be a relative path"); | ||
} | ||
let dst = PathBuf::from(dst); | ||
|
||
// "src" is the absolute path to a directory to be copied. | ||
let src = ib.external_src_dir(extsrc)?; | ||
|
||
for entry in walkdir::WalkDir::new(&src) { | ||
let entry = entry?; | ||
let from = entry.path(); | ||
let to = dst.join(from.strip_prefix(&src)?); | ||
if entry.file_type().is_dir() { | ||
if let Err(e) = std::fs::create_dir(to) { | ||
if !matches!(e.kind(), std::io::ErrorKind::AlreadyExists) { | ||
return Err(e.into()); | ||
} | ||
} | ||
} else if entry.file_type().is_file() { | ||
std::fs::copy(from, to)?; | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the meat of this PR - I more-or-less mimicked how ensure_file
seems to work with pulling extsrc
files, but expanded that to work for directories too.
This was referenced Mar 3, 2023
smklein
added a commit
to oxidecomputer/omicron
that referenced
this pull request
Mar 7, 2023
My expectation is that we'll: 1. Download `global-zone-packages.tar.gz` in the `helios` repo 2. Unpack the contents into a staging directory 3. Use [image builder to copy the contents of these services into the host OS image](illumos/image-builder#4) Additionally, I made the list of artifacts a bit more explicit. *Eventually* we could parse the package manifest to access this info, but for now, I don't want to include any "intermediate" artifacts that shouldn't be installed on a system.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.