Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion man/paru.8
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,21 @@ Note that this is only a temp fix and only applies to this one build. You should
ideally patch the package yourself or report the problem to the maintainer.

If you want to permanently add a package to the chroot use \fBparu -Ci package\fR
to install packages into the master chroot.
Copy link
Owner

Choose a reason for hiding this comment

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

s/master/root

to install packages into the root chroot, or use \-\-rootchrootpkgs to specify
packages that should be installed when the chroot is created.

.TP
.B \-\-rootchrootpkgs <packages>
Comma-separated list of packages to install when creating the root chroot.

Defaults to "base-devel" if not specified.

Unlike \-\-chrootpkgs (which installs packages temporarily before each build),
\-\-rootchrootpkgs packages become part of the root chroot and persist across
all builds.

This only affects chroot creation. To apply changes to an existing chroot,
you must delete and recreate it.

.TP
.B \-\-completioninterval <days>
Expand Down
13 changes: 13 additions & 0 deletions man/paru.conf.5
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,19 @@ 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 RootChrootPkgs = Packages...
Space-separated list of packages to install when creating the root chroot.

Defaults to "base-devel" if not specified.

Unlike \-\-chrootpkgs (which installs packages temporarily before each build),
\-\-rootchrootpkgs packages become part of the root chroot and persist across
all builds.

This only affects chroot creation. To apply changes to an existing chroot,
you must delete and recreate it.

.TP
.B Pager = Command
Command to use for paging
Expand Down
5 changes: 3 additions & 2 deletions src/chroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct Chroot {
pub ro: Vec<String>,
pub rw: Vec<String>,
pub extra_pkgs: Vec<String>,
pub root_pkgs: Vec<String>,
}

fn pacman_conf(pacman_conf: &str) -> Result<tempfile::NamedTempFile> {
Expand All @@ -44,7 +45,7 @@ impl Chroot {
self.path.join("root").exists()
}

pub fn create<S: AsRef<OsStr>>(&self, config: &Config, pkgs: &[S]) -> Result<()> {
pub fn create(&self, config: &Config) -> Result<()> {
let mut cmd = Command::new(&config.sudo_bin);
cmd.arg("install").arg("-dm755").arg(&self.path);
exec::command(&mut cmd)?;
Expand All @@ -59,7 +60,7 @@ impl Chroot {
.arg("-M")
.arg(&self.makepkg_conf)
.arg(dir)
.args(pkgs);
.args(&self.root_pkgs);

exec::command(&mut cmd)?;
Ok(())
Expand Down
4 changes: 4 additions & 0 deletions src/command_line.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ impl Config {
Arg::Long("chrootpkgs") => self
.chroot_pkgs
.extend(value?.split(',').map(|s| s.to_string())),
Arg::Long("rootchrootpkgs") => self
.root_chroot_pkgs
.extend(value?.split(',').map(|s| s.to_string())),

Arg::Long("develsuffixes") => self.devel_suffixes = split_whitespace(value?),
Arg::Long("installdebug") => self.install_debug = true,
Expand Down Expand Up @@ -412,6 +415,7 @@ fn takes_value(arg: Arg) -> TakesValue {
Arg::Long("fmflags") => TakesValue::Required,
Arg::Long("chrootflags") => TakesValue::Required,
Arg::Long("chrootpkgs") => TakesValue::Required,
Arg::Long("rootchrootpkgs") => TakesValue::Required,
Arg::Long("completioninterval") => TakesValue::Required,
Arg::Long("sortby") => TakesValue::Required,
Arg::Long("searchby") => TakesValue::Required,
Expand Down
6 changes: 6 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,8 @@ pub struct Config {
pub chroot_dir: PathBuf,
pub chroot: bool,
pub chroot_pkgs: Vec<String>,
#[default(vec!["base-devel".to_string()])]
pub root_chroot_pkgs: Vec<String>,
pub install: bool,
pub uninstall: bool,
pub sysupgrade: bool,
Expand Down Expand Up @@ -1100,6 +1102,10 @@ then initialise it with:
.ok_or_else(|| anyhow!(tr!("value can not be empty for key '{}'", key)));

match key {
"RootChrootPkgs" => {
self.root_chroot_pkgs
.extend(value?.split_whitespace().map(|s| s.to_string()));
}
"AurUrl" => self.aur_url = value?.parse()?,
"AurRpcUrl" => self.aur_rpc_url = Some(value?.parse()?),
"BuildDir" | "CloneDir" => self.build_dir = PathBuf::from(value?),
Expand Down
3 changes: 3 additions & 0 deletions src/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ pub fn help() {
printtr!(" --[no]signdb Sign databases with gpg");
printtr!(" --[no]localrepo Build packages into a local repo");
printtr!(" --nocheck Don't resolve checkdepends or run the check function");
printtr!(
" --rootchrootpkgs Packages to install in the root chroot (default: base-devel)"
);
printtr!(" --develsuffixes Suffixes used to decide if a package is a devel package");
printtr!(" --ignoredevel Ignore devel upgrades for specified packages");
printtr!(" --bottomup Shows AUR's packages first and then repository's");
Expand Down
3 changes: 2 additions & 1 deletion src/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ impl Installer {

if config.chroot {
if !self.chroot.exists() {
self.chroot.create(config, &["base-devel"])?;
self.chroot.create(config)?;
} else {
self.chroot.update()?;
}
Expand Down Expand Up @@ -1851,6 +1851,7 @@ fn chroot(config: &Config) -> Chroot {
ro: repo::all_files(config),
rw: config.pacman.cache_dir.clone(),
extra_pkgs: config.chroot_pkgs.clone(),
root_pkgs: config.root_chroot_pkgs.clone(),
};

if config.args.count("d", "nodeps") > 1 {
Expand Down
3 changes: 2 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,7 @@ fn handle_chroot(config: &Config) -> Result<i32> {
ro: repo::all_files(config),
rw: config.pacman.cache_dir.clone(),
extra_pkgs: config.chroot_pkgs.clone(),
root_pkgs: config.root_chroot_pkgs.clone(),
};

if config.print {
Expand All @@ -437,7 +438,7 @@ fn handle_chroot(config: &Config) -> Result<i32> {
}

if !chroot.exists() {
chroot.create(config, &["base-devel"])?;
chroot.create(config)?;
}

if config.sysupgrade {
Expand Down
Loading