On Sun, Jul 9, 2023 at 11:11 Morgan Aldridge <morg...@makkintosshu.com>
wrote:

> Hi misc@ and Marc,
>
> I have a script for applying all updates/upgrades for upgrading my OpenBSD
> workstation, dev machines, and servers. I'm currently in the process of
> improving it to better support downloading pending updates in advance of
> actual review and installation (see <
> https://github.com/morgant/swupdate-openbsd/issues/14>. I've been
> studying the pkg_add(1) manual, testing, and also reviewing the pkg_add
> Perl source in src/usr.sbin/pkg_add/OpenBSD/, but while really well
> structured and easy to read, the latter does take me longer to grok than
> the former.
>
> I'm hoping you have a quick answer (even if it's 'no') to the following
> question: Does `pkg_add -u` utilize PKG_CACHE other than with the `-n`
> option?
>
> In my testing (on amd64/7.3-stable), the following will check for updates
> and copy packages to `PKG_CACHE`, as described in pkg_add(1):
>
>     PKG_CACHE=/home/_swupdate/7.3/packages/amd64 pkg_add -nu
>
> If I delete a cached package from the PKG_CACHE directory, re-executing
> the above command will redownload the package. That's what I was hoping
> for. I'm not quite sure whether some of the packages are being
> re-downloaded by just looking at file modification dates (unfortunately,
> `-vvvvv` doesn't note downloads, nor cache mis/hit.)
>
> The following seems to try to update packages from PKG_CACHE, if passed in
> as PKG_PATH, but -- understandably -- does result in errors that some
> packages (those that didn't need updates or have dependencies that did)
> could not be found:
>
>     PKG_PATH=/home/_swupdate/7.3/packages/amd64 pkg_add -u
>
> Naturally, if I append ':installpath' to the above PKG_PATH, it will not
> give such errors:
>
>     PKG_PATH=/home/_swupdate/7.3/packages/amd64:installpath pkg_add -u
>
> However, since '-vvvvv' also doesn't note which package repository (esp.
> local or not) a package was processed from, I don't know whether it's
> actually preferring the local repository.
>
> Additionally, if I set both PKG_CACHE and PKG_PATH to `pkg_add -u`, it
> doesn't appear that packages are downloaded to PKG_CACHE:
>
>     PKG_CACHE=/home/_swupdate/7.3/packages/amd64 
> /home/_swupdate/7.3/packages/amd64
> pkg_add -u
>

Typo. The above command should have been:

    PKG_CACHE=/home/_swupdate/7.3/packages/amd64 \
        PKG_PATH=/home/_swupdate/7.3/packages/amd64 \
        pkg_add -u

This is confirmed by deleting a package from PKG_CACHE and re-executing the
> above, after which the deleted package is still missing from PKG_CACHE. Of
> course, this absolutely feels sketchy to be caching to a package
> repository, but was worth a try.
>

Thanks in advance and please CC me if replying to the list as I'm not
subscribed to misc@.

Morgan

> --
Morgan
---
http://makkintosshu.com/
https://centresteer.com/
https://tobuji.tech/
http://unna.org/

Reply via email to