-
Notifications
You must be signed in to change notification settings - Fork 197
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
composepost: apply add-determinism pyc-zero-mtime #5019
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1201,7 +1201,18 @@ fn workaround_selinux_cross_labeling_recurse( | |
/// This is the nearly the last code executed before we run `ostree commit`. | ||
pub fn compose_postprocess_final(rootfs_dfd: i32, _treefile: &Treefile) -> CxxResult<()> { | ||
let rootfs = unsafe { &crate::ffiutil::ffi_dirfd(rootfs_dfd)? }; | ||
|
||
if std::process::Command::new("add-determinism").status().expect("Failed to find add-determinism on system.").success() { | ||
// add-determinism --handler pyc-zero-mtime | ||
let r = std::process::Command::new("add-determinism") | ||
.arg("--handler") | ||
.arg("pyc-zero-mtime") | ||
.arg("/usr") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This won't do what you expect or want. In an rpm-ostree build, the In rpm-ostree we try hard to use fd-relative accesses generally via cap-std. To do so with an external process, a typical pattern is to use e.g. cwd_dir and then pass |
||
.status() | ||
.expect("Failed to normalize .pyc files using add-determinism"); | ||
if !r.success() { | ||
return Err(anyhow!("Failed to execute add-determinism --handler pyc-zero-mtime: {:?}", r).into()); | ||
} | ||
} | ||
hardlink_rpmdb_base_location(rootfs, None)?; | ||
Ok(()) | ||
} | ||
|
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 should probably be its own function like
run_add_determinisim(rootfs)
;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.
Also this is not a great way to check for the existence of a binary. While the Rust stdlib doesn't have a single function for this I think it's trivial to do by combining
let path = std::env::var_os("PATH")