Skip to content

Commit

Permalink
Merge pull request #1090 from MikeWalrus/master
Browse files Browse the repository at this point in the history
  • Loading branch information
Morganamilo authored Dec 4, 2023
2 parents 166a9d5 + 7b8eae7 commit 1907d66
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 6 deletions.
4 changes: 2 additions & 2 deletions completions/bash
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ _paru() {
noconfirm noprogressbar noscriptlet quiet root verbose
repo aur aururl clonedir makepkg mflags pacman pacman-conf git gitflags sudo sudoflags
asp gpg gpgflags fm fmflags pager completioninterval sortby searchby limit upgrademenu
removemake noremovemake cleanafter nocleanafter rebuild rebuildall norebuild
asp gpg gpgflags fm fmflags chrootflags pager completioninterval sortby searchby limit
upgrademenu removemake noremovemake cleanafter nocleanafter rebuild rebuildall norebuild
rebuildtree redownload noredownload redownloadall pgpfetch nopgpfetch useask
nouseask savechanges nosavechanges failfast nofailfast keepsrc nokeepsrc combinedupgrade
nocombinedupgrade batchinstall nobatchinstall provides noprovides devel nodevel
Expand Down
1 change: 1 addition & 0 deletions completions/fish
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ complete -c $progname -n "not $noopt" -l gpgflags -d 'Pass the following options
complete -c $progname -n "not $noopt" -l sudoflags -d 'Pass the following options to sudo' -f
complete -c $progname -n "not $noopt" -l batflags -d 'Pass the following options to sudo' -f
complete -c $progname -n "not $noopt" -l fmflags -d 'Pass the following options to file manager' -f
complete -c $progname -n "not $noopt" -l chrootflags -d 'Pass the following options to makechrootpkg' -f
complete -c $progname -n "not $noopt" -l sudoloop -d 'Loop sudo calls in the background to avoid timeout' -f
complete -c $progname -n "not $noopt" -l nosudoloop -d 'Do not loop sudo calls in the background' -f
complete -c $progname -n "not $noopt" -l chroot -d 'Build packages in a chroot' -f
Expand Down
1 change: 1 addition & 0 deletions completions/zsh
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ _pacman_opts_common=(
'--batflags[Pass arguments to bat]:flags'
'--gpgflags[Pass arguments to gpg]:flags'
'--fmflags[Pass arguments to file manager]:flags'
'--chrootflags[Pass arguments to makechrootpkg]:flags'

'--sudoloop[Loop sudo calls in the background to avoid timeout]'
'--nosudoloop[Do not loop sudo calls in the background]'
Expand Down
7 changes: 7 additions & 0 deletions man/paru.8
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,13 @@ sudo is called by paru. Arguments are split on whitespace before being
passed to sudo. Multiple arguments may be passed by supplying a space
separated list that is quoted by the shell.

.TP
.B \-\-chrootflags <flags>
Passes arguments to makechrootpkg. These flags get passed to every instance
where makechrootpkg is called by paru. Arguments are split on whitespace before
being passed to makechrootpkg. Multiple arguments may be passed by supplying a
space separated list that is quoted by the shell.

.TP
.B \-\-completioninterval <days>
Time in days to refresh the completion cache. Setting this to 0 will cause the
Expand Down
6 changes: 6 additions & 0 deletions man/paru.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,12 @@ Passes arguments to the file manager. These flags get passed to every instance
where file manager is called by paru. Arguments are split on whitespace before
being passed to file manager.

.TP
.B ChrootFlags = Flags...
Passes arguments to makechrootpkg. These flags get passed to every instance
where makechrootpkg is called by paru. Arguments are split on whitespace before
being passed to makechrootpkg.

.TP
.B Pager = Command
Command to use for paging
Expand Down
4 changes: 2 additions & 2 deletions src/chroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,11 @@ impl Chroot {
self.run(&["pacman", "-Syu", "--noconfirm"])
}

pub fn build(
pub fn build<S: AsRef<OsStr>>(
&self,
pkgbuild: &Path,
pkgs: &[&str],
chroot_flags: &[&str],
chroot_flags: &[S],
flags: &[&str],
env: &[(String, String)],
) -> Result<()> {
Expand Down
2 changes: 2 additions & 0 deletions src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ impl Config {
Arg::Long("sudoflags") => self.sudo_flags.extend(split_whitespace(value?)),
Arg::Long("batflags") => self.bat_flags.extend(split_whitespace(value?)),
Arg::Long("fmflags") => self.fm_flags.extend(split_whitespace(value?)),
Arg::Long("chrootflags") => self.chroot_flags.extend(split_whitespace(value?)),

Arg::Long("develsuffixes") => self.devel_suffixes = split_whitespace(value?),
Arg::Long("installdebug") => self.install_debug = true,
Expand Down Expand Up @@ -406,6 +407,7 @@ fn takes_value(arg: Arg) -> TakesValue {
Arg::Long("sudoflags") => TakesValue::Required,
Arg::Long("batflags") => TakesValue::Required,
Arg::Long("fmflags") => TakesValue::Required,
Arg::Long("chrootflags") => TakesValue::Required,
Arg::Long("completioninterval") => TakesValue::Required,
Arg::Long("sortby") => TakesValue::Required,
Arg::Long("searchby") => TakesValue::Required,
Expand Down
2 changes: 2 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,7 @@ pub struct Config {
pub sudo_flags: Vec<String>,
pub bat_flags: Vec<String>,
pub fm_flags: Vec<String>,
pub chroot_flags: Vec<String>,
pub pager_cmd: Option<String>,

pub devel_suffixes: Vec<String>,
Expand Down Expand Up @@ -1020,6 +1021,7 @@ impl Config {
"SudoFlags" => self.sudo_flags.extend(split),
"BatFlags" => self.bat_flags.extend(split),
"FileManagerFlags" => self.fm_flags.extend(split),
"ChrootFlags" => self.chroot_flags.extend(split),
"PreBuildCommand" => self.pre_build_command = Some(value),
_ => eprintln!(
"{}",
Expand Down
7 changes: 5 additions & 2 deletions src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,11 @@ impl Installer {
if config.repos == LocalRepos::None {
extra.extend(self.built.iter().map(|s| s.as_str()));
}
let mut chroot_flags: Vec<&str> =
config.chroot_flags.iter().map(|s| s.as_str()).collect();
chroot_flags.push("-cu");
self.chroot
.build(dir, &extra, &["-cu"], &["-ofA"], &config.env)
.build(dir, &extra, &chroot_flags, &["-ofA"], &config.env)
.with_context(|| tr!("failed to download sources for '{}'"))?;
} else {
// download sources
Expand Down Expand Up @@ -554,7 +557,7 @@ impl Installer {
.build(
dir,
&extra,
&[],
&config.chroot_flags,
&["-feA", "--noconfirm", "--noprepare", "--holdver"],
&env,
)
Expand Down

0 comments on commit 1907d66

Please sign in to comment.