Skip to content

Conversation

@pfeifferj
Copy link
Contributor

Introduces a new --basechrootpkgs flag and BaseChrootPkgs config option to allow customization of packages installed when creating the base chroot.

This solves the problem of multilib packages failing to build in chroot environments because multilib-devel was not available in the default base-devel installation.

Related: #1355

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

src/config.rs Outdated
"BatFlags" => self.bat_flags.extend(split),
"FileManagerFlags" => self.fm_flags.extend(split),
"ChrootFlags" => self.chroot_flags.extend(split),
"BaseChrootPkgs" => self.base_chroot_pkgs = split.collect(),
Copy link
Owner

Choose a reason for hiding this comment

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

Reading through makechrootpkg again it seems the terminology arch uses root chroot . We should probably match both here and in the flag name.

man/paru.8 Outdated
.TP
.B \-\-basechrootpkgs <packages>
Comma-separated list of packages to install when creating the base chroot.
These packages REPLACE the default base-devel group.
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think there's a need to point out it replaces base-devel. Just that base-devel is the default. As all the flags replace the defaults.

man/paru.8 Outdated
paru --basechrootpkgs=base-devel,multilib-devel
.fi

To create a minimal chroot with only base:
Copy link
Owner

Choose a reason for hiding this comment

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

base isn't suitable for chroots and base-devel is required for building so I wouldn't give examples without it. If the user is choosing to do so I assume they know what they are doing and don't need examples.

Arg::Long("chrootpkgs") => self
.chroot_pkgs
.extend(value?.split(',').map(|s| s.to_string())),
Arg::Long("basechrootpkgs") => {
Copy link
Owner

Choose a reason for hiding this comment

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

Should be in [options] not [bin].

src/help.rs Outdated
printtr!(" --[no]installdebug Also install debug packages when a package provides them");
printtr!(" --[no]sudoloop Loop sudo calls in the background to avoid timeout");
printtr!(" --[no]chroot Build packages in a chroot");
printtr!(" --basechrootpkgs <package(s)> for base chroot (replaces base-devel)");
Copy link
Owner

Choose a reason for hiding this comment

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

I guess --chrootpkgs is mising from the help text so there's no obvious place to put this. But it shouldn't be in the middle of the boolean options.

src/config.rs Outdated
pub chroot_dir: PathBuf,
pub chroot: bool,
pub chroot_pkgs: Vec<String>,
pub base_chroot_pkgs: Vec<String>,
Copy link
Owner

Choose a reason for hiding this comment

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

Should have a [default] setting.

src/config.rs Outdated
"BatFlags" => self.bat_flags.extend(split),
"FileManagerFlags" => self.fm_flags.extend(split),
"ChrootFlags" => self.chroot_flags.extend(split),
"BaseChrootPkgs" => self.base_chroot_pkgs = split.collect(),
Copy link
Owner

Choose a reason for hiding this comment

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

This should .extend ()like other options.

src/chroot.rs Outdated
let tmp = pacman_conf(&self.pacman_conf)?;
let dir = self.path.join("root");

let base_pkgs: Vec<&str> = if self.base_pkgs.is_empty() {
Copy link
Owner

Choose a reason for hiding this comment

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

With [default] on the config struct this can be removed and we can pass the value right through.

man/paru.8 Outdated
These packages REPLACE the default base-devel group.

If specified, you must explicitly include base-devel if you want it.
For example:
Copy link
Owner

Choose a reason for hiding this comment

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

I think example if overkill, we should expect people to know how to use a flag. Though it's probably useful to mention including multilib-devel is one of the reasons you may want this flag.

@pfeifferj pfeifferj force-pushed the feat/basechrootpkgs-flag branch 2 times, most recently from d479361 to c205ceb Compare October 9, 2025 15:30
man/paru.8 Outdated

One use case for this is to include multilib-devel for building multilib packages:
.nf
paru --rootchrootpkgs=base-devel,multilib-devel
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think users need to be shown how to use the flag.

man/paru.conf.5 Outdated

Example:
.nf
[options]
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above. User doesn't need to be show how the config file works. Also detail here should be copied from the flag docs instead of mentioning the paru man page.

src/config.rs Outdated
None => Sign::Yes,
}
}
"RootChrootPkgs" => {
Copy link
Owner

Choose a reason for hiding this comment

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

This should go in the match below so that the unwrap can be replaced with ?

@pfeifferj pfeifferj force-pushed the feat/basechrootpkgs-flag branch from c205ceb to bf60f06 Compare October 9, 2025 18:03
@pfeifferj pfeifferj requested a review from Morganamilo October 9, 2025 19:23
Introduces a new --rootchrootpkgs flag and BaseChrootPkgs config option
to allow customization of packages installed when creating the base chroot.

This solves the problem of multilib packages failing to build in chroot
environments because multilib-devel was not available in the default
base-devel installation.

Related: Morganamilo#1355
@pfeifferj pfeifferj force-pushed the feat/basechrootpkgs-flag branch from bf60f06 to e0ba510 Compare October 9, 2025 22:45
@pfeifferj
Copy link
Contributor Author

pic-selected-251010-0918-07 demo

@Morganamilo Morganamilo merged commit 9405aee into Morganamilo:master Oct 12, 2025
1 of 2 checks passed
@pfeifferj pfeifferj deleted the feat/basechrootpkgs-flag branch October 12, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants