You are not logged in.

#1 2020-11-01 23:10:58

MountainX
Member
Registered: 2016-02-08
Posts: 371

[SOLVED] makechrootpkg: clean the chroot vs update the working copy

I'm trying to understand the "-u" and "-c" options for makechrootpkg. Specifically, what happens if I run "makechrootpkg -u" without the "-c" option? Does that simply run this?

arch-nspawn $CHROOT/myuser pacman -Syu

I assume if I also add the "-c" option (edit: along with -u), it does the equivalent of this:
- deletes $CHROOT/myuser
- arch-nspawn $CHROOT/root pacman -Syu
- then copies $CHROOT/root to $CHROOT/myuser

Is that about correct?

The reason I might sometimes want to run run "makechrootpkg -u" without the "-c" option is when I have installed some packages into the chroot that I need for a build.

This is the info I have found on the topic:

Wiki: Building in the chroot

Firstly, make sure the base chroot ($CHROOT/root) is up to date:

$ arch-nspawn $CHROOT/root pacman -Syu

Then, build a package by calling makechrootpkg in the directory containing its PKGBUILD:

$ makechrootpkg -c -r $CHROOT

Note: Passing the -c flag to makechrootpkg ensures that the working chroot ($CHROOT/$USER) is cleaned before building.

$ makechrootpkg -h
-c         Clean the chroot before building
-u         Update the working copy of the chroot before building

Last edited by MountainX (2020-11-02 00:21:31)

Offline

#2 2020-11-01 23:59:18

eschwartz
Fellow
Registered: 2014-08-08
Posts: 4,097

Re: [SOLVED] makechrootpkg: clean the chroot vs update the working copy

makechrootpkg -c causes the chroot to be deleted and re-inited from $CHROOT/root, makechrootpkg -u causes the chroot (*not* the root one, the copy) to be updated with pacman -Syuu. Together, they cause the chroot to be deleted, re-inited by copying the root one, and finally updated.

There is a reason it specifies "Update the working copy of the chroot". If you wish to update the root one you need to follow the instructions and run arch-nspawn yourself. Or, extra-x86_64-build does this.

There's not much difference. Updating $CHROOT/root first just means there is less work to do if you repeatedly run makechrootpkg -cu since most packages are already updated. The reason it works this way is because makechrootpkg is copy-centric, while extra-x86_64-build is an end-to-end workflow management tool.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2020-11-02 00:06:48

MountainX
Member
Registered: 2016-02-08
Posts: 371

Re: [SOLVED] makechrootpkg: clean the chroot vs update the working copy

eschwartz wrote:

makechrootpkg -c causes the chroot to be deleted and re-inited from $CHROOT/root, makechrootpkg -u causes the chroot (*not* the root one, the copy) to be updated with pacman -Syuu. Together, they cause the chroot to be deleted, re-inited by copying the root one, and finally updated.

There is a reason it specifies "Update the working copy of the chroot". If you wish to update the root one you need to follow the instructions and run arch-nspawn yourself. Or, extra-x86_64-build does this.

There's not much difference. Updating $CHROOT/root first just means there is less work to do if you repeatedly run makechrootpkg -cu since most packages are already updated. The reason it works this way is because makechrootpkg is copy-centric, while extra-x86_64-build is an end-to-end workflow management tool.

Another great explanation! I feel like this answer should be linked to the wiki page. Shall I do that? EDIT: I do not have permission to edit pages in the DeveloperWiki namespace.

Last edited by MountainX (2020-11-02 00:10:37)

Offline

Board footer

Powered by FluxBB