add some extra logic to prevent moving files around when this is possible.
authorespie <espie@openbsd.org>
Thu, 17 Mar 2022 21:45:51 +0000 (21:45 +0000)
committerespie <espie@openbsd.org>
Thu, 17 Mar 2022 21:45:51 +0000 (21:45 +0000)
commitd66db7686d6b59e9fff9cf925321fe4a3bfdd484
tree1e561eaf0adb587f916bae28166b5741f747c6f1
parent94dfe32363aa86cf6afa8bf7555e5a3184d9a99c
add some extra logic to prevent moving files around when this is possible.
Specifically, we created pkg.XXXX temp files for updates to work.

When I added tied files, I generalized this to installs as well, because
it was becoming too complex.

Forward a few years:
- we have tags and define-tag, so we can deem a lot of UpdateSets "safe"
(because they don't run command during the deletion/installation, but at
the end, so they won't see unwanted files)
- the tied logic is well-proven

With this diff:
- installs will again extract files directly in-place, so that install
is (mostly) chown + utimes.

- updates will extract files with new names directly in-place

- tied files that didn't change names will have zero churn (instead
of link to pkg.XXXX, rm orig file, mv pkg.XXXX back to orig file)

After lots of tests involving somewhat broken things.

Okay sthen@

(if it breaks it's easy to revert, but the speed-up for stuff like
texlive minor updates is significant)
usr.sbin/pkg_add/OpenBSD/Add.pm
usr.sbin/pkg_add/OpenBSD/Delete.pm
usr.sbin/pkg_add/OpenBSD/UpdateSet.pm
usr.sbin/pkg_add/OpenBSD/Vstat.pm