Don't update package DB unless `-u` is specified
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
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.
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.
https://github.com/Morganamilo/paru/blob/master/src/install.rs#L1920
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.
That would probably be because -U is no longer it's own thing and actually well integrated with the normal build process.
So basically -S and -U is the same function. So all the -S flags kind of apply in the same way.
So it would make sense for me to use -y here, otherwise -u is overloaded.
Nah. just set sysupgrade to false before the call to install in the -U path. And set some other flag to true.
So when using paru -U, refresh = -u, but when using paru -S, refresh = -y?
Why not just use the refresh flag for both cases?
Because -y is for refreshing databases. The chroot update effectively does -Syu inside the chroot. So it does a -y and a -u.
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.
I'd rather one flag to avoid partial upgrades and because makechrootpkg only has a -u flag
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.
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.