`awk' could probably handle that. Something like this*:

BEGIN { system("pkg update") }
{ while ("pkg info " $1 | getline line > 0) { if ( line ~ /^Available/) { 
packages = package $1 " "; break } }
END { "pkg -y upgrade " packages }

# awk -f pkg_upgrade.awk ~/origins/CA72-pkgs.txt

1. updates pkg repo[s] once
2. checks each package's info for a line begins with "Available" (I think 
packages with available updates have such a line)
3. creates a list of those packages
4. updates them all together

* Not tested
** `pkg query' might have an entry for 'available update' but the manpage 
didn't reveal one
*** you can use a pattern to only match specific packages inside your file; the 
current empty pattern matches all

> ----------------------------------------
> From: Mark Millard <mark...@yahoo.com>
> Sent: Tue Mar 22 10:56:56 CET 2022
> To: Eugene Grosbein <eu...@grosbein.net>
> Cc: b...@freebsd.org <b...@freebsd.org>, <freebsd-po...@freebsd.org>, FreeBSD 
> Toolchain <freebsd-toolch...@freebsd.org>
> Subject: Re: An idea for a pkg option
> 
> 
> On 2022-Mar-22, at 02:34, Eugene Grosbein <eu...@grosbein.net> wrote:
> 
> > 22.03.2022 16:28, Mark Millard wrote:
> > 
> >> So it might look something like:
> >> 
> >> # pkg install --available-ones-of `cat ~/origins/CA72-pkgs.txt`
> >> Updating custom repository catalogue...
> >> custom repository is up to date.
> >> All repositories are up to date.
> >> pkg: No packages available to install matching 'macchiatobin-edk2' have 
> >> been found in the repositories
> >> pkg: No packages available to install matching 'rpi3-edk2' have been found 
> >> in the repositories
> >> pkg: No packages available to install matching 'rpi4-edk2' have been found 
> >> in the repositories
> >> Checking integrity... done (0 conflicting)
> >> The following 1 package(s) will be affected (of 0 checked):
> >> 
> >> New packages to be INSTALLED:
> >>    llvm14: 14.0.0.r4
> >> 
> >> Number of packages to be installed: 1
> >> 
> >> The process will require 864 MiB more space.
> >> 
> >> Proceed with this action? [y/N]: y
> >> [1/1] Installing llvm14-14.0.0.r4...
> >> [1/1] Extracting llvm14-14.0.0.r4: 100%
> > 
> > Use: pkg install -yU *.pkg
> 
> There may well be packages around that I do not
> want installed unless pulled in as a dependency
> of something that I do want. So a general wild
> card is not what I'm after.
> 
> For my explicit list of what to try to install
> (in the file) your command does not work for
> my purpose/goal:
> 
> # pkg install -yU `cat ~/origins/amd64-pkgs.txt`
> pkg: No packages available to install matching 'rpi4-edk2' have been found in 
> the repositories
> pkg: No packages available to install matching 'rpi4-edk2' have been found in 
> the repositories
> 
> Without the two missing packages being listed in
> the file, your command does:
> 
> # pkg install -yU `cat ~/origins/amd64-pkgs.txt`
> Checking integrity... done (0 conflicting)
> The following 1 package(s) will be affected (of 0 checked):
> 
> New packages to be INSTALLED:
>       llvm14: 14.0.0.r4
> 
> Number of packages to be installed: 1
> 
> The process will require 1 GiB more space.
> [1/1] Installing llvm14-14.0.0.r4...
> [1/1] Extracting llvm14-14.0.0.r4: 100%
> 
> 
> ===
> Mark Millard
> marklmi at yahoo.com
> 
> 


-- 
Sent with https://mailfence.com  
Secure and private email

Reply via email to