paru icon indicating copy to clipboard operation
paru copied to clipboard

Don't update package DB unless `-u` is specified

Open WhyNotHugo opened this issue 3 years ago • 14 comments

When running paru -U repeatedly on the same file, paru will update the system package DB each time. This is slow and impractical when doing repeated builds of the same package (e.g.: when using paru as an improved makepkg -fc).

This change avoids updating the system package DB unless -u has been specified.

Fixes: https://github.com/Morganamilo/paru/issues/782

WhyNotHugo avatar Jun 28 '22 18:06 WhyNotHugo

This mostly works, but running paru -Uu results in paru printing:

:: packages not in the AUR: XXXXX

Where XXXXX is a list of all my installed non-repo packages... I'm not entirely sure what that is happening.

WhyNotHugo avatar Jun 28 '22 18:06 WhyNotHugo

Oh, actually this weird warning also shows up on master. However, since -u is always implied, it's not an issue. But I think it needs to be fixed for this change to be acceptable.

WhyNotHugo avatar Jun 28 '22 19:06 WhyNotHugo

https://github.com/Morganamilo/paru/blob/master/src/install.rs#L1920

Morganamilo avatar Jun 28 '22 21:06 Morganamilo

Rebased onto current master. Now paru -U will build without syncing the DB each time. paru -Uu update the DB as intended, but it is also rebuilding out-of-date AUR packages and I'm not sure why that is happening.

WhyNotHugo avatar Jul 25 '22 10:07 WhyNotHugo

That would probably be because -U is no longer it's own thing and actually well integrated with the normal build process.

Morganamilo avatar Jul 25 '22 10:07 Morganamilo

So basically -S and -U is the same function. So all the -S flags kind of apply in the same way.

Morganamilo avatar Jul 25 '22 10:07 Morganamilo

So it would make sense for me to use -y here, otherwise -u is overloaded.

WhyNotHugo avatar Jul 25 '22 11:07 WhyNotHugo

Nah. just set sysupgrade to false before the call to install in the -U path. And set some other flag to true.

Morganamilo avatar Jul 25 '22 11:07 Morganamilo

So when using paru -U, refresh = -u, but when using paru -S, refresh = -y?

Why not just use the refresh flag for both cases?

WhyNotHugo avatar Jul 25 '22 11:07 WhyNotHugo

Because -y is for refreshing databases. The chroot update effectively does -Syu inside the chroot. So it does a -y and a -u.

Morganamilo avatar Jul 25 '22 11:07 Morganamilo

What do you think of the functionality of the latest version of this PR?

I know the code could be refactored to be cleaner, but I mostly want thoughts on the idea itself.

WhyNotHugo avatar Jul 29 '22 11:07 WhyNotHugo

I'd rather one flag to avoid partial upgrades and because makechrootpkg only has a -u flag

Morganamilo avatar Jul 30 '22 00:07 Morganamilo

I've come to the realisation that the repo does need to be updated on each run to get access to the new local repo packages.

It would be possible to write some code to only update the local dbs but that would take a bit of effort as we're no longer using a built in flag.

Morganamilo avatar Sep 03 '22 13:09 Morganamilo

So to recap, a pacman -Sy is needed on every chroot build so that the aur packages that were added to the local repo can be picked up. To avoid partial upgrades -u has to come alone too.

Though now, we copy the databses into the chroot so they don't have to be fetched if up to date. And the main chroot updates once before any builds, then each build updates but should have no actual updates due to just being updated. Is this sufficient for you? Seems like the best we're going to get.

Morganamilo avatar Nov 21 '22 23:11 Morganamilo