-
Notifications
You must be signed in to change notification settings - Fork 205
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
[WIP]nydus-image: enhance unpack command to support extracting files to dir #1480
base: master
Are you sure you want to change the base?
Conversation
573b58b
to
2be1690
Compare
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #1480 +/- ##
==========================================
+ Coverage 62.50% 62.54% +0.03%
==========================================
Files 123 123
Lines 43148 43216 +68
Branches 43148 43216 +68
==========================================
+ Hits 26971 27030 +59
- Misses 14870 14877 +7
- Partials 1307 1309 +2
|
I will add unit tests in this PR later. Please wait a moment. |
2be1690
to
73b6718
Compare
When --output is specified as a directory, the nydus-image unpack command will return an error, which is not convenient for users. This patch enhances this command in the following 3 aspects: 1. Allow --output to be passed as a directory. In this case, the tar file will be output to this subdirectory. 2. Added --untar flag to support decompressing this tar file into the directory specified by --output. 3. When --output is not specified, the default output is to /dev/stdout Signed-off-by: Qinqi Qu <[email protected]>
73b6718
to
3d62276
Compare
.unpack(config) | ||
.with_context(|| "fail to unpack") | ||
.with_context(|| format!("failed to unpack image to: {}", output)) |
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.
unpack blob
.
@@ -32,11 +32,12 @@ pub trait Unpacker { | |||
fn unpack(&self, config: Arc<ConfigV2>) -> Result<()>; | |||
} | |||
|
|||
/// A unpacker with the ability to convert bootstrap file and blob file to tar | |||
/// A unpacker with the ability to convert bootstrap file and blob file to tar or dir. |
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.
or untar to a directory
.
}) | ||
} | ||
|
||
fn load_rafs(&self, config: Arc<ConfigV2>) -> Result<RafsSuper> { | ||
let (rs, _) = RafsSuper::load_from_file(self.bootstrap.as_path(), config, false)?; | ||
Ok(rs) | ||
} | ||
|
||
fn get_unpack_path(&self) -> Result<PathBuf> { | ||
// If output ends with path separator, then it is a dir. |
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.
We'd better not make the assumption.
.required(false), | ||
) | ||
.arg( | ||
Arg::new("untar") |
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.
A smoke test is required for new option.
Besides update doc please.
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.
@ccx1024cc Unit testing is complete and now changed to WIP.
Relevant Issue (if applicable)
N/A
Details
When --output is specified as a directory, the nydus-image unpack command will return an error, which is not convenient for users.
This patch enhances this command in the following 3 aspects:
Types of changes
What types of changes does your PullRequest introduce? Put an
x
in all the boxes that apply:Checklist
Go over all the following points, and put an
x
in all the boxes that apply.